Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: src/x64/assembler-x64.cc

Issue 11574027: Use direct jump and call instruction for X64 when the deoptimization entries are in the code range (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 // ----------------------------------------------------------------------------- 349 // -----------------------------------------------------------------------------
350 // Implementation of Assembler. 350 // Implementation of Assembler.
351 351
352 #ifdef GENERATED_CODE_COVERAGE 352 #ifdef GENERATED_CODE_COVERAGE
353 static void InitCoverageLog(); 353 static void InitCoverageLog();
354 #endif 354 #endif
355 355
356 Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size) 356 Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size)
357 : AssemblerBase(isolate, buffer, buffer_size), 357 : AssemblerBase(isolate, buffer, buffer_size),
358 code_targets_(100), 358 code_targets_(100),
359 runtime_entries_(100),
danno 2013/03/07 14:57:23 Ad previously commented, I don't think you need th
haitao.feng 2013/03/08 05:30:05 Done.
359 positions_recorder_(this) { 360 positions_recorder_(this) {
360 // Clear the buffer in debug mode unless it was provided by the 361 // Clear the buffer in debug mode unless it was provided by the
361 // caller in which case we can't be sure it's okay to overwrite 362 // caller in which case we can't be sure it's okay to overwrite
362 // existing code in it. 363 // existing code in it.
363 #ifdef DEBUG 364 #ifdef DEBUG
364 if (own_buffer_) { 365 if (own_buffer_) {
365 memset(buffer_, 0xCC, buffer_size_); // int3 366 memset(buffer_, 0xCC, buffer_size_); // int3
366 } 367 }
367 #endif 368 #endif
368 369
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 L->link_to(pc_offset() - sizeof(int32_t)); 834 L->link_to(pc_offset() - sizeof(int32_t));
834 } else { 835 } else {
835 ASSERT(L->is_unused()); 836 ASSERT(L->is_unused());
836 int32_t current = pc_offset(); 837 int32_t current = pc_offset();
837 emitl(current); 838 emitl(current);
838 L->link_to(current); 839 L->link_to(current);
839 } 840 }
840 } 841 }
841 842
842 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
843 void Assembler::call(Handle<Code> target, 854 void Assembler::call(Handle<Code> target,
844 RelocInfo::Mode rmode, 855 RelocInfo::Mode rmode,
845 TypeFeedbackId ast_id) { 856 TypeFeedbackId ast_id) {
846 positions_recorder()->WriteRecordedPositions(); 857 positions_recorder()->WriteRecordedPositions();
847 EnsureSpace ensure_space(this); 858 EnsureSpace ensure_space(this);
848 // 1110 1000 #32-bit disp. 859 // 1110 1000 #32-bit disp.
849 emit(0xE8); 860 emit(0xE8);
850 emit_code_target(target, rmode, ast_id); 861 emit_code_target(target, rmode, ast_id);
851 } 862 }
852 863
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 ASSERT(L->is_unused()); 1250 ASSERT(L->is_unused());
1240 emit(0x0F); 1251 emit(0x0F);
1241 emit(0x80 | cc); 1252 emit(0x80 | cc);
1242 int32_t current = pc_offset(); 1253 int32_t current = pc_offset();
1243 emitl(current); 1254 emitl(current);
1244 L->link_to(current); 1255 L->link_to(current);
1245 } 1256 }
1246 } 1257 }
1247 1258
1248 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
1249 void Assembler::j(Condition cc, 1270 void Assembler::j(Condition cc,
1250 Handle<Code> target, 1271 Handle<Code> target,
1251 RelocInfo::Mode rmode) { 1272 RelocInfo::Mode rmode) {
1252 EnsureSpace ensure_space(this); 1273 EnsureSpace ensure_space(this);
1253 ASSERT(is_uint4(cc)); 1274 ASSERT(is_uint4(cc));
1254 // 0000 1111 1000 tttn #32-bit disp. 1275 // 0000 1111 1000 tttn #32-bit disp.
1255 emit(0x0F); 1276 emit(0x0F);
1256 emit(0x80 | cc); 1277 emit(0x80 | cc);
1257 emit_code_target(target, rmode); 1278 emit_code_target(target, rmode);
1258 } 1279 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 1322
1302 1323
1303 void Assembler::jmp(Handle<Code> target, RelocInfo::Mode rmode) { 1324 void Assembler::jmp(Handle<Code> target, RelocInfo::Mode rmode) {
1304 EnsureSpace ensure_space(this); 1325 EnsureSpace ensure_space(this);
1305 // 1110 1001 #32-bit disp. 1326 // 1110 1001 #32-bit disp.
1306 emit(0xE9); 1327 emit(0xE9);
1307 emit_code_target(target, rmode); 1328 emit_code_target(target, rmode);
1308 } 1329 }
1309 1330
1310 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
1311 void Assembler::jmp(Register target) { 1341 void Assembler::jmp(Register target) {
1312 EnsureSpace ensure_space(this); 1342 EnsureSpace ensure_space(this);
1313 // Opcode FF/4 r64. 1343 // Opcode FF/4 r64.
1314 emit_optional_rex_32(target); 1344 emit_optional_rex_32(target);
1315 emit(0xFF); 1345 emit(0xFF);
1316 emit_modrm(0x4, target); 1346 emit_modrm(0x4, target);
1317 } 1347 }
1318 1348
1319 1349
1320 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
3041 3071
3042 void Assembler::RecordComment(const char* msg, bool force) { 3072 void Assembler::RecordComment(const char* msg, bool force) {
3043 if (FLAG_code_comments || force) { 3073 if (FLAG_code_comments || force) {
3044 EnsureSpace ensure_space(this); 3074 EnsureSpace ensure_space(this);
3045 RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg)); 3075 RecordRelocInfo(RelocInfo::COMMENT, reinterpret_cast<intptr_t>(msg));
3046 } 3076 }
3047 } 3077 }
3048 3078
3049 3079
3050 const int RelocInfo::kApplyMask = RelocInfo::kCodeTargetMask | 3080 const int RelocInfo::kApplyMask = RelocInfo::kCodeTargetMask |
3081 1 << RelocInfo::RUNTIME_ENTRY |
3051 1 << RelocInfo::INTERNAL_REFERENCE | 3082 1 << RelocInfo::INTERNAL_REFERENCE |
3052 1 << RelocInfo::CODE_AGE_SEQUENCE; 3083 1 << RelocInfo::CODE_AGE_SEQUENCE;
3053 3084
3054 3085
3055 bool RelocInfo::IsCodedSpecially() { 3086 bool RelocInfo::IsCodedSpecially() {
3056 // 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
3057 // 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
3058 // by branch instructions. 3089 // by branch instructions.
3059 return (1 << rmode_) & kApplyMask; 3090 return (1 << rmode_) & kApplyMask;
3060 } 3091 }
3061 3092
3062 } } // namespace v8::internal 3093 } } // namespace v8::internal
3063 3094
3064 #endif // V8_TARGET_ARCH_X64 3095 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698