Bug 1168756: Add shell flags to enable shared stubs, r=jandem
authorHannes Verschore <hv1989@gmail.com>
Thu, 13 Aug 2015 12:00:16 +0200
changeset 257573 3655d19ce241dfc7356beb4ee31f2382c0f5dd0f
parent 257572 8c3d49b034c1678d17b7c64c4ed872fa8d63e851
child 257574 44174f5d6bc7c1d55276fd52551a26c38aebb1ef
push id29223
push userkwierso@gmail.com
push dateThu, 13 Aug 2015 22:18:08 +0000
treeherdermozilla-central@4b35236fc76e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1168756
milestone43.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 1168756: Add shell flags to enable shared stubs, r=jandem
js/src/jit/JitOptions.cpp
js/src/jit/JitOptions.h
js/src/shell/js.cpp
--- a/js/src/jit/JitOptions.cpp
+++ b/js/src/jit/JitOptions.cpp
@@ -69,85 +69,67 @@ JitOptions::JitOptions()
     // are not modified before its OsiPoint.
     SET_DEFAULT(checkOsiPointRegisters, false);
 #endif
 
     // Whether to enable extra code to perform dynamic validation of
     // RangeAnalysis results.
     SET_DEFAULT(checkRangeAnalysis, false);
 
-    // Whether to enable extra code to perform dynamic validations.
-    SET_DEFAULT(runExtraChecks, false);
+    // Toggles whether Alignment Mask Analysis is globally disabled.
+    SET_DEFAULT(disableAma, false);
 
-    // Toggle whether eager scalar replacement is globally disabled.
-    SET_DEFAULT(disableScalarReplacement, false);
+    // Toggles whether Effective Address Analysis is globally disabled.
+    SET_DEFAULT(disableEaa, false);
 
     // Toggle whether eager simd unboxing is globally disabled.
     SET_DEFAULT(disableEagerSimdUnbox, false);
 
+    // Toggles whether Edge Case Analysis is gobally disabled.
+    SET_DEFAULT(disableEdgeCaseAnalysis, false);
+
     // Toggle whether global value numbering is globally disabled.
     SET_DEFAULT(disableGvn, false);
 
-    // Toggles whether loop invariant code motion is globally disabled.
-    SET_DEFAULT(disableLicm, false);
-
     // Toggles whether inlining is globally disabled.
     SET_DEFAULT(disableInlining, false);
 
-    // Toggles whether Edge Case Analysis is gobally disabled.
-    SET_DEFAULT(disableEdgeCaseAnalysis, false);
+    // Toggles whether loop invariant code motion is globally disabled.
+    SET_DEFAULT(disableLicm, false);
+
+    // Toggles whether Loop Unrolling is globally disabled.
+    SET_DEFAULT(disableLoopUnrolling, true);
 
     // Toggles whether Range Analysis is globally disabled.
     SET_DEFAULT(disableRangeAnalysis, false);
 
+    // Toggle whether eager scalar replacement is globally disabled.
+    SET_DEFAULT(disableScalarReplacement, false);
+
+    // Toggles whether shared stubs are used in Ionmonkey.
+    SET_DEFAULT(disableSharedStubs, true);
+
     // Toggles whether sink code motion is globally disabled.
     SET_DEFAULT(disableSink, true);
 
-    // Toggles whether Loop Unrolling is globally disabled.
-    SET_DEFAULT(disableLoopUnrolling, true);
-
-    // Toggles whether Effective Address Analysis is globally disabled.
-    SET_DEFAULT(disableEaa, false);
-
-    // Toggles whether Alignment Mask Analysis is globally disabled.
-    SET_DEFAULT(disableAma, false);
-
     // Whether functions are compiled immediately.
     SET_DEFAULT(eagerCompilation, false);
 
     // Whether IonBuilder should prefer IC generation above specialized MIR.
     SET_DEFAULT(forceInlineCaches, false);
 
