Bug 1000182, part 1 - Crash @js::ThreadSafeContext::onOutOfMemory with PJS and OOM. r=shu
authorJason Orendorff <jorendorff@mozilla.com>
Fri, 27 Jun 2014 16:19:01 -0500
changeset 240443 03cd5b31ae494ca8d8f55858c6bbbcd64232fe31
parent 240442 acc3209d766a8d0314c55f49773312ad7e57ddde
child 240444 4407bd0c6330307ddc8b7c8ccfebe9c92fa2d559
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersshu
bugs1000182
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1000182, part 1 - Crash @js::ThreadSafeContext::onOutOfMemory with PJS and OOM. r=shu
js/src/jit/Ion.cpp
js/src/jit/JitCompartment.h
--- a/js/src/jit/Ion.cpp
+++ b/js/src/jit/Ion.cpp
@@ -444,24 +444,27 @@ JitCompartment::notifyOfActiveParallelEn
     // already in the set.
     if (script->parallelIonScript()->isParallelEntryScript()) {
         MOZ_ASSERT(activeParallelEntryScripts_ && activeParallelEntryScripts_->has(script));
         script->parallelIonScript()->resetParallelAge();
         return true;
     }
 
     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);
 }
 
 bool
 JitCompartment::hasRecentParallelActivity() const
 {
     return activeParallelEntryScripts_ && !activeParallelEntryScripts_->empty();
 }
 
--- a/js/src/jit/JitCompartment.h
+++ b/js/src/jit/JitCompartment.h
@@ -457,17 +457,18 @@ class JitCompartment
     JitCode *stringConcatStub_;
     JitCode *parallelStringConcatStub_;
     JitCode *regExpExecStub_;
     JitCode *regExpTestStub_;
 
     // 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);
     JitCode *generateRegExpExecStub(JSContext *cx);
     JitCode *generateRegExpTestStub(JSContext *cx);
 
   public:
     JitCode *getStubCode(uint32_t key) {