v8/test/mjsunit/regress/wasm/regress-956771.js
Frederik Gossen 197b1d979c [wasm] Fix Wasm Lazy Compilation
Fix recognition of lazy functions when {--wasm-lazy-compilation} is
used.

Bug: chromium:956771
Change-Id: I3f9bb25ccf3920a6c3d266876faace8841dcdc61
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1585843
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Commit-Queue: Frederik Gossen <frgossen@google.com>
Cr-Commit-Position: refs/heads/master@{#61114}
2019-04-30 13:05:20 +00:00

29 lines
1.1 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.
// Flags: --wasm-lazy-compilation
load('test/mjsunit/wasm/wasm-module-builder.js');
(function testLazyModuleAsyncCompilation() {
print(arguments.callee.name);
let builder = new WasmModuleBuilder();
builder.addFunction("some", kSig_i_ii)
assertPromiseResult(WebAssembly.compile(builder.toBuffer())
.then(assertUnreachable,
error => assertEquals("WebAssembly.compile(): function body must " +
"end with \"end\" opcode @+26",
error.message)));
})();
(function testLazyModuleSyncCompilation() {
print(arguments.callee.name);
let builder = new WasmModuleBuilder();
builder.addFunction("some", kSig_i_ii)
assertThrows(() => builder.toModule(),
WebAssembly.CompileError,
"WebAssembly.Module(): Compiling function #0:\"some\" failed: " +
"function body must end with \"end\" opcode @+26");
})();