-    // Force how many invocation or loop iterations are needed before compiling
-    // a function with the highest ionmonkey optimization level.
-    // (i.e. OptimizationLevel_Normal)
-    const char* forcedDefaultIonWarmUpThresholdEnv = "JIT_OPTION_forcedDefaultIonWarmUpThreshold";
-    if (const char* env = getenv(forcedDefaultIonWarmUpThresholdEnv)) {
-        Maybe<int> value = ParseInt(env);
-        if (value.isSome())
-            forcedDefaultIonWarmUpThreshold.emplace(value.ref());
-        else
-            Warn(forcedDefaultIonWarmUpThresholdEnv, env);
-    }
-
-    // Force the used register allocator instead of letting the optimization
-    // pass decide.
-    const char* forcedRegisterAllocatorEnv = "JIT_OPTION_forcedRegisterAllocator";
-    if (const char* env = getenv(forcedRegisterAllocatorEnv)) {
-        forcedRegisterAllocator = LookupRegisterAllocator(env);
-        if (!forcedRegisterAllocator.isSome())
-            Warn(forcedRegisterAllocatorEnv, env);
-    }
-
     // Toggles whether large scripts are rejected.
     SET_DEFAULT(limitScriptSize, true);
 
     // Toggles whether functions may be entered at loop headers.
     SET_DEFAULT(osr, true);
 
+    // Whether to enable extra code to perform dynamic validations.
+    SET_DEFAULT(runExtraChecks, false);
+
     // How many invocations or loop iterations are needed before functions
     // are compiled with the baseline compiler.
     SET_DEFAULT(baselineWarmUpThreshold, 10);
 
     // Number of exception bailouts (resuming into catch/finally block) before
     // we invalidate and forbid Ion compilation.
     SET_DEFAULT(exceptionBailoutThreshold, 10);
 
@@ -160,16 +142,37 @@ JitOptions::JitOptions()
 
     // How many times we will try to enter a script via OSR before
     // invalidating the script.
     SET_DEFAULT(osrPcMismatchesBeforeRecompile, 6000);
 
     // The bytecode length limit for small function.
     SET_DEFAULT(smallFunctionMaxBytecodeLength_, 100);
 
