PR-URL: https://github.com/nodejs/node/pull/51362 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
31 lines
810 B
JavaScript
31 lines
810 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: --allow-natives-syntax
|
|
|
|
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
|
|
|
|
let builder = new WasmModuleBuilder();
|
|
|
|
builder.addMemory(1, 2);
|
|
|
|
let callee = builder.addFunction('callee', kSig_v_v).addBody([kExprNop]);
|
|
|
|
builder.addDeclarativeElementSegment([callee.index]);
|
|
|
|
let main_func = builder.addFunction('main', kSig_v_v).exportFunc().addBody([
|
|
kExprRefFunc, callee.index,
|
|
kExprCallRef, callee.type_index,
|
|
kExprI32Const, 0,
|
|
kExprI32LoadMem, 0, 0,
|
|
kExprDrop,
|
|
]);
|
|
|
|
let instance = builder.instantiate();
|
|
let main = instance.exports.main;
|
|
|
|
for (let i = 0; i < 20; i++) main();
|
|
%WasmTierUpFunction(main);
|
|
main();
|