8fbefa4797
This adds a non-standard, unsafe instruction for performance experiments: ref.cast_nop_static behaves like ref.cast_static as far as static types are concerned, but emits no code. Bug: v8:7748 Change-Id: Ic5797a941146a06d7c6ff249d8e29919145d8ea1 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3639206 Reviewed-by: Manos Koukoutos <manoskouk@chromium.org> Commit-Queue: Jakob Kummerow <jkummerow@chromium.org> Cr-Commit-Position: refs/heads/main@{#80471}
27 lines
852 B
JavaScript
27 lines
852 B
JavaScript
// Copyright 2022 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 --experimental-wasm-ref-cast-nop
|
|
|
|
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
|
|
|
|
(function TestRefCastNop() {
|
|
var builder = new WasmModuleBuilder();
|
|
let struct = builder.addStruct([makeField(kWasmI32, true)]);
|
|
|
|
builder.addFunction("main", kSig_i_i)
|
|
.addLocals(wasmOptRefType(kWasmDataRef), 1)
|
|
.addBody([
|
|
kExprLocalGet, 0,
|
|
kGCPrefix, kExprStructNew, struct,
|
|
kExprLocalSet, 1,
|
|
kExprLocalGet, 1,
|
|
kGCPrefix, kExprRefCastNopStatic, struct,
|
|
kGCPrefix, kExprStructGet, struct, 0,
|
|
]).exportFunc();
|
|
|
|
var instance = builder.instantiate();
|
|
assertEquals(42, instance.exports.main(42));
|
|
})();
|