Skip to content

Commit

Permalink
Bug 1516697 - Remove the implementation of the asm.js caching mechani…
Browse files Browse the repository at this point in the history
…sm. (APIs to invoke it still remain in place; they just don't do anything.) r=luke
  • Loading branch information
jswalden committed Jan 17, 2019
1 parent bdfbf55 commit 6796de0
Show file tree
Hide file tree
Showing 22 changed files with 50 additions and 873 deletions.
2 changes: 1 addition & 1 deletion dom/asmjscache/test/test_cachingBasic.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
evalAsync(code);
break;
case 1:
ok(jsFuns.isAsmJSModuleLoadedFromCache(module), "module loaded from cache");
ok(jsFuns.isAsmJSModule(module), "module");
SimpleTest.finish();
break;
default:
Expand Down
4 changes: 0 additions & 4 deletions dom/asmjscache/test/test_cachingMulti.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
<script>
var jsFuns = SpecialPowers.Cu.getJSTestingFunctions();

var assertCacheHit = false;

// generate four slightly different big asm.js modules and compile them async
// so that we can hit the asm.js cache.

Expand All @@ -36,7 +34,6 @@
code2 += "return g" + i + ";\n";
code2 += "}\n";
code2 += "ok(jsFuns.isAsmJSModule(f), 'f is an asm.js module')\n";
code2 += "if (assertCacheHit) ok(jsFuns.isAsmJSModuleLoadedFromCache(f), 'cache hit');\n";
code2 += "var gX = f();\n";
code2 += "ok(jsFuns.isAsmJSFunction(gX), 'gX is an asm.js function')\n";
code2 += "ok(gX() === " + i + ", 'gX returns the correct result')\n";
Expand All @@ -58,7 +55,6 @@
if (finishedCount < 1 || finishedCount > 2 * N) {
throw "Huh?!";
} else if (finishedCount == N) {
assertCacheHit = true;
for (let i = 0; i < N; i++)
evalAsync(codes[i]);
} else if (finishedCount == 2 * N) {
Expand Down
2 changes: 1 addition & 1 deletion dom/asmjscache/test/test_workers.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
var workerBlob = new Blob([workerCode], {type: "application/javascript"});

var mainCode = asmjsCode;
mainCode += "ok(jsFuns.isAsmJSModuleLoadedFromCache(f), 'f is a cache hit')\n";
mainCode += "ok(jsFuns.isAsmJSModule(f), 'f is a module')\n";
mainCode += "var g42 = f();\n";
mainCode += "ok(jsFuns.isAsmJSFunction(g42), 'g42 is an asm.js function');\n";
mainCode += "ok(g42() === 42, 'g42 returns the correct result');\n";
Expand Down
6 changes: 0 additions & 6 deletions js/src/builtin/TestingFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5923,12 +5923,6 @@ gc::ZealModeHelpText),
" Returns whether the given value is a function containing \"use asm\" that has been\n"
" validated according to the asm.js spec."),

JS_FN_HELP("isAsmJSModuleLoadedFromCache", IsAsmJSModuleLoadedFromCache, 1, 0,
"isAsmJSModuleLoadedFromCache(fn)",
" Return whether the given asm.js module function has been loaded directly\n"
" from the cache. This function throws an error if fn is not a validated asm.js\n"
" module."),

JS_FN_HELP("isAsmJSFunction", IsAsmJSFunction, 1, 0,
"isAsmJSFunction(fn)",
" Returns whether the given value is a nested function in an asm.js module that has been\n"
Expand Down
14 changes: 1 addition & 13 deletions js/src/jit-test/lib/asm.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,8 @@ function asmCompileCached()
if (!isAsmJSCompilationAvailable())
return Function.apply(null, arguments);

if (!isCachingEnabled()) {
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 = "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);
assertEq(isAsmJSModule(f), true);
return f;
}

Expand Down
1 change: 0 additions & 1 deletion js/src/jit-test/lib/bullet.js
Original file line number Diff line number Diff line change
Expand Up @@ -56007,6 +56007,5 @@ function runBullet() {
// Let the caller decide what should have happened.
return {
asmJSValidated: isAsmJSModule(asmModule) && isAsmJSFunction(asm._main),
loadedFromCache: isAsmJSModule(asmModule) && isAsmJSModuleLoadedFromCache(asmModule)
}
}
1 change: 0 additions & 1 deletion js/src/jit-test/tests/asm.js/testAddressErrors.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
load(libdir + "asm.js");

setIonCheckGraphCoherency(false);
setCachingEnabled(false);

// constants
var buf = new ArrayBuffer(BUF_MIN);
Expand Down
11 changes: 3 additions & 8 deletions js/src/jit-test/tests/asm.js/testBullet.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
// |jit-test| skip-if: !isAsmJSCompilationAvailable()

// 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);
// separate process and then load it again in this process.

// 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); setCachingEnabled(true); load('" + libdir + "bullet.js'); runBullet()";
// nestedShell() to see if the error reproduces.
var code = "setIonCheckGraphCoherency(false); 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);
104 changes: 0 additions & 104 deletions js/src/jit-test/tests/asm.js/testCaching.js

This file was deleted.

2 changes: 0 additions & 2 deletions js/src/jit-test/tests/asm.js/testCloning.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
load(libdir + "asm.js");

setCachingEnabled(true);

var code = asmCompile(USE_ASM + "function g() { return 42 } return g");
assertEq(asmLink(code)(), 42);
assertEq(asmLink(code)(), 42);
Expand Down
4 changes: 0 additions & 4 deletions js/src/jit-test/tests/asm.js/testHeapAccess.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ var code = asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i
var f = asmLink(code, this, null, new ArrayBuffer(BUF_MIN));
assertEq(f(0), 0);

setCachingEnabled(true);

// In order to allow following tests work on both big-endian and little-
// endian architectures we need to define least significant byte (lsb) and
// least significant word (lsw).
Expand Down Expand Up @@ -49,8 +47,6 @@ assertEq(f(0x100),0);
assertEq(asmLink(asmCompile('stdlib', 'foreign', 'heap', USE_ASM + 'var i32=new stdlib.Int32Array(heap); function f(i) {i=i|0;var j=0x10000;return (i32[j>>2] = i)|0 } return f'), this, null, buf)(1), 1);
}

