10e2311f8a
With a recent change, we require WebAssembly code to be tiered up to serialize it, see https://crrev.com/c/2349290. In that CL tests were adjusted to set the --wasm-tier-up flag when serialization was involved. However, the test adjusted in this CL was missing, because this test used the kExprRefNull instruction, which caused a bailout to TurboFan anyways. With recent changes, Liftoff can compile kExprRefNull now, and therefore causes problems. R=thibaudm@chromium.org Bug: v8:10852 Change-Id: I9b89f37c22f17cbf046110f3ee1c98bfea73e009 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2387574 Reviewed-by: Thibaud Michaud <thibaudm@chromium.org> Commit-Queue: Andreas Haas <ahaas@chromium.org> Cr-Commit-Position: refs/heads/master@{#69648}
46 lines
1.6 KiB
JavaScript
46 lines
1.6 KiB
JavaScript
// Copyright 2018 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
// The test needs --wasm-tier-up because we can't serialize and deserialize
|
|
// Liftoff code.
|
|
// Flags: --allow-natives-syntax --experimental-wasm-reftypes --wasm-tier-up
|
|
|
|
load("test/mjsunit/wasm/wasm-module-builder.js");
|
|
|
|
(function testExternRefNull() {
|
|
const builder = new WasmModuleBuilder();
|
|
builder.addFunction('main', kSig_r_v)
|
|
.addBody([kExprRefNull, kWasmExternRef])
|
|
.exportFunc();
|
|
|
|
var wire_bytes = builder.toBuffer();
|
|
var module = new WebAssembly.Module(wire_bytes);
|
|
var buffer = %SerializeWasmModule(module);
|
|
module = %DeserializeWasmModule(buffer, wire_bytes);
|
|
var instance = new WebAssembly.Instance(module);
|
|
|
|
assertEquals(null, instance.exports.main());
|
|
})();
|
|
|
|
(function testExternRefIsNull() {
|
|
const builder = new WasmModuleBuilder();
|
|
builder.addFunction('main', kSig_i_r)
|
|
.addBody([kExprLocalGet, 0, kExprRefIsNull])
|
|
.exportFunc();
|
|
|
|
var wire_bytes = builder.toBuffer();
|
|
var module = new WebAssembly.Module(wire_bytes);
|
|
var buffer = %SerializeWasmModule(module);
|
|
module = %DeserializeWasmModule(buffer, wire_bytes);
|
|
var instance = new WebAssembly.Instance(module);
|
|
|
|
assertEquals(0, instance.exports.main({'hello' : 'world'}));
|
|
assertEquals(0, instance.exports.main(1234));
|
|
assertEquals(0, instance.exports.main(0));
|
|
assertEquals(0, instance.exports.main(123.4));
|
|
assertEquals(0, instance.exports.main(undefined));
|
|
assertEquals(1, instance.exports.main(null));
|
|
assertEquals(0, instance.exports.main(print));
|
|
})();
|