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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 | 594 |
595 // GetCode emits any pending (non-emitted) code and fills the descriptor | 595 // GetCode emits any pending (non-emitted) code and fills the descriptor |
596 // desc. GetCode() is idempotent; it returns the same result if no other | 596 // desc. GetCode() is idempotent; it returns the same result if no other |
597 // Assembler functions are invoked in between GetCode() calls. | 597 // Assembler functions are invoked in between GetCode() calls. |
598 void GetCode(CodeDesc* desc); | 598 void GetCode(CodeDesc* desc); |
599 | 599 |
600 // Read/Modify the code target in the branch/call instruction at pc. | 600 // Read/Modify the code target in the branch/call instruction at pc. |
601 inline static Address target_address_at(Address pc); | 601 inline static Address target_address_at(Address pc); |
602 inline static void set_target_address_at(Address pc, Address target); | 602 inline static void set_target_address_at(Address pc, Address target); |
603 | 603 |
| 604 // Return the code target address at a call site from the return address |
| 605 // of that call in the instruction stream. |
| 606 inline static Address target_address_from_return_address(Address pc); |
| 607 |
604 // This sets the branch destination (which is in the instruction on x86). | 608 // This sets the branch destination (which is in the instruction on x86). |
605 // This is for calls and branches within generated code. | 609 // This is for calls and branches within generated code. |
606 inline static void deserialization_set_special_target_at( | 610 inline static void deserialization_set_special_target_at( |
607 Address instruction_payload, Address target) { | 611 Address instruction_payload, Address target) { |
608 set_target_address_at(instruction_payload, target); | 612 set_target_address_at(instruction_payload, target); |
609 } | 613 } |
610 | 614 |
611 // This sets the branch destination (which is in the instruction on x86). | 615 // This sets the branch destination (which is in the instruction on x86). |
612 // This is for calls and branches to runtime code. | 616 // This is for calls and branches to runtime code. |
613 inline static void set_external_target_at(Address instruction_payload, | 617 inline static void set_external_target_at(Address instruction_payload, |
614 Address target) { | 618 Address target) { |
615 set_target_address_at(instruction_payload, target); | 619 set_target_address_at(instruction_payload, target); |
616 } | 620 } |
617 | 621 |
618 static const int kSpecialTargetSize = kPointerSize; | 622 static const int kSpecialTargetSize = kPointerSize; |
619 | 623 |
620 // Distance between the address of the code target in the call instruction | 624 // Distance between the address of the code target in the call instruction |
621 // and the return address | 625 // and the return address |
622 static const int kCallTargetAddressOffset = kPointerSize; | 626 static const int kCallTargetAddressOffset = kPointerSize; |
623 // Distance between start of patched return sequence and the emitted address | 627 // Distance between start of patched return sequence and the emitted address |
624 // to jump to. | 628 // to jump to. |
625 static const int kPatchReturnSequenceAddressOffset = 1; // JMP imm32. | 629 static const int kPatchReturnSequenceAddressOffset = 1; // JMP imm32. |
626 | 630 |
627 // Distance between start of patched debug break slot and the emitted address | 631 // Distance between start of patched debug break slot and the emitted address |
628 // to jump to. | 632 // to jump to. |
629 static const int kPatchDebugBreakSlotAddressOffset = 1; // JMP imm32. | 633 static const int kPatchDebugBreakSlotAddressOffset = 1; // JMP imm32. |
630 | 634 |
631 static const int kCallInstructionLength = 5; | 635 static const int kCallInstructionLength = 5; |
| 636 static const int kPatchDebugBreakSlotReturnOffset = kPointerSize; |
632 static const int kJSReturnSequenceLength = 6; | 637 static const int kJSReturnSequenceLength = 6; |
633 | 638 |
634 // The debug break slot must be able to contain a call instruction. | 639 // The debug break slot must be able to contain a call instruction. |
635 static const int kDebugBreakSlotLength = kCallInstructionLength; | 640 static const int kDebugBreakSlotLength = kCallInstructionLength; |
636 | 641 |
637 // One byte opcode for test al, 0xXX. | 642 // One byte opcode for test al, 0xXX. |
638 static const byte kTestAlByte = 0xA8; | 643 static const byte kTestAlByte = 0xA8; |
639 // One byte opcode for nop. | 644 // One byte opcode for nop. |
640 static const byte kNopByte = 0x90; | 645 static const byte kNopByte = 0x90; |
641 | 646 |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 private: | 1229 private: |
1225 Assembler* assembler_; | 1230 Assembler* assembler_; |
1226 #ifdef DEBUG | 1231 #ifdef DEBUG |
1227 int space_before_; | 1232 int space_before_; |
1228 #endif | 1233 #endif |
1229 }; | 1234 }; |
1230 | 1235 |
1231 } } // namespace v8::internal | 1236 } } // namespace v8::internal |
1232 | 1237 |
1233 #endif // V8_IA32_ASSEMBLER_IA32_H_ | 1238 #endif // V8_IA32_ASSEMBLER_IA32_H_ |
OLD | NEW |