Commit ea822809 authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

[wasm] Make CodeSpaceWriteScope more narrow

This avoids having all code writable while compiling functions. We only
need it writable for copying the code to the NativeModule and for
updating the jump table(s).

R=jkummerow@chromium.org

Change-Id: Ifb212b1cd3f7702fac4b1eb9e7bc7d5b5bd5198a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3063221Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#76035}
parent f7de8c80
......@@ -1131,7 +1131,6 @@ bool CompileLazy(Isolate* isolate, Handle<WasmModuleObject> module_object,
}
DCHECK(!native_module->lazy_compile_frozen());
CodeSpaceWriteScope code_space_write_scope(native_module);
TRACE_LAZY("Compiling wasm-function#%d.\n", func_index);
......@@ -1180,8 +1179,12 @@ bool CompileLazy(Isolate* isolate, Handle<WasmModuleObject> module_object,
}
WasmCodeRefScope code_ref_scope;
WasmCode* code = native_module->PublishCode(
native_module->AddCompiledCode(std::move(result)));
WasmCode* code;
{
CodeSpaceWriteScope code_space_write_scope(native_module);
code = native_module->PublishCode(
native_module->AddCompiledCode(std::move(result)));
}
DCHECK_EQ(func_index, code->index());
if (WasmCode::ShouldBeLogged(isolate)) {
......
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