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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 // TODO(vitalyr): the assembler does not need an isolate. | 617 // TODO(vitalyr): the assembler does not need an isolate. |
618 Assembler(Isolate* isolate, void* buffer, int buffer_size); | 618 Assembler(Isolate* isolate, void* buffer, int buffer_size); |
619 virtual ~Assembler() { } | 619 virtual ~Assembler() { } |
620 | 620 |
621 // GetCode emits any pending (non-emitted) code and fills the descriptor | 621 // GetCode emits any pending (non-emitted) code and fills the descriptor |
622 // desc. GetCode() is idempotent; it returns the same result if no other | 622 // desc. GetCode() is idempotent; it returns the same result if no other |
623 // Assembler functions are invoked in between GetCode() calls. | 623 // Assembler functions are invoked in between GetCode() calls. |
624 void GetCode(CodeDesc* desc); | 624 void GetCode(CodeDesc* desc); |
625 | 625 |
626 // Read/Modify the code target in the branch/call instruction at pc. | 626 // Read/Modify the code target in the branch/call instruction at pc. |
627 inline static Address target_address_at(Address pc); | 627 inline static Address target_address_at(Address pc, |
628 inline static void set_target_address_at(Address pc, Address target); | 628 ConstantPoolArray* constant_pool); |
| 629 inline static void set_target_address_at(Address pc, |
| 630 ConstantPoolArray* constant_pool, |
| 631 Address target); |
| 632 static inline Address target_address_at(Address pc, Code* code) { |
| 633 return target_address_at(pc, code->constant_pool()); |
| 634 } |
| 635 static inline void set_target_address_at(Address pc, |
| 636 Code* code, |
| 637 Address target) { |
| 638 set_target_address_at(pc, code->constant_pool(), target); |
| 639 } |
629 | 640 |
630 // Return the code target address at a call site from the return address | 641 // Return the code target address at a call site from the return address |
631 // of that call in the instruction stream. | 642 // of that call in the instruction stream. |
632 inline static Address target_address_from_return_address(Address pc); | 643 inline static Address target_address_from_return_address(Address pc); |
633 | 644 |
634 // This sets the branch destination (which is in the instruction on x86). | 645 // This sets the branch destination (which is in the instruction on x86). |
635 // This is for calls and branches within generated code. | 646 // This is for calls and branches within generated code. |
636 inline static void deserialization_set_special_target_at( | 647 inline static void deserialization_set_special_target_at( |
637 Address instruction_payload, Address target) { | 648 Address instruction_payload, Code* code, Address target) { |
638 set_target_address_at(instruction_payload, target); | 649 set_target_address_at(instruction_payload, code, target); |
639 } | 650 } |
640 | 651 |
641 static const int kSpecialTargetSize = kPointerSize; | 652 static const int kSpecialTargetSize = kPointerSize; |
642 | 653 |
643 // Distance between the address of the code target in the call instruction | 654 // Distance between the address of the code target in the call instruction |
644 // and the return address | 655 // and the return address |
645 static const int kCallTargetAddressOffset = kPointerSize; | 656 static const int kCallTargetAddressOffset = kPointerSize; |
646 // Distance between start of patched return sequence and the emitted address | 657 // Distance between start of patched return sequence and the emitted address |
647 // to jump to. | 658 // to jump to. |
648 static const int kPatchReturnSequenceAddressOffset = 1; // JMP imm32. | 659 static const int kPatchReturnSequenceAddressOffset = 1; // JMP imm32. |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1269 private: | 1280 private: |
1270 Assembler* assembler_; | 1281 Assembler* assembler_; |
1271 #ifdef DEBUG | 1282 #ifdef DEBUG |
1272 int space_before_; | 1283 int space_before_; |
1273 #endif | 1284 #endif |
1274 }; | 1285 }; |
1275 | 1286 |
1276 } } // namespace v8::internal | 1287 } } // namespace v8::internal |
1277 | 1288 |
1278 #endif // V8_IA32_ASSEMBLER_IA32_H_ | 1289 #endif // V8_IA32_ASSEMBLER_IA32_H_ |
OLD | NEW |