v8/test/message/wasm-trace-liftoff.js
Camillo Bruni a345a442d3 [d8][mjsunit][tools] Improve d8 file API
- Add d8.file.read() and d8.file.execute() helpers
- Change tools and tests to use new d8.file helper
- Unify error throwing in v8::Shell::ReadFile

Change-Id: I5ef4cb27f217508a367106f01e872a4059d5e399
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2928505
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74883}
2021-06-01 13:37:57 +00:00

56 lines
2.5 KiB
JavaScript

// Copyright 2020 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: --trace-wasm --no-wasm-tier-up --liftoff --no-stress-opt
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
let builder = new WasmModuleBuilder();
let kRet23Function = builder.addFunction('ret_23', kSig_i_v)
.addBody([kExprI32Const, 23])
.exportFunc()
.index;
let kCall23Function = builder.addFunction('call_23', kSig_i_v)
.addBody([kExprCallFunction, kRet23Function])
.exportFunc()
.index;
let kRet57Function = builder.addFunction('ret_57', kSig_l_v)
.addBody([kExprI64Const, 57])
.exportFunc()
.index;
let kUnnamedFunction = builder.addFunction(undefined, kSig_l_v)
.addBody([kExprCallFunction, kRet57Function])
.index;
let kRet0Function = builder.addFunction('ret_0', kSig_f_v)
.addBody(wasmF32Const(0))
.exportFunc()
.index;
let kRet1Function = builder.addFunction('ret_1', kSig_d_v)
.addBody(wasmF64Const(1))
.exportFunc()
.index;
let kIdentityFunction = builder.addFunction('identity', kSig_i_i)
.addBody([kExprLocalGet, 0])
.exportFunc()
.index;
let kCallIdentityFunction = builder.addFunction('call_identity', kSig_i_v)
.addBody([
kExprI32Const, 42, // -
kExprCallFunction, kIdentityFunction // -
])
.exportFunc()
.index;
builder.addFunction('main', kSig_v_v)
.addBody([
kExprCallFunction, kCall23Function, kExprDrop, // -
kExprCallFunction, kUnnamedFunction, kExprDrop, // -
kExprCallFunction, kRet0Function, kExprDrop, // -
kExprCallFunction, kRet1Function, kExprDrop, // -
kExprCallFunction, kCallIdentityFunction, kExprDrop // -
])
.exportAs('main');
let instance = builder.instantiate();
instance.exports.main();