+    // Force how many invocation or loop iterations are needed before compiling
+    // a function with the highest ionmonkey optimization level.
+    // (i.e. OptimizationLevel_Normal)
+    const char* forcedDefaultIonWarmUpThresholdEnv = "JIT_OPTION_forcedDefaultIonWarmUpThreshold";
+    if (const char* env = getenv(forcedDefaultIonWarmUpThresholdEnv)) {
+        Maybe<int> value = ParseInt(env);
+        if (value.isSome())
+            forcedDefaultIonWarmUpThreshold.emplace(value.ref());
+        else
+            Warn(forcedDefaultIonWarmUpThresholdEnv, env);
+    }
+
+    // Force the used register allocator instead of letting the optimization
+    // pass decide.
+    const char* forcedRegisterAllocatorEnv = "JIT_OPTION_forcedRegisterAllocator";
+    if (const char* env = getenv(forcedRegisterAllocatorEnv)) {
+        forcedRegisterAllocator = LookupRegisterAllocator(env);
+        if (!forcedRegisterAllocator.isSome())
+            Warn(forcedRegisterAllocatorEnv, env);
+    }
+
     // Toggles whether unboxed plain objects can be created by the VM.
     SET_DEFAULT(disableUnboxedObjects, false);
 }
 
 bool
 JitOptions::isSmallFunction(JSScript* script) const
 {
     return script->length() <= smallFunctionMaxBytecodeLength_;
--- a/js/src/jit/JitOptions.h
+++ b/js/src/jit/JitOptions.h
@@ -42,39 +42,40 @@ LookupRegisterAllocator(const char* name
 struct JitOptions
 {
     bool checkGraphConsistency;
 #ifdef CHECK_OSIPOINT_REGISTERS
     bool checkOsiPointRegisters;
 #endif
     bool checkRangeAnalysis;
     bool runExtraChecks;
-    bool disableScalarReplacement;
+    bool disableAma;
+    bool disableEaa;
     bool disableEagerSimdUnbox;
-    bool disableGvn;
-    bool disableLicm;
-    bool disableInlining;
     bool disableEdgeCaseAnalysis;
-    bool disableRangeAnalysis;
-    bool disableSink;
+    bool disableGvn;
+    bool disableInlining;
+    bool disableLicm;
     bool disableLoopUnrolling;
-    bool disableEaa;
-    bool disableAma;
+    bool disableRangeAnalysis;
+    bool disableScalarReplacement;
+    bool disableSharedStubs;
+    bool disableSink;
     bool eagerCompilation;
     bool forceInlineCaches;
-    mozilla::Maybe<uint32_t> forcedDefaultIonWarmUpThreshold;
-    mozilla::Maybe<IonRegisterAllocator> forcedRegisterAllocator;
     bool limitScriptSize;
     bool osr;
     uint32_t baselineWarmUpThreshold;
     uint32_t exceptionBailoutThreshold;
     uint32_t frequentBailoutThreshold;
     uint32_t maxStackArgs;
     uint32_t osrPcMismatchesBeforeRecompile;
     uint32_t smallFunctionMaxBytecodeLength_;
+    mozilla::Maybe<uint32_t> forcedDefaultIonWarmUpThreshold;
+    mozilla::Maybe<IonRegisterAllocator> forcedRegisterAllocator;
 
     // The options below affect the rest of the VM, and not just the JIT.
     bool disableUnboxedObjects;
 
     JitOptions();
     bool isSmallFunction(JSScript* script) const;
     void setEagerCompilation();
     void setCompilerWarmUpThreshold(uint32_t warmUpThreshold);
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -5802,16 +5802,25 @@ SetRuntimeOptions(JSRuntime* rt, const O
         if (strcmp(str, "on") == 0)
             jit::js_JitOptions.disableScalarReplacement = false;
         else if (strcmp(str, "off") == 0)
             jit::js_JitOptions.disableScalarReplacement = true;
         else
             return OptionFailure("ion-scalar-replacement", str);
     }
 
+    if (const char* str = op.getStringOption("ion-shared-stubs")) {
+        if (strcmp(str, "on") == 0)
+            jit::js_JitOptions.disableSharedStubs = false;
+        else if (strcmp(str, "off") == 0)
+            jit::js_JitOptions.disableSharedStubs = true;
+        else
+            return OptionFailure("ion-shared-stubs", str);
+    }
+
     if (const char* str = op.getStringOption("ion-gvn")) {
         if (strcmp(str, "off") == 0) {
             jit::js_JitOptions.disableGvn = true;
         } else if (strcmp(str, "on") != 0 &&
                    strcmp(str, "optimistic") != 0 &&
                    strcmp(str, "pessimistic") != 0)
         {
             // We accept "pessimistic" and "optimistic" as synonyms for "on"
@@ -6154,16 +6163,18 @@ main(int argc, char** argv, char** envp)
         || !op.addIntOption('\0', "thread-count", "COUNT", "Use COUNT auxiliary threads "
                             "(default: # of cores - 1)", -1)
         || !op.addBoolOption('\0', "ion", "Enable IonMonkey (default)")
         || !op.addBoolOption('\0', "no-ion", "Disable IonMonkey")
         || !op.addBoolOption('\0', "no-asmjs", "Disable asm.js compilation")
         || !op.addBoolOption('\0', "no-native-regexp", "Disable native regexp compilation")
         || !op.addBoolOption('\0', "no-unboxed-objects", "Disable creating unboxed plain objects")
         || !op.addBoolOption('\0', "unboxed-arrays", "Allow creating unboxed arrays")
+        || !op.addStringOption('\0', "ion-shared-stubs", "on/off",
+                               "Use shared stubs (default: off, on to enable)")
         || !op.addStringOption('\0', "ion-scalar-replacement", "on/off",
                                "Scalar Replacement (default: on, off to disable)")
         || !op.addStringOption('\0', "ion-gvn", "[mode]",
                                "Specify Ion global value numbering:\n"
                                "  off: disable GVN\n"
                                "  on:  enable GVN (default)\n")
         || !op.addStringOption('\0', "ion-licm", "on/off",
                                "Loop invariant code motion (default: on, off to disable)")