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 ConstantPoolArray* constant_pool); | 628 inline static void set_target_address_at(Address pc, Address target); |
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 } | |
640 | 629 |
641 // Return the code target address at a call site from the return address | 630 // Return the code target address at a call site from the return address |
642 // of that call in the instruction stream. | 631 // of that call in the instruction stream. |
643 inline static Address target_address_from_return_address(Address pc); | 632 inline static Address target_address_from_return_address(Address pc); |
644 | 633 |
645 // This sets the branch destination (which is in the instruction on x86). | 634 // This sets the branch destination (which is in the instruction on x86). |
646 // This is for calls and branches within generated code. | 635 // This is for calls and branches within generated code. |
647 inline static void deserialization_set_special_target_at( | 636 inline static void deserialization_set_special_target_at( |
648 Address instruction_payload, Code* code, Address target) { | 637 Address instruction_payload, Address target) { |
649 set_target_address_at(instruction_payload, code, target); | 638 set_target_address_at(instruction_payload, target); |
650 } | 639 } |
651 | 640 |
652 static const int kSpecialTargetSize = kPointerSize; | 641 static const int kSpecialTargetSize = kPointerSize; |
653 | 642 |
654 // Distance between the address of the code target in the call instruction | 643 // Distance between the address of the code target in the call instruction |
655 // and the return address | 644 // and the return address |
656 static const int kCallTargetAddressOffset = kPointerSize; | 645 static const int kCallTargetAddressOffset = kPointerSize; |
657 // Distance between start of patched return sequence and the emitted address | 646 // Distance between start of patched return sequence and the emitted address |
658 // to jump to. | 647 // to jump to. |
659 static const int kPatchReturnSequenceAddressOffset = 1; // JMP imm32. | 648 static const int kPatchReturnSequenceAddressOffset = 1; // JMP imm32. |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 private: | 1269 private: |
1281 Assembler* assembler_; | 1270 Assembler* assembler_; |
1282 #ifdef DEBUG | 1271 #ifdef DEBUG |
1283 int space_before_; | 1272 int space_before_; |
1284 #endif | 1273 #endif |
1285 }; | 1274 }; |
1286 | 1275 |
1287 } } // namespace v8::internal | 1276 } } // namespace v8::internal |
1288 | 1277 |
1289 #endif // V8_IA32_ASSEMBLER_IA32_H_ | 1278 #endif // V8_IA32_ASSEMBLER_IA32_H_ |
OLD | NEW |