Commit 5aff110b authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Narrow code-space modification scopes.

R=hpayer@chromium.org

Change-Id: I748df06492b1712ff15cd56f6eeb159545986c93
Reviewed-on: https://chromium-review.googlesource.com/766431
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49330}
parent 58b4af1b
......@@ -1674,14 +1674,16 @@ MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() {
// If this code object has deoptimization data, then we need a
// unique copy to attach updated deoptimization data.
if (orig_code->deoptimization_data()->length() > 0) {
// TODO(6792): No longer needed once WebAssembly code is off heap.
CodeSpaceMemoryModificationScope modification_scope(
isolate_->heap());
Handle<Code> code = factory->CopyCode(orig_code);
Handle<FixedArray> deopt_data =
factory->NewFixedArray(2, TENURED);
deopt_data->set(1, Smi::FromInt(i));
code->set_deoptimization_data(*deopt_data);
// TODO(6792): No longer needed once WebAssembly code is off heap.
{
CodeSpaceMemoryModificationScope modification_scope(
isolate_->heap());
code->set_deoptimization_data(*deopt_data);
}
code_table->set(i, *code);
}
break;
......@@ -1859,11 +1861,11 @@ MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() {
i < num_functions; ++i) {
Handle<Code> code = handle(Code::cast(code_table->get(i)), isolate_);
if (code->kind() == Code::WASM_FUNCTION) {
// TODO(6792): No longer needed once WebAssembly code is off heap.
CodeSpaceMemoryModificationScope modification_scope(isolate_->heap());
Handle<FixedArray> deopt_data = factory->NewFixedArray(2, TENURED);
deopt_data->set(0, *weak_link);
deopt_data->set(1, Smi::FromInt(i));
// TODO(6792): No longer needed once WebAssembly code is off heap.
CodeSpaceMemoryModificationScope modification_scope(isolate_->heap());
code->set_deoptimization_data(*deopt_data);
continue;
}
......
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