Revision: 17925
Author: [email protected]
Date: Wed Nov 20 13:44:24 2013 UTC
Log: Replace hard-coded stack frame size literals with
StandardFrameConstants::kFixedFrameSizeFromFp
[email protected]
Review URL: https://codereview.chromium.org/60763006
http://code.google.com/p/v8/source/detail?r=17925
Modified:
/branches/bleeding_edge/src/arm/builtins-arm.cc
/branches/bleeding_edge/src/arm/codegen-arm.cc
/branches/bleeding_edge/src/arm/frames-arm.h
/branches/bleeding_edge/src/arm/lithium-codegen-arm.cc
/branches/bleeding_edge/src/arm/macro-assembler-arm.cc
/branches/bleeding_edge/src/deoptimizer.cc
/branches/bleeding_edge/src/frames.h
/branches/bleeding_edge/src/lithium.cc
=======================================
--- /branches/bleeding_edge/src/arm/builtins-arm.cc Tue Nov 5 09:00:00
2013 UTC
+++ /branches/bleeding_edge/src/arm/builtins-arm.cc Wed Nov 20 13:44:24
2013 UTC
@@ -844,7 +844,7 @@
// Perform prologue operations usually performed by the young code stub.
__ stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit());
- __ add(fp, sp, Operand(2 * kPointerSize));
+ __ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
// Jump to point after the code-age stub.
__ add(r0, r0, Operand(kNoCodeAgeSequenceLength *
Assembler::kInstrSize));
@@ -1177,11 +1177,13 @@
void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
- const int kIndexOffset = -5 * kPointerSize;
- const int kLimitOffset = -4 * kPointerSize;
- const int kArgsOffset = 2 * kPointerSize;
- const int kRecvOffset = 3 * kPointerSize;
- const int kFunctionOffset = 4 * kPointerSize;
+ const int kIndexOffset =
+ StandardFrameConstants::kExpressionsOffset - (2 * kPointerSize);
+ const int kLimitOffset =
+ StandardFrameConstants::kExpressionsOffset - (1 * kPointerSize);
+ const int kArgsOffset = 2 * kPointerSize;
+ const int kRecvOffset = 3 * kPointerSize;
+ const int kFunctionOffset = 4 * kPointerSize;
{
FrameScope frame_scope(masm, StackFrame::INTERNAL);
@@ -1341,7 +1343,8 @@
__ SmiTag(r0);
__ mov(r4, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
__ stm(db_w, sp, r0.bit() | r1.bit() | r4.bit() | fp.bit() | lr.bit());
- __ add(fp, sp, Operand(3 * kPointerSize));
+ __ add(fp, sp,
+ Operand(StandardFrameConstants::kFixedFrameSizeFromFp +
kPointerSize));
}
@@ -1351,7 +1354,8 @@
// -----------------------------------
// Get the number of arguments passed (as a smi), tear down the frame and
// then tear down the parameters.
- __ ldr(r1, MemOperand(fp, -3 * kPointerSize));
+ __ ldr(r1, MemOperand(fp,
-(StandardFrameConstants::kFixedFrameSizeFromFp +
+ kPointerSize)));
__ mov(sp, fp);
__ ldm(ia_w, sp, fp.bit() | lr.bit());
__ add(sp, sp, Operand::PointerOffsetFromSmiKey(r1));
@@ -1438,7 +1442,9 @@
// r3: code entry to call
__ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
__ sub(r2, fp, Operand(r2, LSL, kPointerSizeLog2));
- __ sub(r2, r2, Operand(4 * kPointerSize)); // Adjust for frame.
+ // Adjust for frame.
+ __ sub(r2, r2, Operand(StandardFrameConstants::kFixedFrameSizeFromFp +
+ 2 * kPointerSize));
Label fill;
__ bind(&fill);
=======================================
--- /branches/bleeding_edge/src/arm/codegen-arm.cc Tue Nov 5 13:19:14 2013
UTC
+++ /branches/bleeding_edge/src/arm/codegen-arm.cc Wed Nov 20 13:44:24 2013
UTC
@@ -851,7 +851,8 @@
PredictableCodeSizeScope scope(patcher.masm(), *length);
patcher.masm()->stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() |
lr.bit());
patcher.masm()->nop(ip.code());
- patcher.masm()->add(fp, sp, Operand(2 * kPointerSize));
+ patcher.masm()->add(fp, sp,
+
Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
initialized = true;
}
return byte_sequence;
=======================================
--- /branches/bleeding_edge/src/arm/frames-arm.h Mon Sep 23 15:01:33 2013
UTC
+++ /branches/bleeding_edge/src/arm/frames-arm.h Wed Nov 20 13:44:24 2013
UTC
@@ -102,7 +102,8 @@
class EntryFrameConstants : public AllStatic {
public:
- static const int kCallerFPOffset = -3 * kPointerSize;
+ static const int kCallerFPOffset =
+ -(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize);
};
=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Wed Nov 20
13:28:19 2013 UTC
+++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Wed Nov 20
13:44:24 2013 UTC
@@ -260,7 +260,7 @@
__ stm(db_w, sp, cp.bit() | fp.bit() | lr.bit());
__ mov(scratch0(), Operand(Smi::FromInt(StackFrame::STUB)));
__ push(scratch0());
- __ add(fp, sp, Operand(2 * kPointerSize));
+ __ add(fp, sp,
Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
Comment(";;; Deferred code");
}
code->Generate();
@@ -325,7 +325,7 @@
ASSERT(info()->IsStub());
__ mov(scratch0(), Operand(Smi::FromInt(StackFrame::STUB)));
__ push(scratch0());
- __ add(fp, sp, Operand(2 * kPointerSize));
+ __ add(fp, sp,
Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
__ mov(lr, Operand(pc), LeaveCC, al);
__ mov(pc, ip);
}
=======================================
--- /branches/bleeding_edge/src/arm/macro-assembler-arm.cc Tue Nov 19
16:41:07 2013 UTC
+++ /branches/bleeding_edge/src/arm/macro-assembler-arm.cc Wed Nov 20
13:44:24 2013 UTC
@@ -867,7 +867,7 @@
stm(db_w, sp, cp.bit() | fp.bit() | lr.bit());
Push(Smi::FromInt(StackFrame::STUB));
// Adjust FP to point to saved FP.
- add(fp, sp, Operand(2 * kPointerSize));
+ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
} else {
PredictableCodeSizeScope predictible_code_size_scope(
this, kNoCodeAgeSequenceLength * Assembler::kInstrSize);
@@ -883,7 +883,7 @@
stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit());
nop(ip.code());
// Adjust FP to point to saved FP.
- add(fp, sp, Operand(2 * kPointerSize));
+ add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
}
}
}
@@ -896,7 +896,9 @@
push(ip);
mov(ip, Operand(CodeObject()));
push(ip);
- add(fp, sp, Operand(3 * kPointerSize)); // Adjust FP to point to saved
FP.
+ // Adjust FP to point to saved FP.
+ add(fp, sp,
+ Operand(StandardFrameConstants::kFixedFrameSizeFromFp +
kPointerSize));
}
=======================================
--- /branches/bleeding_edge/src/deoptimizer.cc Fri Nov 15 10:52:05 2013 UTC
+++ /branches/bleeding_edge/src/deoptimizer.cc Wed Nov 20 13:44:24 2013 UTC
@@ -181,7 +181,8 @@
// Always use the actual stack slots when calculating the fp to sp
// delta adding two for the function and context.
unsigned stack_slots = code->stack_slots();
- unsigned fp_to_sp_delta = ((stack_slots + 2) * kPointerSize);
+ unsigned fp_to_sp_delta = (stack_slots * kPointerSize) +
+ StandardFrameConstants::kFixedFrameSizeFromFp;
Deoptimizer* deoptimizer = new Deoptimizer(isolate,
function,
@@ -890,7 +891,8 @@
// If the optimized frame had alignment padding, adjust the frame
pointer
// to point to the new position of the old frame pointer after padding
// is removed. Subtract 2 * kPointerSize for the context and function
slots.
- top_address = input_->GetRegister(fp_reg.code()) - (2 * kPointerSize) -
+ top_address = input_->GetRegister(fp_reg.code()) -
+ StandardFrameConstants::kFixedFrameSizeFromFp -
height_in_bytes + has_alignment_padding_ * kPointerSize;
} else {
top_address = output_[frame_index - 1]->GetTop() - output_frame_size;
@@ -1303,14 +1305,14 @@
" translating %s stub => height=%u\n", kind, height_in_bytes);
}
- // We need 1 stack entry for the return address + 4 stack entries from
- // StackFrame::INTERNAL (FP, context, frame type, code object, see
+ // We need 1 stack entry for the return address and enough entries for
the
+ // StackFrame::INTERNAL (FP, context, frame type and code object - see
// MacroAssembler::EnterFrame). For a setter stub frame we need one
additional
// entry for the implicit return value, see
// StoreStubCompiler::CompileStoreViaSetter.
- unsigned fixed_frame_entries = (kPCOnStackSize / kPointerSize) +
- (kFPOnStackSize / kPointerSize) + 3 +
- (is_setter_stub_frame ? 1 : 0);
+ unsigned fixed_frame_entries =
+ (StandardFrameConstants::kFixedFrameSize / kPointerSize) + 1 +
+ (is_setter_stub_frame ? 1 : 0);
unsigned fixed_frame_size = fixed_frame_entries * kPointerSize;
unsigned output_frame_size = height_in_bytes + fixed_frame_size;
@@ -1483,7 +1485,7 @@
// context and function slots.
Register fp_reg = StubFailureTrampolineFrame::fp_register();
intptr_t top_address = input_->GetRegister(fp_reg.code()) -
- (2 * kPointerSize) - height_in_bytes;
+ StandardFrameConstants::kFixedFrameSizeFromFp - height_in_bytes;
output_frame->SetTop(top_address);
// Read caller's PC (JSFunction continuation) from the input frame.
@@ -2454,8 +2456,9 @@
unsigned Deoptimizer::ComputeInputFrameSize() const {
unsigned fixed_size = ComputeFixedSize(function_);
// The fp-to-sp delta already takes the context and the function
- // into account so we have to avoid double counting them (-2).
- unsigned result = fixed_size + fp_to_sp_delta_ - (2 * kPointerSize);
+ // into account so we have to avoid double counting them.
+ unsigned result = fixed_size + fp_to_sp_delta_ -
+ StandardFrameConstants::kFixedFrameSizeFromFp;
#ifdef DEBUG
if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) {
unsigned stack_slots = compiled_code_->stack_slots();
=======================================
--- /branches/bleeding_edge/src/frames.h Wed Oct 23 13:48:04 2013 UTC
+++ /branches/bleeding_edge/src/frames.h Wed Nov 20 13:44:24 2013 UTC
@@ -170,14 +170,15 @@
// context and function.
// StandardFrame::IterateExpressions assumes that kContextOffset is the
last
// object pointer.
- static const int kFixedFrameSize = kPCOnStackSize + kFPOnStackSize +
- 2 * kPointerSize;
- static const int kExpressionsOffset = -3 * kPointerSize;
- static const int kMarkerOffset = -2 * kPointerSize;
- static const int kContextOffset = -1 * kPointerSize;
- static const int kCallerFPOffset = 0 * kPointerSize;
- static const int kCallerPCOffset = +1 * kFPOnStackSize;
- static const int kCallerSPOffset = kCallerPCOffset + 1 *
kPCOnStackSize;
+ static const int kFixedFrameSizeFromFp = 2 * kPointerSize;
+ static const int kFixedFrameSize = kPCOnStackSize +
kFPOnStackSize +
+ kFixedFrameSizeFromFp;
+ static const int kExpressionsOffset = -3 * kPointerSize;
+ static const int kMarkerOffset = -2 * kPointerSize;
+ static const int kContextOffset = -1 * kPointerSize;
+ static const int kCallerFPOffset = 0 * kPointerSize;
+ static const int kCallerPCOffset = +1 * kFPOnStackSize;
+ static const int kCallerSPOffset = kCallerPCOffset + 1 *
kPCOnStackSize;
};
=======================================
--- /branches/bleeding_edge/src/lithium.cc Fri Nov 15 17:24:10 2013 UTC
+++ /branches/bleeding_edge/src/lithium.cc Wed Nov 20 13:44:24 2013 UTC
@@ -237,7 +237,8 @@
if (index >= 0) {
// Local or spill slot. Skip the frame pointer, function, and
// context in the fixed part of the frame.
- return -(index + 3) * kPointerSize;
+ return -(index + 1) * kPointerSize -
+ StandardFrameConstants::kFixedFrameSizeFromFp;
} else {
// Incoming parameter. Skip the return address.
return -(index + 1) * kPointerSize + kFPOnStackSize + kPCOnStackSize;
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.