Revision: 3383
Author: [email protected]
Date: Mon Nov 30 07:09:49 2009
Log: Move CPU-specific constants from debug.h into the platform-specific  
directories.

The constant for the return sequence length (JSReturnSequenceLength) was
defined in debug.h. Since this constant are also needed outside the  
debugger code
I moved them into assembler-xxx.h. Otherwise compiling with  
debuggersupport=off
would fail on ARM.

BUG=http://code.google.com/p/v8/issues/detail?id=533

Review URL: http://codereview.chromium.org/456001
http://code.google.com/p/v8/source/detail?r=3383

Modified:
  /branches/bleeding_edge/src/arm/assembler-arm.h
  /branches/bleeding_edge/src/arm/codegen-arm.cc
  /branches/bleeding_edge/src/arm/debug-arm.cc
  /branches/bleeding_edge/src/arm/fast-codegen-arm.cc
  /branches/bleeding_edge/src/debug.h
  /branches/bleeding_edge/src/ia32/assembler-ia32.h
  /branches/bleeding_edge/src/ia32/codegen-ia32.cc
  /branches/bleeding_edge/src/ia32/debug-ia32.cc
  /branches/bleeding_edge/src/ia32/fast-codegen-ia32.cc
  /branches/bleeding_edge/src/x64/assembler-x64.h
  /branches/bleeding_edge/src/x64/codegen-x64.cc
  /branches/bleeding_edge/src/x64/debug-x64.cc
  /branches/bleeding_edge/src/x64/fast-codegen-x64.cc

=======================================
--- /branches/bleeding_edge/src/arm/assembler-arm.h     Fri Nov 13 04:32:57 2009
+++ /branches/bleeding_edge/src/arm/assembler-arm.h     Mon Nov 30 07:09:49 2009
@@ -566,6 +566,7 @@
    // register.
    static const int kPcLoadDelta = 8;

+  static const int kJSReturnSequenceLength = 4;

    //  
---------------------------------------------------------------------------
    // Code generation
=======================================
--- /branches/bleeding_edge/src/arm/codegen-arm.cc      Tue Nov 24 06:10:06 2009
+++ /branches/bleeding_edge/src/arm/codegen-arm.cc      Mon Nov 30 07:09:49 2009
@@ -326,7 +326,7 @@
      // Calculate the exact length of the return sequence and make sure that
      // the constant pool is not emitted inside of the return sequence.
      int32_t sp_delta = (scope_->num_parameters() + 1) * kPointerSize;
-    int return_sequence_length = Debug::kARMJSReturnSequenceLength;
+    int return_sequence_length = Assembler::kJSReturnSequenceLength;
      if (!masm_->ImmediateFitsAddrMode1Instruction(sp_delta)) {
        // Additional mov instruction generated.
        return_sequence_length++;
=======================================
--- /branches/bleeding_edge/src/arm/debug-arm.cc        Wed Nov  4 06:45:50 2009
+++ /branches/bleeding_edge/src/arm/debug-arm.cc        Mon Nov 30 07:09:49 2009
@@ -61,7 +61,7 @@
  // Restore the JS frame exit code.
  void BreakLocationIterator::ClearDebugBreakAtReturn() {
    rinfo()->PatchCode(original_rinfo()->pc(),
-                     Debug::kARMJSReturnSequenceLength);
+                     Assembler::kJSReturnSequenceLength);
  }


=======================================
--- /branches/bleeding_edge/src/arm/fast-codegen-arm.cc Thu Nov 26 16:28:06  
2009
+++ /branches/bleeding_edge/src/arm/fast-codegen-arm.cc Mon Nov 30 07:09:49  
2009
@@ -188,7 +188,7 @@
      // the constant pool is not emitted inside of the return sequence.
      int num_parameters = function_->scope()->num_parameters();
      int32_t sp_delta = (num_parameters + 1) * kPointerSize;
