Bump the C stack pointer when building Dart frames to maintain the ARM64 ABI requirements without guessing the stack limit.

Fixes running with the profiler on ARM64.

Cf. 5d02929fa0.

BUG=http://dartbug.com/26472
R=vegorov@google.com, zra@google.com

Review URL: https://codereview.chromium.org/2014413003 .
This commit is contained in:
Ryan Macnak 2016-05-31 15:36:44 -07:00
parent 858407ebf0
commit 6e2c4636cd
7 changed files with 128 additions and 79 deletions

View file

@ -1126,7 +1126,33 @@ void Assembler::CheckCodePointer() {
}
void Assembler::SetupDartSP() {
mov(SP, CSP);
}
void Assembler::RestoreCSP() {
mov(CSP, SP);
}
void Assembler::EnterFrame(intptr_t frame_size) {
// The ARM64 ABI requires at all times
// - stack limit < CSP <= stack base
// - CSP mod 16 = 0
// - we do not access stack memory below CSP
// Pratically, this means we need to keep the C stack pointer ahead of the
// Dart stack pointer and 16-byte aligned for signal handlers. If we knew the
// real stack limit, we could just set CSP to a value near it during
// SetupDartSP, but we do not know the real stack limit for the initial
// thread or threads created by the embedder.
// TODO(26472): It would be safer to use CSP as the Dart stack pointer, but
// this requires adjustments to stack handling to maintain the 16-byte
// alignment.
const intptr_t kMaxDartFrameSize = 4096;
sub(TMP, SP, Operand(kMaxDartFrameSize));
andi(CSP, TMP, Immediate(~15));
PushPair(LR, FP);
mov(FP, SP);

View file

@ -1349,18 +1349,12 @@ class Assembler : public ValueObject {
Register scratch2,
Label* miss);
void SetupDartSP();
void RestoreCSP();
void EnterFrame(intptr_t frame_size);
void LeaveFrame();
// When entering Dart code from C++, we copy the system stack pointer (CSP)
// to the Dart stack pointer (SP), and reserve a little space for the stack
// to grow.
void SetupDartSP(intptr_t reserved_space) {
ASSERT(Utils::IsAligned(reserved_space, 16));
mov(SP, CSP);
sub(CSP, CSP, Operand(reserved_space));
}
void CheckCodePointer();
void RestoreCodePointer();

View file

@ -390,12 +390,12 @@ ASSEMBLER_TEST_RUN(WordOverflow, test) {
// Loads and Stores.
ASSEMBLER_TEST_GENERATE(SimpleLoadStore, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
__ movz(R0, Immediate(43), 0);
__ movz(R1, Immediate(42), 0);
__ str(R1, Address(SP, -1*kWordSize, Address::PreIndex));
__ ldr(R0, Address(SP, 1*kWordSize, Address::PostIndex));
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -407,13 +407,13 @@ ASSEMBLER_TEST_RUN(SimpleLoadStore, test) {
ASSEMBLER_TEST_GENERATE(SimpleLoadStoreHeapTag, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
__ movz(R0, Immediate(43), 0);
__ movz(R1, Immediate(42), 0);
__ add(R2, SP, Operand(1));
__ str(R1, Address(R2, -1));
__ ldr(R0, Address(R2, -1));
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -425,7 +425,7 @@ ASSEMBLER_TEST_RUN(SimpleLoadStoreHeapTag, test) {
ASSEMBLER_TEST_GENERATE(LoadStoreLargeIndex, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
__ movz(R0, Immediate(43), 0);
__ movz(R1, Immediate(42), 0);
// Largest negative offset that can fit in the signed 9-bit immediate field.
@ -434,7 +434,7 @@ ASSEMBLER_TEST_GENERATE(LoadStoreLargeIndex, assembler) {
__ ldr(R0, Address(SP, 31*kWordSize, Address::PostIndex));
// Correction.
__ add(SP, SP, Operand(kWordSize)); // Restore SP.
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -446,14 +446,14 @@ ASSEMBLER_TEST_RUN(LoadStoreLargeIndex, test) {
ASSEMBLER_TEST_GENERATE(LoadStoreLargeOffset, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
__ movz(R0, Immediate(43), 0);
__ movz(R1, Immediate(42), 0);
__ sub(SP, SP, Operand(512*kWordSize));
__ str(R1, Address(SP, 512*kWordSize, Address::Offset));
__ add(SP, SP, Operand(512*kWordSize));
__ ldr(R0, Address(SP));
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -465,7 +465,7 @@ ASSEMBLER_TEST_RUN(LoadStoreLargeOffset, test) {
ASSEMBLER_TEST_GENERATE(LoadStoreExtReg, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
__ movz(R0, Immediate(43), 0);
__ movz(R1, Immediate(42), 0);
__ movz(R2, Immediate(0xfff8), 0);
@ -476,7 +476,7 @@ ASSEMBLER_TEST_GENERATE(LoadStoreExtReg, assembler) {
__ sub(SP, SP, Operand(kWordSize));
__ ldr(R0, Address(SP));
__ add(SP, SP, Operand(kWordSize));
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -488,7 +488,7 @@ ASSEMBLER_TEST_RUN(LoadStoreExtReg, test) {
ASSEMBLER_TEST_GENERATE(LoadStoreScaledReg, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
__ movz(R0, Immediate(43), 0);
__ movz(R1, Immediate(42), 0);
__ movz(R2, Immediate(10), 0);
@ -497,7 +497,7 @@ ASSEMBLER_TEST_GENERATE(LoadStoreScaledReg, assembler) {
__ str(R1, Address(SP, R2, UXTX, Address::Scaled));
__ ldr(R0, Address(SP, R2, UXTX, Address::Scaled));
__ add(SP, SP, Operand(10*kWordSize));
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -509,12 +509,12 @@ ASSEMBLER_TEST_RUN(LoadStoreScaledReg, test) {
ASSEMBLER_TEST_GENERATE(LoadSigned32Bit, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
__ LoadImmediate(R1, 0xffffffff);
__ str(R1, Address(SP, -4, Address::PreIndex, kWord), kWord);
__ ldr(R0, Address(SP), kWord);
__ ldr(R1, Address(SP, 4, Address::PostIndex, kWord), kWord);
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -526,13 +526,13 @@ ASSEMBLER_TEST_RUN(LoadSigned32Bit, test) {
ASSEMBLER_TEST_GENERATE(SimpleLoadStorePair, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
__ LoadImmediate(R2, 43);
__ LoadImmediate(R3, 42);
__ stp(R2, R3, Address(SP, -2*kWordSize, Address::PairPreIndex));
__ ldp(R0, R1, Address(SP, 2*kWordSize, Address::PairPostIndex));
__ sub(R0, R0, Operand(R1));
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -544,7 +544,7 @@ ASSEMBLER_TEST_RUN(SimpleLoadStorePair, test) {
ASSEMBLER_TEST_GENERATE(LoadStorePairOffset, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
__ LoadImmediate(R2, 43);
__ LoadImmediate(R3, 42);
__ sub(SP, SP, Operand(4 * kWordSize));
@ -552,7 +552,7 @@ ASSEMBLER_TEST_GENERATE(LoadStorePairOffset, assembler) {
__ ldp(R0, R1, Address::Pair(SP, 2 * kWordSize));
__ add(SP, SP, Operand(4 * kWordSize));
__ sub(R0, R0, Operand(R1));
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -564,7 +564,7 @@ ASSEMBLER_TEST_RUN(LoadStorePairOffset, test) {
ASSEMBLER_TEST_GENERATE(Semaphore, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
__ movz(R0, Immediate(40), 0);
__ movz(R1, Immediate(42), 0);
__ Push(R0);
@ -575,7 +575,7 @@ ASSEMBLER_TEST_GENERATE(Semaphore, assembler) {
__ cmp(TMP, Operand(0));
__ b(&retry, NE); // NE if context switch occurred between ldrex and strex.
__ Pop(R0); // 42
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -588,7 +588,7 @@ ASSEMBLER_TEST_RUN(Semaphore, test) {
ASSEMBLER_TEST_GENERATE(FailedSemaphore, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
__ movz(R0, Immediate(40), 0);
__ movz(R1, Immediate(42), 0);
__ Push(R0);
@ -597,7 +597,7 @@ ASSEMBLER_TEST_GENERATE(FailedSemaphore, assembler) {
__ stxr(TMP, R1, SP); // IP == 1, failure
__ Pop(R0); // 40
__ add(R0, R0, Operand(TMP));
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -723,6 +723,24 @@ ASSEMBLER_TEST_RUN(AndImm, test) {
}
ASSEMBLER_TEST_GENERATE(AndImmCsp, assembler) {
// Note we must maintain the ARM64 ABI invariants on CSP here.
__ mov(TMP, CSP);
__ sub(TMP2, CSP, Operand(31));
__ andi(CSP, TMP2, Immediate(~15));
__ mov(R0, CSP);
__ sub(R0, TMP, Operand(R0));
__ mov(CSP, TMP);
__ ret();
}
ASSEMBLER_TEST_RUN(AndImmCsp, test) {
typedef int64_t (*Int64Return)() DART_UNUSED;
EXPECT_EQ(32, EXECUTE_TEST_CODE_INT64(Int64Return, test->entry()));
}
ASSEMBLER_TEST_GENERATE(AndOneImm, assembler) {
__ movz(R1, Immediate(43), 0);
__ andi(R0, R1, Immediate(1));
@ -1689,11 +1707,11 @@ static void LeaveTestFrame(Assembler* assembler) {
// Loading immediate values with the object pool.
ASSEMBLER_TEST_GENERATE(LoadImmediatePPSmall, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
EnterTestFrame(assembler);
__ LoadImmediate(R0, 42);
LeaveTestFrame(assembler);
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -1704,11 +1722,11 @@ ASSEMBLER_TEST_RUN(LoadImmediatePPSmall, test) {
ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
EnterTestFrame(assembler);
__ LoadImmediate(R0, 0xf1234123);
LeaveTestFrame(assembler);
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -1719,11 +1737,11 @@ ASSEMBLER_TEST_RUN(LoadImmediatePPMed, test) {
ASSEMBLER_TEST_GENERATE(LoadImmediatePPMed2, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
EnterTestFrame(assembler);
__ LoadImmediate(R0, 0x4321f1234124);
LeaveTestFrame(assembler);
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -1734,11 +1752,11 @@ ASSEMBLER_TEST_RUN(LoadImmediatePPMed2, test) {
ASSEMBLER_TEST_GENERATE(LoadImmediatePPLarge, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
EnterTestFrame(assembler);
__ LoadImmediate(R0, 0x9287436598237465);
LeaveTestFrame(assembler);
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -1751,11 +1769,11 @@ ASSEMBLER_TEST_RUN(LoadImmediatePPLarge, test) {
// LoadObject null.
ASSEMBLER_TEST_GENERATE(LoadObjectNull, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
EnterTestFrame(assembler);
__ LoadObject(R0, Object::null_object());
LeaveTestFrame(assembler);
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -1766,11 +1784,11 @@ ASSEMBLER_TEST_RUN(LoadObjectNull, test) {
ASSEMBLER_TEST_GENERATE(LoadObjectTrue, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
EnterTestFrame(assembler);
__ LoadObject(R0, Bool::True());
LeaveTestFrame(assembler);
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -1781,11 +1799,11 @@ ASSEMBLER_TEST_RUN(LoadObjectTrue, test) {
ASSEMBLER_TEST_GENERATE(LoadObjectFalse, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
EnterTestFrame(assembler);
__ LoadObject(R0, Bool::False());
LeaveTestFrame(assembler);
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -1940,11 +1958,11 @@ ASSEMBLER_TEST_RUN(Fmovdr, test) {
ASSEMBLER_TEST_GENERATE(FldrdFstrdPrePostIndex, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
__ LoadDImmediate(V1, 42.0);
__ fstrd(V1, Address(SP, -1*kWordSize, Address::PreIndex));
__ fldrd(V0, Address(SP, 1*kWordSize, Address::PostIndex));
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -1956,13 +1974,13 @@ ASSEMBLER_TEST_RUN(FldrdFstrdPrePostIndex, test) {
ASSEMBLER_TEST_GENERATE(FldrsFstrsPrePostIndex, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
__ LoadDImmediate(V1, 42.0);
__ fcvtsd(V2, V1);
__ fstrs(V2, Address(SP, -1*kWordSize, Address::PreIndex));
__ fldrs(V3, Address(SP, 1*kWordSize, Address::PostIndex));
__ fcvtds(V0, V3);
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -1974,7 +1992,7 @@ ASSEMBLER_TEST_RUN(FldrsFstrsPrePostIndex, test) {
ASSEMBLER_TEST_GENERATE(FldrqFstrqPrePostIndex, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
__ LoadDImmediate(V1, 21.0);
__ LoadDImmediate(V2, 21.0);
__ LoadImmediate(R1, 42);
@ -1987,7 +2005,7 @@ ASSEMBLER_TEST_GENERATE(FldrqFstrqPrePostIndex, assembler) {
__ PopDouble(V0);
__ PopDouble(V1);
__ faddd(V0, V0, V1);
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -2160,7 +2178,7 @@ ASSEMBLER_TEST_RUN(Fsubd, test) {
ASSEMBLER_TEST_GENERATE(FldrdFstrdHeapTag, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
__ LoadDImmediate(V0, 43.0);
__ LoadDImmediate(V1, 42.0);
__ AddImmediate(SP, SP, -1 * kWordSize);
@ -2168,7 +2186,7 @@ ASSEMBLER_TEST_GENERATE(FldrdFstrdHeapTag, assembler) {
__ fstrd(V1, Address(R2, -1));
__ fldrd(V0, Address(R2, -1));
__ AddImmediate(SP, SP, 1 * kWordSize);
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -2180,7 +2198,7 @@ ASSEMBLER_TEST_RUN(FldrdFstrdHeapTag, test) {
ASSEMBLER_TEST_GENERATE(FldrdFstrdLargeIndex, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
__ LoadDImmediate(V0, 43.0);
__ LoadDImmediate(V1, 42.0);
// Largest negative offset that can fit in the signed 9-bit immediate field.
@ -2189,7 +2207,7 @@ ASSEMBLER_TEST_GENERATE(FldrdFstrdLargeIndex, assembler) {
__ fldrd(V0, Address(SP, 31*kWordSize, Address::PostIndex));
// Correction.
__ add(SP, SP, Operand(kWordSize)); // Restore SP.
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -2201,14 +2219,14 @@ ASSEMBLER_TEST_RUN(FldrdFstrdLargeIndex, test) {
ASSEMBLER_TEST_GENERATE(FldrdFstrdLargeOffset, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
__ LoadDImmediate(V0, 43.0);
__ LoadDImmediate(V1, 42.0);
__ sub(SP, SP, Operand(512*kWordSize));
__ fstrd(V1, Address(SP, 512*kWordSize, Address::Offset));
__ add(SP, SP, Operand(512*kWordSize));
__ fldrd(V0, Address(SP));
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -2220,7 +2238,7 @@ ASSEMBLER_TEST_RUN(FldrdFstrdLargeOffset, test) {
ASSEMBLER_TEST_GENERATE(FldrdFstrdExtReg, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
__ LoadDImmediate(V0, 43.0);
__ LoadDImmediate(V1, 42.0);
__ movz(R2, Immediate(0xfff8), 0);
@ -2231,7 +2249,7 @@ ASSEMBLER_TEST_GENERATE(FldrdFstrdExtReg, assembler) {
__ sub(SP, SP, Operand(kWordSize));
__ fldrd(V0, Address(SP));
__ add(SP, SP, Operand(kWordSize));
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -2243,7 +2261,7 @@ ASSEMBLER_TEST_RUN(FldrdFstrdExtReg, test) {
ASSEMBLER_TEST_GENERATE(FldrdFstrdScaledReg, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
__ LoadDImmediate(V0, 43.0);
__ LoadDImmediate(V1, 42.0);
__ movz(R2, Immediate(10), 0);
@ -2252,7 +2270,7 @@ ASSEMBLER_TEST_GENERATE(FldrdFstrdScaledReg, assembler) {
__ fstrd(V1, Address(SP, R2, UXTX, Address::Scaled));
__ fldrd(V0, Address(SP, R2, UXTX, Address::Scaled));
__ add(SP, SP, Operand(10*kWordSize));
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -2707,7 +2725,7 @@ ASSEMBLER_TEST_RUN(Vdivd, test) {
ASSEMBLER_TEST_GENERATE(Vdupd, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
__ LoadDImmediate(V0, 21.0);
__ vdupd(V1, V0, 0);
@ -2719,7 +2737,7 @@ ASSEMBLER_TEST_GENERATE(Vdupd, assembler) {
__ fldrd(V3, Address(SP, 1 * dword_bytes, Address::PostIndex));
__ faddd(V0, V2, V3);
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -2731,7 +2749,7 @@ ASSEMBLER_TEST_RUN(Vdupd, test) {
ASSEMBLER_TEST_GENERATE(Vdups, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
__ LoadDImmediate(V0, 21.0);
__ fcvtsd(V0, V0);
__ vdups(V1, V0, 0);
@ -2753,7 +2771,7 @@ ASSEMBLER_TEST_GENERATE(Vdups, assembler) {
__ faddd(V0, V1, V1);
__ faddd(V0, V0, V2);
__ faddd(V0, V0, V3);
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -2765,7 +2783,7 @@ ASSEMBLER_TEST_RUN(Vdups, test) {
ASSEMBLER_TEST_GENERATE(Vinsd, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
__ LoadDImmediate(V5, 42.0);
__ vinsd(V1, 1, V5, 0); // V1[1] <- V0[0].
@ -2777,7 +2795,7 @@ ASSEMBLER_TEST_GENERATE(Vinsd, assembler) {
__ fldrd(V3, Address(SP, 1 * dword_bytes, Address::PostIndex));
__ fmovdd(V0, V3);
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -2789,7 +2807,7 @@ ASSEMBLER_TEST_RUN(Vinsd, test) {
ASSEMBLER_TEST_GENERATE(Vinss, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
__ LoadDImmediate(V0, 21.0);
__ fcvtsd(V0, V0);
__ vinss(V1, 3, V0, 0);
@ -2812,7 +2830,7 @@ ASSEMBLER_TEST_GENERATE(Vinss, assembler) {
__ faddd(V0, V0, V1);
__ faddd(V0, V0, V2);
__ faddd(V0, V0, V3);
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
@ -3601,7 +3619,7 @@ ASSEMBLER_TEST_RUN(ReciprocalSqrt, test) {
// R1: growable array.
// R2: current thread.
ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
__ Push(CODE_REG);
__ Push(THR);
__ Push(LR);
@ -3612,13 +3630,13 @@ ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) {
__ Pop(LR);
__ Pop(THR);
__ Pop(CODE_REG);
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}
ASSEMBLER_TEST_GENERATE(ComputeRange, assembler) {
__ SetupDartSP(kTestStackSpace);
__ SetupDartSP();
EnterTestFrame(assembler);
Label miss, done;
__ ComputeRange(R0, R2, R3, &miss);
@ -3629,7 +3647,7 @@ ASSEMBLER_TEST_GENERATE(ComputeRange, assembler) {
__ Bind(&done);
LeaveTestFrame(assembler);
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}

View file

@ -996,7 +996,15 @@ class Instr {
return R31IsSP;
}
}
// TODO(zra): Handle for logical immediate operations.
if (IsLogicalImmOp()) {
const int op = Bits(29, 2);
const bool set_flags = op == 3;
if (set_flags) {
return R31IsZR;
} else {
return R31IsSP;
}
}
return R31IsZR;
}

View file

@ -2649,7 +2649,9 @@ void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
compiler->AddSlowPathCode(slow_path);
__ ldr(TMP, Address(THR, Thread::stack_limit_offset()));
__ CompareRegisters(SP, TMP);
// Compare to CSP not SP because CSP is closer to the stack limit. See
// Assembler::EnterFrame.
__ CompareRegisters(CSP, TMP);
__ b(slow_path->entry_label(), LS);
if (compiler->CanOSRFunction() && in_loop()) {
const Register temp = locs()->temp(0).reg();

View file

@ -17,7 +17,7 @@ namespace dart {
// Generate a simple dart code sequence.
// This is used to test Code and Instruction object creation.
void GenerateIncrement(Assembler* assembler) {
__ mov(SP, CSP);
__ EnterFrame(1 * kWordSize);
__ movz(R0, Immediate(0), 0);
__ Push(R0);
__ add(R0, R0, Operand(1));
@ -26,6 +26,7 @@ void GenerateIncrement(Assembler* assembler) {
__ add(R1, R1, Operand(1));
__ Pop(R0);
__ mov(R0, R1);
__ LeaveFrame();
__ ret();
}

View file

@ -780,8 +780,8 @@ void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) {
__ Comment("InvokeDartCodeStub");
// Copy the C stack pointer (R31) into the stack pointer we'll actually use
// to access the stack, and put the C stack pointer at the stack limit.
__ SetupDartSP(OSThread::GetSpecifiedStackSize());
// to access the stack.
__ SetupDartSP();
__ EnterFrame(0);
// Push code object to PC marker slot.
@ -896,7 +896,7 @@ void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) {
// Restore the frame pointer and C stack pointer and return.
__ LeaveFrame();
__ mov(CSP, SP);
__ RestoreCSP();
__ ret();
}