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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 } | 554 } |
555 | 555 |
556 // This sets the branch destination (which is a load instruction on x64). | 556 // This sets the branch destination (which is a load instruction on x64). |
557 // This is for calls and branches to runtime code. | 557 // This is for calls and branches to runtime code. |
558 inline static void set_external_target_at(Address instruction_payload, | 558 inline static void set_external_target_at(Address instruction_payload, |
559 Address target) { | 559 Address target) { |
560 *reinterpret_cast<Address*>(instruction_payload) = target; | 560 *reinterpret_cast<Address*>(instruction_payload) = target; |
561 } | 561 } |
562 | 562 |
563 inline Handle<Object> code_target_object_handle_at(Address pc); | 563 inline Handle<Object> code_target_object_handle_at(Address pc); |
564 inline Address runtime_entry_at(Address pc); | |
565 // Number of bytes taken up by the branch target in the code. | 564 // Number of bytes taken up by the branch target in the code. |
566 static const int kSpecialTargetSize = 4; // Use 32-bit displacement. | 565 static const int kSpecialTargetSize = 4; // Use 32-bit displacement. |
567 // Distance between the address of the code target in the call instruction | 566 // Distance between the address of the code target in the call instruction |
568 // and the return address pushed on the stack. | 567 // and the return address pushed on the stack. |
569 static const int kCallTargetAddressOffset = 4; // Use 32-bit displacement. | 568 static const int kCallTargetAddressOffset = 4; // Use 32-bit displacement. |
570 // Distance between the start of the JS return sequence and where the | 569 // Distance between the start of the JS return sequence and where the |
571 // 32-bit displacement of a near call would be, relative to the pushed | 570 // 32-bit displacement of a near call would be, relative to the pushed |
572 // return address. TODO: Use return sequence length instead. | 571 // return address. TODO: Use return sequence length instead. |
573 // Should equal Debug::kX64JSReturnSequenceLength - kCallTargetAddressOffset; | 572 // Should equal Debug::kX64JSReturnSequenceLength - kCallTargetAddressOffset; |
574 static const int kPatchReturnSequenceAddressOffset = 13 - 4; | 573 static const int kPatchReturnSequenceAddressOffset = 13 - 4; |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 // bind(&L); // illegal: a label may be bound only once | 1173 // bind(&L); // illegal: a label may be bound only once |
1175 // | 1174 // |
1176 // Note: The same Label can be used for forward and backward branches | 1175 // Note: The same Label can be used for forward and backward branches |
1177 // but it may be bound only once. | 1176 // but it may be bound only once. |
1178 | 1177 |
1179 void bind(Label* L); // binds an unbound label L to the current code position | 1178 void bind(Label* L); // binds an unbound label L to the current code position |
1180 | 1179 |
1181 // Calls | 1180 // Calls |
1182 // Call near relative 32-bit displacement, relative to next instruction. | 1181 // Call near relative 32-bit displacement, relative to next instruction. |
1183 void call(Label* L); | 1182 void call(Label* L); |
1184 void call(Address entry, RelocInfo::Mode rmode); | |
1185 void call(Handle<Code> target, | 1183 void call(Handle<Code> target, |
1186 RelocInfo::Mode rmode = RelocInfo::CODE_TARGET, | 1184 RelocInfo::Mode rmode = RelocInfo::CODE_TARGET, |
1187 TypeFeedbackId ast_id = TypeFeedbackId::None()); | 1185 TypeFeedbackId ast_id = TypeFeedbackId::None()); |
1188 | 1186 |
1189 // Calls directly to the given address using a relative offset. | 1187 // Calls directly to the given address using a relative offset. |
1190 // Should only ever be used in Code objects for calls within the | 1188 // Should only ever be used in Code objects for calls within the |
1191 // same Code object. Should not be used when generating new code (use labels), | 1189 // same Code object. Should not be used when generating new code (use labels), |
1192 // but only when patching existing code. | 1190 // but only when patching existing code. |
1193 void call(Address target); | 1191 void call(Address target); |
1194 | 1192 |
1195 // Call near absolute indirect, address in register | 1193 // Call near absolute indirect, address in register |
1196 void call(Register adr); | 1194 void call(Register adr); |
1197 | 1195 |
1198 // Call near indirect | 1196 // Call near indirect |
1199 void call(const Operand& operand); | 1197 void call(const Operand& operand); |
1200 | 1198 |
1201 // Jumps | 1199 // Jumps |
1202 // Jump short or near relative. | 1200 // Jump short or near relative. |
1203 // Use a 32-bit signed displacement. | 1201 // Use a 32-bit signed displacement. |
1204 // Unconditional jump to L | 1202 // Unconditional jump to L |
1205 void jmp(Label* L, Label::Distance distance = Label::kFar); | 1203 void jmp(Label* L, Label::Distance distance = Label::kFar); |
1206 void jmp(Address entry, RelocInfo::Mode rmode); | |
1207 void jmp(Handle<Code> target, RelocInfo::Mode rmode); | 1204 void jmp(Handle<Code> target, RelocInfo::Mode rmode); |
1208 | 1205 |
1209 // Jump near absolute indirect (r64) | 1206 // Jump near absolute indirect (r64) |
1210 void jmp(Register adr); | 1207 void jmp(Register adr); |
1211 | 1208 |
1212 // Jump near absolute indirect (m64) | 1209 // Jump near absolute indirect (m64) |
1213 void jmp(const Operand& src); | 1210 void jmp(const Operand& src); |
1214 | 1211 |
1215 // Conditional jumps | 1212 // Conditional jumps |
1216 void j(Condition cc, | 1213 void j(Condition cc, |
1217 Label* L, | 1214 Label* L, |
1218 Label::Distance distance = Label::kFar); | 1215 Label::Distance distance = Label::kFar); |
1219 void j(Condition cc, Address entry, RelocInfo::Mode rmode); | |
1220 void j(Condition cc, Handle<Code> target, RelocInfo::Mode rmode); | 1216 void j(Condition cc, Handle<Code> target, RelocInfo::Mode rmode); |
1221 | 1217 |
1222 // Floating-point operations | 1218 // Floating-point operations |
1223 void fld(int i); | 1219 void fld(int i); |
1224 | 1220 |
1225 void fld1(); | 1221 void fld1(); |
1226 void fldz(); | 1222 void fldz(); |
1227 void fldpi(); | 1223 void fldpi(); |
1228 void fldln2(); | 1224 void fldln2(); |
1229 | 1225 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1427 // code emission | 1423 // code emission |
1428 void GrowBuffer(); | 1424 void GrowBuffer(); |
1429 | 1425 |
1430 void emit(byte x) { *pc_++ = x; } | 1426 void emit(byte x) { *pc_++ = x; } |
1431 inline void emitl(uint32_t x); | 1427 inline void emitl(uint32_t x); |
1432 inline void emitq(uint64_t x, RelocInfo::Mode rmode); | 1428 inline void emitq(uint64_t x, RelocInfo::Mode rmode); |
1433 inline void emitw(uint16_t x); | 1429 inline void emitw(uint16_t x); |
1434 inline void emit_code_target(Handle<Code> target, | 1430 inline void emit_code_target(Handle<Code> target, |
1435 RelocInfo::Mode rmode, | 1431 RelocInfo::Mode rmode, |
1436 TypeFeedbackId ast_id = TypeFeedbackId::None()); | 1432 TypeFeedbackId ast_id = TypeFeedbackId::None()); |
1437 inline void emit_runtime_entry(Address entry, RelocInfo::Mode rmode); | |
1438 void emit(Immediate x) { emitl(x.value_); } | 1433 void emit(Immediate x) { emitl(x.value_); } |
1439 | 1434 |
1440 // Emits a REX prefix that encodes a 64-bit operand size and | 1435 // Emits a REX prefix that encodes a 64-bit operand size and |
1441 // the top bit of both register codes. | 1436 // the top bit of both register codes. |
1442 // High bit of reg goes to REX.R, high bit of rm_reg goes to REX.B. | 1437 // High bit of reg goes to REX.R, high bit of rm_reg goes to REX.B. |
1443 // REX.W is set. | 1438 // REX.W is set. |
1444 inline void emit_rex_64(XMMRegister reg, Register rm_reg); | 1439 inline void emit_rex_64(XMMRegister reg, Register rm_reg); |
1445 inline void emit_rex_64(Register reg, XMMRegister rm_reg); | 1440 inline void emit_rex_64(Register reg, XMMRegister rm_reg); |
1446 inline void emit_rex_64(Register reg, Register rm_reg); | 1441 inline void emit_rex_64(Register reg, Register rm_reg); |
1447 | 1442 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1636 private: | 1631 private: |
1637 Assembler* assembler_; | 1632 Assembler* assembler_; |
1638 #ifdef DEBUG | 1633 #ifdef DEBUG |
1639 int space_before_; | 1634 int space_before_; |
1640 #endif | 1635 #endif |
1641 }; | 1636 }; |
1642 | 1637 |
1643 } } // namespace v8::internal | 1638 } } // namespace v8::internal |
1644 | 1639 |
1645 #endif // V8_X64_ASSEMBLER_X64_H_ | 1640 #endif // V8_X64_ASSEMBLER_X64_H_ |
OLD | NEW |