Author: [email protected]
Date: Mon Jun  8 07:39:50 2009
New Revision: 2123

Modified:
    branches/bleeding_edge/src/frames-inl.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

Log:
Simplify the IA32 exception handler block by removing the unused code
pointer and parameter pointer slots.

Review URL: http://codereview.chromium.org/118383

Modified: branches/bleeding_edge/src/frames-inl.h
==============================================================================
--- branches/bleeding_edge/src/frames-inl.h     (original)
+++ branches/bleeding_edge/src/frames-inl.h     Mon Jun  8 07:39:50 2009
@@ -68,13 +68,7 @@

  inline void StackHandler::Iterate(ObjectVisitor* v) const {
    // Stack handlers do not contain any pointers that need to be
-  // traversed. The only field that have to worry about is the code
-  // field which is unused and should always be uninitialized.
-#ifdef DEBUG
-  const int offset = StackHandlerConstants::kCodeOffset;
-  Object* code = Memory::Object_at(address() + offset);
-  ASSERT(Smi::cast(code)->value() == StackHandler::kCodeNotPresent);
-#endif
+  // traversed.
  }



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     Mon Jun  8 07:39:50 2009
@@ -6935,16 +6935,16 @@


  void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
-  ASSERT(StackHandlerConstants::kSize == 6 * kPointerSize);  // adjust  
this code
+  // Adjust this code if not the case.
+  ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize);
    ExternalReference handler_address(Top::k_handler_address);
    __ mov(edx, Operand::StaticVariable(handler_address));
-  __ mov(ecx, Operand(edx, -1 * kPointerSize));  // get next in chain
+  // Get next in chain.
+  __ mov(ecx, Operand(edx, StackHandlerConstants::kAddressDisplacement));
    __ mov(Operand::StaticVariable(handler_address), ecx);
    __ mov(esp, Operand(edx));
-  __ pop(edi);
    __ pop(ebp);
-  __ pop(edx);  // remove code pointer
-  __ pop(edx);  // remove state
+  __ pop(edx);  // Remove state.

    // Before returning we restore the context from the frame pointer if not  
NULL.
    // The frame pointer is NULL in the exception handler of a JS entry  
frame.
@@ -7040,6 +7040,9 @@


  void CEntryStub::GenerateThrowOutOfMemory(MacroAssembler* masm) {
+  // Adjust this code if not the case.
+  ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize);
+
    // Fetch top stack handler.
    ExternalReference handler_address(Top::k_handler_address);
    __ mov(edx, Operand::StaticVariable(handler_address));
@@ -7080,9 +7083,7 @@
    __ xor_(esi, Operand(esi));

    // Restore registers from handler.
-  __ pop(edi);  // PP
    __ pop(ebp);  // FP
-  __ pop(edx);  // Code
    __ pop(edx);  // State

    __ ret(0);

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       Mon Jun  8 07:39:50 2009
@@ -55,14 +55,10 @@
  class StackHandlerConstants : public AllStatic {
   public:
    static const int kNextOffset  = 0 * kPointerSize;
-  static const int kPPOffset    = 1 * kPointerSize;
-  static const int kFPOffset    = 2 * kPointerSize;
+  static const int kFPOffset    = 1 * kPointerSize;

-  // TODO(1233780): Get rid of the code slot in stack handlers.
-  static const int kCodeOffset  = 3 * kPointerSize;
-
-  static const int kStateOffset = 4 * kPointerSize;
-  static const int kPCOffset    = 5 * kPointerSize;
+  static const int kStateOffset = 2 * kPointerSize;
+  static const int kPCOffset    = 3 * kPointerSize;

    static const int kAddressDisplacement = -1 * kPointerSize;
    static const int kSize = kPCOffset + kPointerSize;
@@ -134,157 +130,6 @@
    const int offset = JavaScriptFrameConstants::kFunctionOffset;
    return Memory::Object_at(fp() + offset);
  }
