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