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