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