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 | |
854 void Assembler::call(Handle<Code> target, | 844 void Assembler::call(Handle<Code> target, |
855 RelocInfo::Mode rmode, | 845 RelocInfo::Mode rmode, |
856 TypeFeedbackId ast_id) { | 846 TypeFeedbackId ast_id) { |
857 positions_recorder()->WriteRecordedPositions(); | 847 positions_recorder()->WriteRecordedPositions(); |
858 EnsureSpace ensure_space(this); | 848 EnsureSpace ensure_space(this); |
859 // 1110 1000 #32-bit disp. | 849 // 1110 1000 #32-bit disp. |
860 emit(0xE8); | 850 emit(0xE8); |
861 emit_code_target(target, rmode, ast_id); | 851 emit_code_target(target, rmode, ast_id); |
862 } | 852 } |
863 | 853 |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 ASSERT(L->is_unused()); | 1240 ASSERT(L->is_unused()); |
1251 emit(0x0F); | 1241 emit(0x0F); |
1252 emit(0x80 | cc); | 1242 emit(0x80 | cc); |
1253 int32_t current = pc_offset(); | 1243 int32_t current = pc_offset(); |
1254 emitl(current); | 1244 emitl(current); |
1255 L->link_to(current); | 1245 L->link_to(current); |
1256 } | 1246 } |
1257 } | 1247 } |
1258 | 1248 |
1259 | 1249 |
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 | |
1270 void Assembler::j(Condition cc, | 1250 void Assembler::j(Condition cc, |
1271 Handle<Code> target, | 1251 Handle<Code> target, |
1272 RelocInfo::Mode rmode) { | 1252 RelocInfo::Mode rmode) { |
1273 EnsureSpace ensure_space(this); | 1253 EnsureSpace ensure_space(this); |
1274 ASSERT(is_uint4(cc)); | 1254 ASSERT(is_uint4(cc)); |
1275 // 0000 1111 1000 tttn #32-bit disp. | 1255 // 0000 1111 1000 tttn #32-bit disp. |
1276 emit(0x0F); | 1256 emit(0x0F); |
1277 emit(0x80 | cc); | 1257 emit(0x80 | cc); |
1278 emit_code_target(target, rmode); | 1258 emit_code_target(target, rmode); |
1279 } | 1259 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 | 1302 |
1323 | 1303 |
1324 void Assembler::jmp(Handle<Code> target, RelocInfo::Mode rmode) { | 1304 void Assembler::jmp(Handle<Code> target, RelocInfo::Mode rmode) { |
1325 EnsureSpace ensure_space(this); | 1305 EnsureSpace ensure_space(this); |
1326 // 1110 1001 #32-bit disp. | 1306 // 1110 1001 #32-bit disp. |
1327 emit(0xE9); | 1307 emit(0xE9); |
1328 emit_code_target(target, rmode); | 1308 emit_code_target(target, rmode); |
1329 } | 1309 } |
1330 | 1310 |
1331 | 1311 |
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 | |
1341 void Assembler::jmp(Register target) { | 1312 void Assembler::jmp(Register target) { |
1342 EnsureSpace ensure_space(this); | 1313 EnsureSpace ensure_space(this); |
1343 // Opcode FF/4 r64. | 1314 // Opcode FF/4 r64. |
1344 emit_optional_rex_32(target); | 1315 emit_optional_rex_32(target); |
1345 emit(0xFF); | 1316 emit(0xFF); |
1346 emit_modrm(0x4, target); | 1317 emit_modrm(0x4, target); |
1347 } | 1318 } |
1348 | 1319 |
1349 | 1320 |
1350 void Assembler::jmp(const Operand& src) { | 1321 void Assembler::jmp(const Operand& src) { |
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3071 | 3042 |
3072 void Assembler::RecordComment(const char* msg, bool force) { | 3043 void Assembler::RecordComment(const char* msg, bool force) { |
3073 if (FLAG_code_comments || force) { | 3044 if (FLAG_code_comments || force) { |
3074 EnsureSpace ensure_space(this); | 3045 EnsureSpace ensure_space(this); |
3075 RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg)); | 3046 RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg)); |
3076 } | 3047 } |
3077 } | 3048 } |
3078 | 3049 |
3079 | 3050 |
3080 const int RelocInfo::kApplyMask = RelocInfo::kCodeTargetMask | | 3051 const int RelocInfo::kApplyMask = RelocInfo::kCodeTargetMask | |
3081 1 << RelocInfo::RUNTIME_ENTRY | | |
3082 1 << RelocInfo::INTERNAL_REFERENCE | | 3052 1 << RelocInfo::INTERNAL_REFERENCE | |
3083 1 << RelocInfo::CODE_AGE_SEQUENCE; | 3053 1 << RelocInfo::CODE_AGE_SEQUENCE; |
3084 | 3054 |
3085 | 3055 |
3086 bool RelocInfo::IsCodedSpecially() { | 3056 bool RelocInfo::IsCodedSpecially() { |
3087 // The deserializer needs to know whether a pointer is specially coded. Being | 3057 // The deserializer needs to know whether a pointer is specially coded. Being |
3088 // specially coded on x64 means that it is a relative 32 bit address, as used | 3058 // specially coded on x64 means that it is a relative 32 bit address, as used |
3089 // by branch instructions. | 3059 // by branch instructions. |
3090 return (1 << rmode_) & kApplyMask; | 3060 return (1 << rmode_) & kApplyMask; |
3091 } | 3061 } |
3092 | 3062 |
3093 } } // namespace v8::internal | 3063 } } // namespace v8::internal |
3094 | 3064 |
3095 #endif // V8_TARGET_ARCH_X64 | 3065 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |