Revision: 22935
Author:   [email protected]
Date:     Wed Aug  6 13:56:58 2014 UTC
Log:      Abstract out fetching of break_address in debug mode

If the platform has a variable length call sequence
more than simple offset math is required. This can
be true with out of line constant pools on PowerPC.

BUG=
[email protected]

Review URL: https://codereview.chromium.org/427863003

Patch from Andrew Low <[email protected]>.
http://code.google.com/p/v8/source/detail?r=22935

Modified:
 /branches/bleeding_edge/src/arm/assembler-arm-inl.h
 /branches/bleeding_edge/src/arm/assembler-arm.h
 /branches/bleeding_edge/src/arm64/assembler-arm64-inl.h
 /branches/bleeding_edge/src/arm64/assembler-arm64.h
 /branches/bleeding_edge/src/debug.cc
 /branches/bleeding_edge/src/ia32/assembler-ia32-inl.h
 /branches/bleeding_edge/src/ia32/assembler-ia32.h
 /branches/bleeding_edge/src/mips/assembler-mips-inl.h
 /branches/bleeding_edge/src/mips/assembler-mips.h
 /branches/bleeding_edge/src/mips64/assembler-mips64-inl.h
 /branches/bleeding_edge/src/mips64/assembler-mips64.h
 /branches/bleeding_edge/src/x64/assembler-x64-inl.h
 /branches/bleeding_edge/src/x64/assembler-x64.h
 /branches/bleeding_edge/src/x87/assembler-x87-inl.h
 /branches/bleeding_edge/src/x87/assembler-x87.h

=======================================
--- /branches/bleeding_edge/src/arm/assembler-arm-inl.h Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/arm/assembler-arm-inl.h Wed Aug 6 13:56:58 2014 UTC
@@ -456,6 +456,11 @@
     return candidate;
   }
 }
