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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
574 // Read/Modify the code target in the relative branch/call instruction at pc. | 574 // Read/Modify the code target in the relative branch/call instruction at pc. |
575 // On the x64 architecture, we use relative jumps with a 32-bit displacement | 575 // On the x64 architecture, we use relative jumps with a 32-bit displacement |
576 // to jump to other Code objects in the Code space in the heap. | 576 // to jump to other Code objects in the Code space in the heap. |
577 // Jumps to C functions are done indirectly through a 64-bit register holding | 577 // Jumps to C functions are done indirectly through a 64-bit register holding |
578 // the absolute address of the target. | 578 // the absolute address of the target. |
579 // These functions convert between absolute Addresses of Code objects and | 579 // These functions convert between absolute Addresses of Code objects and |
580 // the relative displacements stored in the code. | 580 // the relative displacements stored in the code. |
581 static inline Address target_address_at(Address pc); | 581 static inline Address target_address_at(Address pc); |
582 static inline void set_target_address_at(Address pc, Address target); | 582 static inline void set_target_address_at(Address pc, Address target); |
583 | 583 |
584 static inline Address target_address_from_return_address(Address pc); | |
Michael Starzinger
2012/10/10 14:19:29
See comment in ARM assembler.
danno
2012/10/17 10:04:44
Done.
| |
585 | |
584 // This sets the branch destination (which is in the instruction on x64). | 586 // This sets the branch destination (which is in the instruction on x64). |
585 // This is for calls and branches within generated code. | 587 // This is for calls and branches within generated code. |
586 inline static void deserialization_set_special_target_at( | 588 inline static void deserialization_set_special_target_at( |
587 Address instruction_payload, Address target) { | 589 Address instruction_payload, Address target) { |
588 set_target_address_at(instruction_payload, target); | 590 set_target_address_at(instruction_payload, target); |
589 } | 591 } |
590 | 592 |
591 // This sets the branch destination (which is a load instruction on x64). | 593 // This sets the branch destination (which is a load instruction on x64). |
592 // This is for calls and branches to runtime code. | 594 // This is for calls and branches to runtime code. |
593 inline static void set_external_target_at(Address instruction_payload, | 595 inline static void set_external_target_at(Address instruction_payload, |
(...skipping 19 matching lines...) Expand all Loading... | |
613 static const int kPatchDebugBreakSlotAddressOffset = 13 - 4; | 615 static const int kPatchDebugBreakSlotAddressOffset = 13 - 4; |
614 // TODO(X64): Rename this, removing the "Real", after changing the above. | 616 // TODO(X64): Rename this, removing the "Real", after changing the above. |
615 static const int kRealPatchReturnSequenceAddressOffset = 2; | 617 static const int kRealPatchReturnSequenceAddressOffset = 2; |
616 | 618 |
617 // Some x64 JS code is padded with int3 to make it large | 619 // Some x64 JS code is padded with int3 to make it large |
618 // enough to hold an instruction when the debugger patches it. | 620 // enough to hold an instruction when the debugger patches it. |
619 static const int kJumpInstructionLength = 13; | 621 static const int kJumpInstructionLength = 13; |
620 static const int kCallInstructionLength = 13; | 622 static const int kCallInstructionLength = 13; |
621 static const int kJSReturnSequenceLength = 13; | 623 static const int kJSReturnSequenceLength = 13; |
622 static const int kShortCallInstructionLength = 5; | 624 static const int kShortCallInstructionLength = 5; |
625 static const int kPatchDebugBreakSlotReturnOffset = 4; | |
623 | 626 |
624 // The debug break slot must be able to contain a call instruction. | 627 // The debug break slot must be able to contain a call instruction. |
625 static const int kDebugBreakSlotLength = kCallInstructionLength; | 628 static const int kDebugBreakSlotLength = kCallInstructionLength; |
626 | 629 |
627 // One byte opcode for test eax,0xXXXXXXXX. | 630 // One byte opcode for test eax,0xXXXXXXXX. |
628 static const byte kTestEaxByte = 0xA9; | 631 static const byte kTestEaxByte = 0xA9; |
629 // One byte opcode for test al, 0xXX. | 632 // One byte opcode for test al, 0xXX. |
630 static const byte kTestAlByte = 0xA8; | 633 static const byte kTestAlByte = 0xA8; |
631 // One byte opcode for nop. | 634 // One byte opcode for nop. |
632 static const byte kNopByte = 0x90; | 635 static const byte kNopByte = 0x90; |
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1672 private: | 1675 private: |
1673 Assembler* assembler_; | 1676 Assembler* assembler_; |
1674 #ifdef DEBUG | 1677 #ifdef DEBUG |
1675 int space_before_; | 1678 int space_before_; |
1676 #endif | 1679 #endif |
1677 }; | 1680 }; |
1678 | 1681 |
1679 } } // namespace v8::internal | 1682 } } // namespace v8::internal |
1680 | 1683 |
1681 #endif // V8_X64_ASSEMBLER_X64_H_ | 1684 #endif // V8_X64_ASSEMBLER_X64_H_ |
OLD | NEW |