mirror of
https://github.com/nodejs/node.git
synced 2025-05-15 16:01:52 +00:00

PR-URL: https://github.com/nodejs/node/pull/52465 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
27 lines
809 B
JavaScript
27 lines
809 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-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(kWasmStructRef, 1)
|
|
.addBody([
|
|
kExprLocalGet, 0,
|
|
kGCPrefix, kExprStructNew, struct,
|
|
kExprLocalSet, 1,
|
|
kExprLocalGet, 1,
|
|
kGCPrefix, kExprRefCastNop, struct,
|
|
kGCPrefix, kExprStructGet, struct, 0,
|
|
]).exportFunc();
|
|
|
|
var instance = builder.instantiate();
|
|
assertEquals(42, instance.exports.main(42));
|
|
})();
|