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

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

Issue 1522473002: Reland addition of init function for asm->wasm. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 | « src/wasm/asm-wasm-builder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/asm-wasm.js
diff --git a/test/mjsunit/wasm/asm-wasm.js b/test/mjsunit/wasm/asm-wasm.js
index 8a803cdcd4616982e15a82020199df9e03d1bcdf..adb37d1268a387410fa1b17582ceca2cbc0d826d 100644
--- a/test/mjsunit/wasm/asm-wasm.js
+++ b/test/mjsunit/wasm/asm-wasm.js
@@ -512,48 +512,42 @@ function TestModDoubleNegative() {
assertEquals(28, WASM.asmCompileRun(TestModDoubleNegative.toString()));
*/
-function TestGlobals() {
+function TestNamedFunctions() {
"use asm";
var a = 0.0;
var b = 0.0;
- var c = 0.0;
function add() {
- c = a + b;
+ return +(a + b);
}
- function caller() {
- a = 23.75;
- b = 7.75;
- add();
- return (~~c)|0;
+ function init() {
+ a = 43.25;
+ b = 34.25;
}
- return {caller:caller};
+ return {init:init,
+ add:add};
}
-assertEquals(31, WASM.asmCompileRun(TestGlobals.toString()));
+var module = WASM.instantiateModuleFromAsm(TestNamedFunctions.toString());
+module.init();
+assertEquals(77.5, module.add());
function TestGlobalsWithInit() {
"use asm";
- var a = 0.0;
- var b = 0.0;
+ var a = 43.25;
+ var b = 34.25;
function add() {
return +(a + b);
}
- function init() {
- a = 43.25;
- b = 34.25;
- }
-
- return {init:init,
- add:add};
+ return {add:add};
}
var module = WASM.instantiateModuleFromAsm(TestGlobalsWithInit.toString());
-module.init();
+module.__init__();
assertEquals(77.5, module.add());
« no previous file with comments | « src/wasm/asm-wasm-builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698