| 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 // Return the code target address at a call site from the return address |
| 585 // of that call in the instruction stream. |
| 586 static inline Address target_address_from_return_address(Address pc); |
| 587 |
| 584 // This sets the branch destination (which is in the instruction on x64). | 588 // This sets the branch destination (which is in the instruction on x64). |
| 585 // This is for calls and branches within generated code. | 589 // This is for calls and branches within generated code. |
| 586 inline static void deserialization_set_special_target_at( | 590 inline static void deserialization_set_special_target_at( |
| 587 Address instruction_payload, Address target) { | 591 Address instruction_payload, Address target) { |
| 588 set_target_address_at(instruction_payload, target); | 592 set_target_address_at(instruction_payload, target); |
| 589 } | 593 } |
| 590 | 594 |
| 591 // This sets the branch destination (which is a load instruction on x64). | 595 // This sets the branch destination (which is a load instruction on x64). |
| 592 // This is for calls and branches to runtime code. | 596 // This is for calls and branches to runtime code. |
| 593 inline static void set_external_target_at(Address instruction_payload, | 597 inline static void set_external_target_at(Address instruction_payload, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 613 static const int kPatchDebugBreakSlotAddressOffset = 13 - 4; | 617 static const int kPatchDebugBreakSlotAddressOffset = 13 - 4; |
| 614 // TODO(X64): Rename this, removing the "Real", after changing the above. | 618 // TODO(X64): Rename this, removing the "Real", after changing the above. |
| 615 static const int kRealPatchReturnSequenceAddressOffset = 2; | 619 static const int kRealPatchReturnSequenceAddressOffset = 2; |
| 616 | 620 |
| 617 // Some x64 JS code is padded with int3 to make it large | 621 // Some x64 JS code is padded with int3 to make it large |
| 618 // enough to hold an instruction when the debugger patches it. | 622 // enough to hold an instruction when the debugger patches it. |
| 619 static const int kJumpInstructionLength = 13; | 623 static const int kJumpInstructionLength = 13; |
| 620 static const int kCallInstructionLength = 13; | 624 static const int kCallInstructionLength = 13; |
| 621 static const int kJSReturnSequenceLength = 13; | 625 static const int kJSReturnSequenceLength = 13; |
| 622 static const int kShortCallInstructionLength = 5; | 626 static const int kShortCallInstructionLength = 5; |
| 627 static const int kPatchDebugBreakSlotReturnOffset = 4; |
| 623 | 628 |
| 624 // The debug break slot must be able to contain a call instruction. | 629 // The debug break slot must be able to contain a call instruction. |
| 625 static const int kDebugBreakSlotLength = kCallInstructionLength; | 630 static const int kDebugBreakSlotLength = kCallInstructionLength; |
| 626 | 631 |
| 627 // One byte opcode for test eax,0xXXXXXXXX. | 632 // One byte opcode for test eax,0xXXXXXXXX. |
| 628 static const byte kTestEaxByte = 0xA9; | 633 static const byte kTestEaxByte = 0xA9; |
| 629 // One byte opcode for test al, 0xXX. | 634 // One byte opcode for test al, 0xXX. |
| 630 static const byte kTestAlByte = 0xA8; | 635 static const byte kTestAlByte = 0xA8; |
| 631 // One byte opcode for nop. | 636 // One byte opcode for nop. |
| 632 static const byte kNopByte = 0x90; | 637 static const byte kNopByte = 0x90; |
| (...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1672 private: | 1677 private: |
| 1673 Assembler* assembler_; | 1678 Assembler* assembler_; |
| 1674 #ifdef DEBUG | 1679 #ifdef DEBUG |
| 1675 int space_before_; | 1680 int space_before_; |
| 1676 #endif | 1681 #endif |
| 1677 }; | 1682 }; |
| 1678 | 1683 |
| 1679 } } // namespace v8::internal | 1684 } } // namespace v8::internal |
| 1680 | 1685 |
| 1681 #endif // V8_X64_ASSEMBLER_X64_H_ | 1686 #endif // V8_X64_ASSEMBLER_X64_H_ |
| OLD | NEW |