d314be6730
This patch makes V8 accept the binary format produced by Binaryen after https://github.com/WebAssembly/binaryen/pull/3933 when the --experimental-wasm-gc-experiments flag is present. The explicit inheritance information is not used for anything. Validation is performed only insofar as explicit supertypes must be valid types. Bug: v8:7748 Change-Id: Id5b5050aa03591281632e3a2a161aa93422e10bd Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3071406 Reviewed-by: Manos Koukoutos <manoskouk@chromium.org> Commit-Queue: Jakob Kummerow <jkummerow@chromium.org> Cr-Commit-Position: refs/heads/master@{#76135}
32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
// Copyright 2021 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.
|
|
|
|
// Flags: --experimental-wasm-gc-experiments
|
|
|
|
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
|
|
|
|
var builder = new WasmModuleBuilder();
|
|
let struct1 = builder.addStruct([makeField(kWasmI32, true)]);
|
|
let struct2 = builder.addStructExtending(
|
|
[makeField(kWasmI32, true), makeField(kWasmI32, true)], struct1);
|
|
|
|
let array1 = builder.addArray(kWasmI32, true);
|
|
let array2 = builder.addArrayExtending(kWasmI32, true, array1);
|
|
|
|
builder.addFunction("main", kSig_v_v)
|
|
.addLocals(wasmOptRefType(struct1), 1)
|
|
.addLocals(wasmOptRefType(array1), 1)
|
|
.addBody([
|
|
kGCPrefix, kExprRttCanon, struct2,
|
|
kGCPrefix, kExprStructNewDefault, struct2,
|
|
kExprLocalSet, 0,
|
|
kExprI32Const, 10, // length
|
|
kGCPrefix, kExprRttCanon, array2,
|
|
kGCPrefix, kExprArrayNewDefault, array2,
|
|
kExprLocalSet, 1
|
|
]);
|
|
|
|
// This test is only interested in type checking.
|
|
builder.instantiate();
|