OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 *reinterpret_cast<Address*>(instruction_payload) = target; | 572 *reinterpret_cast<Address*>(instruction_payload) = target; |
573 } | 573 } |
574 | 574 |
575 inline Handle<Object> code_target_object_handle_at(Address pc); | 575 inline Handle<Object> code_target_object_handle_at(Address pc); |
576 inline Address runtime_entry_at(Address pc); | 576 inline Address runtime_entry_at(Address pc); |
577 // Number of bytes taken up by the branch target in the code. | 577 // Number of bytes taken up by the branch target in the code. |
578 static const int kSpecialTargetSize = 4; // Use 32-bit displacement. | 578 static const int kSpecialTargetSize = 4; // Use 32-bit displacement. |
579 // Distance between the address of the code target in the call instruction | 579 // Distance between the address of the code target in the call instruction |
580 // and the return address pushed on the stack. | 580 // and the return address pushed on the stack. |
581 static const int kCallTargetAddressOffset = 4; // Use 32-bit displacement. | 581 static const int kCallTargetAddressOffset = 4; // Use 32-bit displacement. |
582 // The length of call(kScratchRegister). | 582 // Distance between the start of the JS return sequence and where the |
583 static const int kCallScratchRegisterInstructionLength = 3; | 583 // 32-bit displacement of a near call would be, relative to the pushed |
584 // The length of call(Immediate32). | 584 // return address. TODO: Use return sequence length instead. |
| 585 // Should equal Debug::kX64JSReturnSequenceLength - kCallTargetAddressOffset; |
| 586 static const int kPatchReturnSequenceAddressOffset = 13 - 4; |
| 587 // Distance between start of patched debug break slot and where the |
| 588 // 32-bit displacement of a near call would be, relative to the pushed |
| 589 // return address. TODO: Use return sequence length instead. |
| 590 // Should equal Debug::kX64JSReturnSequenceLength - kCallTargetAddressOffset; |
| 591 static const int kPatchDebugBreakSlotAddressOffset = 13 - 4; |
| 592 // TODO(X64): Rename this, removing the "Real", after changing the above. |
| 593 static const int kRealPatchReturnSequenceAddressOffset = 2; |
| 594 |
| 595 // Some x64 JS code is padded with int3 to make it large |
| 596 // enough to hold an instruction when the debugger patches it. |
| 597 static const int kJumpInstructionLength = 13; |
| 598 static const int kCallInstructionLength = 13; |
| 599 static const int kJSReturnSequenceLength = 13; |
585 static const int kShortCallInstructionLength = 5; | 600 static const int kShortCallInstructionLength = 5; |
586 // The length of movq(kScratchRegister, address). | 601 static const int kPatchDebugBreakSlotReturnOffset = 4; |
587 static const int kMoveAddressIntoScratchRegisterInstructionLength = | |
588 2 + kPointerSize; | |
589 // The length of movq(kScratchRegister, address) and call(kScratchRegister). | |
590 static const int kCallSequenceLength = | |
591 kMoveAddressIntoScratchRegisterInstructionLength + | |
592 kCallScratchRegisterInstructionLength; | |
593 | 602 |
594 // The js return and debug break slot must be able to contain an indirect | 603 // The debug break slot must be able to contain a call instruction. |
595 // call sequence, some x64 JS code is padded with int3 to make it large | 604 static const int kDebugBreakSlotLength = kCallInstructionLength; |
596 // enough to hold an instruction when the debugger patches it. | |
597 static const int kJSReturnSequenceLength = kCallSequenceLength; | |
598 static const int kDebugBreakSlotLength = kCallSequenceLength; | |
599 static const int kPatchDebugBreakSlotReturnOffset = kCallTargetAddressOffset; | |
600 // Distance between the start of the JS return sequence and where the | |
601 // 32-bit displacement of a short call would be. The short call is from | |
602 // SetDebugBreakAtIC from debug-x64.cc. | |
603 static const int kPatchReturnSequenceAddressOffset = | |
604 kJSReturnSequenceLength - kPatchDebugBreakSlotReturnOffset; | |
605 // Distance between the start of the JS return sequence and where the | |
606 // 32-bit displacement of a short call would be. The short call is from | |
607 // SetDebugBreakAtIC from debug-x64.cc. | |
608 static const int kPatchDebugBreakSlotAddressOffset = | |
609 kDebugBreakSlotLength - kPatchDebugBreakSlotReturnOffset; | |
610 static const int kRealPatchReturnSequenceAddressOffset = | |
611 kMoveAddressIntoScratchRegisterInstructionLength - kPointerSize; | |
612 | 605 |
613 // One byte opcode for test eax,0xXXXXXXXX. | 606 // One byte opcode for test eax,0xXXXXXXXX. |
614 static const byte kTestEaxByte = 0xA9; | 607 static const byte kTestEaxByte = 0xA9; |
615 // One byte opcode for test al, 0xXX. | 608 // One byte opcode for test al, 0xXX. |
616 static const byte kTestAlByte = 0xA8; | 609 static const byte kTestAlByte = 0xA8; |
617 // One byte opcode for nop. | 610 // One byte opcode for nop. |
618 static const byte kNopByte = 0x90; | 611 static const byte kNopByte = 0x90; |
619 | 612 |
620 // One byte prefix for a short conditional jump. | 613 // One byte prefix for a short conditional jump. |
621 static const byte kJccShortPrefix = 0x70; | 614 static const byte kJccShortPrefix = 0x70; |
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1659 private: | 1652 private: |
1660 Assembler* assembler_; | 1653 Assembler* assembler_; |
1661 #ifdef DEBUG | 1654 #ifdef DEBUG |
1662 int space_before_; | 1655 int space_before_; |
1663 #endif | 1656 #endif |
1664 }; | 1657 }; |
1665 | 1658 |
1666 } } // namespace v8::internal | 1659 } } // namespace v8::internal |
1667 | 1660 |
1668 #endif // V8_X64_ASSEMBLER_X64_H_ | 1661 #endif // V8_X64_ASSEMBLER_X64_H_ |
OLD | NEW |