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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 } | 585 } |
586 | 586 |
587 // This sets the branch destination (which is a load instruction on x64). | 587 // This sets the branch destination (which is a load instruction on x64). |
588 // This is for calls and branches to runtime code. | 588 // This is for calls and branches to runtime code. |
589 inline static void set_external_target_at(Address instruction_payload, | 589 inline static void set_external_target_at(Address instruction_payload, |
590 Address target) { | 590 Address target) { |
591 *reinterpret_cast<Address*>(instruction_payload) = target; | 591 *reinterpret_cast<Address*>(instruction_payload) = target; |
592 } | 592 } |
593 | 593 |
594 inline Handle<Object> code_target_object_handle_at(Address pc); | 594 inline Handle<Object> code_target_object_handle_at(Address pc); |
| 595 inline Address deopt_entry_at(Address pc); |
595 // Number of bytes taken up by the branch target in the code. | 596 // Number of bytes taken up by the branch target in the code. |
596 static const int kSpecialTargetSize = 4; // Use 32-bit displacement. | 597 static const int kSpecialTargetSize = 4; // Use 32-bit displacement. |
597 // Distance between the address of the code target in the call instruction | 598 // Distance between the address of the code target in the call instruction |
598 // and the return address pushed on the stack. | 599 // and the return address pushed on the stack. |
599 static const int kCallTargetAddressOffset = 4; // Use 32-bit displacement. | 600 static const int kCallTargetAddressOffset = 4; // Use 32-bit displacement. |
600 // Distance between the start of the JS return sequence and where the | 601 // Distance between the start of the JS return sequence and where the |
601 // 32-bit displacement of a near call would be, relative to the pushed | 602 // 32-bit displacement of a near call would be, relative to the pushed |
602 // return address. TODO: Use return sequence length instead. | 603 // return address. TODO: Use return sequence length instead. |
603 // Should equal Debug::kX64JSReturnSequenceLength - kCallTargetAddressOffset; | 604 // Should equal Debug::kX64JSReturnSequenceLength - kCallTargetAddressOffset; |
604 static const int kPatchReturnSequenceAddressOffset = 13 - 4; | 605 static const int kPatchReturnSequenceAddressOffset = 13 - 4; |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 // bind(&L); // illegal: a label may be bound only once | 1204 // bind(&L); // illegal: a label may be bound only once |
1204 // | 1205 // |
1205 // Note: The same Label can be used for forward and backward branches | 1206 // Note: The same Label can be used for forward and backward branches |
1206 // but it may be bound only once. | 1207 // but it may be bound only once. |
1207 | 1208 |
1208 void bind(Label* L); // binds an unbound label L to the current code position | 1209 void bind(Label* L); // binds an unbound label L to the current code position |
1209 | 1210 |
1210 // Calls | 1211 // Calls |
1211 // Call near relative 32-bit displacement, relative to next instruction. | 1212 // Call near relative 32-bit displacement, relative to next instruction. |
1212 void call(Label* L); | 1213 void call(Label* L); |
| 1214 void call(Address entry, RelocInfo::Mode rmode); |
1213 void call(Handle<Code> target, | 1215 void call(Handle<Code> target, |
1214 RelocInfo::Mode rmode = RelocInfo::CODE_TARGET, | 1216 RelocInfo::Mode rmode = RelocInfo::CODE_TARGET, |
1215 TypeFeedbackId ast_id = TypeFeedbackId::None()); | 1217 TypeFeedbackId ast_id = TypeFeedbackId::None()); |
1216 | 1218 |
1217 // Calls directly to the given address using a relative offset. | 1219 // Calls directly to the given address using a relative offset. |
1218 // Should only ever be used in Code objects for calls within the | 1220 // Should only ever be used in Code objects for calls within the |
1219 // same Code object. Should not be used when generating new code (use labels), | 1221 // same Code object. Should not be used when generating new code (use labels), |
1220 // but only when patching existing code. | 1222 // but only when patching existing code. |
1221 void call(Address target); | 1223 void call(Address target); |
1222 | 1224 |
1223 // Call near absolute indirect, address in register | 1225 // Call near absolute indirect, address in register |
1224 void call(Register adr); | 1226 void call(Register adr); |
1225 | 1227 |
1226 // Call near indirect | 1228 // Call near indirect |
1227 void call(const Operand& operand); | 1229 void call(const Operand& operand); |
1228 | 1230 |
1229 // Jumps | 1231 // Jumps |
1230 // Jump short or near relative. | 1232 // Jump short or near relative. |
1231 // Use a 32-bit signed displacement. | 1233 // Use a 32-bit signed displacement. |
1232 // Unconditional jump to L | 1234 // Unconditional jump to L |
1233 void jmp(Label* L, Label::Distance distance = Label::kFar); | 1235 void jmp(Label* L, Label::Distance distance = Label::kFar); |
| 1236 void jmp(Address entry, RelocInfo::Mode rmode); |
1234 void jmp(Handle<Code> target, RelocInfo::Mode rmode); | 1237 void jmp(Handle<Code> target, RelocInfo::Mode rmode); |
1235 | 1238 |
1236 // Jump near absolute indirect (r64) | 1239 // Jump near absolute indirect (r64) |
1237 void jmp(Register adr); | 1240 void jmp(Register adr); |
1238 | 1241 |
1239 // Jump near absolute indirect (m64) | 1242 // Jump near absolute indirect (m64) |
1240 void jmp(const Operand& src); | 1243 void jmp(const Operand& src); |
1241 | 1244 |
1242 // Conditional jumps | 1245 // Conditional jumps |
1243 void j(Condition cc, | 1246 void j(Condition cc, |
1244 Label* L, | 1247 Label* L, |
1245 Label::Distance distance = Label::kFar); | 1248 Label::Distance distance = Label::kFar); |
| 1249 void j(Condition cc, Address entry, RelocInfo::Mode rmode); |
1246 void j(Condition cc, Handle<Code> target, RelocInfo::Mode rmode); | 1250 void j(Condition cc, Handle<Code> target, RelocInfo::Mode rmode); |
1247 | 1251 |
1248 // Floating-point operations | 1252 // Floating-point operations |
1249 void fld(int i); | 1253 void fld(int i); |
1250 | 1254 |
1251 void fld1(); | 1255 void fld1(); |
1252 void fldz(); | 1256 void fldz(); |
1253 void fldpi(); | 1257 void fldpi(); |
1254 void fldln2(); | 1258 void fldln2(); |
1255 | 1259 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1452 // code emission | 1456 // code emission |
1453 void GrowBuffer(); | 1457 void GrowBuffer(); |
1454 | 1458 |
1455 void emit(byte x) { *pc_++ = x; } | 1459 void emit(byte x) { *pc_++ = x; } |
1456 inline void emitl(uint32_t x); | 1460 inline void emitl(uint32_t x); |
1457 inline void emitq(uint64_t x, RelocInfo::Mode rmode); | 1461 inline void emitq(uint64_t x, RelocInfo::Mode rmode); |
1458 inline void emitw(uint16_t x); | 1462 inline void emitw(uint16_t x); |
1459 inline void emit_code_target(Handle<Code> target, | 1463 inline void emit_code_target(Handle<Code> target, |
1460 RelocInfo::Mode rmode, | 1464 RelocInfo::Mode rmode, |
1461 TypeFeedbackId ast_id = TypeFeedbackId::None()); | 1465 TypeFeedbackId ast_id = TypeFeedbackId::None()); |
| 1466 inline void emit_deopt_entry(Address entry, RelocInfo::Mode rmode); |
1462 void emit(Immediate x) { emitl(x.value_); } | 1467 void emit(Immediate x) { emitl(x.value_); } |
1463 | 1468 |
1464 // Emits a REX prefix that encodes a 64-bit operand size and | 1469 // Emits a REX prefix that encodes a 64-bit operand size and |
1465 // the top bit of both register codes. | 1470 // the top bit of both register codes. |
1466 // High bit of reg goes to REX.R, high bit of rm_reg goes to REX.B. | 1471 // High bit of reg goes to REX.R, high bit of rm_reg goes to REX.B. |
1467 // REX.W is set. | 1472 // REX.W is set. |
1468 inline void emit_rex_64(XMMRegister reg, Register rm_reg); | 1473 inline void emit_rex_64(XMMRegister reg, Register rm_reg); |
1469 inline void emit_rex_64(Register reg, XMMRegister rm_reg); | 1474 inline void emit_rex_64(Register reg, XMMRegister rm_reg); |
1470 inline void emit_rex_64(Register reg, Register rm_reg); | 1475 inline void emit_rex_64(Register reg, Register rm_reg); |
1471 | 1476 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1624 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); | 1629 void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0); |
1625 | 1630 |
1626 friend class CodePatcher; | 1631 friend class CodePatcher; |
1627 friend class EnsureSpace; | 1632 friend class EnsureSpace; |
1628 friend class RegExpMacroAssemblerX64; | 1633 friend class RegExpMacroAssemblerX64; |
1629 | 1634 |
1630 // code generation | 1635 // code generation |
1631 RelocInfoWriter reloc_info_writer; | 1636 RelocInfoWriter reloc_info_writer; |
1632 | 1637 |
1633 List< Handle<Code> > code_targets_; | 1638 List< Handle<Code> > code_targets_; |
| 1639 List<Address> deopt_entries_; |
1634 | 1640 |
1635 PositionsRecorder positions_recorder_; | 1641 PositionsRecorder positions_recorder_; |
1636 friend class PositionsRecorder; | 1642 friend class PositionsRecorder; |
1637 }; | 1643 }; |
1638 | 1644 |
1639 | 1645 |
1640 // Helper class that ensures that there is enough space for generating | 1646 // Helper class that ensures that there is enough space for generating |
1641 // instructions and relocation information. The constructor makes | 1647 // instructions and relocation information. The constructor makes |
1642 // sure that there is enough space and (in debug mode) the destructor | 1648 // sure that there is enough space and (in debug mode) the destructor |
1643 // checks that we did not generate too much. | 1649 // checks that we did not generate too much. |
(...skipping 16 matching lines...) Expand all Loading... |
1660 private: | 1666 private: |
1661 Assembler* assembler_; | 1667 Assembler* assembler_; |
1662 #ifdef DEBUG | 1668 #ifdef DEBUG |
1663 int space_before_; | 1669 int space_before_; |
1664 #endif | 1670 #endif |
1665 }; | 1671 }; |
1666 | 1672 |
1667 } } // namespace v8::internal | 1673 } } // namespace v8::internal |
1668 | 1674 |
1669 #endif // V8_X64_ASSEMBLER_X64_H_ | 1675 #endif // V8_X64_ASSEMBLER_X64_H_ |
OLD | NEW |