v8/test/mjsunit/regress/wasm/regress-1027410.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

57 lines
1.7 KiB
JavaScript

// Copyright 2019 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.
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
(function() {
const builder = new WasmModuleBuilder();
builder.addType(makeSig([kWasmF64, kWasmF64, kWasmI32, kWasmI32], [kWasmI32]));
builder.addType(makeSig([], [kWasmF64]));
// Generate function 1 (out of 2).
builder.addFunction(undefined, 0 /* sig */)
.addBodyWithEnd([
// signature: i_ddii
// body:
kExprI32Const, 0x01,
kExprEnd, // @3
]);
// Generate function 2 (out of 2).
builder.addFunction(undefined, 1 /* sig */)
.addLocals(kWasmF64, 8)
.addBodyWithEnd([
// signature: d_v
// body:
kExprBlock, kWasmF64, // @3 f64
kExprBlock, kWasmVoid, // @5
kExprF64Const, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f,
kExprLocalTee, 0x00,
kExprLocalTee, 0x01,
kExprLocalTee, 0x02,
kExprLocalTee, 0x03,
kExprLocalTee, 0x04,
kExprLocalTee, 0x05,
kExprLocalTee, 0x06,
kExprF64Const, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f,
kExprF64Const, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f,
kExprLocalTee, 0x07,
kExprI32Const, 0x00,
kExprIf, kWasmI32, // @52 i32
kExprI32Const, 0x00,
kExprElse, // @56
kExprI32Const, 0x00,
kExprEnd, // @59
kExprBrIf, 0x01, // depth=1
kExprI32UConvertF64,
kExprI32Const, 0x00,
kExprCallFunction, 0x00, // function #0: i_ddii
kExprDrop,
kExprUnreachable,
kExprEnd, // @70
kExprUnreachable,
kExprEnd, // @72
kExprEnd, // @73
]);
assertDoesNotThrow(function() { builder.instantiate(); });
})();