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

Unified Diff: test/mjsunit/wasm/start-function.js

Issue 2483193002: [wasm] Wrap start function in a JS->WASM wrapper before calling it during initialization. (Closed)
Patch Set: Created 4 years, 1 month 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/wasm-module.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/start-function.js
diff --git a/test/mjsunit/wasm/start-function.js b/test/mjsunit/wasm/start-function.js
index 58ff79e1608f7939dececb5d794a909d36aa8301..da1c7c37c498d70dfaee4001e561fecba509de8a 100644
--- a/test/mjsunit/wasm/start-function.js
+++ b/test/mjsunit/wasm/start-function.js
@@ -62,14 +62,31 @@ assertThrows(() => {instantiate(kSig_i_v, [kExprI8Const, 0]);});
})();
-(function testRun() {
- print("testRun");
+(function testRun1() {
+ print("testRun1");
var builder = new WasmModuleBuilder();
builder.addMemory(12, 12, true);
var func = builder.addFunction("", kSig_v_v)
- .addBody([kExprI8Const, 0, kExprI8Const, 77, kExprI32StoreMem, 0, 0]);
+ .addBody([kExprI8Const, 0, kExprI8Const, 66, kExprI32StoreMem, 0, 0]);
+
+ builder.addStart(func.index);
+
+ var module = builder.instantiate();
+ var memory = module.exports.memory.buffer;
+ var view = new Int8Array(memory);
+ assertEquals(66, view[0]);
+})();
+
+(function testRun2() {
+ print("testRun2");
+ var builder = new WasmModuleBuilder();
+
+ builder.addMemory(12, 12, true);
+
+ var func = builder.addFunction("", kSig_v_v)
+ .addBody([kExprI8Const, 0, kExprI8Const, 22, kExprI8Const, 55, kExprI32Add, kExprI32StoreMem, 0, 0]);
builder.addStart(func.index);
« no previous file with comments | « src/wasm/wasm-module.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698