Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems |
|
Michael Starzinger
2012/10/10 14:19:29
Looks like a typo?
danno
2012/10/17 10:04:44
Done.
| |
| 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 // |
| 11 // - Redistribution in binary form must reproduce the above copyright | 11 // - Redistribution in binary form must reproduce the above copyright |
| (...skipping 582 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 inline static 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.
| |
| 605 | |
| 604 // This sets the branch destination (which is in the instruction on x86). | 606 // This sets the branch destination (which is in the instruction on x86). |
| 605 // This is for calls and branches within generated code. | 607 // This is for calls and branches within generated code. |
| 606 inline static void deserialization_set_special_target_at( | 608 inline static void deserialization_set_special_target_at( |
| 607 Address instruction_payload, Address target) { | 609 Address instruction_payload, Address target) { |
| 608 set_target_address_at(instruction_payload, target); | 610 set_target_address_at(instruction_payload, target); |
| 609 } | 611 } |
| 610 | 612 |
| 611 // This sets the branch destination (which is in the instruction on x86). | 613 // This sets the branch destination (which is in the instruction on x86). |
| 612 // This is for calls and branches to runtime code. | 614 // This is for calls and branches to runtime code. |
| 613 inline static void set_external_target_at(Address instruction_payload, | 615 inline static void set_external_target_at(Address instruction_payload, |
| 614 Address target) { | 616 Address target) { |
| 615 set_target_address_at(instruction_payload, target); | 617 set_target_address_at(instruction_payload, target); |
| 616 } | 618 } |
| 617 | 619 |
| 618 static const int kSpecialTargetSize = kPointerSize; | 620 static const int kSpecialTargetSize = kPointerSize; |
| 619 | 621 |
| 620 // Distance between the address of the code target in the call instruction | 622 // Distance between the address of the code target in the call instruction |
| 621 // and the return address | 623 // and the return address |
| 622 static const int kCallTargetAddressOffset = kPointerSize; | 624 static const int kCallTargetAddressOffset = kPointerSize; |
| 623 // Distance between start of patched return sequence and the emitted address | 625 // Distance between start of patched return sequence and the emitted address |
| 624 // to jump to. | 626 // to jump to. |
| 625 static const int kPatchReturnSequenceAddressOffset = 1; // JMP imm32. | 627 static const int kPatchReturnSequenceAddressOffset = 1; // JMP imm32. |
| 626 | 628 |
| 627 // Distance between start of patched debug break slot and the emitted address | 629 // Distance between start of patched debug break slot and the emitted address |
| 628 // to jump to. | 630 // to jump to. |
| 629 static const int kPatchDebugBreakSlotAddressOffset = 1; // JMP imm32. | 631 static const int kPatchDebugBreakSlotAddressOffset = 1; // JMP imm32. |
| 630 | 632 |
| 631 static const int kCallInstructionLength = 5; | 633 static const int kCallInstructionLength = 5; |
| 634 static const int kPatchDebugBreakSlotReturnOffset = kPointerSize; | |
| 632 static const int kJSReturnSequenceLength = 6; | 635 static const int kJSReturnSequenceLength = 6; |
| 633 | 636 |
| 634 // The debug break slot must be able to contain a call instruction. | 637 // The debug break slot must be able to contain a call instruction. |
| 635 static const int kDebugBreakSlotLength = kCallInstructionLength; | 638 static const int kDebugBreakSlotLength = kCallInstructionLength; |
| 636 | 639 |
| 637 // One byte opcode for test al, 0xXX. | 640 // One byte opcode for test al, 0xXX. |
| 638 static const byte kTestAlByte = 0xA8; | 641 static const byte kTestAlByte = 0xA8; |
| 639 // One byte opcode for nop. | 642 // One byte opcode for nop. |
| 640 static const byte kNopByte = 0x90; | 643 static const byte kNopByte = 0x90; |
| 641 | 644 |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1224 private: | 1227 private: |
| 1225 Assembler* assembler_; | 1228 Assembler* assembler_; |
| 1226 #ifdef DEBUG | 1229 #ifdef DEBUG |
| 1227 int space_before_; | 1230 int space_before_; |
| 1228 #endif | 1231 #endif |
| 1229 }; | 1232 }; |
| 1230 | 1233 |
| 1231 } } // namespace v8::internal | 1234 } } // namespace v8::internal |
| 1232 | 1235 |
| 1233 #endif // V8_IA32_ASSEMBLER_IA32_H_ | 1236 #endif // V8_IA32_ASSEMBLER_IA32_H_ |
| OLD | NEW |