Bug 855037 - JäegerMonkey: Check if there is an helper thread for Ion compilation. r=dvander
authorNicolas B. Pierron <nicolas.b.pierron@mozilla.com>
Tue, 02 Apr 2013 13:55:49 -0700
changeset 127474 12ec336988e527cb91a44ec55d2789f7b4c99fd0
parent 127473 cec16f7093d6afd6f3997e383c1bb228ec294c18
child 127475 63cfb554e9e9fdce76c71e87f49726ca6531c9af
push id24506
push userryanvm@gmail.com
push dateWed, 03 Apr 2013 22:14:39 +0000
treeherdermozilla-central@475dc5f51bdb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs855037
milestone23.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 855037 - JäegerMonkey: Check if there is an helper thread for Ion compilation. r=dvander
js/src/methodjit/Compiler.cpp
js/src/methodjit/StubCalls.cpp
--- a/js/src/methodjit/Compiler.cpp
+++ b/js/src/methodjit/Compiler.cpp
@@ -20,16 +20,17 @@
 #include "assembler/jit/ExecutableAllocator.h"
 #include "assembler/assembler/LinkBuffer.h"
 #include "FrameState-inl.h"
 #include "jsobjinlines.h"
 #include "jsscriptinlines.h"
 #include "InlineFrameAssembler.h"
 #include "jscompartment.h"
 #include "jsopcodeinlines.h"
+#include "jsworkers.h"
 
 #include "builtin/RegExp.h"
 #include "vm/RegExpStatics.h"
 #include "vm/RegExpObject.h"
 
 #include "jsautooplen.h"
 #include "jstypedarrayinlines.h"
 #include "vm/RegExpObject-inl.h"
@@ -960,17 +961,17 @@ IonGetsFirstChance(JSContext *cx, JSScri
     // If we cannot enter Ion because bailouts are expected, let JM take over.
     if (script->hasIonScript() && script->ion->bailoutExpected())
         return false;
 
     // If we cannot enter Ion because it was compiled for OSR at a different PC,
     // let JM take over until the PC is reached. Don't do this until the script
     // reaches a high use count, as if we do this prematurely we may get stuck
     // in JM code.
-    if (ion::js_IonOptions.parallelCompilation && script->hasIonScript() &&
+    if (OffThreadCompilationEnabled(cx) && script->hasIonScript() &&
         pc && script->ionScript()->osrPc() && script->ionScript()->osrPc() != pc &&
         script->getUseCount() >= ion::js_IonOptions.usesBeforeCompile * 2)
     {
         return false;
     }
 
     // If ion compilation is pending or in progress on another thread, continue
     // using JM until that compilation finishes.
@@ -4059,17 +4060,17 @@ mjit::Compiler::ionCompileHelper()
     stubcc.masm.move(ImmPtr(ionScriptAddress), reg);
     Jump scriptJump = stubcc.masm.branchPtr(Assembler::Equal, Address(reg), ImmPtr(NULL));
     frame.freeReg(reg);
 #else
 #error "Unknown platform"
 #endif
 
     stubcc.linkExitDirect(trigger.inlineJump,
-                          ion::js_IonOptions.parallelCompilation
+                          OffThreadCompilationEnabled(cx)
                           ? secondTest
                           : trigger.stubLabel);
 
     scriptJump.linkTo(trigger.stubLabel, &stubcc.masm);
     stubcc.crossJump(stubcc.masm.jump(), masm.label());
 
     stubcc.leave();
     OOL_STUBCALL(stubs::TriggerIonCompile, REJOIN_RESUME);
--- a/js/src/methodjit/StubCalls.cpp
+++ b/js/src/methodjit/StubCalls.cpp
@@ -11,16 +11,17 @@
 #include "jscntxt.h"
 #include "jsobj.h"
 #include "jslibmath.h"
 #include "jsiter.h"
 #include "jsnum.h"
 #include "jsbool.h"
 #include "assembler/assembler/MacroAssemblerCodeRef.h"
 #include "jstypes.h"
+#include "jsworkers.h"
 
 #include "gc/Marking.h"
 #include "ion/AsmJS.h"
 #include "vm/Debugger.h"
 #include "vm/NumericConversions.h"
 #include "vm/Shape.h"
 #include "vm/String.h"
 #include "methodjit/Compiler.h"
@@ -771,17 +772,17 @@ stubs::Interrupt(VMFrame &f, jsbytecode 
 }
 
 #ifdef JS_ION
 void JS_FASTCALL
 stubs::TriggerIonCompile(VMFrame &f)
 {
     RootedScript script(f.cx, f.script());
 
-    if (ion::js_IonOptions.parallelCompilation && !f.cx->runtime->profilingScripts) {
+    if (OffThreadCompilationEnabled(f.cx) && !f.cx->runtime->profilingScripts) {
         if (script->hasIonScript()) {
             /*
              * Normally TriggerIonCompile is not called if !script->ion, but the
              * latter jump can be bypassed if DisableScriptCodeForIon wants this
              * code to be destroyed so that the Ion code can start running.
              */
             ExpandInlineFrames(f.cx->zone());
             Recompiler::clearStackReferences(f.cx->runtime->defaultFreeOp(), script);