-
-
-// ----------------------------------------------------
-
-
-
-
-  // C Entry frames:
-
-  //    lower    |    Stack    |
-  //  addresses  |      ^      |
-  //             |      |      |
-  //             |             |
-  //             +-------------+
-  //             |  entry_pc   |
-  //             +-------------+ <--+ entry_sp
-  //                    .           |
-  //                    .           |
-  //                    .           |
-  //             +-------------+    |
-  //          -3 |  entry_sp --+----+
-  //      e      +-------------+
-  //      n   -2 | C function  |
-  //      t      +-------------+
-  //      r   -1 |  caller_pp  |
-  //      y      +-------------+ <--- fp (frame pointer, ebp)
-  //           0 |  caller_fp  |
-  //      f      +-------------+
-  //      r    1 |  caller_pc  |
-  //      a      +-------------+ <--- caller_sp (stack pointer, esp)
-  //      m    2 |             |
-  //      e      |  arguments  |
-  //             |             |
-  //             +- - - - - - -+
-  //             |  argument0  |
-  //             +=============+
-  //             |             |
-  //             |   caller    |
-  //   higher    | expressions |
-  //  addresses  |             |
-
-
-  // Proper JS frames:
-
-  //    lower    |    Stack    |
-  //  addresses  |      ^      |
-  //             |      |      |
-  //             |             |
-  // ----------- +=============+ <--- sp (stack pointer, esp)
-  //             |  function   |
-  //             +-------------+
-  //             |             |
-  //             | expressions |
-  //             |             |
-  //             +-------------+
-  //      a      |             |
-  //      c      |   locals    |
-  //      t      |             |
-  //      i      +- - - - - - -+ <---
-  //      v   -4 |   local0    |   ^
-  //      a      +-------------+   |
-  //      t   -3 |    code     |   |
-  //      i      +-------------+   |
-  //      o   -2 |   context   |   | kLocal0Offset
-  //      n      +-------------+   |
-  //          -1 |  caller_pp  |   v
-  //      f      +-------------+ <--- fp (frame pointer, ebp)
-  //      r    0 |  caller_fp  |
-  //      a      +-------------+
-  //      m    1 |  caller_pc  |
-  //      e      +-------------+ <--- caller_sp (incl. parameters)
-  //           2 |             |
-  //             | parameters  |
-  //             |             |
-  //             +- - - - - - -+ <---
-  //          -2 | parameter0  |   ^
-  //             +-------------+   | kParam0Offset
-  //          -1 |  receiver   |   v
-  // ----------- +=============+ <--- pp (parameter pointer, edi)
-  //           0 |  function   |
-  //             +-------------+
-  //             |             |
-  //             |   caller    |
-  //   higher    | expressions |
-  //  addresses  |             |
-
-
-  // JS entry frames: When calling from C to JS, we construct two extra
-  // frames: An entry frame (C) and a trampoline frame (JS). The
-  // following pictures shows the two frames:
-
-  //    lower    |    Stack    |
-  //  addresses  |      ^      |
-  //             |      |      |
-  //             |             |
-  // ----------- +=============+ <--- sp (stack pointer, esp)
-  //             |             |
-  //             | parameters  |
-  //      t      |             |
-  //      r      +- - - - - - -+
-  //      a      | parameter0  |
-  //      m      +-------------+
-  //      p      |  receiver   |
-  //      o      +-------------+ <---
-  //      l      |  function   |   ^
-  //      i      +-------------+   |
-  //      n   -3 |    code     |   | kLocal0Offset
-  //      e      +-------------+
-  //          -2 |    NULL     | context is always NULL
-  //             +-------------+
-  //      f   -1 |    NULL     | caller pp is always NULL for entry frames
-  //      r      +-------------+ <--- fp (frame pointer, ebp)
-  //      a    0 |  caller fp  |
-  //      m      +-------------+
-  //      e    1 |  caller pc  |
-  //             +-------------+ <--- caller_sp (incl. parameters)
-  //             |      0      |
-  // ----------- +=============+ <--- pp (parameter pointer, edi)
-  //             |      0      |
-  //             +-------------+ <---
-  //                    .          ^
-  //                    .          |  try-handler (HandlerOffsets::kSize)
-  //                    .          v
-  //             +-------------+ <---
-  //          -5 | next top pp |
-  //             +-------------+
-  //      e   -4 | next top fp |
-  //      n      +-------------+ <---
-  //      t   -3 |     ebx     |   ^
-  //      r      +-------------+   |
-  //      y   -2 |     esi     |   |  callee-saved registers
-  //             +-------------+   |
-  //          -1 |     edi     |   v
-  //      f      +-------------+ <--- fp
-  //      r    0 |  caller fp  |
-  //      a      +-------------+      pp == NULL (parameter pointer)
-  //      m    1 |  caller pc  |
-  //      e      +-------------+ <--- caller sp
-  //           2 | code  entry |   ^
-  //             +-------------+   |
-  //           3 |  function   |   |
-  //             +-------------+   |  arguments passed from C code
-  //           4 |  receiver   |   |
-  //             +-------------+   |
-  //           5 |    argc     |   |
-  //             +-------------+   |
-  //           6 |    argv     |   v
-  //             +-------------+ <---
-  //             |             |
-  //   higher    |             |
-  //  addresses  |             |


  } }  // namespace v8::internal

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     Mon Jun  8  
07:39:50 2009
@@ -448,7 +448,8 @@

  void MacroAssembler::PushTryHandler(CodeLocation try_location,
                                      HandlerType type) {
-  ASSERT(StackHandlerConstants::kSize == 6 * kPointerSize);  // adjust  
this code
+  // Adjust this code if not the case.
+  ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize);
    // The pc (return address) is already on TOS.
    if (try_location == IN_JAVASCRIPT) {
      if (type == TRY_CATCH_HANDLER) {
@@ -456,9 +457,7 @@
      } else {
        push(Immediate(StackHandler::TRY_FINALLY));
      }
-    push(Immediate(Smi::FromInt(StackHandler::kCodeNotPresent)));
      push(ebp);
-    push(edi);
    } else {
      ASSERT(try_location == IN_JS_ENTRY);
      // The parameter pointer is meaningless here and ebp does not
@@ -466,9 +465,7 @@
      // expect the code throwing an exception to check ebp before
      // dereferencing it to restore the context.
      push(Immediate(StackHandler::ENTRY));
-    push(Immediate(Smi::FromInt(StackHandler::kCodeNotPresent)));
      push(Immediate(0));  // NULL frame pointer
-    push(Immediate(0));  // NULL parameter pointer
    }
    // Cached TOS.
    mov(eax,  
Operand::StaticVariable(ExternalReference(Top::k_handler_address)));

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to