setCachingEnabled(false);

var code = asmCompile('glob', 'imp', 'b', USE_ASM + HEAP_IMPORTS + 'function f(i) {i=i|0; i32[0] = i; return u8[' + lsb + ']|0}; return f');
var f = asmLink(code, this, null, new ArrayBuffer(BUF_MIN));
assertEq(f(0),0);
Expand Down
38 changes: 18 additions & 20 deletions js/src/jit-test/tests/asm.js/testSource.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
setCachingEnabled(true);

(function() {
/*
* NO ARGUMENT
Expand Down Expand Up @@ -51,9 +49,9 @@ f0 = new Function(bodyOnly);
assertEq(f0.toString(), "function anonymous(\n) {\n" + bodyOnly + "\n}");
assertEq(f0.toSource(), "(function anonymous(\n) {\n" + bodyOnly + "\n})");

if (isAsmJSCompilationAvailable() && isCachingEnabled()) {
if (isAsmJSCompilationAvailable()) {
var m = new Function(bodyOnly);
assertEq(isAsmJSModuleLoadedFromCache(m), true);
assertEq(isAsmJSModule(m), true);
assertEq(m.toString(), "function anonymous(\n) {\n" + bodyOnly + "\n}");
assertEq(m.toSource(), "(function anonymous(\n) {\n" + bodyOnly + "\n})");
}
Expand Down Expand Up @@ -110,9 +108,9 @@ f1 = new Function('glob', bodyOnly);
assertEq(f1.toString(), "function anonymous(glob\n) {\n" + bodyOnly + "\n}");
assertEq(f1.toSource(), "(function anonymous(glob\n) {\n" + bodyOnly + "\n})");

if (isAsmJSCompilationAvailable() && isCachingEnabled()) {
if (isAsmJSCompilationAvailable()) {
var m = new Function('glob', bodyOnly);
assertEq(isAsmJSModuleLoadedFromCache(m), true);
assertEq(isAsmJSModule(m), true);
assertEq(m.toString(), "function anonymous(glob\n) {\n" + bodyOnly + "\n}");
assertEq(m.toSource(), "(function anonymous(glob\n) {\n" + bodyOnly + "\n})");
}
Expand Down Expand Up @@ -170,9 +168,9 @@ f2 = new Function('glob', 'ffi', bodyOnly);
assertEq(f2.toString(), "function anonymous(glob,ffi\n) {\n" + bodyOnly + "\n}");
assertEq(f2.toSource(), "(function anonymous(glob,ffi\n) {\n" + bodyOnly + "\n})");

if (isAsmJSCompilationAvailable() && isCachingEnabled()) {
if (isAsmJSCompilationAvailable()) {
var m = new Function('glob', 'ffi', bodyOnly);
assertEq(isAsmJSModuleLoadedFromCache(m), true);
assertEq(isAsmJSModule(m), true);
assertEq(m.toString(), "function anonymous(glob,ffi\n) {\n" + bodyOnly + "\n}");
assertEq(m.toSource(), "(function anonymous(glob,ffi\n) {\n" + bodyOnly + "\n})");
}
Expand Down Expand Up @@ -230,9 +228,9 @@ f3 = new Function('glob', 'ffi', 'heap', bodyOnly);
assertEq(f3.toString(), "function anonymous(glob,ffi,heap\n) {\n" + bodyOnly + "\n}");
assertEq(f3.toSource(), "(function anonymous(glob,ffi,heap\n) {\n" + bodyOnly + "\n})");

if (isAsmJSCompilationAvailable() && isCachingEnabled()) {
if (isAsmJSCompilationAvailable()) {
var m = new Function('glob', 'ffi', 'heap', bodyOnly);
assertEq(isAsmJSModuleLoadedFromCache(m), true);
assertEq(isAsmJSModule(m), true);
assertEq(m.toString(), "function anonymous(glob,ffi,heap\n) {\n" + bodyOnly + "\n}");
assertEq(m.toSource(), "(function anonymous(glob,ffi,heap\n) {\n" + bodyOnly + "\n})");
}
Expand All @@ -257,9 +255,9 @@ var expectedToSource = '(' + expectedToString + ')';
assertEq(f4.toString(), expectedToString);
assertEq(f4.toSource(), expectedToSource);

if (isAsmJSCompilationAvailable() && isCachingEnabled()) {
if (isAsmJSCompilationAvailable()) {
var f5 = eval("\"use strict\";\n(" + funcSource + ")");
assertEq(isAsmJSModuleLoadedFromCache(f5), true);
assertEq(isAsmJSModule(f5), true);
assertEq(f5.toString(), expectedToString);
assertEq(f5.toSource(), expectedToSource);
}
Expand Down Expand Up @@ -318,21 +316,21 @@ function checkFuncSrc(m) {
}
checkFuncSrc(moduleG);

if (isAsmJSCompilationAvailable() && isCachingEnabled()) {
if (isAsmJSCompilationAvailable()) {
var g2 = new Function(funcBody);
assertEq(isAsmJSModuleLoadedFromCache(g2), true);
assertEq(isAsmJSModule(g2), true);
m = g2();
checkFuncSrc(m);

var moduleDecl = 'function g3() {' + funcBody + '}';
eval(moduleDecl);
m = g3();
assertEq(isAsmJSModuleLoadedFromCache(g3), false);
assertEq(isAsmJSModule(g3), true);
checkFuncSrc(m);

eval('var x = 42;' + moduleDecl);
m = g3();
assertEq(isAsmJSModuleLoadedFromCache(g3), true);
assertEq(isAsmJSModule(g3), true);
checkFuncSrc(m);
}

Expand All @@ -358,9 +356,9 @@ var expectedToSource = expectedToString
assertEq(f5.toString(), expectedToString);
assertEq(f5.toSource(), expectedToSource);

if (isAsmJSCompilationAvailable() && isCachingEnabled()) {
if (isAsmJSCompilationAvailable()) {
var mf5 = eval("\"use strict\";\n(" + moduleCode + ")");
assertEq(isAsmJSModuleLoadedFromCache(mf5), true);
assertEq(isAsmJSModule(mf5), true);
var f5 = mf5();
assertEq(f5.toString(), expectedToString);
assertEq(f5.toSource(), expectedToSource);
Expand All @@ -387,9 +385,9 @@ var f6 = eval(useStrict + ";\n(" + moduleCode + "({Math:{}}))");
assertEq(f6.toString(), funcCode);
assertEq(f6.toSource(), funcCode);

if (isAsmJSCompilationAvailable() && isCachingEnabled()) {
if (isAsmJSCompilationAvailable()) {
var mf6 = eval("\"use strict\";\n(" + moduleCode + ")");
assertEq(isAsmJSModuleLoadedFromCache(mf6), true);
assertEq(isAsmJSModule(mf6), true);
var f6 = mf6({Math:{}});
assertEq(f6.toString(), funcCode);
assertEq(f6.toSource(), funcCode);
Expand Down
5 changes: 2 additions & 3 deletions js/src/jit-test/tests/asm.js/testStackWalking.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ function dumpStack()
setJitCompilerOption("ion.warmup.trigger", 10);
setJitCompilerOption("baseline.warmup.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");

Expand All @@ -31,9 +30,9 @@ for (var i = 0; i < 15; i++) {
matchStack(stack, ['dumpStack', 'f']);
}

if (isAsmJSCompilationAvailable() && isCachingEnabled()) {
if (isAsmJSCompilationAvailable()) {
var callFFI = asmCompile('global', 'ffis', USE_ASM + "var ffi=ffis.ffi; function f() { return ffi()|0 } return f");
assertEq(isAsmJSModuleLoadedFromCache(callFFI), true);
assertEq(isAsmJSModule(callFFI), true);
stack = null;
f();
matchStack(stack, ['dumpStack', 'f']);
Expand Down
Binary file removed js/src/jit-test/tests/binast/lazy/latin1/asm.binjs
Binary file not shown.
1 change: 0 additions & 1 deletion js/src/jit-test/tests/binast/lazy/latin1/asm.dir

This file was deleted.

Binary file removed js/src/jit-test/tests/binast/nonlazy/latin1/asm.binjs
Binary file not shown.
1 change: 0 additions & 1 deletion js/src/jit-test/tests/binast/nonlazy/latin1/asm.dir

This file was deleted.

Loading

0 comments on commit 6796de0

Please sign in to comment.