From 302892032ca54b236703d0f4f5a499a0e95beced Mon Sep 17 00:00:00 2001 From: Jakob Linke Date: Thu, 5 Jan 2023 09:42:13 +0100 Subject: [PATCH] [factory] Remove dead code in NewOffHeapTrampolineFor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit .. and restructure a bit. The V8_EXTERNAL_CODE_SPACE case is fully handled in the initial code section (thus dead code further down can be removed). Also, no need to guard both through an #ifdef and an `if`. Change-Id: Ibc56bc5922908e7a73f26a2799ac29287336cb3a Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4136721 Auto-Submit: Jakob Linke Reviewed-by: Dominik Inführ Commit-Queue: Dominik Inführ Cr-Commit-Position: refs/heads/main@{#85137} --- src/heap/factory.cc | 41 ++++++++++++++--------------------------- 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/src/heap/factory.cc b/src/heap/factory.cc index c89fb56ba0..4e8a64d155 100644 --- a/src/heap/factory.cc +++ b/src/heap/factory.cc @@ -2504,23 +2504,20 @@ Handle Factory::NewOffHeapTrampolineFor(Handle code, CHECK(Builtins::IsIsolateIndependentBuiltin(*code)); #ifdef V8_EXTERNAL_CODE_SPACE - if (V8_EXTERNAL_CODE_SPACE_BOOL) { - const int no_flags = 0; - Handle code_data_container = - NewCodeDataContainer(no_flags, AllocationType::kOld); - - const bool set_is_off_heap_trampoline = true; - code_data_container->initialize_flags(code->kind(), code->builtin_id(), - code->is_turbofanned(), - set_is_off_heap_trampoline); - code_data_container->set_kind_specific_flags( - code->kind_specific_flags(kRelaxedLoad), kRelaxedStore); - code_data_container->set_code_entry_point(isolate(), - code->code_entry_point()); - return Handle::cast(code_data_container); - } -#endif // V8_EXTERNAL_CODE_SPACE + const int no_flags = 0; + Handle code_data_container = + NewCodeDataContainer(no_flags, AllocationType::kOld); + const bool set_is_off_heap_trampoline = true; + code_data_container->initialize_flags(code->kind(), code->builtin_id(), + code->is_turbofanned(), + set_is_off_heap_trampoline); + code_data_container->set_kind_specific_flags( + code->kind_specific_flags(kRelaxedLoad), kRelaxedStore); + code_data_container->set_code_entry_point(isolate(), + code->code_entry_point()); + return Handle::cast(code_data_container); +#else bool generate_jump_to_instruction_stream = Builtins::CodeObjectIsExecutable(code->builtin_id()); Handle result = Builtins::GenerateOffHeapTrampolineFor( @@ -2569,20 +2566,10 @@ Handle Factory::NewOffHeapTrampolineFor(Handle code, } #endif raw_result.set_relocation_info(canonical_reloc_info); - if (V8_EXTERNAL_CODE_SPACE_BOOL) { - CodeDataContainer code_data_container = - raw_result.code_data_container(kAcquireLoad); - // Updating flags (in particular is_off_heap_trampoline one) might change - // the value of the instruction start, so update it here. - code_data_container.UpdateCodeEntryPoint(isolate(), raw_result); - // Also update flag values cached on the code data container. - code_data_container.initialize_flags( - raw_code.kind(), raw_code.builtin_id(), raw_code.is_turbofanned(), - set_is_off_heap_trampoline); - } } return ToCodeT(result, isolate()); +#endif // V8_EXTERNAL_CODE_SPACE } Handle Factory::CopyBytecodeArray(Handle source) {