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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 // Assembler functions are invoked in between GetCode() calls. | 528 // Assembler functions are invoked in between GetCode() calls. |
529 void GetCode(CodeDesc* desc); | 529 void GetCode(CodeDesc* desc); |
530 | 530 |
531 // Read/Modify the code target in the relative branch/call instruction at pc. | 531 // Read/Modify the code target in the relative branch/call instruction at pc. |
532 // On the x64 architecture, we use relative jumps with a 32-bit displacement | 532 // On the x64 architecture, we use relative jumps with a 32-bit displacement |
533 // to jump to other Code objects in the Code space in the heap. | 533 // to jump to other Code objects in the Code space in the heap. |
534 // Jumps to C functions are done indirectly through a 64-bit register holding | 534 // Jumps to C functions are done indirectly through a 64-bit register holding |
535 // the absolute address of the target. | 535 // the absolute address of the target. |
536 // These functions convert between absolute Addresses of Code objects and | 536 // These functions convert between absolute Addresses of Code objects and |
537 // the relative displacements stored in the code. | 537 // the relative displacements stored in the code. |
538 static inline Address target_address_at(Address pc, Address constant_pool); | 538 static inline Address target_address_at(Address pc, |
539 static inline void set_target_address_at( | 539 ConstantPoolArray* constant_pool); |
540 Address pc, Address constant_pool, Address target, | 540 static inline void set_target_address_at(Address pc, |
541 ICacheFlushMode icache_flush_mode = FLUSH_ICACHE_IF_NEEDED); | 541 ConstantPoolArray* constant_pool, |
| 542 Address target, |
| 543 ICacheFlushMode icache_flush_mode = |
| 544 FLUSH_ICACHE_IF_NEEDED) ; |
542 static inline Address target_address_at(Address pc, Code* code) { | 545 static inline Address target_address_at(Address pc, Code* code) { |
543 Address constant_pool = code ? code->constant_pool() : NULL; | 546 ConstantPoolArray* constant_pool = code ? code->constant_pool() : NULL; |
544 return target_address_at(pc, constant_pool); | 547 return target_address_at(pc, constant_pool); |
545 } | 548 } |
546 static inline void set_target_address_at(Address pc, | 549 static inline void set_target_address_at(Address pc, |
547 Code* code, | 550 Code* code, |
548 Address target, | 551 Address target, |
549 ICacheFlushMode icache_flush_mode = | 552 ICacheFlushMode icache_flush_mode = |
550 FLUSH_ICACHE_IF_NEEDED) { | 553 FLUSH_ICACHE_IF_NEEDED) { |
551 Address constant_pool = code ? code->constant_pool() : NULL; | 554 ConstantPoolArray* constant_pool = code ? code->constant_pool() : NULL; |
552 set_target_address_at(pc, constant_pool, target, icache_flush_mode); | 555 set_target_address_at(pc, constant_pool, target, icache_flush_mode); |
553 } | 556 } |
554 | 557 |
555 // Return the code target address at a call site from the return address | 558 // Return the code target address at a call site from the return address |
556 // of that call in the instruction stream. | 559 // of that call in the instruction stream. |
557 static inline Address target_address_from_return_address(Address pc); | 560 static inline Address target_address_from_return_address(Address pc); |
558 | 561 |
559 // Return the code target address of the patch debug break slot | 562 // Return the code target address of the patch debug break slot |
560 inline static Address break_address_from_return_address(Address pc); | 563 inline static Address break_address_from_return_address(Address pc); |
561 | 564 |
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1618 void RecordDebugBreakSlot(); | 1621 void RecordDebugBreakSlot(); |
1619 | 1622 |
1620 // Record a comment relocation entry that can be used by a disassembler. | 1623 // Record a comment relocation entry that can be used by a disassembler. |
1621 // Use --code-comments to enable. | 1624 // Use --code-comments to enable. |
1622 void RecordComment(const char* msg); | 1625 void RecordComment(const char* msg); |
1623 | 1626 |
1624 // Record a deoptimization reason that can be used by a log or cpu profiler. | 1627 // Record a deoptimization reason that can be used by a log or cpu profiler. |
1625 // Use --trace-deopt to enable. | 1628 // Use --trace-deopt to enable. |
1626 void RecordDeoptReason(const int reason, const SourcePosition position); | 1629 void RecordDeoptReason(const int reason, const SourcePosition position); |
1627 | 1630 |
1628 void PatchConstantPoolAccessInstruction(int pc_offset, int offset, | 1631 // Allocate a constant pool of the correct size for the generated code. |
1629 ConstantPoolEntry::Access access, | 1632 Handle<ConstantPoolArray> NewConstantPool(Isolate* isolate); |
1630 ConstantPoolEntry::Type type) { | 1633 |
1631 // No embedded constant pool support. | 1634 // Generate the constant pool for the generated code. |
1632 UNREACHABLE(); | 1635 void PopulateConstantPool(ConstantPoolArray* constant_pool); |
1633 } | |
1634 | 1636 |
1635 // Writes a single word of data in the code stream. | 1637 // Writes a single word of data in the code stream. |
1636 // Used for inline tables, e.g., jump-tables. | 1638 // Used for inline tables, e.g., jump-tables. |
1637 void db(uint8_t data); | 1639 void db(uint8_t data); |
1638 void dd(uint32_t data); | 1640 void dd(uint32_t data); |
1639 void dq(uint64_t data); | |
1640 void dp(uintptr_t data) { dq(data); } | |
1641 void dq(Label* label); | 1641 void dq(Label* label); |
1642 | 1642 |
1643 PositionsRecorder* positions_recorder() { return &positions_recorder_; } | 1643 PositionsRecorder* positions_recorder() { return &positions_recorder_; } |
1644 | 1644 |
1645 // Check if there is less than kGap bytes available in the buffer. | 1645 // Check if there is less than kGap bytes available in the buffer. |
1646 // If this is the case, we need to grow the buffer before emitting | 1646 // If this is the case, we need to grow the buffer before emitting |
1647 // an instruction or relocation information. | 1647 // an instruction or relocation information. |
1648 inline bool buffer_overflow() const { | 1648 inline bool buffer_overflow() const { |
1649 return pc_ >= reloc_info_writer.pos() - kGap; | 1649 return pc_ >= reloc_info_writer.pos() - kGap; |
1650 } | 1650 } |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2156 private: | 2156 private: |
2157 Assembler* assembler_; | 2157 Assembler* assembler_; |
2158 #ifdef DEBUG | 2158 #ifdef DEBUG |
2159 int space_before_; | 2159 int space_before_; |
2160 #endif | 2160 #endif |
2161 }; | 2161 }; |
2162 | 2162 |
2163 } } // namespace v8::internal | 2163 } } // namespace v8::internal |
2164 | 2164 |
2165 #endif // V8_X64_ASSEMBLER_X64_H_ | 2165 #endif // V8_X64_ASSEMBLER_X64_H_ |
OLD | NEW |