Bug 992461 - Turn off the shell's asm.js cache by default. r=bbouvier, a=sledru
authorLuke Wagner <luke@mozilla.com>
Wed, 13 Aug 2014 15:08:19 -0500
changeset 217492 a75e270e297696e06b865f40798f45188d37fd42
parent 217491 6b801f094ae6730d2b8c666ea4a5be8555e12568
child 217493 aa7f00d2f78d3fe978f64bf4a4e89d215609c3e5
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier, sledru
bugs992461
milestone33.0a2
Bug 992461 - Turn off the shell's asm.js cache by default. r=bbouvier, a=sledru
js/src/jit-test/lib/asm.js
js/src/jit-test/tests/asm.js/testBullet.js
js/src/jit-test/tests/asm.js/testCaching.js
js/src/jit-test/tests/asm.js/testHeapAccess.js
js/src/jit-test/tests/asm.js/testSource.js
js/src/jit-test/tests/asm.js/testStackWalking.js
js/src/jit-test/tests/asm.js/testTimeout-deactivate-reactivate-signals.js
js/src/jit-test/tests/latin1/asm.js
js/src/shell/js.cpp
--- a/js/src/jit-test/lib/asm.js
+++ b/js/src/jit-test/lib/asm.js
@@ -29,17 +29,17 @@ function asmCompileCached()
         var f = Function.apply(null, arguments);
         assertEq(isAsmJSModule(f), true);
         return f;
     }
 
     var quotedArgs = [];
     for (var i = 0; i < arguments.length; i++)
         quotedArgs.push("'" + arguments[i] + "'");
-    var code = "var f = new Function(" + quotedArgs.join(',') + ");assertEq(isAsmJSModule(f), true);";
+    var code = "setCachingEnabled(true); var f = new Function(" + quotedArgs.join(',') + ");assertEq(isAsmJSModule(f), true);";
     nestedShell("--js-cache", "--no-js-cache-per-process", "--execute=" + code);
 
     var f = Function.apply(null, arguments);
     assertEq(isAsmJSModuleLoadedFromCache(f), true);
     return f;
 }
 
 function assertAsmDirectiveFail(str)
--- a/js/src/jit-test/tests/asm.js/testBullet.js
+++ b/js/src/jit-test/tests/asm.js/testBullet.js
@@ -1,18 +1,19 @@
 // Test a big fat asm.js module. First load/compile/cache bullet.js in a
 // separate process and then load it again in this process, which should be a
 // cache hit.
 
+setCachingEnabled(true);
 if (!isAsmJSCompilationAvailable())
     quit();
 
 // Note: if you get some failure in this test, it probably has to do with
 // bullet.js and not the nestedShell() call, so try first commenting out
 // nestedShell() (and the loadedFromCache assertion) to see if the error
 // reproduces.
-var code = "setIonCheckGraphCoherency(false); load('" + libdir + "bullet.js'); runBullet()";
+var code = "setIonCheckGraphCoherency(false); setCachingEnabled(true); load('" + libdir + "bullet.js'); runBullet()";
 nestedShell("--js-cache", "--no-js-cache-per-process", "--execute=" + code);
 setIonCheckGraphCoherency(false);
 load(libdir + 'bullet.js');
 var results = runBullet();
 assertEq(results.asmJSValidated, true);
 assertEq(results.loadedFromCache, true);
--- a/js/src/jit-test/tests/asm.js/testCaching.js
+++ b/js/src/jit-test/tests/asm.js/testCaching.js
@@ -1,10 +1,11 @@
 load(libdir + "asm.js");
 
+setCachingEnabled(true);
 if (!isAsmJSCompilationAvailable() || !isCachingEnabled())
     quit();
 
 var body1 = "'use asm'; function f() { return 42 } function ff() { return 43 } return f";
 var m = new Function(body1);
 assertEq(isAsmJSModule(m), true);
 assertEq(m()(), 42);
 var m = new Function(body1);
