Commit 197b1d97 authored by Frederik Gossen's avatar Frederik Gossen Committed by Commit Bot

[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/+/1585843Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Frederik Gossen <frgossen@google.com>
Cr-Commit-Position: refs/heads/master@{#61114}
parent 0a0d70eb
This diff is collapsed.
......@@ -149,6 +149,7 @@ class AsyncCompileJob {
Isolate* const isolate_;
const WasmFeatures enabled_features_;
const bool wasm_lazy_compilation_;
// Copy of the module wire bytes, moved into the {native_module_} on its
// creation.
std::unique_ptr<byte[]> bytes_copy_;
......
......@@ -376,8 +376,6 @@ class V8_EXPORT_PRIVATE NativeModule final {
UseTrapHandler use_trap_handler() const { return use_trap_handler_; }
void set_lazy_compile_frozen(bool frozen) { lazy_compile_frozen_ = frozen; }
bool lazy_compile_frozen() const { return lazy_compile_frozen_; }
void set_lazy_compilation(bool lazy) { lazy_compilation_ = lazy; }
bool lazy_compilation() const { return lazy_compilation_; }
Vector<const uint8_t> wire_bytes() const { return wire_bytes_->as_vector(); }
const WasmModule* module() const { return module_.get(); }
std::shared_ptr<const WasmModule> shared_module() const { return module_; }
......@@ -535,7 +533,6 @@ class V8_EXPORT_PRIVATE NativeModule final {
UseTrapHandler use_trap_handler_ = kNoTrapHandler;
bool is_executable_ = false;
bool lazy_compile_frozen_ = false;
bool lazy_compilation_ = false;
DISALLOW_COPY_AND_ASSIGN(NativeModule);
};
......
......@@ -633,8 +633,6 @@ MaybeHandle<WasmModuleObject> DeserializeNativeModule(
std::move(wire_bytes_copy), script, Handle<ByteArray>::null());
NativeModule* native_module = module_object->native_module();
native_module->set_lazy_compilation(FLAG_wasm_lazy_compilation);
NativeModuleDeserializer deserializer(native_module);
WasmCodeRefScope wasm_code_ref_scope;
......
// 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");
})();
// 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 --wasm-test-streaming
load('test/mjsunit/wasm/wasm-module-builder.js');
(function testLazyModuleStreamingCompilation() {
print(arguments.callee.name);
let builder = new WasmModuleBuilder();
builder.addFunction("some", kSig_i_ii);
let bytes = builder.toBuffer();
assertPromiseResult(WebAssembly.compileStreaming(Promise.resolve(bytes))
.then(assertUnreachable,
error => assertEquals("WebAssembly.compile(): function body must " +
"end with \"end\" opcode @+26",
error.message)));
})();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment