OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 L->link_to(pc_offset() - sizeof(int32_t)); | 834 L->link_to(pc_offset() - sizeof(int32_t)); |
835 } else { | 835 } else { |
836 ASSERT(L->is_unused()); | 836 ASSERT(L->is_unused()); |
837 int32_t current = pc_offset(); | 837 int32_t current = pc_offset(); |
838 emitl(current); | 838 emitl(current); |
839 L->link_to(current); | 839 L->link_to(current); |
840 } | 840 } |
841 } | 841 } |
842 | 842 |
843 | 843 |
| 844 void Assembler::call(Address entry, RelocInfo::Mode rmode) { |
| 845 ASSERT(RelocInfo::IsRuntimeEntry(rmode)); |
| 846 positions_recorder()->WriteRecordedPositions(); |
| 847 EnsureSpace ensure_space(this); |
| 848 // 1110 1000 #32-bit disp. |
| 849 emit(0xE8); |
| 850 emit_runtime_entry(entry, rmode); |
| 851 } |
| 852 |
| 853 |
844 void Assembler::call(Handle<Code> target, | 854 void Assembler::call(Handle<Code> target, |
845 RelocInfo::Mode rmode, | 855 RelocInfo::Mode rmode, |
846 TypeFeedbackId ast_id) { | 856 TypeFeedbackId ast_id) { |
847 positions_recorder()->WriteRecordedPositions(); | 857 positions_recorder()->WriteRecordedPositions(); |
848 EnsureSpace ensure_space(this); | 858 EnsureSpace ensure_space(this); |
849 // 1110 1000 #32-bit disp. | 859 // 1110 1000 #32-bit disp. |
850 emit(0xE8); | 860 emit(0xE8); |
851 emit_code_target(target, rmode, ast_id); | 861 emit_code_target(target, rmode, ast_id); |
852 } | 862 } |
853 | 863 |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 ASSERT(L->is_unused()); | 1250 ASSERT(L->is_unused()); |
1241 emit(0x0F); | 1251 emit(0x0F); |
1242 emit(0x80 | cc); | 1252 emit(0x80 | cc); |
1243 int32_t current = pc_offset(); | 1253 int32_t current = pc_offset(); |
1244 emitl(current); | 1254 emitl(current); |
1245 L->link_to(current); | 1255 L->link_to(current); |
1246 } | 1256 } |
1247 } | 1257 } |
1248 | 1258 |
1249 | 1259 |
| 1260 void Assembler::j(Condition cc, Address entry, RelocInfo::Mode rmode) { |
| 1261 ASSERT(RelocInfo::IsRuntimeEntry(rmode)); |
| 1262 EnsureSpace ensure_space(this); |
| 1263 ASSERT(is_uint4(cc)); |
| 1264 emit(0x0F); |
| 1265 emit(0x80 | cc); |
| 1266 emit_runtime_entry(entry, rmode); |
| 1267 } |
| 1268 |
| 1269 |
1250 void Assembler::j(Condition cc, | 1270 void Assembler::j(Condition cc, |
1251 Handle<Code> target, | 1271 Handle<Code> target, |
1252 RelocInfo::Mode rmode) { | 1272 RelocInfo::Mode rmode) { |
1253 EnsureSpace ensure_space(this); | 1273 EnsureSpace ensure_space(this); |
1254 ASSERT(is_uint4(cc)); | 1274 ASSERT(is_uint4(cc)); |
1255 // 0000 1111 1000 tttn #32-bit disp. | 1275 // 0000 1111 1000 tttn #32-bit disp. |
1256 emit(0x0F); | 1276 emit(0x0F); |
1257 emit(0x80 | cc); | 1277 emit(0x80 | cc); |
1258 emit_code_target(target, rmode); | 1278 emit_code_target(target, rmode); |
1259 } | 1279 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1302 | 1322 |
1303 | 1323 |
1304 void Assembler::jmp(Handle<Code> target, RelocInfo::Mode rmode) { | 1324 void Assembler::jmp(Handle<Code> target, RelocInfo::Mode rmode) { |
1305 EnsureSpace ensure_space(this); | 1325 EnsureSpace ensure_space(this); |
1306 // 1110 1001 #32-bit disp. | 1326 // 1110 1001 #32-bit disp. |
1307 emit(0xE9); | 1327 emit(0xE9); |
1308 emit_code_target(target, rmode); | 1328 emit_code_target(target, rmode); |
1309 } | 1329 } |
1310 | 1330 |
1311 | 1331 |
| 1332 void Assembler::jmp(Address entry, RelocInfo::Mode rmode) { |
| 1333 ASSERT(RelocInfo::IsRuntimeEntry(rmode)); |
| 1334 EnsureSpace ensure_space(this); |
| 1335 ASSERT(RelocInfo::IsRuntimeEntry(rmode)); |
| 1336 emit(0xE9); |
| 1337 emit_runtime_entry(entry, rmode); |
| 1338 } |
| 1339 |
| 1340 |
1312 void Assembler::jmp(Register target) { | 1341 void Assembler::jmp(Register target) { |
1313 EnsureSpace ensure_space(this); | 1342 EnsureSpace ensure_space(this); |
1314 // Opcode FF/4 r64. | 1343 // Opcode FF/4 r64. |
1315 emit_optional_rex_32(target); | 1344 emit_optional_rex_32(target); |
1316 emit(0xFF); | 1345 emit(0xFF); |
1317 emit_modrm(0x4, target); | 1346 emit_modrm(0x4, target); |
1318 } | 1347 } |
1319 | 1348 |
1320 | 1349 |
1321 void Assembler::jmp(const Operand& src) { | 1350 void Assembler::jmp(const Operand& src) { |
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3042 | 3071 |
3043 void Assembler::RecordComment(const char* msg, bool force) { | 3072 void Assembler::RecordComment(const char* msg, bool force) { |
3044 if (FLAG_code_comments || force) { | 3073 if (FLAG_code_comments || force) { |
3045 EnsureSpace ensure_space(this); | 3074 EnsureSpace ensure_space(this); |
3046 RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg)); | 3075 RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg)); |
3047 } | 3076 } |
3048 } | 3077 } |
3049 | 3078 |
3050 | 3079 |
3051 const int RelocInfo::kApplyMask = RelocInfo::kCodeTargetMask | | 3080 const int RelocInfo::kApplyMask = RelocInfo::kCodeTargetMask | |
| 3081 1 << RelocInfo::RUNTIME_ENTRY | |
3052 1 << RelocInfo::INTERNAL_REFERENCE | | 3082 1 << RelocInfo::INTERNAL_REFERENCE | |
3053 1 << RelocInfo::CODE_AGE_SEQUENCE; | 3083 1 << RelocInfo::CODE_AGE_SEQUENCE; |
3054 | 3084 |
3055 | 3085 |
3056 bool RelocInfo::IsCodedSpecially() { | 3086 bool RelocInfo::IsCodedSpecially() { |
3057 // The deserializer needs to know whether a pointer is specially coded. Being | 3087 // The deserializer needs to know whether a pointer is specially coded. Being |
3058 // specially coded on x64 means that it is a relative 32 bit address, as used | 3088 // specially coded on x64 means that it is a relative 32 bit address, as used |
3059 // by branch instructions. | 3089 // by branch instructions. |
3060 return (1 << rmode_) & kApplyMask; | 3090 return (1 << rmode_) & kApplyMask; |
3061 } | 3091 } |
3062 | 3092 |
3063 } } // namespace v8::internal | 3093 } } // namespace v8::internal |
3064 | 3094 |
3065 #endif // V8_TARGET_ARCH_X64 | 3095 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |