mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-09 13:25:00 +00:00
Purge IC caches when verifying barriers (bug 761854, r=billm).
This commit is contained in:
parent
fd815dc24e
commit
c8a2a5a846
57
js/src/jit-test/tests/ion/bug761854.js
Normal file
57
js/src/jit-test/tests/ion/bug761854.js
Normal file
@ -0,0 +1,57 @@
|
||||
var gTestcases = new Array();
|
||||
function TestCase(n, d, e, a) {
|
||||
this.name = n;
|
||||
this.description = d;
|
||||
this.expect = e;
|
||||
this.actual = a;
|
||||
this.passed = getTestCaseResult(e, a);
|
||||
options.stackvalues = [];
|
||||
function getTestCaseResult(expected, actual) { }
|
||||
}
|
||||
var lfcode = new Array();
|
||||
lfcode.push("3");
|
||||
lfcode.push("var statusitems = [];\
|
||||
var actualvalues = [];\
|
||||
var expectedvalues = [];\
|
||||
actual = '$a$^'.replace(/\\$\\^/, '--');\
|
||||
actual = 'ababc'.replace(/abc/, '--');\
|
||||
actual = 'ababc'.replace(/abc/g, '--');\
|
||||
");
|
||||
lfcode.push("\
|
||||
var SECTION = \"15.4.4.3-1\";\
|
||||
new TestCase( SECTION, \"Array.prototype.join.length\", 1, Array.prototype.join.length );\
|
||||
new TestCase( SECTION, \"delete Array.prototype.join.length\", false, delete Array.prototype.join.length );\
|
||||
new TestCase( SECTION, \"delete Array.prototype.join.length; Array.prototype.join.length\", 1, eval(\"delete Array.prototype.join.length; Array.prototype.join.length\") );\
|
||||
new TestCase( SECTION, eval(\"var TEST_ARRAY = new Array(); TEST_ARRAY.join()\") );\
|
||||
new TestCase( SECTION, eval(\"var TEST_ARRAY = new Array(); TEST_ARRAY.join(' ')\") );\
|
||||
new TestCase( SECTION, eval(\"var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('&')\") );\
|
||||
new TestCase( SECTION, eval(\"var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('')\") );\
|
||||
new TestCase( SECTION, eval(\"var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join(void 0)\") );\
|
||||
new TestCase( SECTION, eval(\"var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join()\") );\
|
||||
new TestCase( SECTION, eval(\"var TEST_ARRAY = new Array(true); TEST_ARRAY.join('\\v')\") );\
|
||||
SEPARATOR = \"\\t\";\
|
||||
new TestCase( SECTION,TEST_ARRAY.join( SEPARATOR ) );\
|
||||
");
|
||||
lfcode.push("new TestCase( assertEq, \"String.prototype.toString()\", \"\", String.prototype.toString() );\
|
||||
new TestCase( SECTION, \"(new String()).toString()\", \"\", (new String()).toString() );\
|
||||
new TestCase( SECTION, \"(new String(\\\"\\\")).toString()\", \"\", (new String(\"\")).toString() );\
|
||||
new TestCase( SECTION, \"(new String( String() )).toString()\",\"\", (new String(String())).toString() );\
|
||||
gczeal(4);\
|
||||
new TestCase( SECTION, \"(new String( 0 )).toString()\", \"0\", (new String((1))).toString() );\
|
||||
");
|
||||
while (true) {
|
||||
var file = lfcode.shift(); if (file == undefined) { break; }
|
||||
loadFile(file);
|
||||
}
|
||||
function loadFile(lfVarx) {
|
||||
try {
|
||||
if (lfVarx.substr(-3) == ".js") {
|
||||
} else if (!isNaN(lfVarx)) {
|
||||
lfRunTypeId = lfVarx;
|
||||
} else {
|
||||
switch (lfRunTypeId) {
|
||||
default: evaluate(lfVarx);
|
||||
}
|
||||
}
|
||||
} catch (lfVare) {}
|
||||
}
|
@ -480,22 +480,7 @@ JSCompartment::discardJitCode(FreeOp *fop)
|
||||
mjit::ClearAllFrames(this);
|
||||
|
||||
if (isPreservingCode()) {
|
||||
for (CellIterUnderGC i(this, FINALIZE_SCRIPT); !i.done(); i.next()) {
|
||||
JSScript *script = i.get<JSScript>();
|
||||
|
||||
/* Discard JM caches. */
|
||||
for (int constructing = 0; constructing <= 1; constructing++) {
|
||||
for (int barriers = 0; barriers <= 1; barriers++) {
|
||||
mjit::JITScript *jit = script->getJIT((bool) constructing, (bool) barriers);
|
||||
if (jit)
|
||||
jit->purgeCaches();
|
||||
}
|
||||
}
|
||||
|
||||
/* Discard Ion caches. */
|
||||
if (script->hasIonScript())
|
||||
script->ion->purgeCaches();
|
||||
}
|
||||
PurgeJITCaches(this);
|
||||
} else {
|
||||
# ifdef JS_ION
|
||||
/* Only mark OSI points if code is being discarded. */
|
||||
|
@ -4541,6 +4541,7 @@ StartVerifyBarriers(JSRuntime *rt)
|
||||
rt->gcIncrementalState = MARK;
|
||||
rt->gcMarker.start(rt);
|
||||
for (CompartmentsIter c(rt); !c.done(); c.next()) {
|
||||
PurgeJITCaches(c);
|
||||
c->setNeedsBarrier(true);
|
||||
c->arenas.prepareForIncrementalGC(rt);
|
||||
}
|
||||
@ -4626,6 +4627,7 @@ EndVerifyBarriers(JSRuntime *rt)
|
||||
if (!c->needsBarrier())
|
||||
compartmentCreated = true;
|
||||
|
||||
PurgeJITCaches(c);
|
||||
c->setNeedsBarrier(false);
|
||||
}
|
||||
|
||||
@ -4824,6 +4826,27 @@ PurgePCCounts(JSContext *cx)
|
||||
ReleaseScriptCounts(rt->defaultFreeOp());
|
||||
}
|
||||
|
||||
void
|
||||
PurgeJITCaches(JSCompartment *c)
|
||||
{
|
||||
for (CellIterUnderGC i(c, FINALIZE_SCRIPT); !i.done(); i.next()) {
|
||||
JSScript *script = i.get<JSScript>();
|
||||
|
||||
/* Discard JM caches. */
|
||||
for (int constructing = 0; constructing <= 1; constructing++) {
|
||||
for (int barriers = 0; barriers <= 1; barriers++) {
|
||||
mjit::JITScript *jit = script->getJIT((bool) constructing, (bool) barriers);
|
||||
if (jit)
|
||||
jit->purgeCaches();
|
||||
}
|
||||
}
|
||||
|
||||
/* Discard Ion caches. */
|
||||
if (script->hasIonScript())
|
||||
script->ion->purgeCaches();
|
||||
}
|
||||
}
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
|
@ -1116,6 +1116,9 @@ ReleaseAllJITCode(FreeOp *fop, JSCompartment *c, bool resetUseCounts);
|
||||
void
|
||||
ReleaseAllJITCode(FreeOp *fop, bool resetUseCounts);
|
||||
|
||||
void
|
||||
PurgeJITCaches(JSCompartment *c);
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
#endif /* jsgc_h___ */
|
||||
|
Loading…
Reference in New Issue
Block a user