a345a442d3
- 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}
26 lines
986 B
JavaScript
26 lines
986 B
JavaScript
// Copyright 2018 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: --wasm-lazy-compilation
|
|
|
|
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
|
|
|
|
const builder1 = new WasmModuleBuilder();
|
|
builder1.addFunction('mul', kSig_i_ii)
|
|
.addBody([kExprLocalGet, 0, kExprLocalGet, 1, kExprI32Mul])
|
|
.exportFunc();
|
|
const mul = builder1.instantiate().exports.mul;
|
|
const table = new WebAssembly.Table({
|
|
element: 'anyfunc',
|
|
initial: 10,
|
|
});
|
|
const builder2 = new WasmModuleBuilder();
|
|
const mul_import = builder2.addImport('q', 'wasm_mul', kSig_i_ii);
|
|
builder2.addImportedTable('q', 'table');
|
|
const glob_import = builder2.addImportedGlobal('q', 'glob', kWasmI32);
|
|
builder2.addActiveElementSegment(0, WasmInitExpr.GlobalGet(glob_import),
|
|
[mul_import]);
|
|
builder2.instantiate(
|
|
{q: {glob: 0, js_div: i => i, wasm_mul: mul, table: table}});
|