summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/wasm/compiled-module-serialization.js
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2016-12-23 16:30:57 +0100
committerMichaël Zasso <targos@protonmail.com>2017-01-26 22:46:17 +0100
commit2739185b790e040c3b044c577327f5d44bffad4a (patch)
tree29a466999212f4c85958379d9d400eec8a185ba5 /deps/v8/test/mjsunit/wasm/compiled-module-serialization.js
parenta67a04d7654faaa04c8da00e42981ebc9fd0911c (diff)
downloadnode-new-2739185b790e040c3b044c577327f5d44bffad4a.tar.gz
deps: update V8 to 5.5.372.40
PR-URL: https://github.com/nodejs/node/pull/9618 Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'deps/v8/test/mjsunit/wasm/compiled-module-serialization.js')
-rw-r--r--deps/v8/test/mjsunit/wasm/compiled-module-serialization.js32
1 files changed, 26 insertions, 6 deletions
diff --git a/deps/v8/test/mjsunit/wasm/compiled-module-serialization.js b/deps/v8/test/mjsunit/wasm/compiled-module-serialization.js
index 94cc894275..aa36b71882 100644
--- a/deps/v8/test/mjsunit/wasm/compiled-module-serialization.js
+++ b/deps/v8/test/mjsunit/wasm/compiled-module-serialization.js
@@ -17,13 +17,13 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
builder.addFunction("main", kSig_i_i)
.addBody([
- kExprI32Const, 1,
kExprGetLocal, 0,
kExprI32LoadMem, 0, 0,
- kExprCallIndirect, kArity1, signature,
+ kExprI32Const, 1,
+ kExprCallIndirect, signature,
kExprGetLocal,0,
kExprI32LoadMem,0, 0,
- kExprCallImport, kArity0, 0,
+ kExprCallFunction, 0,
kExprI32Add
]).exportFunc();
@@ -32,8 +32,8 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
builder.addFunction("_wrap_writer", signature)
.addBody([
kExprGetLocal, 0,
- kExprCallImport, kArity1, 1]);
- builder.appendToTable([0, 1]);
+ kExprCallFunction, 1]);
+ builder.appendToTable([2, 3]);
var module = new WebAssembly.Module(builder.toBuffer());
@@ -77,4 +77,24 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
assertFalse(clone == undefined);
assertFalse(clone == compiled_module);
assertEquals(clone.constructor, compiled_module.constructor);
-})()
+})();
+
+(function SerializeAfterInstantiation() {
+ let builder = new WasmModuleBuilder();
+ builder.addFunction("main", kSig_i)
+ .addBody([kExprI8Const, 42])
+ .exportFunc();
+
+ var compiled_module = new WebAssembly.Module(builder.toBuffer());
+ var instance1 = new WebAssembly.Instance(compiled_module);
+ var instance2 = new WebAssembly.Instance(compiled_module);
+ var serialized = %SerializeWasmModule(compiled_module);
+ var clone = %DeserializeWasmModule(serialized);
+
+ assertNotNull(clone);
+ assertFalse(clone == undefined);
+ assertFalse(clone == compiled_module);
+ assertEquals(clone.constructor, compiled_module.constructor);
+ var instance3 = new WebAssembly.Instance(clone);
+ assertFalse(instance3 == undefined);
+})();