Commit 329ee4d4 authored by Victor Gomes's avatar Victor Gomes Committed by V8 LUCI CQ

[baseline] Use RO empty byte array in NewEmptyCode

Bug: v8:11872
Change-Id: I95fb2199fb91f51e9b03a8a88000f9240d5d104b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2978255
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75301}
parent 4378ff2d
......@@ -264,9 +264,6 @@ MaybeHandle<Code> Factory::NewEmptyCode(CodeKind kind, int buffer_size) {
const int object_size = Code::SizeFor(buffer_size);
Heap* heap = isolate()->heap();
// TODO(victorgomes): Move this RO space and use only 1 object per process.
Handle<ByteArray> empty_reloc_info = NewByteArray(0, AllocationType::kOld);
HeapObject result = heap->AllocateRawWith<Heap::kLightRetry>(
object_size, AllocationType::kCode, AllocationOrigin::kRuntime);
if (result.is_null()) return MaybeHandle<Code>();
......@@ -278,7 +275,7 @@ MaybeHandle<Code> Factory::NewEmptyCode(CodeKind kind, int buffer_size) {
constexpr bool kIsNotOffHeapTrampoline = false;
raw_code.set_raw_instruction_size(0);
raw_code.set_raw_metadata_size(buffer_size);
raw_code.set_relocation_info(*empty_reloc_info);
raw_code.set_relocation_info(*empty_byte_array());
raw_code.initialize_flags(kind, false, 0, kIsNotOffHeapTrampoline);
raw_code.set_handler_table_offset(0);
raw_code.set_constant_pool_offset(0);
......
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