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 208306 51f60a862089
parent 208305 cfec8a16880a
child 208307 9ebeb7669cda
child 208309 1764a68fe1ae
push id3814
push userryanvm@gmail.com
push date2014-08-14 17:04 +0000
treeherdermozilla-beta@51f60a862089 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier, sledru
bugs992461
milestone32.0
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/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", "--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", "--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,23 +10,27 @@ 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);
 
+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
@@ -12,16 +12,18 @@ function matchStack(stackString, stackAr
 }
 
 var stack;
 function dumpStack()
 {
     stack = new Error().stack
 }
 
+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 < 5000; i++) {
     stack = null;
     f();
     matchStack(stack, ['dumpStack', 'f']);
 }
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -120,17 +120,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);