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). | |
danno
2013/08/02 14:01:20
I am not sure that it is help to include "Scratch"
haitao.feng
2013/08/02 15:10:56
If the register number is less than 8, then the ca
| |
583 static const int kCallScratchRegisterInstructionSize = 3; | |
584 // The length of call(Immediate32). | |
585 static const int kShortCallInstructionLength = 5; | |
danno
2013/08/02 14:01:20
Unify to either "...Length" or "...Size". I think
haitao.feng
2013/08/02 15:10:56
Done.
| |
586 // The length of movq(kScratchRegister, address). | |
587 static const int kMoveAddressIntoScratchRegisterInstructionSize = | |
588 2 + kPointerSize; | |
589 // The length of movq(kScratchRegister, address) and call(kScratchRegister). | |
590 static const int kCallSequenceLength = | |
591 kMoveAddressIntoScratchRegisterInstructionSize + | |
592 kCallScratchRegisterInstructionSize; | |
593 | |
594 // The js return and debug break slot must be able to contain an indirect | |
595 // call sequence, 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 kJSReturnSequenceLength = kCallSequenceLength; | |
598 static const int kDebugBreakSlotLength = kCallSequenceLength; | |
haitao.feng
2013/08/02 04:41:17
It seems that we could use short call and RUNTIME_
| |
599 static const int kPatchDebugBreakSlotReturnOffset = kCallTargetAddressOffset; | |
582 // Distance between the start of the JS return sequence and where the | 600 // Distance between the start of the JS return sequence and where the |
583 // 32-bit displacement of a near call would be, relative to the pushed | 601 // 32-bit displacement of a short call would be. The short call is from |
584 // return address. TODO: Use return sequence length instead. | 602 // SetDebugBreakAtIC from debug-x64.cc. |
585 // Should equal Debug::kX64JSReturnSequenceLength - kCallTargetAddressOffset; | 603 static const int kPatchReturnSequenceAddressOffset = |
586 static const int kPatchReturnSequenceAddressOffset = 13 - 4; | 604 kJSReturnSequenceLength - kPatchDebugBreakSlotReturnOffset; |
587 // Distance between start of patched debug break slot and where the | 605 // Distance between the start of the JS return sequence and where the |
588 // 32-bit displacement of a near call would be, relative to the pushed | 606 // 32-bit displacement of a short call would be. The short call is from |
589 // return address. TODO: Use return sequence length instead. | 607 // SetDebugBreakAtIC from debug-x64.cc. |
590 // Should equal Debug::kX64JSReturnSequenceLength - kCallTargetAddressOffset; | 608 static const int kPatchDebugBreakSlotAddressOffset = |
591 static const int kPatchDebugBreakSlotAddressOffset = 13 - 4; | 609 kDebugBreakSlotLength - kPatchDebugBreakSlotReturnOffset; |
592 // TODO(X64): Rename this, removing the "Real", after changing the above. | 610 static const int kRealPatchReturnSequenceAddressOffset = |
593 static const int kRealPatchReturnSequenceAddressOffset = 2; | 611 kMoveAddressIntoScratchRegisterInstructionSize - kPointerSize; |
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; | |
600 static const int kShortCallInstructionLength = 5; | |
601 static const int kPatchDebugBreakSlotReturnOffset = 4; | |
602 | |
603 // The debug break slot must be able to contain a call instruction. | |
604 static const int kDebugBreakSlotLength = kCallInstructionLength; | |
605 | 612 |
606 // One byte opcode for test eax,0xXXXXXXXX. | 613 // One byte opcode for test eax,0xXXXXXXXX. |
607 static const byte kTestEaxByte = 0xA9; | 614 static const byte kTestEaxByte = 0xA9; |
608 // One byte opcode for test al, 0xXX. | 615 // One byte opcode for test al, 0xXX. |
609 static const byte kTestAlByte = 0xA8; | 616 static const byte kTestAlByte = 0xA8; |
610 // One byte opcode for nop. | 617 // One byte opcode for nop. |
611 static const byte kNopByte = 0x90; | 618 static const byte kNopByte = 0x90; |
612 | 619 |
613 // One byte prefix for a short conditional jump. | 620 // One byte prefix for a short conditional jump. |
614 static const byte kJccShortPrefix = 0x70; | 621 static const byte kJccShortPrefix = 0x70; |
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1652 private: | 1659 private: |
1653 Assembler* assembler_; | 1660 Assembler* assembler_; |
1654 #ifdef DEBUG | 1661 #ifdef DEBUG |
1655 int space_before_; | 1662 int space_before_; |
1656 #endif | 1663 #endif |
1657 }; | 1664 }; |
1658 | 1665 |
1659 } } // namespace v8::internal | 1666 } } // namespace v8::internal |
1660 | 1667 |
1661 #endif // V8_X64_ASSEMBLER_X64_H_ | 1668 #endif // V8_X64_ASSEMBLER_X64_H_ |
OLD | NEW |