Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Unified Diff: test/mjsunit/wasm/asm-wasm-stdlib.js

Issue 2264913002: [wasm] asm.js - Remove Wasm.instantiateModuleFromAsm, use asm.js directly. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/wasm/asm-wasm-literals.js ('k') | test/mjsunit/wasm/asm-wasm-switch.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/asm-wasm-stdlib.js
diff --git a/test/mjsunit/wasm/asm-wasm-stdlib.js b/test/mjsunit/wasm/asm-wasm-stdlib.js
index 82c27d4da99253b70330fa41688768d2326c52a4..05e1ca509c4c5d1cb33ad36e80656c9db98a91bb 100644
--- a/test/mjsunit/wasm/asm-wasm-stdlib.js
+++ b/test/mjsunit/wasm/asm-wasm-stdlib.js
@@ -2,10 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --expose-wasm
+// Flags: --validate-asm --allow-natives-syntax
var stdlib = this;
+function assertValidAsm(func) {
+ assertTrue(%IsAsmWasmCode(func));
+}
+
(function TestStdlibConstants() {
function Module(stdlib) {
"use asm";
@@ -41,7 +45,8 @@ var stdlib = this;
return {caller:caller, nanCheck:nanCheck};
}
- var m = Wasm.instantiateModuleFromAsm(Module.toString(), stdlib);
+ var m = Module(stdlib);
+ assertValidAsm(Module);
assertEquals(1, m.caller());
assertTrue(isNaN(m.nanCheck()));
})();
@@ -95,9 +100,9 @@ var stdlib_math_members = [
stdlib[member] = 0;
print(member);
var code = Module.toString().replace('NaN', member);
- assertThrows(function() {
- Wasm.instantiateModuleFromAsm(code, stdlib);
- });
+ var decl = eval('(' + code + ')');
+ decl(stdlib);
+ assertTrue(%IsNotAsmWasmCode(decl));
}
for (var i = 0; i < stdlib_math_members.length; ++i) {
var member = stdlib_math_members[i];
@@ -105,9 +110,9 @@ var stdlib_math_members = [
stdlib['Math'][member] = 0;
print(member);
var code = Module.toString().replace('NaN', 'Math.' + member);
- assertThrows(function() {
- Wasm.instantiateModuleFromAsm(code, stdlib);
- });
+ var decl = eval('(' + code + ')');
+ decl(stdlib);
+ assertTrue(%IsNotAsmWasmCode(decl));
}
})();
@@ -121,15 +126,17 @@ var stdlib_math_members = [
for (var i = 0; i < stdlib_root_members.length; ++i) {
var member = stdlib_root_members[i];
var code = Module.toString().replace('NaN', member);
- assertThrows(function() {
- Wasm.instantiateModuleFromAsm(code, {});
- });
+ var decl = eval('(' + code + ')');
+ decl({});
+ assertTrue(%IsNotAsmWasmCode(decl));
}
for (var i = 0; i < stdlib_math_members.length; ++i) {
var member = stdlib_math_members[i];
var code = Module.toString().replace('NaN', 'Math.' + member);
+ var decl = eval('(' + code + ')');
assertThrows(function() {
- Wasm.instantiateModuleFromAsm(code, {});
+ decl({});
+ assertTrue(%IsNotAsmWasmCode(decl));
});
}
})();
@@ -210,7 +217,8 @@ var stdlib_math_members = [
return {caller:caller};
}
- var m = Wasm.instantiateModuleFromAsm(Module.toString(), stdlib);
+ var m = Module(stdlib);
+ assertValidAsm(Module);
assertEquals(1, m.caller());
})();
@@ -354,7 +362,8 @@ var stdlib_math_members = [
max_f64: max_f64,
};
}
- var m = Wasm.instantiateModuleFromAsm(Module.toString(), stdlib);
+ var m = Module(stdlib);
+ assertValidAsm(Module);
var values = {
i32: [
0, 1, -1, 123, 456, -123, -456,
« no previous file with comments | « test/mjsunit/wasm/asm-wasm-literals.js ('k') | test/mjsunit/wasm/asm-wasm-switch.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698