Commit c7949470 authored by Toon Verwaest's avatar Toon Verwaest Committed by V8 LUCI CQ

[masm] Read builtin off builtin_entry_table rather than EmbeddedData...

... when we do have an isolate. This is a little leaner.

Change-Id: Ia95d9888b11cab9e43362f4fe78689a79dfa8b2d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2964604
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75181}
parent b1e8c266
......@@ -24,7 +24,6 @@
#include "src/numbers/double.h"
#include "src/objects/objects-inl.h"
#include "src/runtime/runtime.h"
#include "src/snapshot/embedded/embedded-data.h"
#include "src/snapshot/snapshot.h"
#if V8_ENABLE_WEBASSEMBLY
......@@ -187,11 +186,9 @@ void TurboAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode,
} else if (options().inline_offheap_trampolines && target_is_builtin) {
// Inline the trampoline.
RecordCommentForOffHeapTrampoline(builtin);
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin);
// Use ip directly instead of using UseScratchRegisterScope, as we do not
// preserve scratch registers across calls.
mov(ip, Operand(entry, RelocInfo::OFF_HEAP_TARGET));
mov(ip, Operand(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET));
Jump(ip, cond);
return;
}
......@@ -316,13 +313,10 @@ MemOperand TurboAssembler::EntryFromBuiltinAsOperand(Builtin builtin) {
}
void TurboAssembler::CallBuiltin(Builtin builtin, Condition cond) {
DCHECK(Builtins::IsBuiltinId(builtin));
RecordCommentForOffHeapTrampoline(builtin);
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin);
// Use ip directly instead of using UseScratchRegisterScope, as we do not
// preserve scratch registers across calls.
mov(ip, Operand(entry, RelocInfo::OFF_HEAP_TARGET));
mov(ip, Operand(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET));
Call(ip, cond);
}
......
......@@ -22,7 +22,6 @@
#include "src/init/bootstrapper.h"
#include "src/logging/counters.h"
#include "src/runtime/runtime.h"
#include "src/snapshot/embedded/embedded-data.h"
#include "src/snapshot/snapshot.h"
#if V8_ENABLE_WEBASSEMBLY
......@@ -1945,16 +1944,12 @@ void TurboAssembler::CallBuiltin(Builtin builtin) {
RecordCommentForOffHeapTrampoline(builtin);
CHECK_NE(builtin, Builtin::kNoBuiltinId);
if (options().short_builtin_calls) {
EmbeddedData d = EmbeddedData::FromBlob(isolate());
Address entry = d.InstructionStartOfBuiltin(builtin);
Call(entry, RelocInfo::RUNTIME_ENTRY);
Call(BuiltinEntry(builtin), RelocInfo::RUNTIME_ENTRY);
} else {
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin);
UseScratchRegisterScope temps(this);
Register scratch = temps.AcquireX();
Ldr(scratch, Operand(entry, RelocInfo::OFF_HEAP_TARGET));
Ldr(scratch, Operand(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET));
Call(scratch);
}
RecordComment("]");
......@@ -1965,13 +1960,9 @@ void TurboAssembler::TailCallBuiltin(Builtin builtin) {
RecordCommentForOffHeapTrampoline(builtin);
CHECK_NE(builtin, Builtin::kNoBuiltinId);
if (options().short_builtin_calls) {
EmbeddedData d = EmbeddedData::FromBlob(isolate());
Address entry = d.InstructionStartOfBuiltin(builtin);
Jump(entry, RelocInfo::RUNTIME_ENTRY);
Jump(BuiltinEntry(builtin), RelocInfo::RUNTIME_ENTRY);
} else {
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin);
// The control flow integrity (CFI) feature allows us to "sign" code entry
// points as a target for calls, jumps or both. Arm64 has special
// instructions for this purpose, so-called "landing pads" (see
......@@ -1983,7 +1974,7 @@ void TurboAssembler::TailCallBuiltin(Builtin builtin) {
// (i.e. `bti j`) landing pads for the tail-called code.
Register temp = x17;
Ldr(temp, Operand(entry, RelocInfo::OFF_HEAP_TARGET));
Ldr(temp, Operand(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET));
Jump(temp);
}
RecordComment("]");
......
......@@ -54,7 +54,6 @@
#include "src/roots/roots-inl.h"
#include "src/roots/roots.h"
#include "src/runtime/runtime.h"
#include "src/snapshot/embedded/embedded-data.h"
#include "src/utils/utils.h"
// Satisfy cpplint check, but don't include platform-specific header. It is
......@@ -2202,12 +2201,8 @@ void TurboAssembler::CallBuiltinByIndex(Register builtin_index) {
}
void TurboAssembler::CallBuiltin(Builtin builtin) {
DCHECK(Builtins::IsBuiltinId(builtin));
RecordCommentForOffHeapTrampoline(builtin);
CHECK_NE(builtin, Builtin::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin);
call(entry, RelocInfo::OFF_HEAP_TARGET);
call(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET);
}
Operand TurboAssembler::EntryFromBuiltinAsOperand(Builtin builtin) {
......@@ -2290,10 +2285,7 @@ void TurboAssembler::Jump(Handle<Code> code_object, RelocInfo::Mode rmode) {
if (isolate()->builtins()->IsBuiltinHandle(code_object, &builtin)) {
// Inline the trampoline.
RecordCommentForOffHeapTrampoline(builtin);
CHECK_NE(builtin, Builtin::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin);
jmp(entry, RelocInfo::OFF_HEAP_TARGET);
jmp(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET);
return;
}
}
......
......@@ -22,7 +22,6 @@
#include "src/logging/counters.h"
#include "src/objects/heap-number.h"
#include "src/runtime/runtime.h"
#include "src/snapshot/embedded/embedded-data.h"
#include "src/snapshot/snapshot.h"
#if V8_ENABLE_WEBASSEMBLY
......@@ -301,12 +300,8 @@ void TurboAssembler::CallRecordWriteStub(
Builtins::GetRecordWriteStub(remembered_set_action, fp_mode);
if (options().inline_offheap_trampolines) {
// Inline the trampoline.
DCHECK(Builtins::IsBuiltinId(builtin));
RecordCommentForOffHeapTrampoline(builtin);
CHECK_NE(builtin, Builtin::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin);
li(t9, Operand(entry, RelocInfo::OFF_HEAP_TARGET));
li(t9, Operand(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET));
Call(t9);
} else {
Handle<Code> code_target = isolate()->builtins()->code_handle(builtin);
......@@ -3798,10 +3793,7 @@ void TurboAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode,
options().inline_offheap_trampolines) {
// Inline the trampoline.
RecordCommentForOffHeapTrampoline(builtin);
CHECK_NE(builtin, Builtin::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin);
li(t9, Operand(entry, RelocInfo::OFF_HEAP_TARGET));
li(t9, Operand(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET));
Jump(t9, 0, cond, rs, rt, bd);
return;
}
......@@ -3938,10 +3930,7 @@ void TurboAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode,
options().inline_offheap_trampolines) {
// Inline the trampoline.
RecordCommentForOffHeapTrampoline(builtin);
CHECK_NE(builtin, Builtin::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin);
li(t9, Operand(entry, RelocInfo::OFF_HEAP_TARGET));
li(t9, Operand(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET));
Call(t9, 0, cond, rs, rt, bd);
return;
}
......@@ -3978,12 +3967,8 @@ void TurboAssembler::CallBuiltinByIndex(Register builtin_index) {
Call(builtin_index);
}
void TurboAssembler::CallBuiltin(Builtin builtin) {
DCHECK(Builtin::IsBuiltinId(builtin));
RecordCommentForOffHeapTrampoline(builtin);
CHECK_NE(builtin, Builtin::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob(isolate());
Address entry = d.InstructionStartOfBuiltin(builtin);
Call(entry, RelocInfo::OFF_HEAP_TARGET);
Call(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET);
if (FLAG_code_comments) RecordComment("]");
}
......
......@@ -22,7 +22,6 @@
#include "src/logging/counters.h"
#include "src/objects/heap-number.h"
#include "src/runtime/runtime.h"
#include "src/snapshot/embedded/embedded-data.h"
#include "src/snapshot/snapshot.h"
#if V8_ENABLE_WEBASSEMBLY
......@@ -298,12 +297,8 @@ void TurboAssembler::CallRecordWriteStub(
auto builtin = Builtins::GetRecordWriteStub(remembered_set_action, fp_mode);
if (options().inline_offheap_trampolines) {
// Inline the trampoline.
DCHECK(Builtins::IsBuiltinId(builtin));
RecordCommentForOffHeapTrampoline(builtin);
CHECK_NE(builtin, Builtin::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin);
li(t9, Operand(entry, RelocInfo::OFF_HEAP_TARGET));
li(t9, Operand(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET));
Call(t9);
} else {
Handle<Code> code_target = isolate()->builtins()->code_handle(builtin);
......@@ -4347,10 +4342,7 @@ void TurboAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode,
Builtins::IsIsolateIndependent(builtin)) {
// Inline the trampoline.
RecordCommentForOffHeapTrampoline(builtin);
CHECK_NE(builtin, Builtin::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin);
li(t9, Operand(entry, RelocInfo::OFF_HEAP_TARGET));
li(t9, Operand(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET));
Jump(t9, cond, rs, rt, bd);
return;
}
......@@ -4426,10 +4418,7 @@ void TurboAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode,
Builtins::IsIsolateIndependent(builtin)) {
// Inline the trampoline.
RecordCommentForOffHeapTrampoline(builtin);
CHECK_NE(builtin, Builtin::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin);
li(t9, Operand(entry, RelocInfo::OFF_HEAP_TARGET));
li(t9, Operand(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET));
Call(t9, cond, rs, rt, bd);
return;
}
......@@ -4466,12 +4455,8 @@ void TurboAssembler::CallBuiltinByIndex(Register builtin_index) {
Call(builtin_index);
}
void TurboAssembler::CallBuiltin(Builtin builtin) {
DCHECK(Builtin::IsBuiltinId(builtin));
RecordCommentForOffHeapTrampoline(builtin);
CHECK_NE(builtin, Builtin::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob(isolate());
Address entry = d.InstructionStartOfBuiltin(builtin);
Call(entry, RelocInfo::OFF_HEAP_TARGET);
Call(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET);
if (FLAG_code_comments) RecordComment("]");
}
......
......@@ -21,7 +21,6 @@
#include "src/init/bootstrapper.h"
#include "src/logging/counters.h"
#include "src/runtime/runtime.h"
#include "src/snapshot/embedded/embedded-data.h"
#include "src/snapshot/snapshot.h"
#if V8_ENABLE_WEBASSEMBLY
......@@ -194,11 +193,9 @@ void TurboAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode,
// Inline the trampoline.
Label skip;
RecordCommentForOffHeapTrampoline(builtin_index);
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin_index);
// Use ip directly instead of using UseScratchRegisterScope, as we do
// not preserve scratch registers across calls.
mov(ip, Operand(entry, RelocInfo::OFF_HEAP_TARGET));
mov(ip, Operand(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET));
if (cond != al) b(NegateCondition(cond), &skip, cr);
Jump(ip);
bind(&skip);
......@@ -281,11 +278,9 @@ void TurboAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode,
} else if (options().inline_offheap_trampolines && target_is_builtin) {
// Inline the trampoline.
RecordCommentForOffHeapTrampoline(builtin_index);
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin_index);
// Use ip directly instead of using UseScratchRegisterScope, as we do
// not preserve scratch registers across calls.
mov(ip, Operand(entry, RelocInfo::OFF_HEAP_TARGET));
mov(ip, Operand(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET));
Label skip;
if (cond != al) b(NegateCondition(cond), &skip);
Call(ip);
......@@ -703,11 +698,9 @@ void TurboAssembler::CallRecordWriteStub(
Builtins::GetRecordWriteStub(remembered_set_action, fp_mode);
if (options().inline_offheap_trampolines) {
RecordCommentForOffHeapTrampoline(builtin_index);
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin_index);
// Use ip directly instead of using UseScratchRegisterScope, as we do
// not preserve scratch registers across calls.
mov(ip, Operand(entry, RelocInfo::OFF_HEAP_TARGET));
mov(ip, Operand(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET));
Call(ip);
} else {
Handle<Code> code_target =
......
......@@ -22,7 +22,6 @@
#include "src/logging/counters.h"
#include "src/objects/heap-number.h"
#include "src/runtime/runtime.h"
#include "src/snapshot/embedded/embedded-data.h"
#include "src/snapshot/snapshot.h"
#include "src/wasm/wasm-code-manager.h"
......@@ -289,16 +288,12 @@ void TurboAssembler::CallRecordWriteStub(
auto builtin = Builtins::GetRecordWriteStub(remembered_set_action, fp_mode);
if (options().inline_offheap_trampolines) {
// Inline the trampoline. //qj
DCHECK(Builtins::IsBuiltinId(builtin));
RecordCommentForOffHeapTrampoline(builtin);
CHECK_NE(builtin, Builtin::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin);
UseScratchRegisterScope temps(this);
BlockTrampolinePoolScope block_trampoline_pool(this);
Register scratch = temps.Acquire();
li(scratch, Operand(entry, RelocInfo::OFF_HEAP_TARGET));
li(scratch, Operand(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET));
Call(scratch);
} else {
Handle<Code> code_target = isolate()->builtins()->code_handle(builtin);
......@@ -3023,10 +3018,7 @@ void TurboAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode,
target_is_isolate_independent_builtin) {
// Inline the trampoline.
RecordCommentForOffHeapTrampoline(builtin);
CHECK_NE(builtin, Builtin::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin);
li(t6, Operand(entry, RelocInfo::OFF_HEAP_TARGET));
li(t6, Operand(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET));
Jump(t6, cond, rs, rt);
return;
}
......@@ -3105,10 +3097,7 @@ void TurboAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode,
target_is_isolate_independent_builtin) {
// Inline the trampoline.
RecordCommentForOffHeapTrampoline(builtin);
CHECK_NE(builtin, Builtin::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin);
li(t6, Operand(entry, RelocInfo::OFF_HEAP_TARGET));
li(t6, Operand(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET));
Call(t6, cond, rs, rt);
return;
}
......@@ -3136,29 +3125,21 @@ void TurboAssembler::CallBuiltinByIndex(Register builtin) {
}
void TurboAssembler::CallBuiltin(Builtin builtin) {
DCHECK(Builtins::IsBuiltinId(builtin));
RecordCommentForOffHeapTrampoline(builtin);
CHECK_NE(builtin, Builtin::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob(isolate());
Address entry = d.InstructionStartOfBuiltin(builtin);
if (options().short_builtin_calls) {
Call(entry, RelocInfo::RUNTIME_ENTRY);
Call(BuiltinEntry(builtin), RelocInfo::RUNTIME_ENTRY);
} else {
Call(entry, RelocInfo::OFF_HEAP_TARGET);
Call(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET);
}
RecordComment("]");
}
void TurboAssembler::TailCallBuiltin(Builtin builtin) {
DCHECK(Builtins::IsBuiltinId(builtin));
RecordCommentForOffHeapTrampoline(builtin);
CHECK_NE(builtin, Builtin::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob(isolate());
Address entry = d.InstructionStartOfBuiltin(builtin);
if (options().short_builtin_calls) {
Jump(entry, RelocInfo::RUNTIME_ENTRY);
Jump(BuiltinEntry(builtin), RelocInfo::RUNTIME_ENTRY);
} else {
Jump(entry, RelocInfo::OFF_HEAP_TARGET);
Jump(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET);
}
RecordComment("]");
}
......
......@@ -22,7 +22,6 @@
#include "src/logging/counters.h"
#include "src/objects/smi.h"
#include "src/runtime/runtime.h"
#include "src/snapshot/embedded/embedded-data.h"
#include "src/snapshot/snapshot.h"
#if V8_ENABLE_WEBASSEMBLY
......@@ -408,10 +407,7 @@ void TurboAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode,
if (options().inline_offheap_trampolines && target_is_builtin) {
// Inline the trampoline.
RecordCommentForOffHeapTrampoline(builtin_index);
CHECK_NE(builtin_index, Builtin::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin_index);
mov(ip, Operand(entry, RelocInfo::OFF_HEAP_TARGET));
mov(ip, Operand(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET));
b(cond, ip);
return;
}
......@@ -469,10 +465,7 @@ void TurboAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode,
if (target_is_builtin && options().inline_offheap_trampolines) {
// Inline the trampoline.
RecordCommentForOffHeapTrampoline(builtin_index);
CHECK_NE(builtin_index, Builtin::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin_index);
mov(ip, Operand(entry, RelocInfo::OFF_HEAP_TARGET));
mov(ip, Operand(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET));
Call(ip);
return;
}
......@@ -935,10 +928,7 @@ void TurboAssembler::CallRecordWriteStub(
Builtins::GetRecordWriteStub(remembered_set_action, fp_mode);
if (options().inline_offheap_trampolines) {
RecordCommentForOffHeapTrampoline(builtin_index);
CHECK_NE(builtin_index, Builtin::kNoBuiltinId);
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin_index);
mov(ip, Operand(entry, RelocInfo::OFF_HEAP_TARGET));
mov(ip, Operand(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET));
Call(ip);
} else {
Handle<Code> code_target =
......
......@@ -9,6 +9,7 @@
#include "src/codegen/external-reference-encoder.h"
#include "src/execution/isolate-data.h"
#include "src/execution/isolate-inl.h"
#include "src/snapshot/embedded/embedded-data.h"
namespace v8 {
namespace internal {
......@@ -24,6 +25,19 @@ TurboAssemblerBase::TurboAssemblerBase(Isolate* isolate,
}
}
Address TurboAssemblerBase::BuiltinEntry(Builtin builtin) {
DCHECK(Builtins::IsBuiltinId(builtin));
if (isolate_ != nullptr) {
Address entry =
isolate_->builtin_entry_table()[static_cast<int32_t>(builtin)];
DCHECK_EQ(entry, EmbeddedData::FromBlob(isolate_).InstructionStartOfBuiltin(
builtin));
return entry;
}
EmbeddedData d = EmbeddedData::FromBlob();
return d.InstructionStartOfBuiltin(builtin);
}
void TurboAssemblerBase::IndirectLoadConstant(Register destination,
Handle<HeapObject> object) {
CHECK(root_array_available_);
......
......@@ -64,6 +64,8 @@ class V8_EXPORT_PRIVATE TurboAssemblerBase : public Assembler {
void IndirectLoadExternalReference(Register destination,
ExternalReference reference);
Address BuiltinEntry(Builtin builtin);
virtual void LoadFromConstantsTable(Register destination,
int constant_index) = 0;
......
......@@ -27,7 +27,6 @@
#include "src/logging/counters.h"
#include "src/objects/objects-inl.h"
#include "src/objects/smi.h"
#include "src/snapshot/embedded/embedded-data.h"
#include "src/snapshot/snapshot.h"
// Satisfy cpplint check, but don't include platform-specific header. It is
......@@ -1785,17 +1784,10 @@ void TurboAssembler::CallBuiltinByIndex(Register builtin_index) {
void TurboAssembler::CallBuiltin(Builtin builtin) {
ASM_CODE_COMMENT_STRING(this, CommentForOffHeapTrampoline("call", builtin));
DCHECK(Builtins::IsBuiltinId(builtin));
CHECK_NE(builtin, Builtin::kNoBuiltinId);
if (options().short_builtin_calls) {
EmbeddedData d = EmbeddedData::FromBlob(isolate());
Address entry = d.InstructionStartOfBuiltin(builtin);
call(entry, RelocInfo::RUNTIME_ENTRY);
call(BuiltinEntry(builtin), RelocInfo::RUNTIME_ENTRY);
} else {
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin);
Move(kScratchRegister, entry, RelocInfo::OFF_HEAP_TARGET);
Move(kScratchRegister, BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET);
call(kScratchRegister);
}
}
......@@ -1803,17 +1795,10 @@ void TurboAssembler::CallBuiltin(Builtin builtin) {
void TurboAssembler::TailCallBuiltin(Builtin builtin) {
ASM_CODE_COMMENT_STRING(this,
CommentForOffHeapTrampoline("tail call", builtin));
DCHECK(Builtins::IsBuiltinId(builtin));
CHECK_NE(builtin, Builtin::kNoBuiltinId);
if (options().short_builtin_calls) {
EmbeddedData d = EmbeddedData::FromBlob(isolate());
Address entry = d.InstructionStartOfBuiltin(builtin);
jmp(entry, RelocInfo::RUNTIME_ENTRY);
jmp(BuiltinEntry(builtin), RelocInfo::RUNTIME_ENTRY);
} else {
EmbeddedData d = EmbeddedData::FromBlob();
Address entry = d.InstructionStartOfBuiltin(builtin);
Jump(entry, RelocInfo::OFF_HEAP_TARGET);
Jump(BuiltinEntry(builtin), RelocInfo::OFF_HEAP_TARGET);
}
}
......
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