+
+
+Address Assembler::break_address_from_return_address(Address pc) {
+  return pc - Assembler::kPatchDebugBreakSlotReturnOffset;
+}


 Address Assembler::return_address_from_call_start(Address pc) {
=======================================
--- /branches/bleeding_edge/src/arm/assembler-arm.h Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/arm/assembler-arm.h Wed Aug 6 13:56:58 2014 UTC
@@ -781,6 +781,9 @@
   // in the instruction stream that the call will return from.
   INLINE(static Address return_address_from_call_start(Address pc));

+  // Return the code target address of the patch debug break slot
+  INLINE(static Address break_address_from_return_address(Address pc));
+
// This sets the branch destination (which is in the constant pool on ARM).
   // This is for calls and branches within generated code.
   inline static void deserialization_set_special_target_at(
=======================================
--- /branches/bleeding_edge/src/arm64/assembler-arm64-inl.h Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/arm64/assembler-arm64-inl.h Wed Aug 6 13:56:58 2014 UTC
@@ -605,6 +605,11 @@
   DCHECK(instr->IsLdrLiteralX());
   return candidate;
 }
+
+
+Address Assembler::break_address_from_return_address(Address pc) {
+  return pc - Assembler::kPatchDebugBreakSlotReturnOffset;
+}


 Address Assembler::return_address_from_call_start(Address pc) {
=======================================
--- /branches/bleeding_edge/src/arm64/assembler-arm64.h Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/arm64/assembler-arm64.h Wed Aug 6 13:56:58 2014 UTC
@@ -887,6 +887,9 @@
   // instruction stream that call will return from.
   inline static Address return_address_from_call_start(Address pc);

+  // Return the code target address of the patch debug break slot
+  inline static Address break_address_from_return_address(Address pc);
+
// This sets the branch destination (which is in the constant pool on ARM).
   // This is for calls and branches within generated code.
   inline static void deserialization_set_special_target_at(
=======================================
--- /branches/bleeding_edge/src/debug.cc        Wed Aug  6 09:41:52 2014 UTC
+++ /branches/bleeding_edge/src/debug.cc        Wed Aug  6 13:56:58 2014 UTC
@@ -2326,7 +2326,7 @@
// Find the call address in the running code. This address holds the call to
   // either a DebugBreakXXX or to the debug break return entry code if the
   // break point is still active after processing the break point.
-  Address addr = frame->pc() - Assembler::kPatchDebugBreakSlotReturnOffset;
+  Address addr = Assembler::break_address_from_return_address(frame->pc());

   // Check if the location is at JS exit or debug break slot.
   bool at_js_return = false;
@@ -2417,7 +2417,7 @@
 #endif

   // Find the call address in the running code.
-  Address addr = frame->pc() - Assembler::kPatchDebugBreakSlotReturnOffset;
+  Address addr = Assembler::break_address_from_return_address(frame->pc());

   // Check if the location is at JS return.
   RelocIterator it(debug_info->code());
=======================================
--- /branches/bleeding_edge/src/ia32/assembler-ia32-inl.h Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/ia32/assembler-ia32-inl.h Wed Aug 6 13:56:58 2014 UTC
@@ -480,6 +480,11 @@
 Address Assembler::target_address_from_return_address(Address pc) {
   return pc - kCallTargetAddressOffset;
 }
+
+
+Address Assembler::break_address_from_return_address(Address pc) {
+  return pc - Assembler::kPatchDebugBreakSlotReturnOffset;
+}


 Displacement Assembler::disp_at(Label* L) {
=======================================
--- /branches/bleeding_edge/src/ia32/assembler-ia32.h Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/ia32/assembler-ia32.h Wed Aug 6 13:56:58 2014 UTC
@@ -519,6 +519,9 @@
   // of that call in the instruction stream.
   inline static Address target_address_from_return_address(Address pc);

+  // Return the code target address of the patch debug break slot
+  inline static Address break_address_from_return_address(Address pc);
+
   // This sets the branch destination (which is in the instruction on x86).
   // This is for calls and branches within generated code.
   inline static void deserialization_set_special_target_at(
=======================================
--- /branches/bleeding_edge/src/mips/assembler-mips-inl.h Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/mips/assembler-mips-inl.h Wed Aug 6 13:56:58 2014 UTC
@@ -188,6 +188,11 @@
 Address Assembler::target_address_from_return_address(Address pc) {
   return pc - kCallTargetAddressOffset;
 }
+
+
+Address Assembler::break_address_from_return_address(Address pc) {
+  return pc - Assembler::kPatchDebugBreakSlotReturnOffset;
+}


 Object* RelocInfo::target_object() {
=======================================
--- /branches/bleeding_edge/src/mips/assembler-mips.h Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/mips/assembler-mips.h Wed Aug 6 13:56:58 2014 UTC
@@ -511,6 +511,9 @@
   // of that call in the instruction stream.
   inline static Address target_address_from_return_address(Address pc);

+  // Return the code target address of the patch debug break slot
+  inline static Address break_address_from_return_address(Address pc);
+
   static void JumpLabelToJumpRegister(Address pc);

   static void QuietNaN(HeapObject* nan);
=======================================
--- /branches/bleeding_edge/src/mips64/assembler-mips64-inl.h Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/mips64/assembler-mips64-inl.h Wed Aug 6 13:56:58 2014 UTC
@@ -182,6 +182,11 @@
 Address Assembler::target_address_from_return_address(Address pc) {
   return pc - kCallTargetAddressOffset;
 }
+
+
+Address Assembler::break_address_from_return_address(Address pc) {
+  return pc - Assembler::kPatchDebugBreakSlotReturnOffset;
+}


 Object* RelocInfo::target_object() {
=======================================
--- /branches/bleeding_edge/src/mips64/assembler-mips64.h Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/mips64/assembler-mips64.h Wed Aug 6 13:56:58 2014 UTC
@@ -512,6 +512,9 @@
   // of that call in the instruction stream.
   inline static Address target_address_from_return_address(Address pc);

+  // Return the code target address of the patch debug break slot
+  inline static Address break_address_from_return_address(Address pc);
+
   static void JumpLabelToJumpRegister(Address pc);

   static void QuietNaN(HeapObject* nan);
=======================================
--- /branches/bleeding_edge/src/x64/assembler-x64-inl.h Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/x64/assembler-x64-inl.h Wed Aug 6 13:56:58 2014 UTC
@@ -204,6 +204,11 @@
 Address Assembler::target_address_from_return_address(Address pc) {
   return pc - kCallTargetAddressOffset;
 }
+
+
+Address Assembler::break_address_from_return_address(Address pc) {
+  return pc - Assembler::kPatchDebugBreakSlotReturnOffset;
+}


 Handle<Object> Assembler::code_target_object_handle_at(Address pc) {
=======================================
--- /branches/bleeding_edge/src/x64/assembler-x64.h Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/x64/assembler-x64.h Wed Aug 6 13:56:58 2014 UTC
@@ -539,6 +539,9 @@
   // of that call in the instruction stream.
   static inline Address target_address_from_return_address(Address pc);

+  // Return the code target address of the patch debug break slot
+  inline static Address break_address_from_return_address(Address pc);
+
   // This sets the branch destination (which is in the instruction on x64).
   // This is for calls and branches within generated code.
   inline static void deserialization_set_special_target_at(
=======================================
--- /branches/bleeding_edge/src/x87/assembler-x87-inl.h Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/x87/assembler-x87-inl.h Wed Aug 6 13:56:58 2014 UTC
@@ -481,6 +481,11 @@
 Address Assembler::target_address_from_return_address(Address pc) {
   return pc - kCallTargetAddressOffset;
 }
+
+
+Address Assembler::break_address_from_return_address(Address pc) {
+  return pc - Assembler::kPatchDebugBreakSlotReturnOffset;
+}


 Displacement Assembler::disp_at(Label* L) {
=======================================
--- /branches/bleeding_edge/src/x87/assembler-x87.h Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/x87/assembler-x87.h Wed Aug 6 13:56:58 2014 UTC
@@ -508,6 +508,9 @@
   // of that call in the instruction stream.
   inline static Address target_address_from_return_address(Address pc);

+  // Return the code target address of the patch debug break slot
+  inline static Address break_address_from_return_address(Address pc);
+
   // This sets the branch destination (which is in the instruction on x86).
   // This is for calls and branches within generated code.
   inline static void deserialization_set_special_target_at(

--
--
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/d/optout.

Reply via email to