Commit 5b3b2be3 authored by Georgia Kouveli's avatar Georgia Kouveli Committed by Commit Bot

[builtins,arm64] Use direct calls for embedded builtins.

This is a port of e5630ea9:
"[builtins,x64] pc-relative builtin-to-builtin calls".

Bug: v8:6666
Change-Id: Id53bf45c6a4fedb1c972ced72984b6673808ee96
Reviewed-on: https://chromium-review.googlesource.com/1126249Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Georgia Kouveli <georgia.kouveli@arm.com>
Cr-Commit-Position: refs/heads/master@{#54243}
parent e644b15d
......@@ -1931,7 +1931,13 @@ void TurboAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode,
Condition cond) {
DCHECK(RelocInfo::IsCodeTarget(rmode));
if (FLAG_embedded_builtins) {
if (root_array_available_ && options().isolate_independent_code) {
if (root_array_available_ && options().isolate_independent_code &&
!Builtins::IsIsolateIndependentBuiltin(*code)) {
// Calls to embedded targets are initially generated as standard
// pc-relative calls below. When creating the embedded blob, call offsets
// are patched up to point directly to the off-heap instruction start.
// Note: It is safe to dereference {code} above since code generation
// for builtins and code stubs happens on the main thread.
UseScratchRegisterScope temps(this);
Register scratch = temps.AcquireX();
IndirectLoadConstant(scratch, code);
......@@ -2004,7 +2010,13 @@ void TurboAssembler::Call(Handle<Code> code, RelocInfo::Mode rmode) {
#endif
if (FLAG_embedded_builtins) {
if (root_array_available_ && options().isolate_independent_code) {
if (root_array_available_ && options().isolate_independent_code &&
!Builtins::IsIsolateIndependentBuiltin(*code)) {
// Calls to embedded targets are initially generated as standard
// pc-relative calls below. When creating the embedded blob, call offsets
// are patched up to point directly to the off-heap instruction start.
// Note: It is safe to dereference {code} above since code generation
// for builtins and code stubs happens on the main thread.
UseScratchRegisterScope temps(this);
Register scratch = temps.AcquireX();
IndirectLoadConstant(scratch, code);
......
......@@ -340,7 +340,7 @@ void FinalizeEmbeddedCodeTargets(Isolate* isolate, EmbeddedData* blob) {
RelocIterator on_heap_it(code, kRelocMask);
RelocIterator off_heap_it(blob, code, kRelocMask);
#ifdef V8_TARGET_ARCH_X64
#if defined(V8_TARGET_ARCH_X64) || defined(V8_TARGET_ARCH_ARM64)
while (!on_heap_it.done()) {
DCHECK(!off_heap_it.done());
......@@ -357,12 +357,12 @@ void FinalizeEmbeddedCodeTargets(Isolate* isolate, EmbeddedData* blob) {
}
DCHECK(off_heap_it.done());
#else
// Architectures other than x64 do not use pc-relative calls and thus must
// not contain embedded code targets. Instead, we use an indirection through
// the root register.
// Architectures other than x64 and arm64 do not use pc-relative calls and
// thus must not contain embedded code targets. Instead, we use an
// indirection through the root register.
CHECK(on_heap_it.done());
CHECK(off_heap_it.done());
#endif // V8_TARGET_ARCH_X64
#endif // defined(V8_TARGET_ARCH_X64) || defined(V8_TARGET_ARCH_ARM64)
}
}
} // namespace
......
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