[factory] Remove dead code in NewOffHeapTrampolineFor

.. 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 <jgruber@chromium.org>
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#85137}
This commit is contained in:
Jakob Linke 2023-01-05 09:42:13 +01:00 committed by V8 LUCI CQ
parent 3172b30fe4
commit 302892032c

View File

@ -2504,23 +2504,20 @@ Handle<CodeT> Factory::NewOffHeapTrampolineFor(Handle<CodeT> code,
CHECK(Builtins::IsIsolateIndependentBuiltin(*code));
#ifdef V8_EXTERNAL_CODE_SPACE
if (V8_EXTERNAL_CODE_SPACE_BOOL) {
const int no_flags = 0;
Handle<CodeDataContainer> 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<CodeT>::cast(code_data_container);
}
#endif // V8_EXTERNAL_CODE_SPACE
const int no_flags = 0;
Handle<CodeDataContainer> 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<CodeT>::cast(code_data_container);
#else
bool generate_jump_to_instruction_stream =
Builtins::CodeObjectIsExecutable(code->builtin_id());
Handle<Code> result = Builtins::GenerateOffHeapTrampolineFor(
@ -2569,20 +2566,10 @@ Handle<CodeT> Factory::NewOffHeapTrampolineFor(Handle<CodeT> 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<BytecodeArray> Factory::CopyBytecodeArray(Handle<BytecodeArray> source) {