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()); |
+})(); |