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

Unified Diff: test/mjsunit/wasm/instantiate-run-basic.js

Issue 1770913002: [wasm] Use the JavaScript WasmModuleBuilder utility in JS tests. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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/instantiate-module-basic.js ('k') | test/mjsunit/wasm/module-memory.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/instantiate-run-basic.js
diff --git a/test/mjsunit/wasm/instantiate-run-basic.js b/test/mjsunit/wasm/instantiate-run-basic.js
index 55e7c6e851319f27cc89d9775848bf1d5eca95ac..2e649a0bd28b7c9e449b444968355eca7d8fd79a 100644
--- a/test/mjsunit/wasm/instantiate-run-basic.js
+++ b/test/mjsunit/wasm/instantiate-run-basic.js
@@ -5,27 +5,16 @@
// Flags: --expose-wasm
load("test/mjsunit/wasm/wasm-constants.js");
+load("test/mjsunit/wasm/wasm-module-builder.js");
-var kReturnValue = 97;
+(function BasicTest() {
+ var kReturnValue = 107;
+ var builder = new WasmModuleBuilder();
-var kBodySize = 2;
-var kNameOffset = kHeaderSize + 15 + kBodySize + 1;
+ builder.addFunction("main", [kAstI32])
+ .addBody([kExprI8Const, kReturnValue])
+ .exportFunc();
-var data = bytesWithHeader(
- // -- signatures
- kDeclSignatures, 1,
- 0, kAstI32, // signature: void -> int
- // -- main function
- kDeclFunctions, 1,
- kDeclFunctionName | kDeclFunctionExport,
- 0, 0, // signature index
- kNameOffset, 0, 0, 0, // name offset
- kBodySize, 0, // body size
- // -- body
- kExprI8Const, // --
- kReturnValue, // --
- kDeclEnd,
- 'm', 'a', 'i', 'n', 0 // name
-);
-
-assertEquals(kReturnValue, _WASMEXP_.instantiateModule(data).main());
+ var main = builder.instantiate().exports.main;
+ assertEquals(kReturnValue, main());
+})();
« no previous file with comments | « test/mjsunit/wasm/instantiate-module-basic.js ('k') | test/mjsunit/wasm/module-memory.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698