Index: src/x64/assembler-x64.h |
diff --git a/src/x64/assembler-x64.h b/src/x64/assembler-x64.h |
index 07afc129dc82c76b76a5eadb2c6bd3425eb0289e..4e36b6e4bc4062ead3023e978af5e2115b7c99db 100644 |
--- a/src/x64/assembler-x64.h |
+++ b/src/x64/assembler-x64.h |
@@ -579,29 +579,36 @@ class Assembler : public AssemblerBase { |
// Distance between the address of the code target in the call instruction |
// and the return address pushed on the stack. |
static const int kCallTargetAddressOffset = 4; // Use 32-bit displacement. |
- // Distance between the start of the JS return sequence and where the |
- // 32-bit displacement of a near call would be, relative to the pushed |
- // return address. TODO: Use return sequence length instead. |
- // Should equal Debug::kX64JSReturnSequenceLength - kCallTargetAddressOffset; |
- static const int kPatchReturnSequenceAddressOffset = 13 - 4; |
- // Distance between start of patched debug break slot and where the |
- // 32-bit displacement of a near call would be, relative to the pushed |
- // return address. TODO: Use return sequence length instead. |
- // Should equal Debug::kX64JSReturnSequenceLength - kCallTargetAddressOffset; |
- static const int kPatchDebugBreakSlotAddressOffset = 13 - 4; |
- // TODO(X64): Rename this, removing the "Real", after changing the above. |
- static const int kRealPatchReturnSequenceAddressOffset = 2; |
- |
- // Some x64 JS code is padded with int3 to make it large |
- // enough to hold an instruction when the debugger patches it. |
- static const int kJumpInstructionLength = 13; |
- static const int kCallInstructionLength = 13; |
- static const int kJSReturnSequenceLength = 13; |
+ // The length of call(kScratchRegister). |
+ static const int kCallScratchRegisterInstructionLength = 3; |
+ // The length of call(Immediate32). |
static const int kShortCallInstructionLength = 5; |
- static const int kPatchDebugBreakSlotReturnOffset = 4; |
- |
- // The debug break slot must be able to contain a call instruction. |
- static const int kDebugBreakSlotLength = kCallInstructionLength; |
+ // The length of movq(kScratchRegister, address). |
+ static const int kMoveAddressIntoScratchRegisterInstructionLength = |
+ 2 + kPointerSize; |
+ // The length of movq(kScratchRegister, address) and call(kScratchRegister). |
+ static const int kCallSequenceLength = |
+ kMoveAddressIntoScratchRegisterInstructionLength + |
+ kCallScratchRegisterInstructionLength; |
+ |
+ // The js return and debug break slot must be able to contain an indirect |
+ // call sequence, some x64 JS code is padded with int3 to make it large |
+ // enough to hold an instruction when the debugger patches it. |
+ static const int kJSReturnSequenceLength = kCallSequenceLength; |
+ static const int kDebugBreakSlotLength = kCallSequenceLength; |
+ static const int kPatchDebugBreakSlotReturnOffset = kCallTargetAddressOffset; |
+ // Distance between the start of the JS return sequence and where the |
+ // 32-bit displacement of a short call would be. The short call is from |
+ // SetDebugBreakAtIC from debug-x64.cc. |
+ static const int kPatchReturnSequenceAddressOffset = |
+ kJSReturnSequenceLength - kPatchDebugBreakSlotReturnOffset; |
+ // Distance between the start of the JS return sequence and where the |
+ // 32-bit displacement of a short call would be. The short call is from |
+ // SetDebugBreakAtIC from debug-x64.cc. |
+ static const int kPatchDebugBreakSlotAddressOffset = |
+ kDebugBreakSlotLength - kPatchDebugBreakSlotReturnOffset; |
+ static const int kRealPatchReturnSequenceAddressOffset = |
+ kMoveAddressIntoScratchRegisterInstructionLength - kPointerSize; |
// One byte opcode for test eax,0xXXXXXXXX. |
static const byte kTestEaxByte = 0xA9; |