-    int return_sequence_length = Debug::kARMJSReturnSequenceLength;
+    int return_sequence_length = Assembler::kJSReturnSequenceLength;
      if (!masm_->ImmediateFitsAddrMode1Instruction(sp_delta)) {
        // Additional mov instruction generated.
        return_sequence_length++;
=======================================
--- /branches/bleeding_edge/src/debug.h Wed Nov 18 00:59:28 2009
+++ /branches/bleeding_edge/src/debug.h Mon Nov 30 07:09:49 2009
@@ -370,17 +370,6 @@
    // Garbage collection notifications.
    static void AfterGarbageCollection();

-  // Code generation assumptions.
-  static const int kIa32CallInstructionLength = 5;
-  static const int kIa32JSReturnSequenceLength = 6;
-
-  // The x64 JS return sequence is padded with int3 to make it large
-  // enough to hold a call instruction when the debugger patches it.
-  static const int kX64CallInstructionLength = 13;
-  static const int kX64JSReturnSequenceLength = 13;
-
-  static const int kARMJSReturnSequenceLength = 4;
-
    // Code generator routines.
    static void GenerateLoadICDebugBreak(MacroAssembler* masm);
    static void GenerateStoreICDebugBreak(MacroAssembler* masm);
=======================================
--- /branches/bleeding_edge/src/ia32/assembler-ia32.h   Tue Nov 17 00:35:43  
2009
+++ /branches/bleeding_edge/src/ia32/assembler-ia32.h   Mon Nov 30 07:09:49  
2009
@@ -464,6 +464,8 @@
    // to jump to.
    static const int kPatchReturnSequenceAddressOffset = 1;  // JMP imm32.

+  static const int kCallInstructionLength = 5;
+  static const int kJSReturnSequenceLength = 6;

    //  
---------------------------------------------------------------------------
    // Code generation
=======================================
--- /branches/bleeding_edge/src/ia32/codegen-ia32.cc    Tue Nov 24 06:10:06  
2009
+++ /branches/bleeding_edge/src/ia32/codegen-ia32.cc    Mon Nov 30 07:09:49  
2009
@@ -2490,7 +2490,7 @@
  #ifdef ENABLE_DEBUGGER_SUPPORT
    // Check that the size of the code used for returning matches what is
    // expected by the debugger.
-  ASSERT_EQ(Debug::kIa32JSReturnSequenceLength,
+  ASSERT_EQ(Assembler::kJSReturnSequenceLength,
              masm_->SizeOfCodeGeneratedSince(&check_exit_codesize));
  #endif
  }
=======================================
--- /branches/bleeding_edge/src/ia32/debug-ia32.cc      Thu Oct 15 04:52:53 2009
+++ /branches/bleeding_edge/src/ia32/debug-ia32.cc      Mon Nov 30 07:09:49 2009
@@ -45,17 +45,17 @@
  // CodeGenerator::VisitReturnStatement and VirtualFrame::Exit in  
codegen-ia32.cc
  // for the precise return instructions sequence.
  void BreakLocationIterator::SetDebugBreakAtReturn() {
-  ASSERT(Debug::kIa32JSReturnSequenceLength >=
-         Debug::kIa32CallInstructionLength);
+  ASSERT(Assembler::kJSReturnSequenceLength >=
+         Assembler::kCallInstructionLength);
    rinfo()->PatchCodeWithCall(Debug::debug_break_return()->entry(),
-      Debug::kIa32JSReturnSequenceLength -  
Debug::kIa32CallInstructionLength);
+      Assembler::kJSReturnSequenceLength -  
Assembler::kCallInstructionLength);
  }


  // Restore the JS frame exit code.
  void BreakLocationIterator::ClearDebugBreakAtReturn() {
    rinfo()->PatchCode(original_rinfo()->pc(),
-                     Debug::kIa32JSReturnSequenceLength);
+                     Assembler::kJSReturnSequenceLength);
  }


=======================================
--- /branches/bleeding_edge/src/ia32/fast-codegen-ia32.cc       Thu Nov 26  
16:28:06 2009
+++ /branches/bleeding_edge/src/ia32/fast-codegen-ia32.cc       Mon Nov 30  
07:09:49 2009
@@ -187,7 +187,7 @@
  #ifdef ENABLE_DEBUGGER_SUPPORT
      // Check that the size of the code used for returning matches what is
      // expected by the debugger.
-    ASSERT_EQ(Debug::kIa32JSReturnSequenceLength,
+    ASSERT_EQ(Assembler::kJSReturnSequenceLength,
              masm_->SizeOfCodeGeneratedSince(&check_exit_codesize));
  #endif
    }
