Author: kmilli...@chromium.org Date: Wed Jun 10 08:08:25 2009 New Revision: 2137
Modified: branches/bleeding_edge/src/arm/codegen-arm.cc branches/bleeding_edge/src/arm/frames-arm.h branches/bleeding_edge/src/arm/macro-assembler-arm.cc branches/bleeding_edge/src/arm/macro-assembler-arm.h branches/bleeding_edge/src/frames-inl.h branches/bleeding_edge/src/frames.cc branches/bleeding_edge/src/frames.h branches/bleeding_edge/src/ia32/codegen-ia32.cc branches/bleeding_edge/src/ia32/frames-ia32.h branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc branches/bleeding_edge/src/runtime.cc branches/bleeding_edge/src/x64/frames-x64.h branches/bleeding_edge/src/x64/macro-assembler-x64.cc Log: 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 Modified: branches/bleeding_edge/src/arm/codegen-arm.cc ============================================================================== --- branches/bleeding_edge/src/arm/codegen-arm.cc (original) +++ branches/bleeding_edge/src/arm/codegen-arm.cc Wed Jun 10 08:08:25 2009 @@ -289,7 +289,6 @@ // r0: result // sp: stack pointer // fp: frame pointer - // pp: parameter pointer // cp: callee's context __ mov(r0, Operand(Factory::undefined_value())); @@ -5251,7 +5250,6 @@ // r0:r1: result // sp: stack pointer // fp: frame pointer - // pp: caller's parameter pointer pp (restored as C callee-saved) __ LeaveExitFrame(frame_type); // check if we should retry or throw exception @@ -5291,9 +5289,8 @@ // r0: number of arguments including receiver // r1: pointer to builtin function // 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) - // pp: caller's parameter pointer pp (C callee-saved) // NOTE: Invocations of builtins may return failure objects // instead of a proper result. The builtin entry handles @@ -5364,7 +5361,7 @@ // Called from C, so do not pop argc and args on exit (preserve sp) // 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()); // Get address of argv, see stm above. @@ -5408,10 +5405,10 @@ __ bind(&invoke); // Must preserve r0-r4, r5-r7 are available. __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER); - // If an exception not caught by another handler occurs, this handler returns - // control to the code after the bl(&invoke) above, which restores all - // kCalleeSaved registers (including cp, pp and fp) to their saved values - // before returning a failure to C. + // If an exception not caught by another handler occurs, this handler + // returns control to the code after the bl(&invoke) above, which + // restores all kCalleeSaved registers (including cp and fp) to their + // saved values before returning a failure to C. // Clear any pending exceptions. __ mov(ip, Operand(ExternalReference::the_hole_value_location())); Modified: branches/bleeding_edge/src/arm/frames-arm.h ============================================================================== --- branches/bleeding_edge/src/arm/frames-arm.h (original) +++ branches/bleeding_edge/src/arm/frames-arm.h Wed Jun 10 08:08:25 2009 @@ -68,7 +68,7 @@ 1 << 8 | // r8 v5 (cp in JavaScript code) kR9Available << 9 | // r9 v6 - 1 << 10 | // r10 v7 (pp in JavaScript code) + 1 << 10 | // r10 v7 1 << 11; // r11 v8 (fp in JavaScript code) static const int kNumCalleeSaved = 7 + kR9Available; @@ -104,14 +104,14 @@ 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. 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; + + // 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 @@ static const int kSavedRegistersOffset = +2 * kPointerSize; static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset; - // PP-relative. + // Caller SP-relative. static const int kParam0Offset = -2 * kPointerSize; static const int kReceiverOffset = -1 * kPointerSize; }; Modified: branches/bleeding_edge/src/arm/macro-assembler-arm.cc ============================================================================== --- branches/bleeding_edge/src/arm/macro-assembler-arm.cc (original) +++ branches/bleeding_edge/src/arm/macro-assembler-arm.cc Wed Jun 10 08:08:25 2009 @@ -35,11 +35,6 @@ namespace v8 { namespace internal { -// Give alias names to registers -Register cp = { 8 }; // JavaScript context pointer -Register pp = { 10 }; // parameter pointer - - MacroAssembler::MacroAssembler(void* buffer, int size) : Assembler(buffer, size), unresolved_(0), @@ -285,8 +280,8 @@ add(r6, sp, Operand(r0, LSL, kPointerSizeLog2)); sub(r6, r6, Operand(kPointerSize)); - // Compute parameter pointer before making changes and save it as ip - // register so that it is restored as sp register on exit, thereby + // Compute callee's stack pointer before making changes and save it as + // ip register so that it is restored as sp register on exit, thereby // popping the args. // ip = sp + kPointerSize * #args; Modified: branches/bleeding_edge/src/arm/macro-assembler-arm.h ============================================================================== --- branches/bleeding_edge/src/arm/macro-assembler-arm.h (original) +++ branches/bleeding_edge/src/arm/macro-assembler-arm.h Wed Jun 10 08:08:25 2009 @@ -35,8 +35,7 @@ // Give alias names to registers -extern Register cp; // JavaScript context pointer -extern Register pp; // parameter pointer +const Register cp = { 8 }; // JavaScript context pointer // Helper types to make boolean flag easier to read at call-site. Modified: branches/bleeding_edge/src/frames-inl.h ============================================================================== --- branches/bleeding_edge/src/frames-inl.h (original) +++ branches/bleeding_edge/src/frames-inl.h Wed Jun 10 08:08:25 2009 @@ -110,11 +110,6 @@ } -inline Address StandardFrame::caller_sp() const { - return pp(); -} - - inline Address StandardFrame::caller_fp() const { return Memory::Address_at(fp() + StandardFrameConstants::kCallerFPOffset); } @@ -145,13 +140,13 @@ inline Object* JavaScriptFrame::receiver() const { 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) { const int offset = JavaScriptFrameConstants::kReceiverOffset; - Memory::Object_at(pp() + offset) = value; + Memory::Object_at(caller_sp() + offset) = value; } Modified: branches/bleeding_edge/src/frames.cc ============================================================================== --- branches/bleeding_edge/src/frames.cc (original) +++ branches/bleeding_edge/src/frames.cc Wed Jun 10 08:08:25 2009 @@ -400,7 +400,7 @@ void ExitFrame::ComputeCallerState(State* state) const { // Setup the caller state. - state->sp = pp(); + state->sp = caller_sp(); state->fp = Memory::Address_at(fp() + ExitFrameConstants::kCallerFPOffset); state->pc_address = reinterpret_cast<Address*>(fp() + ExitFrameConstants::kCallerPCOffset); @@ -408,7 +408,7 @@ Address ExitFrame::GetCallerStackPointer() const { - return fp() + ExitFrameConstants::kPPDisplacement; + return fp() + ExitFrameConstants::kCallerSPDisplacement; } @@ -453,12 +453,12 @@ Object* JavaScriptFrame::GetParameter(int index) const { ASSERT(index >= 0 && index < ComputeParametersCount()); 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 { - Address base = pp() + JavaScriptFrameConstants::kReceiverOffset; + Address base = caller_sp() + JavaScriptFrameConstants::kReceiverOffset; Address limit = fp() + JavaScriptFrameConstants::kSavedRegistersOffset; return (base - limit) / kPointerSize; } @@ -683,7 +683,7 @@ const int kBaseOffset = JavaScriptFrameConstants::kSavedRegistersOffset; const int kLimitOffset = JavaScriptFrameConstants::kReceiverOffset; 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); } Modified: branches/bleeding_edge/src/frames.h ============================================================================== --- branches/bleeding_edge/src/frames.h (original) +++ branches/bleeding_edge/src/frames.h Wed Jun 10 08:08:25 2009 @@ -129,7 +129,7 @@ // Accessors. Address sp() const { return state_.sp; } Address fp() const { return state_.fp; } - Address pp() const { return GetCallerStackPointer(); } + Address caller_sp() const { return GetCallerStackPointer(); } Address pc() const { return *pc_address(); } void set_pc(Address pc) { *pc_address() = pc; } @@ -137,7 +137,7 @@ Address* pc_address() const { return state_.pc_address; } // 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. bool HasHandler() const; @@ -334,7 +334,6 @@ virtual void ComputeCallerState(State* state) const; // Accessors. - inline Address caller_sp() const; inline Address caller_fp() const; inline Address caller_pc() const; Modified: branches/bleeding_edge/src/ia32/codegen-ia32.cc ============================================================================== --- branches/bleeding_edge/src/ia32/codegen-ia32.cc (original) +++ branches/bleeding_edge/src/ia32/codegen-ia32.cc Wed Jun 10 08:08:25 2009 @@ -7118,12 +7118,11 @@ // ebp: frame pointer (restored after C call) // esp: stack pointer (restored after C call) // 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 - // instead of a proper result. The builtin entry handles - // this by performing a garbage collection and retrying the - // builtin once. + // NOTE: Invocations of builtins may return failure objects instead + // of a proper result. The builtin entry handles this by performing + // a garbage collection and retrying the builtin (twice). StackFrame::Type frame_type = is_debug_break ? StackFrame::EXIT_DEBUG : Modified: branches/bleeding_edge/src/ia32/frames-ia32.h ============================================================================== --- branches/bleeding_edge/src/ia32/frames-ia32.h (original) +++ branches/bleeding_edge/src/ia32/frames-ia32.h Wed Jun 10 08:08:25 2009 @@ -79,12 +79,12 @@ static const int kDebugMarkOffset = -2 * 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 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 @@ static const int kSavedRegistersOffset = +2 * kPointerSize; static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset; - // CallerSP-relative (aka PP-relative) + // Caller SP-relative. static const int kParam0Offset = -2 * kPointerSize; static const int kReceiverOffset = -1 * kPointerSize; }; Modified: branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc ============================================================================== --- branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc (original) +++ branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc Wed Jun 10 08:08:25 2009 @@ -358,7 +358,7 @@ ASSERT(type == StackFrame::EXIT || type == StackFrame::EXIT_DEBUG); // Setup the frame structure on the stack. - ASSERT(ExitFrameConstants::kPPDisplacement == +2 * kPointerSize); + ASSERT(ExitFrameConstants::kCallerSPDisplacement == +2 * kPointerSize); ASSERT(ExitFrameConstants::kCallerPCOffset == +1 * kPointerSize); ASSERT(ExitFrameConstants::kCallerFPOffset == 0 * kPointerSize); push(ebp); Modified: branches/bleeding_edge/src/runtime.cc ============================================================================== --- branches/bleeding_edge/src/runtime.cc (original) +++ branches/bleeding_edge/src/runtime.cc Wed Jun 10 08:08:25 2009 @@ -4821,8 +4821,8 @@ // and print some interesting cpu debugging info. JavaScriptFrameIterator it; JavaScriptFrame* frame = it.frame(); - PrintF("fp = %p, sp = %p, pp = %p: ", - frame->fp(), frame->sp(), frame->pp()); + PrintF("fp = %p, sp = %p, caller_sp = %p: ", + frame->fp(), frame->sp(), frame->caller_sp()); } else { PrintF("DebugPrint: "); } Modified: branches/bleeding_edge/src/x64/frames-x64.h ============================================================================== --- branches/bleeding_edge/src/x64/frames-x64.h (original) +++ branches/bleeding_edge/src/x64/frames-x64.h Wed Jun 10 08:08:25 2009 @@ -73,12 +73,12 @@ static const int kDebugMarkOffset = -2 * 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 kCallerPCOffset = +1 * kPointerSize; + + // FP-relative displacement of the caller's SP. It points just + // below the saved PC. + static const int kCallerSPDisplacement = +2 * kPointerSize; }; Modified: branches/bleeding_edge/src/x64/macro-assembler-x64.cc ============================================================================== --- branches/bleeding_edge/src/x64/macro-assembler-x64.cc (original) +++ branches/bleeding_edge/src/x64/macro-assembler-x64.cc Wed Jun 10 08:08:25 2009 @@ -287,7 +287,7 @@ ASSERT(type == StackFrame::EXIT || type == StackFrame::EXIT_DEBUG); // Setup the frame structure on the stack. - ASSERT(ExitFrameConstants::kPPDisplacement == +2 * kPointerSize); + ASSERT(ExitFrameConstants::kCallerSPDisplacement == +2 * kPointerSize); ASSERT(ExitFrameConstants::kCallerPCOffset == +1 * kPointerSize); ASSERT(ExitFrameConstants::kCallerFPOffset == 0 * kPointerSize); push(rbp); --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list v8-dev@googlegroups.com http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---