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, ...@@ -1678,30 +1678,35 @@ void MacroAssembler::CallStub(CodeStub* stub,
void TurboAssembler::CallStubDelayed(CodeStub* stub) { void TurboAssembler::CallStubDelayed(CodeStub* stub) {
DCHECK(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. DCHECK(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs.
if (isolate() != nullptr && isolate()->ShouldLoadConstantsFromRootList()) {
// Block constant pool for the call instruction sequence. stub->set_isolate(isolate());
BlockConstPoolScope block_const_pool(this); 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 #ifdef DEBUG
Label start; Label start;
bind(&start); bind(&start);
#endif #endif
// Call sequence on V7 or later may be : // Call sequence on V7 or later may be :
// movw ip, #... @ call address low 16 // movw ip, #... @ call address low 16
// movt ip, #... @ call address high 16 // movt ip, #... @ call address high 16
// blx ip // blx ip
// @ return address // @ return address
// Or for pre-V7 or values that may be back-patched // Or for pre-V7 or values that may be back-patched
// to avoid ICache flushes: // to avoid ICache flushes:
// ldr ip, [pc, #...] @ call address // ldr ip, [pc, #...] @ call address
// blx ip // blx ip
// @ return address // @ return address
mov(ip, Operand::EmbeddedCode(stub)); mov(ip, Operand::EmbeddedCode(stub));
blx(ip, al); blx(ip, al);
DCHECK_EQ(kCallStubSize, SizeOfCodeGeneratedSince(&start)); DCHECK_EQ(kCallStubSize, SizeOfCodeGeneratedSince(&start));
}
} }
void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) { void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) {
......
...@@ -1709,14 +1709,19 @@ void TurboAssembler::AssertPositiveOrZero(Register value) { ...@@ -1709,14 +1709,19 @@ void TurboAssembler::AssertPositiveOrZero(Register value) {
void TurboAssembler::CallStubDelayed(CodeStub* stub) { void TurboAssembler::CallStubDelayed(CodeStub* stub) {
DCHECK(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. 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 #ifdef DEBUG
Label start; Label start;
Bind(&start); Bind(&start);
#endif #endif
Operand operand = Operand::EmbeddedCode(stub); Operand operand = Operand::EmbeddedCode(stub);
near_call(operand.heap_object_request()); near_call(operand.heap_object_request());
DCHECK_EQ(kNearCallSize, SizeOfCodeGeneratedSince(&start)); DCHECK_EQ(kNearCallSize, SizeOfCodeGeneratedSince(&start));
}
} }
void MacroAssembler::CallStub(CodeStub* stub) { void MacroAssembler::CallStub(CodeStub* stub) {
......
...@@ -975,7 +975,12 @@ void MacroAssembler::CallStub(CodeStub* stub) { ...@@ -975,7 +975,12 @@ void MacroAssembler::CallStub(CodeStub* stub) {
void TurboAssembler::CallStubDelayed(CodeStub* stub) { void TurboAssembler::CallStubDelayed(CodeStub* stub) {
DCHECK(AllowThisStubCall(stub)); // Calls are not allowed in some stubs. 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) { void MacroAssembler::TailCallStub(CodeStub* stub) {
......
...@@ -4474,12 +4474,16 @@ void TurboAssembler::CallStubDelayed(CodeStub* stub, Condition cond, ...@@ -4474,12 +4474,16 @@ void TurboAssembler::CallStubDelayed(CodeStub* stub, Condition cond,
Register r1, const Operand& r2, Register r1, const Operand& r2,
BranchDelaySlot bd) { BranchDelaySlot bd) {
DCHECK(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. DCHECK(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs.
if (isolate() != nullptr && isolate()->ShouldLoadConstantsFromRootList()) {
BlockTrampolinePoolScope block_trampoline_pool(this); stub->set_isolate(isolate());
UseScratchRegisterScope temps(this); Call(stub->GetCode(), RelocInfo::CODE_TARGET, cond, r1, r2, bd);
Register scratch = temps.Acquire(); } else {
li(scratch, Operand::EmbeddedCode(stub)); BlockTrampolinePoolScope block_trampoline_pool(this);
Call(scratch); UseScratchRegisterScope temps(this);
Register scratch = temps.Acquire();
li(scratch, Operand::EmbeddedCode(stub));
Call(scratch);
}
} }
void MacroAssembler::TailCallStub(CodeStub* stub, void MacroAssembler::TailCallStub(CodeStub* stub,
......
...@@ -4821,13 +4821,17 @@ void TurboAssembler::CallStubDelayed(CodeStub* stub, Condition cond, ...@@ -4821,13 +4821,17 @@ void TurboAssembler::CallStubDelayed(CodeStub* stub, Condition cond,
Register r1, const Operand& r2, Register r1, const Operand& r2,
BranchDelaySlot bd) { BranchDelaySlot bd) {
DCHECK(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. 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();
UseScratchRegisterScope temps(this); li(scratch, Operand::EmbeddedCode(stub));
Register scratch = temps.Acquire(); Call(scratch);
li(scratch, Operand::EmbeddedCode(stub)); }
Call(scratch);
} }
void MacroAssembler::TailCallStub(CodeStub* stub, void MacroAssembler::TailCallStub(CodeStub* stub,
......
...@@ -1567,13 +1567,17 @@ void MacroAssembler::CallStub(CodeStub* stub, Condition cond) { ...@@ -1567,13 +1567,17 @@ void MacroAssembler::CallStub(CodeStub* stub, Condition cond) {
void TurboAssembler::CallStubDelayed(CodeStub* stub) { void TurboAssembler::CallStubDelayed(CodeStub* stub) {
DCHECK(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. 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. mov(ip, Operand::EmbeddedCode(stub));
ConstantPoolUnavailableScope constant_pool_unavailable(this); mtctr(ip);
bctrl();
mov(ip, Operand::EmbeddedCode(stub)); }
mtctr(ip);
bctrl();
} }
void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) { void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) {
......
...@@ -1546,7 +1546,12 @@ void MacroAssembler::CallStub(CodeStub* stub, Condition cond) { ...@@ -1546,7 +1546,12 @@ void MacroAssembler::CallStub(CodeStub* stub, Condition cond) {
void TurboAssembler::CallStubDelayed(CodeStub* stub) { void TurboAssembler::CallStubDelayed(CodeStub* stub) {
DCHECK(AllowThisStubCall(stub)); // Stub calls are not allowed in some stubs. 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) { void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) {
......
...@@ -560,7 +560,12 @@ void TurboAssembler::Abort(AbortReason reason) { ...@@ -560,7 +560,12 @@ void TurboAssembler::Abort(AbortReason reason) {
void TurboAssembler::CallStubDelayed(CodeStub* stub) { void TurboAssembler::CallStubDelayed(CodeStub* stub) {
DCHECK(AllowThisStubCall(stub)); // Calls are not allowed in some stubs 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) { 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