--- a/js/src/jit-test/tests/asm.js/testHeapAccess.js
+++ b/js/src/jit-test/tests/asm.js/testHeapAccess.js
@@ -10,16 +10,18 @@ assertAsmTypeFail('glob', 'imp', 'b', US
 assertAsmTypeFail('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f() { return i32[0>>1]|0 }; return f');
 assertAsmTypeFail('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f() { return i32[0>>4]|0 }; return f');
 assertEq(asmLink(asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f() { return i32[0]|0 }; return f'), this, null, new ArrayBuffer(4096))(), 0);
 
 var code = asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i) {i=i|0; i = i32[i>>2]|0; return i|0}; return f');
 var f = asmLink(code, this, null, new ArrayBuffer(4096));
 assertEq(f(0), 0);
 
+setCachingEnabled(true);
+
 var code = asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i) {i=i|0; i32[0] = i; return i8[0]|0}; return f');
 var f = asmLink(code, this, null, new ArrayBuffer(4096));
 assertEq(f(0),0);
 assertEq(f(0x7f),0x7f);
 assertEq(f(0xff),-1);
 assertEq(f(0x100),0);
 
 // Test signal handlers deactivation
@@ -44,16 +46,18 @@ assertEq(f(0x100),0);
         assertEq(f(0x100),0);
         setJitCompilerOption("signals.enable", 1);
     }
     jco = getJitCompilerOptions();
     var signalHandlersAfter = jco["signals.enable"];
     assertEq(signalHandlersBefore, signalHandlersAfter);
 })();
 
+setCachingEnabled(false);
+
 var code = asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i) {i=i|0; i32[0] = i; return u8[0]|0}; return f');
 var f = asmLink(code, this, null, new ArrayBuffer(4096));
 assertEq(f(0),0);
 assertEq(f(0x7f),0x7f);
 assertEq(f(0xff),0xff);
 assertEq(f(0x100),0);
 
 var code = asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i) {i=i|0; i32[0] = i; return i16[0]|0}; return f');
--- a/js/src/jit-test/tests/asm.js/testSource.js
+++ b/js/src/jit-test/tests/asm.js/testSource.js
@@ -1,8 +1,10 @@
+setCachingEnabled(true);
+
 (function() {
 /*
  * NO ARGUMENT
  */
 
 function f0() {
     "use asm";
     function g() {}
--- a/js/src/jit-test/tests/asm.js/testStackWalking.js
+++ b/js/src/jit-test/tests/asm.js/testStackWalking.js
@@ -15,16 +15,17 @@ var stack;
 function dumpStack()
 {
     stack = new Error().stack
 }
 
 setJitCompilerOption("ion.usecount.trigger", 10);
 setJitCompilerOption("baseline.usecount.trigger", 0);
 setJitCompilerOption("offthread-compilation.enable", 0);
+setCachingEnabled(true);
 
 var callFFI = asmCompile('global', 'ffis', USE_ASM + "var ffi=ffis.ffi; function f() { return ffi()|0 } return f");
 
 var f = asmLink(callFFI, null, {ffi:dumpStack});
 for (var i = 0; i < 15; i++) {
     stack = null;
     f();
     matchStack(stack, ['dumpStack', 'f']);
--- a/js/src/jit-test/tests/asm.js/testTimeout-deactivate-reactivate-signals.js
+++ b/js/src/jit-test/tests/asm.js/testTimeout-deactivate-reactivate-signals.js
@@ -1,12 +1,14 @@
 // |jit-test| exitstatus: 6;
 
 load(libdir + "asm.js");
 
+setCachingEnabled(true);
+
 var jco = getJitCompilerOptions();
 if (jco["signals.enable"] === 0 || !isCachingEnabled() || !isAsmJSCompilationAvailable())
     quit(6);
 
 // Modules compiled without signal handlers should still work even if signal
 // handlers have been reactivated.
 setJitCompilerOption("signals.enable", 0);
 
--- a/js/src/jit-test/tests/latin1/asm.js
+++ b/js/src/jit-test/tests/latin1/asm.js
@@ -1,10 +1,11 @@
 load(libdir + "asm.js");
 
+setCachingEnabled(true);
 if (!isAsmJSCompilationAvailable() || !isCachingEnabled())
     quit();
 
 // Test Latin1 and TwoByte PropertyName serialization.
 
 // Latin1
 toLatin1("funName"); // Latin1 atom.
 var body1 = "'use asm'; function funName() { return 42 } return funName";
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -122,17 +122,17 @@ static double gTimeoutInterval = -1.0;
 static volatile bool gServiceInterrupt = false;
 static Maybe<JS::PersistentRootedValue> gInterruptFunc;
 
 static bool enableDisassemblyDumps = false;
 
 static bool printTiming = false;
 static const char *jsCacheDir = nullptr;
 static const char *jsCacheAsmJSPath = nullptr;
-static bool jsCachingEnabled = true;
+static bool jsCachingEnabled = false;
 mozilla::Atomic<bool> jsCacheOpened(false);
 
 static bool
 SetTimeoutValue(JSContext *cx, double t);
 
 static bool
 InitWatchdog(JSRuntime *rt);