Commit ff06752a authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

[builtins] Isolate-independent CallStubDelayed

This is only used by ProfileEntryHookStub. For builtins, this also
needs to go through an indirection.

Bug: v8:6666
Change-Id: I088fa472e2d365ccfb2d027bfbdad182ffae487e
Reviewed-on: https://chromium-review.googlesource.com/c/1326025Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57379}
parent 13d89167
......@@ -1678,30 +1678,35 @@ void MacroAssembler::CallStub(CodeStub* stub,
void TurboAssembler::CallStubDelayed(CodeStub* stub) {
DCHECK(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs.
// Block constant pool for the call instruction sequence.
BlockConstPoolScope block_const_pool(this);
if (isolate() != nullptr && isolate()->ShouldLoadConstantsFromRootList()) {
stub->set_isolate(isolate());
Call(stub->GetCode(), RelocInfo::CODE_TARGET, al, CAN_INLINE_TARGET_ADDRESS,
false);
} else {
// Block constant pool for the call instruction sequence.
BlockConstPoolScope block_const_pool(this);
#ifdef DEBUG
Label start;
bind(&start);
Label start;
bind(&start);
#endif
// Call sequence on V7 or later may be :
// movw ip, #... @ call address low 16
// movt ip, #... @ call address high 16
// blx ip
// @ return address
// Or for pre-V7 or values that may be back-patched
// to avoid ICache flushes:
// ldr ip, [pc, #...] @ call address
// blx ip
// @ return address
// Call sequence on V7 or later may be :
// movw ip, #... @ call address low 16
// movt ip, #... @ call address high 16
// blx ip
// @ return address
// Or for pre-V7 or values that may be back-patched
// to avoid ICache flushes:
// ldr ip, [pc, #...] @ call address
// blx ip
// @ return address
mov(ip, Operand::EmbeddedCode(stub));
blx(ip, al);
mov(ip, Operand::EmbeddedCode(stub));
blx(ip, al);
DCHECK_EQ(kCallStubSize, SizeOfCodeGeneratedSince(&start));
DCHECK_EQ(kCallStubSize, SizeOfCodeGeneratedSince(&start));
}
}
void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) {
......
......@@ -1709,14 +1709,19 @@ void TurboAssembler::AssertPositiveOrZero(Register value) {
void TurboAssembler::CallStubDelayed(CodeStub* stub) {
DCHECK(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs.
BlockPoolsScope scope(this);
if (isolate() != nullptr && isolate()->ShouldLoadConstantsFromRootList()) {
stub->set_isolate(isolate());
Call(stub->GetCode(), RelocInfo::CODE_TARGET);
} else {
BlockPoolsScope scope(this);
#ifdef DEBUG
Label start;
Bind(&start);
Label start;
Bind(&start);
#endif
Operand operand = Operand::EmbeddedCode(stub);
near_call(operand.heap_object_request());
DCHECK_EQ(kNearCallSize, SizeOfCodeGeneratedSince(&start));
Operand operand = Operand::EmbeddedCode(stub);
near_call(operand.heap_object_request());
DCHECK_EQ(kNearCallSize, SizeOfCodeGeneratedSince(&start));
}
}
void MacroAssembler::CallStub(CodeStub* stub) {
......
......@@ -975,7 +975,12 @@ void MacroAssembler::CallStub(CodeStub* stub) {
void TurboAssembler::CallStubDelayed(CodeStub* stub) {
DCHECK(AllowThisStubCall(stub)); // Calls are not allowed in some stubs.
call(stub);
if (isolate() != nullptr && isolate()->ShouldLoadConstantsFromRootList()) {
stub->set_isolate(isolate());
Call(stub->GetCode(), RelocInfo::CODE_TARGET);
} else {
call(stub);
}
}
void MacroAssembler::TailCallStub(CodeStub* stub) {
......
......@@ -4474,12 +4474,16 @@ void TurboAssembler::CallStubDelayed(CodeStub* stub, Condition cond,
Register r1, const Operand& r2,
BranchDelaySlot bd) {
DCHECK(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs.
BlockTrampolinePoolScope block_trampoline_pool(this);
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
li(scratch, Operand::EmbeddedCode(stub));
Call(scratch);
if (isolate() != nullptr && isolate()->ShouldLoadConstantsFromRootList()) {
stub->set_isolate(isolate());
Call(stub->GetCode(), RelocInfo::CODE_TARGET, cond, r1, r2, bd);
} else {
BlockTrampolinePoolScope block_trampoline_pool(this);
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
li(scratch, Operand::EmbeddedCode(stub));
Call(scratch);
}
}
void MacroAssembler::TailCallStub(CodeStub* stub,
......
......@@ -4821,13 +4821,17 @@ void TurboAssembler::CallStubDelayed(CodeStub* stub, Condition cond,
Register r1, const Operand& r2,
BranchDelaySlot bd) {
DCHECK(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs.
if (isolate() != nullptr && isolate()->ShouldLoadConstantsFromRootList()) {
stub->set_isolate(isolate());
Call(stub->GetCode(), RelocInfo::CODE_TARGET, cond, r1, r2, bd);
} else {
BlockTrampolinePoolScope block_trampoline_pool(this);
BlockTrampolinePoolScope block_trampoline_pool(this);
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
li(scratch, Operand::EmbeddedCode(stub));
Call(scratch);
UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
li(scratch, Operand::EmbeddedCode(stub));
Call(scratch);
}
}
void MacroAssembler::TailCallStub(CodeStub* stub,
......
......@@ -1567,13 +1567,17 @@ void MacroAssembler::CallStub(CodeStub* stub, Condition cond) {
void TurboAssembler::CallStubDelayed(CodeStub* stub) {
DCHECK(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs.
if (isolate() != nullptr && isolate()->ShouldLoadConstantsFromRootList()) {
stub->set_isolate(isolate());
Call(stub->GetCode(), RelocInfo::CODE_TARGET);
} else {
// Block constant pool for the call instruction sequence.
ConstantPoolUnavailableScope constant_pool_unavailable(this);
// Block constant pool for the call instruction sequence.
ConstantPoolUnavailableScope constant_pool_unavailable(this);
mov(ip, Operand::EmbeddedCode(stub));
mtctr(ip);
bctrl();
mov(ip, Operand::EmbeddedCode(stub));
mtctr(ip);
bctrl();
}
}
void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) {
......
......@@ -1546,7 +1546,12 @@ void MacroAssembler::CallStub(CodeStub* stub, Condition cond) {
void TurboAssembler::CallStubDelayed(CodeStub* stub) {
DCHECK(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs.
call(stub);
if (isolate() != nullptr && isolate()->ShouldLoadConstantsFromRootList()) {
stub->set_isolate(isolate());
Call(stub->GetCode(), RelocInfo::CODE_TARGET);
} else {
call(stub);
}
}
void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) {
......
......@@ -560,7 +560,12 @@ void TurboAssembler::Abort(AbortReason reason) {
void TurboAssembler::CallStubDelayed(CodeStub* stub) {
DCHECK(AllowThisStubCall(stub)); // Calls are not allowed in some stubs
call(stub);
if (isolate() != nullptr && isolate()->ShouldLoadConstantsFromRootList()) {
stub->set_isolate(isolate());
Call(stub->GetCode(), RelocInfo::CODE_TARGET);
} else {
call(stub);
}
}
void MacroAssembler::CallStub(CodeStub* stub) {
......
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