PPC/s390: [roots] Remove pseudo-smi stack limit roots
Port c4d31fea9e
Original Commit Message:
Stack limits were additionally maintained in pseudo-smi roots.
"Pseudo", because we stored the raw limit pointers there, just making
sure their values looked like smis by masking the least significant
bits.
This mechanism is no longer needed now that we can access the stack
limit external references as efficiently as the smi roots.
R=jgruber@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N
Change-Id: Ida5c1fe10a494e9c6d665425bd464228978ecd1b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1752142
Reviewed-by: Junliang Yan <jyan@ca.ibm.com>
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#63194}
This commit is contained in:
parent
cf07f9e492
commit
ec4447dbb9
@ -81,12 +81,24 @@ static void GenerateTailCallToReturnedCode(MacroAssembler* masm,
|
||||
|
||||
namespace {
|
||||
|
||||
void LoadRealStackLimit(MacroAssembler* masm, Register destination) {
|
||||
DCHECK(masm->root_array_available());
|
||||
Isolate* isolate = masm->isolate();
|
||||
ExternalReference limit = ExternalReference::address_of_real_jslimit(isolate);
|
||||
DCHECK(TurboAssembler::IsAddressableThroughRootRegister(isolate, limit));
|
||||
|
||||
intptr_t offset =
|
||||
TurboAssembler::RootRegisterOffsetForExternalReference(isolate, limit);
|
||||
CHECK(is_int32(offset));
|
||||
__ LoadP(destination, MemOperand(kRootRegister, offset));
|
||||
}
|
||||
|
||||
void Generate_StackOverflowCheck(MacroAssembler* masm, Register num_args,
|
||||
Register scratch, Label* stack_overflow) {
|
||||
// Check the stack for overflow. We are not trying to catch
|
||||
// interruptions (e.g. debug break and preemption) here, so the "real stack
|
||||
// limit" is checked.
|
||||
__ LoadRoot(scratch, RootIndex::kRealStackLimit);
|
||||
LoadRealStackLimit(masm, scratch);
|
||||
// Make scratch the space we have left. The stack might already be overflowed
|
||||
// here which will cause scratch to become negative.
|
||||
__ sub(scratch, sp, scratch);
|
||||
@ -437,7 +449,8 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) {
|
||||
// Check the stack for overflow. We are not trying to catch interruptions
|
||||
// (i.e. debug break and preemption) here, so check the "real stack limit".
|
||||
Label stack_overflow;
|
||||
__ CompareRoot(sp, RootIndex::kRealStackLimit);
|
||||
LoadRealStackLimit(masm, scratch);
|
||||
__ cmpl(sp, scratch);
|
||||
__ blt(&stack_overflow);
|
||||
|
||||
// Push receiver.
|
||||
@ -729,7 +742,7 @@ static void Generate_CheckStackOverflow(MacroAssembler* masm, Register argc,
|
||||
// interruptions (e.g. debug break and preemption) here, so the "real stack
|
||||
// limit" is checked.
|
||||
Label okay;
|
||||
__ LoadRoot(scratch1, RootIndex::kRealStackLimit);
|
||||
LoadRealStackLimit(masm, scratch1);
|
||||
// Make scratch1 the space we have left. The stack might already be overflowed
|
||||
// here which will cause scratch1 to become negative.
|
||||
__ sub(scratch1, sp, scratch1);
|
||||
@ -1144,7 +1157,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
|
||||
// Do a stack check to ensure we don't go over the limit.
|
||||
Label ok;
|
||||
__ sub(r8, sp, r5);
|
||||
__ LoadRoot(r0, RootIndex::kRealStackLimit);
|
||||
LoadRealStackLimit(masm, r0);
|
||||
__ cmpl(r8, r0);
|
||||
__ bge(&ok);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow);
|
||||
@ -2163,7 +2176,12 @@ void Generate_PushBoundArguments(MacroAssembler* masm) {
|
||||
// Check the stack for overflow. We are not trying to catch interruptions
|
||||
// (i.e. debug break and preemption) here, so check the "real stack
|
||||
// limit".
|
||||
__ CompareRoot(sp, RootIndex::kRealStackLimit);
|
||||
{
|
||||
UseScratchRegisterScope temps(masm);
|
||||
Register scratch = temps.Acquire();
|
||||
LoadRealStackLimit(masm, scratch);
|
||||
__ cmpl(sp, scratch);
|
||||
}
|
||||
__ bgt(&done); // Signed comparison.
|
||||
// Restore the stack pointer.
|
||||
__ mr(sp, scratch);
|
||||
|
@ -81,12 +81,24 @@ static void GenerateTailCallToReturnedCode(MacroAssembler* masm,
|
||||
|
||||
namespace {
|
||||
|
||||
MemOperand RealStackLimitAsMemOperand(MacroAssembler* masm) {
|
||||
DCHECK(masm->root_array_available());
|
||||
Isolate* isolate = masm->isolate();
|
||||
ExternalReference limit = ExternalReference::address_of_real_jslimit(isolate);
|
||||
DCHECK(TurboAssembler::IsAddressableThroughRootRegister(isolate, limit));
|
||||
|
||||
intptr_t offset =
|
||||
TurboAssembler::RootRegisterOffsetForExternalReference(isolate, limit);
|
||||
CHECK(is_int32(offset));
|
||||
return MemOperand(kRootRegister, offset);
|
||||
}
|
||||
|
||||
void Generate_StackOverflowCheck(MacroAssembler* masm, Register num_args,
|
||||
Register scratch, Label* stack_overflow) {
|
||||
// Check the stack for overflow. We are not trying to catch
|
||||
// interruptions (e.g. debug break and preemption) here, so the "real stack
|
||||
// limit" is checked.
|
||||
__ LoadRoot(scratch, RootIndex::kRealStackLimit);
|
||||
__ LoadP(scratch, RealStackLimitAsMemOperand(masm));
|
||||
// Make scratch the space we have left. The stack might already be overflowed
|
||||
// here which will cause scratch to become negative.
|
||||
__ SubP(scratch, sp, scratch);
|
||||
@ -429,7 +441,8 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) {
|
||||
// Check the stack for overflow. We are not trying to catch interruptions
|
||||
// (i.e. debug break and preemption) here, so check the "real stack limit".
|
||||
Label stack_overflow;
|
||||
__ CompareRoot(sp, RootIndex::kRealStackLimit);
|
||||
__ LoadP(scratch, RealStackLimitAsMemOperand(masm));
|
||||
__ CmpLogicalP(sp, scratch);
|
||||
__ blt(&stack_overflow);
|
||||
|
||||
// Push receiver.
|
||||
@ -772,7 +785,7 @@ static void Generate_CheckStackOverflow(MacroAssembler* masm, Register argc,
|
||||
// interruptions (e.g. debug break and preemption) here, so the "real stack
|
||||
// limit" is checked.
|
||||
Label okay;
|
||||
__ LoadRoot(scratch1, RootIndex::kRealStackLimit);
|
||||
__ LoadP(scratch1, RealStackLimitAsMemOperand(masm));
|
||||
// Make scratch1 the space we have left. The stack might already be overflowed
|
||||
// here which will cause scratch1 to become negative.
|
||||
__ SubP(scratch1, sp, scratch1);
|
||||
@ -1197,8 +1210,7 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
|
||||
// Do a stack check to ensure we don't go over the limit.
|
||||
Label ok;
|
||||
__ SubP(r8, sp, r4);
|
||||
__ LoadRoot(r0, RootIndex::kRealStackLimit);
|
||||
__ CmpLogicalP(r8, r0);
|
||||
__ CmpLogicalP(r8, RealStackLimitAsMemOperand(masm));
|
||||
__ bge(&ok);
|
||||
__ CallRuntime(Runtime::kThrowStackOverflow);
|
||||
__ bind(&ok);
|
||||
@ -2219,7 +2231,7 @@ void Generate_PushBoundArguments(MacroAssembler* masm) {
|
||||
// Check the stack for overflow. We are not trying to catch interruptions
|
||||
// (i.e. debug break and preemption) here, so check the "real stack
|
||||
// limit".
|
||||
__ CompareRoot(sp, RootIndex::kRealStackLimit);
|
||||
__ CmpLogicalP(sp, RealStackLimitAsMemOperand(masm));
|
||||
__ bgt(&done); // Signed comparison.
|
||||
// Restore the stack pointer.
|
||||
__ LoadRR(sp, scratch);
|
||||
|
Loading…
Reference in New Issue
Block a user