Commit d4ec15f9 authored by mtrofin's avatar mtrofin Committed by Commit bot

[wasm] additional serialization test

Ensure we can serialize a wasm compiled module even after it was
instantiated a few times.

BUG=

Review-Url: https://codereview.chromium.org/2339933003
Cr-Commit-Position: refs/heads/master@{#39463}
parent e1997bb7
......@@ -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);
})();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment