Commit c33cbd9f authored by plind44@gmail.com's avatar plind44@gmail.com

MIPS: Replace hard-coded stack frame size literals with...

MIPS: Replace hard-coded stack frame size literals with StandardFrameConstants::kFixedFrameSizeFromFp.

Port r17925 (0b95731)

BUG=
R=plind44@gmail.com

Review URL: https://codereview.chromium.org/77763006

Patch from Balazs Kilvady <kilvadyb@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17940 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e5f18799
...@@ -879,7 +879,7 @@ void Builtins::Generate_MarkCodeAsExecutedOnce(MacroAssembler* masm) { ...@@ -879,7 +879,7 @@ void Builtins::Generate_MarkCodeAsExecutedOnce(MacroAssembler* masm) {
// Perform prologue operations usually performed by the young code stub. // Perform prologue operations usually performed by the young code stub.
__ Push(ra, fp, cp, a1); __ Push(ra, fp, cp, a1);
__ Addu(fp, sp, Operand(2 * kPointerSize)); __ Addu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
// Jump to point after the code-age stub. // Jump to point after the code-age stub.
__ Addu(a0, a0, Operand((kNoCodeAgeSequenceLength) * Assembler::kInstrSize)); __ Addu(a0, a0, Operand((kNoCodeAgeSequenceLength) * Assembler::kInstrSize));
...@@ -1208,11 +1208,13 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { ...@@ -1208,11 +1208,13 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
void Builtins::Generate_FunctionApply(MacroAssembler* masm) { void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
const int kIndexOffset = -5 * kPointerSize; const int kIndexOffset =
const int kLimitOffset = -4 * kPointerSize; StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize);
const int kArgsOffset = 2 * kPointerSize; const int kLimitOffset =
const int kRecvOffset = 3 * kPointerSize; StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize);
const int kFunctionOffset = 4 * kPointerSize; const int kArgsOffset = 2 * kPointerSize;
const int kRecvOffset = 3 * kPointerSize;
const int kFunctionOffset = 4 * kPointerSize;
{ {
FrameScope frame_scope(masm, StackFrame::INTERNAL); FrameScope frame_scope(masm, StackFrame::INTERNAL);
...@@ -1371,7 +1373,8 @@ static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { ...@@ -1371,7 +1373,8 @@ static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) {
__ sll(a0, a0, kSmiTagSize); __ sll(a0, a0, kSmiTagSize);
__ li(t0, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); __ li(t0, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
__ MultiPush(a0.bit() | a1.bit() | t0.bit() | fp.bit() | ra.bit()); __ MultiPush(a0.bit() | a1.bit() | t0.bit() | fp.bit() | ra.bit());
__ Addu(fp, sp, Operand(3 * kPointerSize)); __ Addu(fp, sp,
Operand(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize));
} }
...@@ -1381,7 +1384,8 @@ static void LeaveArgumentsAdaptorFrame(MacroAssembler* masm) { ...@@ -1381,7 +1384,8 @@ static void LeaveArgumentsAdaptorFrame(MacroAssembler* masm) {
// ----------------------------------- // -----------------------------------
// Get the number of arguments passed (as a smi), tear down the frame and // Get the number of arguments passed (as a smi), tear down the frame and
// then tear down the parameters. // then tear down the parameters.
__ lw(a1, MemOperand(fp, -3 * kPointerSize)); __ lw(a1, MemOperand(fp, -(StandardFrameConstants::kFixedFrameSizeFromFp +
kPointerSize)));
__ mov(sp, fp); __ mov(sp, fp);
__ MultiPop(fp.bit() | ra.bit()); __ MultiPop(fp.bit() | ra.bit());
__ sll(t0, a1, kPointerSizeLog2 - kSmiTagSize); __ sll(t0, a1, kPointerSizeLog2 - kSmiTagSize);
...@@ -1479,7 +1483,9 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { ...@@ -1479,7 +1483,9 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
__ LoadRoot(t0, Heap::kUndefinedValueRootIndex); __ LoadRoot(t0, Heap::kUndefinedValueRootIndex);
__ sll(t2, a2, kPointerSizeLog2); __ sll(t2, a2, kPointerSizeLog2);
__ Subu(a2, fp, Operand(t2)); __ Subu(a2, fp, Operand(t2));
__ Addu(a2, a2, Operand(-4 * kPointerSize)); // Adjust for frame. // Adjust for frame.
__ Subu(a2, a2, Operand(StandardFrameConstants::kFixedFrameSizeFromFp +
2 * kPointerSize));
Label fill; Label fill;
__ bind(&fill); __ bind(&fill);
......
...@@ -618,7 +618,8 @@ static byte* GetNoCodeAgeSequence(uint32_t* length) { ...@@ -618,7 +618,8 @@ static byte* GetNoCodeAgeSequence(uint32_t* length) {
CodePatcher patcher(byte_sequence, kNoCodeAgeSequenceLength); CodePatcher patcher(byte_sequence, kNoCodeAgeSequenceLength);
patcher.masm()->Push(ra, fp, cp, a1); patcher.masm()->Push(ra, fp, cp, a1);
patcher.masm()->nop(Assembler::CODE_AGE_SEQUENCE_NOP); patcher.masm()->nop(Assembler::CODE_AGE_SEQUENCE_NOP);
patcher.masm()->Addu(fp, sp, Operand(2 * kPointerSize)); patcher.masm()->Addu(fp, sp,
Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
initialized = true; initialized = true;
} }
return byte_sequence; return byte_sequence;
......
...@@ -154,7 +154,8 @@ const int kSafepointRegisterStackIndexMap[kNumRegs] = { ...@@ -154,7 +154,8 @@ const int kSafepointRegisterStackIndexMap[kNumRegs] = {
class EntryFrameConstants : public AllStatic { class EntryFrameConstants : public AllStatic {
public: public:
static const int kCallerFPOffset = -3 * kPointerSize; static const int kCallerFPOffset =
-(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize);
}; };
......
...@@ -257,7 +257,7 @@ bool LCodeGen::GenerateDeferredCode() { ...@@ -257,7 +257,7 @@ bool LCodeGen::GenerateDeferredCode() {
__ MultiPush(cp.bit() | fp.bit() | ra.bit()); __ MultiPush(cp.bit() | fp.bit() | ra.bit());
__ li(scratch0(), Operand(Smi::FromInt(StackFrame::STUB))); __ li(scratch0(), Operand(Smi::FromInt(StackFrame::STUB)));
__ push(scratch0()); __ push(scratch0());
__ Addu(fp, sp, Operand(2 * kPointerSize)); __ Addu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
Comment(";;; Deferred code"); Comment(";;; Deferred code");
} }
code->Generate(); code->Generate();
...@@ -309,7 +309,7 @@ bool LCodeGen::GenerateDeoptJumpTable() { ...@@ -309,7 +309,7 @@ bool LCodeGen::GenerateDeoptJumpTable() {
ASSERT(info()->IsStub()); ASSERT(info()->IsStub());
__ li(scratch0(), Operand(Smi::FromInt(StackFrame::STUB))); __ li(scratch0(), Operand(Smi::FromInt(StackFrame::STUB)));
__ push(scratch0()); __ push(scratch0());
__ Addu(fp, sp, Operand(2 * kPointerSize)); __ Addu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
__ Call(t9); __ Call(t9);
} }
} else { } else {
......
...@@ -4516,7 +4516,7 @@ void MacroAssembler::Prologue(PrologueFrameMode frame_mode) { ...@@ -4516,7 +4516,7 @@ void MacroAssembler::Prologue(PrologueFrameMode frame_mode) {
Push(ra, fp, cp); Push(ra, fp, cp);
Push(Smi::FromInt(StackFrame::STUB)); Push(Smi::FromInt(StackFrame::STUB));
// Adjust FP to point to saved FP. // Adjust FP to point to saved FP.
Addu(fp, sp, Operand(2 * kPointerSize)); Addu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
} else { } else {
PredictableCodeSizeScope predictible_code_size_scope( PredictableCodeSizeScope predictible_code_size_scope(
this, kNoCodeAgeSequenceLength * Assembler::kInstrSize); this, kNoCodeAgeSequenceLength * Assembler::kInstrSize);
...@@ -4539,7 +4539,7 @@ void MacroAssembler::Prologue(PrologueFrameMode frame_mode) { ...@@ -4539,7 +4539,7 @@ void MacroAssembler::Prologue(PrologueFrameMode frame_mode) {
Push(ra, fp, cp, a1); Push(ra, fp, cp, a1);
nop(Assembler::CODE_AGE_SEQUENCE_NOP); nop(Assembler::CODE_AGE_SEQUENCE_NOP);
// Adjust fp to point to caller's fp. // Adjust fp to point to caller's fp.
Addu(fp, sp, Operand(2 * kPointerSize)); Addu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
} }
} }
} }
...@@ -4554,7 +4554,9 @@ void MacroAssembler::EnterFrame(StackFrame::Type type) { ...@@ -4554,7 +4554,9 @@ void MacroAssembler::EnterFrame(StackFrame::Type type) {
sw(cp, MemOperand(sp, 2 * kPointerSize)); sw(cp, MemOperand(sp, 2 * kPointerSize));
sw(t8, MemOperand(sp, 1 * kPointerSize)); sw(t8, MemOperand(sp, 1 * kPointerSize));
sw(t9, MemOperand(sp, 0 * kPointerSize)); sw(t9, MemOperand(sp, 0 * kPointerSize));
addiu(fp, sp, 3 * kPointerSize); // Adjust FP to point to saved FP.
Addu(fp, sp,
Operand(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize));
} }
......
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