Bug 1000182, part 1 - Crash @js::ThreadSafeContext::onOutOfMemory with PJS and OOM. r=shu.

This commit is contained in:
Jason Orendorff 2014-06-20 12:01:01 -05:00
parent 8ecdb98d44
commit 77e66219d7
3 changed files with 26 additions and 5 deletions

View File

@ -0,0 +1,17 @@
// |jit-test| allow-unhandlable-oom;
function range(n, m) {
var result = [];
result.push(i);
return result;
for (var i = 0, l = a.length; i < l; i++) {}
}
function b(opFunction, cmpFunction) {
var result = opFunction({mode:"compile"});
var result = opFunction({mode:"par"});
}
function a(arr, op, func, cmpFunc) {
b(function (m) { return arr[op + "Par"].apply(arr, [func, m]); }, function(m) {});
}
if ("mapPar" in [])
a(range(0, 1024), "map", function (i) {});
oomAfterAllocations(4);

View File

@ -524,14 +524,17 @@ JitCompartment::notifyOfActiveParallelEntryScript(JSContext *cx, HandleScript sc
}
if (!activeParallelEntryScripts_) {
activeParallelEntryScripts_ = cx->new_<ScriptSet>(cx);
if (!activeParallelEntryScripts_ || !activeParallelEntryScripts_->init())
ScriptSet *scripts = js_new<ScriptSet>();
if (!scripts || !scripts->init()) {
js_delete(scripts);
js_ReportOutOfMemory(cx);
return false;
}
activeParallelEntryScripts_ = scripts;
}
script->parallelIonScript()->setIsParallelEntryScript();
ScriptSet::AddPtr p = activeParallelEntryScripts_->lookupForAdd(script);
return p || activeParallelEntryScripts_->add(p, script);
return activeParallelEntryScripts_->put(script);
}
void

View File

@ -414,7 +414,8 @@ class JitCompartment
// Set of JSScripts invoked by ForkJoin (i.e. the entry script). These
// scripts are marked if their respective parallel IonScripts' age is less
// than a certain amount. See IonScript::parallelAge_.
typedef HashSet<PreBarrieredScript> ScriptSet;
typedef HashSet<PreBarrieredScript, DefaultHasher<PreBarrieredScript>, SystemAllocPolicy>
ScriptSet;
ScriptSet *activeParallelEntryScripts_;
JitCode *generateStringConcatStub(JSContext *cx, ExecutionMode mode);