=======================================
--- /branches/bleeding_edge/src/x64/assembler-x64.h     Tue Nov 17 00:35:43 2009
+++ /branches/bleeding_edge/src/x64/assembler-x64.h     Mon Nov 30 07:09:49 2009
@@ -482,6 +482,12 @@
    static const int kPatchReturnSequenceAddressOffset = 13 - 4;
    // TODO(X64): Rename this, removing the "Real", after changing the above.
    static const int kRealPatchReturnSequenceAddressOffset = 2;
+
+  // The x64 JS return sequence is padded with int3 to make it large
+  // enough to hold a call instruction when the debugger patches it.
+  static const int kCallInstructionLength = 13;
+  static const int kJSReturnSequenceLength = 13;
+
    //  
---------------------------------------------------------------------------
    // Code generation
    //
=======================================
--- /branches/bleeding_edge/src/x64/codegen-x64.cc      Tue Nov 24 06:10:06 2009
+++ /branches/bleeding_edge/src/x64/codegen-x64.cc      Mon Nov 30 07:09:49 2009
@@ -505,13 +505,13 @@
    // Add padding that will be overwritten by a debugger breakpoint.
    // frame_->Exit() generates "movq rsp, rbp; pop rbp; ret k"
    // with length 7 (3 + 1 + 3).
-  const int kPadding = Debug::kX64JSReturnSequenceLength - 7;
+  const int kPadding = Assembler::kJSReturnSequenceLength - 7;
    for (int i = 0; i < kPadding; ++i) {
      masm_->int3();
    }
    // Check that the size of the code used for returning matches what is
    // expected by the debugger.
-  ASSERT_EQ(Debug::kX64JSReturnSequenceLength,
+  ASSERT_EQ(Assembler::kJSReturnSequenceLength,
              masm_->SizeOfCodeGeneratedSince(&check_exit_codesize));
  #endif
    DeleteFrame();
=======================================
--- /branches/bleeding_edge/src/x64/debug-x64.cc        Thu Oct 15 04:52:53 2009
+++ /branches/bleeding_edge/src/x64/debug-x64.cc        Mon Nov 30 07:09:49 2009
@@ -181,7 +181,7 @@

  void BreakLocationIterator::ClearDebugBreakAtReturn() {
    rinfo()->PatchCode(original_rinfo()->pc(),
-                     Debug::kX64JSReturnSequenceLength);
+                     Assembler::kJSReturnSequenceLength);
  }


@@ -191,9 +191,10 @@


  void BreakLocationIterator::SetDebugBreakAtReturn()  {
-  ASSERT(Debug::kX64JSReturnSequenceLength >=  
Debug::kX64CallInstructionLength);
+  ASSERT(Assembler::kJSReturnSequenceLength >=
+         Assembler::kCallInstructionLength);
    rinfo()->PatchCodeWithCall(Debug::debug_break_return()->entry(),
-      Debug::kX64JSReturnSequenceLength -  
Debug::kX64CallInstructionLength);
+      Assembler::kJSReturnSequenceLength -  
Assembler::kCallInstructionLength);
  }

  #endif  // ENABLE_DEBUGGER_SUPPORT
=======================================
--- /branches/bleeding_edge/src/x64/fast-codegen-x64.cc Thu Nov 26 16:28:06  
2009
+++ /branches/bleeding_edge/src/x64/fast-codegen-x64.cc Mon Nov 30 07:09:49  
2009
@@ -189,13 +189,13 @@
      // Add padding that will be overwritten by a debugger breakpoint.  We
      // have just generated "movq rsp, rbp; pop rbp; ret k" with length 7
      // (3 + 1 + 3).
-    const int kPadding = Debug::kX64JSReturnSequenceLength - 7;
+    const int kPadding = Assembler::kJSReturnSequenceLength - 7;
      for (int i = 0; i < kPadding; ++i) {
        masm_->int3();
      }
      // Check that the size of the code used for returning matches what is
      // expected by the debugger.
-    ASSERT_EQ(Debug::kX64JSReturnSequenceLength,
+    ASSERT_EQ(Assembler::kJSReturnSequenceLength,
              masm_->SizeOfCodeGeneratedSince(&check_exit_codesize));
  #endif
    }

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

Reply via email to