Get rid of the notion of "parameter pointer" that no longer exists in

the implementation but still lives on in comments and identifier
names.

Where it was used, it has been changed to "caller's stack pointer".
Review URL: http://codereview.chromium.org/118500

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2137 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent cbd31001
...@@ -289,7 +289,6 @@ void CodeGenerator::GenCode(FunctionLiteral* fun) { ...@@ -289,7 +289,6 @@ void CodeGenerator::GenCode(FunctionLiteral* fun) {
// r0: result // r0: result
// sp: stack pointer // sp: stack pointer
// fp: frame pointer // fp: frame pointer
// pp: parameter pointer
// cp: callee's context // cp: callee's context
__ mov(r0, Operand(Factory::undefined_value())); __ mov(r0, Operand(Factory::undefined_value()));
...@@ -5251,7 +5250,6 @@ void CEntryStub::GenerateCore(MacroAssembler* masm, ...@@ -5251,7 +5250,6 @@ void CEntryStub::GenerateCore(MacroAssembler* masm,
// r0:r1: result // r0:r1: result
// sp: stack pointer // sp: stack pointer
// fp: frame pointer // fp: frame pointer
// pp: caller's parameter pointer pp (restored as C callee-saved)
__ LeaveExitFrame(frame_type); __ LeaveExitFrame(frame_type);
// check if we should retry or throw exception // check if we should retry or throw exception
...@@ -5291,9 +5289,8 @@ void CEntryStub::GenerateBody(MacroAssembler* masm, bool is_debug_break) { ...@@ -5291,9 +5289,8 @@ void CEntryStub::GenerateBody(MacroAssembler* masm, bool is_debug_break) {
// r0: number of arguments including receiver // r0: number of arguments including receiver
// r1: pointer to builtin function // r1: pointer to builtin function
// fp: frame pointer (restored after C call) // fp: frame pointer (restored after C call)
// sp: stack pointer (restored as callee's pp after C call) // sp: stack pointer (restored as callee's sp after C call)
// cp: current context (C callee-saved) // cp: current context (C callee-saved)
// pp: caller's parameter pointer pp (C callee-saved)
// NOTE: Invocations of builtins may return failure objects // NOTE: Invocations of builtins may return failure objects
// instead of a proper result. The builtin entry handles // instead of a proper result. The builtin entry handles
...@@ -5364,7 +5361,7 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { ...@@ -5364,7 +5361,7 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
// Called from C, so do not pop argc and args on exit (preserve sp) // Called from C, so do not pop argc and args on exit (preserve sp)
// No need to save register-passed args // No need to save register-passed args
// Save callee-saved registers (incl. cp, pp, and fp), sp, and lr // Save callee-saved registers (incl. cp and fp), sp, and lr
__ stm(db_w, sp, kCalleeSaved | lr.bit()); __ stm(db_w, sp, kCalleeSaved | lr.bit());
// Get address of argv, see stm above. // Get address of argv, see stm above.
...@@ -5408,10 +5405,10 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { ...@@ -5408,10 +5405,10 @@ void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
__ bind(&invoke); __ bind(&invoke);
// Must preserve r0-r4, r5-r7 are available. // Must preserve r0-r4, r5-r7 are available.
__ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER); __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER);
// If an exception not caught by another handler occurs, this handler returns // If an exception not caught by another handler occurs, this handler
// control to the code after the bl(&invoke) above, which restores all // returns control to the code after the bl(&invoke) above, which
// kCalleeSaved registers (including cp, pp and fp) to their saved values // restores all kCalleeSaved registers (including cp and fp) to their
// before returning a failure to C. // saved values before returning a failure to C.
// Clear any pending exceptions. // Clear any pending exceptions.
__ mov(ip, Operand(ExternalReference::the_hole_value_location())); __ mov(ip, Operand(ExternalReference::the_hole_value_location()));
......
...@@ -68,7 +68,7 @@ static const RegList kCalleeSaved = ...@@ -68,7 +68,7 @@ static const RegList kCalleeSaved =
1 << 8 | // r8 v5 (cp in JavaScript code) 1 << 8 | // r8 v5 (cp in JavaScript code)
kR9Available kR9Available
<< 9 | // r9 v6 << 9 | // r9 v6
1 << 10 | // r10 v7 (pp in JavaScript code) 1 << 10 | // r10 v7
1 << 11; // r11 v8 (fp in JavaScript code) 1 << 11; // r11 v8 (fp in JavaScript code)
static const int kNumCalleeSaved = 7 + kR9Available; static const int kNumCalleeSaved = 7 + kR9Available;
...@@ -104,14 +104,14 @@ class ExitFrameConstants : public AllStatic { ...@@ -104,14 +104,14 @@ class ExitFrameConstants : public AllStatic {
static const int kSavedRegistersOffset = 0 * kPointerSize; static const int kSavedRegistersOffset = 0 * kPointerSize;
// Let the parameters pointer for exit frames point just below the
// frame structure on the stack.
static const int kPPDisplacement = 3 * kPointerSize;
// The caller fields are below the frame pointer on the stack. // The caller fields are below the frame pointer on the stack.
static const int kCallerFPOffset = +0 * kPointerSize; static const int kCallerFPOffset = +0 * kPointerSize;
static const int kCallerPPOffset = +1 * kPointerSize; // The calling JS function is between FP and PC.
static const int kCallerPCOffset = +2 * kPointerSize; static const int kCallerPCOffset = +2 * kPointerSize;
// FP-relative displacement of the caller's SP. It points just
// below the saved PC.
static const int kCallerSPDisplacement = +3 * kPointerSize;
}; };
...@@ -133,7 +133,7 @@ class JavaScriptFrameConstants : public AllStatic { ...@@ -133,7 +133,7 @@ class JavaScriptFrameConstants : public AllStatic {
static const int kSavedRegistersOffset = +2 * kPointerSize; static const int kSavedRegistersOffset = +2 * kPointerSize;
static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset; static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset;
// PP-relative. // Caller SP-relative.
static const int kParam0Offset = -2 * kPointerSize; static const int kParam0Offset = -2 * kPointerSize;
static const int kReceiverOffset = -1 * kPointerSize; static const int kReceiverOffset = -1 * kPointerSize;
}; };
......
...@@ -35,11 +35,6 @@ ...@@ -35,11 +35,6 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
// Give alias names to registers
Register cp = { 8 }; // JavaScript context pointer
Register pp = { 10 }; // parameter pointer
MacroAssembler::MacroAssembler(void* buffer, int size) MacroAssembler::MacroAssembler(void* buffer, int size)
: Assembler(buffer, size), : Assembler(buffer, size),
unresolved_(0), unresolved_(0),
...@@ -285,8 +280,8 @@ void MacroAssembler::EnterExitFrame(StackFrame::Type type) { ...@@ -285,8 +280,8 @@ void MacroAssembler::EnterExitFrame(StackFrame::Type type) {
add(r6, sp, Operand(r0, LSL, kPointerSizeLog2)); add(r6, sp, Operand(r0, LSL, kPointerSizeLog2));
sub(r6, r6, Operand(kPointerSize)); sub(r6, r6, Operand(kPointerSize));
// Compute parameter pointer before making changes and save it as ip // Compute callee's stack pointer before making changes and save it as
// register so that it is restored as sp register on exit, thereby // ip register so that it is restored as sp register on exit, thereby
// popping the args. // popping the args.
// ip = sp + kPointerSize * #args; // ip = sp + kPointerSize * #args;
......
...@@ -35,8 +35,7 @@ namespace internal { ...@@ -35,8 +35,7 @@ namespace internal {
// Give alias names to registers // Give alias names to registers
extern Register cp; // JavaScript context pointer const Register cp = { 8 }; // JavaScript context pointer
extern Register pp; // parameter pointer
// Helper types to make boolean flag easier to read at call-site. // Helper types to make boolean flag easier to read at call-site.
......
...@@ -110,11 +110,6 @@ inline Object* StandardFrame::context() const { ...@@ -110,11 +110,6 @@ inline Object* StandardFrame::context() const {
} }
inline Address StandardFrame::caller_sp() const {
return pp();
}
inline Address StandardFrame::caller_fp() const { inline Address StandardFrame::caller_fp() const {
return Memory::Address_at(fp() + StandardFrameConstants::kCallerFPOffset); return Memory::Address_at(fp() + StandardFrameConstants::kCallerFPOffset);
} }
...@@ -145,13 +140,13 @@ inline bool StandardFrame::IsConstructFrame(Address fp) { ...@@ -145,13 +140,13 @@ inline bool StandardFrame::IsConstructFrame(Address fp) {
inline Object* JavaScriptFrame::receiver() const { inline Object* JavaScriptFrame::receiver() const {
const int offset = JavaScriptFrameConstants::kReceiverOffset; const int offset = JavaScriptFrameConstants::kReceiverOffset;
return Memory::Object_at(pp() + offset); return Memory::Object_at(caller_sp() + offset);
} }
inline void JavaScriptFrame::set_receiver(Object* value) { inline void JavaScriptFrame::set_receiver(Object* value) {
const int offset = JavaScriptFrameConstants::kReceiverOffset; const int offset = JavaScriptFrameConstants::kReceiverOffset;
Memory::Object_at(pp() + offset) = value; Memory::Object_at(caller_sp() + offset) = value;
} }
......
...@@ -400,7 +400,7 @@ Code* ExitFrame::code() const { ...@@ -400,7 +400,7 @@ Code* ExitFrame::code() const {
void ExitFrame::ComputeCallerState(State* state) const { void ExitFrame::ComputeCallerState(State* state) const {
// Setup the caller state. // Setup the caller state.
state->sp = pp(); state->sp = caller_sp();
state->fp = Memory::Address_at(fp() + ExitFrameConstants::kCallerFPOffset); state->fp = Memory::Address_at(fp() + ExitFrameConstants::kCallerFPOffset);
state->pc_address state->pc_address
= reinterpret_cast<Address*>(fp() + ExitFrameConstants::kCallerPCOffset); = reinterpret_cast<Address*>(fp() + ExitFrameConstants::kCallerPCOffset);
...@@ -408,7 +408,7 @@ void ExitFrame::ComputeCallerState(State* state) const { ...@@ -408,7 +408,7 @@ void ExitFrame::ComputeCallerState(State* state) const {
Address ExitFrame::GetCallerStackPointer() const { Address ExitFrame::GetCallerStackPointer() const {
return fp() + ExitFrameConstants::kPPDisplacement; return fp() + ExitFrameConstants::kCallerSPDisplacement;
} }
...@@ -453,12 +453,12 @@ bool StandardFrame::IsExpressionInsideHandler(int n) const { ...@@ -453,12 +453,12 @@ bool StandardFrame::IsExpressionInsideHandler(int n) const {
Object* JavaScriptFrame::GetParameter(int index) const { Object* JavaScriptFrame::GetParameter(int index) const {
ASSERT(index >= 0 && index < ComputeParametersCount()); ASSERT(index >= 0 && index < ComputeParametersCount());
const int offset = JavaScriptFrameConstants::kParam0Offset; const int offset = JavaScriptFrameConstants::kParam0Offset;
return Memory::Object_at(pp() + offset - (index * kPointerSize)); return Memory::Object_at(caller_sp() + offset - (index * kPointerSize));
} }
int JavaScriptFrame::ComputeParametersCount() const { int JavaScriptFrame::ComputeParametersCount() const {
Address base = pp() + JavaScriptFrameConstants::kReceiverOffset; Address base = caller_sp() + JavaScriptFrameConstants::kReceiverOffset;
Address limit = fp() + JavaScriptFrameConstants::kSavedRegistersOffset; Address limit = fp() + JavaScriptFrameConstants::kSavedRegistersOffset;
return (base - limit) / kPointerSize; return (base - limit) / kPointerSize;
} }
...@@ -683,7 +683,7 @@ void JavaScriptFrame::Iterate(ObjectVisitor* v) const { ...@@ -683,7 +683,7 @@ void JavaScriptFrame::Iterate(ObjectVisitor* v) const {
const int kBaseOffset = JavaScriptFrameConstants::kSavedRegistersOffset; const int kBaseOffset = JavaScriptFrameConstants::kSavedRegistersOffset;
const int kLimitOffset = JavaScriptFrameConstants::kReceiverOffset; const int kLimitOffset = JavaScriptFrameConstants::kReceiverOffset;
Object** base = &Memory::Object_at(fp() + kBaseOffset); Object** base = &Memory::Object_at(fp() + kBaseOffset);
Object** limit = &Memory::Object_at(pp() + kLimitOffset) + 1; Object** limit = &Memory::Object_at(caller_sp() + kLimitOffset) + 1;
v->VisitPointers(base, limit); v->VisitPointers(base, limit);
} }
......
...@@ -129,7 +129,7 @@ class StackFrame BASE_EMBEDDED { ...@@ -129,7 +129,7 @@ class StackFrame BASE_EMBEDDED {
// Accessors. // Accessors.
Address sp() const { return state_.sp; } Address sp() const { return state_.sp; }
Address fp() const { return state_.fp; } Address fp() const { return state_.fp; }
Address pp() const { return GetCallerStackPointer(); } Address caller_sp() const { return GetCallerStackPointer(); }
Address pc() const { return *pc_address(); } Address pc() const { return *pc_address(); }
void set_pc(Address pc) { *pc_address() = pc; } void set_pc(Address pc) { *pc_address() = pc; }
...@@ -137,7 +137,7 @@ class StackFrame BASE_EMBEDDED { ...@@ -137,7 +137,7 @@ class StackFrame BASE_EMBEDDED {
Address* pc_address() const { return state_.pc_address; } Address* pc_address() const { return state_.pc_address; }
// Get the id of this stack frame. // Get the id of this stack frame.
Id id() const { return static_cast<Id>(OffsetFrom(pp())); } Id id() const { return static_cast<Id>(OffsetFrom(caller_sp())); }
// Checks if this frame includes any stack handlers. // Checks if this frame includes any stack handlers.
bool HasHandler() const; bool HasHandler() const;
...@@ -334,7 +334,6 @@ class StandardFrame: public StackFrame { ...@@ -334,7 +334,6 @@ class StandardFrame: public StackFrame {
virtual void ComputeCallerState(State* state) const; virtual void ComputeCallerState(State* state) const;
// Accessors. // Accessors.
inline Address caller_sp() const;
inline Address caller_fp() const; inline Address caller_fp() const;
inline Address caller_pc() const; inline Address caller_pc() const;
......
...@@ -7118,12 +7118,11 @@ void CEntryStub::GenerateBody(MacroAssembler* masm, bool is_debug_break) { ...@@ -7118,12 +7118,11 @@ void CEntryStub::GenerateBody(MacroAssembler* masm, bool is_debug_break) {
// ebp: frame pointer (restored after C call) // ebp: frame pointer (restored after C call)
// esp: stack pointer (restored after C call) // esp: stack pointer (restored after C call)
// esi: current context (C callee-saved) // esi: current context (C callee-saved)
// edi: caller's parameter pointer pp (C callee-saved) // edi: JS function of the caller (C callee-saved)
// NOTE: Invocations of builtins may return failure objects // NOTE: Invocations of builtins may return failure objects instead
// instead of a proper result. The builtin entry handles // of a proper result. The builtin entry handles this by performing
// this by performing a garbage collection and retrying the // a garbage collection and retrying the builtin (twice).
// builtin once.
StackFrame::Type frame_type = is_debug_break ? StackFrame::Type frame_type = is_debug_break ?
StackFrame::EXIT_DEBUG : StackFrame::EXIT_DEBUG :
......
...@@ -79,12 +79,12 @@ class ExitFrameConstants : public AllStatic { ...@@ -79,12 +79,12 @@ class ExitFrameConstants : public AllStatic {
static const int kDebugMarkOffset = -2 * kPointerSize; static const int kDebugMarkOffset = -2 * kPointerSize;
static const int kSPOffset = -1 * kPointerSize; static const int kSPOffset = -1 * kPointerSize;
// Let the parameters pointer for exit frames point just below the
// frame structure on the stack (frame pointer and return address).
static const int kPPDisplacement = +2 * kPointerSize;
static const int kCallerFPOffset = 0 * kPointerSize; static const int kCallerFPOffset = 0 * kPointerSize;
static const int kCallerPCOffset = +1 * kPointerSize; static const int kCallerPCOffset = +1 * kPointerSize;
// FP-relative displacement of the caller's SP. It points just
// below the saved PC.
static const int kCallerSPDisplacement = +2 * kPointerSize;
}; };
...@@ -106,7 +106,7 @@ class JavaScriptFrameConstants : public AllStatic { ...@@ -106,7 +106,7 @@ class JavaScriptFrameConstants : public AllStatic {
static const int kSavedRegistersOffset = +2 * kPointerSize; static const int kSavedRegistersOffset = +2 * kPointerSize;
static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset; static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset;
// CallerSP-relative (aka PP-relative) // Caller SP-relative.
static const int kParam0Offset = -2 * kPointerSize; static const int kParam0Offset = -2 * kPointerSize;
static const int kReceiverOffset = -1 * kPointerSize; static const int kReceiverOffset = -1 * kPointerSize;
}; };
......
...@@ -358,7 +358,7 @@ void MacroAssembler::EnterExitFrame(StackFrame::Type type) { ...@@ -358,7 +358,7 @@ void MacroAssembler::EnterExitFrame(StackFrame::Type type) {
ASSERT(type == StackFrame::EXIT || type == StackFrame::EXIT_DEBUG); ASSERT(type == StackFrame::EXIT || type == StackFrame::EXIT_DEBUG);
// Setup the frame structure on the stack. // Setup the frame structure on the stack.
ASSERT(ExitFrameConstants::kPPDisplacement == +2 * kPointerSize); ASSERT(ExitFrameConstants::kCallerSPDisplacement == +2 * kPointerSize);
ASSERT(ExitFrameConstants::kCallerPCOffset == +1 * kPointerSize); ASSERT(ExitFrameConstants::kCallerPCOffset == +1 * kPointerSize);
ASSERT(ExitFrameConstants::kCallerFPOffset == 0 * kPointerSize); ASSERT(ExitFrameConstants::kCallerFPOffset == 0 * kPointerSize);
push(ebp); push(ebp);
......
...@@ -4821,8 +4821,8 @@ static Object* Runtime_DebugPrint(Arguments args) { ...@@ -4821,8 +4821,8 @@ static Object* Runtime_DebugPrint(Arguments args) {
// and print some interesting cpu debugging info. // and print some interesting cpu debugging info.
JavaScriptFrameIterator it; JavaScriptFrameIterator it;
JavaScriptFrame* frame = it.frame(); JavaScriptFrame* frame = it.frame();
PrintF("fp = %p, sp = %p, pp = %p: ", PrintF("fp = %p, sp = %p, caller_sp = %p: ",
frame->fp(), frame->sp(), frame->pp()); frame->fp(), frame->sp(), frame->caller_sp());
} else { } else {
PrintF("DebugPrint: "); PrintF("DebugPrint: ");
} }
......
...@@ -73,12 +73,12 @@ class ExitFrameConstants : public AllStatic { ...@@ -73,12 +73,12 @@ class ExitFrameConstants : public AllStatic {
static const int kDebugMarkOffset = -2 * kPointerSize; static const int kDebugMarkOffset = -2 * kPointerSize;
static const int kSPOffset = -1 * kPointerSize; static const int kSPOffset = -1 * kPointerSize;
// TODO(X64): Remove usage of PP in exit frames?
// Still used though StackFrame::pp()
static const int kPPDisplacement = +2 * kPointerSize;
static const int kCallerFPOffset = +0 * kPointerSize; static const int kCallerFPOffset = +0 * kPointerSize;
static const int kCallerPCOffset = +1 * kPointerSize; static const int kCallerPCOffset = +1 * kPointerSize;
// FP-relative displacement of the caller's SP. It points just
// below the saved PC.
static const int kCallerSPDisplacement = +2 * kPointerSize;
}; };
......
...@@ -287,7 +287,7 @@ void MacroAssembler::EnterExitFrame(StackFrame::Type type) { ...@@ -287,7 +287,7 @@ void MacroAssembler::EnterExitFrame(StackFrame::Type type) {
ASSERT(type == StackFrame::EXIT || type == StackFrame::EXIT_DEBUG); ASSERT(type == StackFrame::EXIT || type == StackFrame::EXIT_DEBUG);
// Setup the frame structure on the stack. // Setup the frame structure on the stack.
ASSERT(ExitFrameConstants::kPPDisplacement == +2 * kPointerSize); ASSERT(ExitFrameConstants::kCallerSPDisplacement == +2 * kPointerSize);
ASSERT(ExitFrameConstants::kCallerPCOffset == +1 * kPointerSize); ASSERT(ExitFrameConstants::kCallerPCOffset == +1 * kPointerSize);
ASSERT(ExitFrameConstants::kCallerFPOffset == 0 * kPointerSize); ASSERT(ExitFrameConstants::kCallerFPOffset == 0 * kPointerSize);
push(rbp); push(rbp);
......
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