Commit ba5501ed authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[heap] Make {NewOffHeapTrampolineFor} use finer scope.

This makes the above factory function use a fine-grained scope when
unlocking code space for modification. It is now based on the memory
chunk of the resulting code object.

R=ulan@chromium.org

Change-Id: Iabe6fba7595ba3264b21bcd6f6634ab9725eaad9
Reviewed-on: https://chromium-review.googlesource.com/c/1335687Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57498}
parent ed77644b
...@@ -2692,8 +2692,13 @@ Handle<Code> Factory::NewOffHeapTrampolineFor(Handle<Code> code, ...@@ -2692,8 +2692,13 @@ Handle<Code> Factory::NewOffHeapTrampolineFor(Handle<Code> code,
// The trampoline code object must inherit specific flags from the original // The trampoline code object must inherit specific flags from the original
// builtin (e.g. the safepoint-table offset). We set them manually here. // builtin (e.g. the safepoint-table offset). We set them manually here.
{
MemoryChunk* chunk = MemoryChunk::FromAddress(result->ptr());
CodePageMemoryModificationScope code_allocation(chunk);
const bool set_is_off_heap_trampoline = true; const bool set_is_off_heap_trampoline = true;
const int stack_slots = code->has_safepoint_info() ? code->stack_slots() : 0; const int stack_slots =
code->has_safepoint_info() ? code->stack_slots() : 0;
result->initialize_flags(code->kind(), code->has_unwinding_info(), result->initialize_flags(code->kind(), code->has_unwinding_info(),
code->is_turbofanned(), stack_slots, code->is_turbofanned(), stack_slots,
set_is_off_heap_trampoline); set_is_off_heap_trampoline);
...@@ -2707,8 +2712,8 @@ Handle<Code> Factory::NewOffHeapTrampolineFor(Handle<Code> code, ...@@ -2707,8 +2712,8 @@ Handle<Code> Factory::NewOffHeapTrampolineFor(Handle<Code> code,
} }
// Replace the newly generated trampoline's RelocInfo ByteArray with the // Replace the newly generated trampoline's RelocInfo ByteArray with the
// canonical one stored in the roots to avoid duplicating it for every single // canonical one stored in the roots to avoid duplicating it for every
// builtin. // single builtin.
ByteArray* canonical_reloc_info = ByteArray* canonical_reloc_info =
ReadOnlyRoots(isolate()).off_heap_trampoline_relocation_info(); ReadOnlyRoots(isolate()).off_heap_trampoline_relocation_info();
#ifdef DEBUG #ifdef DEBUG
...@@ -2720,6 +2725,7 @@ Handle<Code> Factory::NewOffHeapTrampolineFor(Handle<Code> code, ...@@ -2720,6 +2725,7 @@ Handle<Code> Factory::NewOffHeapTrampolineFor(Handle<Code> code,
} }
#endif #endif
result->set_relocation_info(canonical_reloc_info); result->set_relocation_info(canonical_reloc_info);
}
return result; return result;
} }
......
...@@ -3024,7 +3024,6 @@ void CreateOffHeapTrampolines(Isolate* isolate) { ...@@ -3024,7 +3024,6 @@ void CreateOffHeapTrampolines(Isolate* isolate) {
EmbeddedData d = EmbeddedData::FromBlob(); EmbeddedData d = EmbeddedData::FromBlob();
CodeSpaceMemoryModificationScope code_allocation(isolate->heap());
for (int i = 0; i < Builtins::builtin_count; i++) { for (int i = 0; i < Builtins::builtin_count; i++) {
if (!Builtins::IsIsolateIndependent(i)) continue; if (!Builtins::IsIsolateIndependent(i)) 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