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

Side by Side Diff: src/assembler.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 8 years 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 (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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 const int kLastChunkTag = 1; 286 const int kLastChunkTag = 1;
287 287
288 288
289 const int kDataJumpExtraTag = kPCJumpExtraTag - 1; 289 const int kDataJumpExtraTag = kPCJumpExtraTag - 1;
290 290
291 const int kCodeWithIdTag = 0; 291 const int kCodeWithIdTag = 0;
292 const int kNonstatementPositionTag = 1; 292 const int kNonstatementPositionTag = 1;
293 const int kStatementPositionTag = 2; 293 const int kStatementPositionTag = 2;
294 const int kCommentTag = 3; 294 const int kCommentTag = 3;
295 295
296 #if !defined(V8_TARGET_ARCH_X64)
Sven Panne 2012/12/14 08:20:11 Again for this and the rest of the file: No archit
296 const int kConstPoolExtraTag = kPCJumpExtraTag - 2; 297 const int kConstPoolExtraTag = kPCJumpExtraTag - 2;
297 const int kConstPoolTag = 3; 298 const int kConstPoolTag = 3;
298 299 #else
300 const int kDeoptEntryExtraTag = kPCJumpExtraTag - 2;
301 const int kDeoptEntryTag = 3;
302 #endif
299 303
300 uint32_t RelocInfoWriter::WriteVariableLengthPCJump(uint32_t pc_delta) { 304 uint32_t RelocInfoWriter::WriteVariableLengthPCJump(uint32_t pc_delta) {
301 // Return if the pc_delta can fit in kSmallPCDeltaBits bits. 305 // Return if the pc_delta can fit in kSmallPCDeltaBits bits.
302 // Otherwise write a variable length PC jump for the bits that do 306 // Otherwise write a variable length PC jump for the bits that do
303 // not fit in the kSmallPCDeltaBits bits. 307 // not fit in the kSmallPCDeltaBits bits.
304 if (is_uintn(pc_delta, kSmallPCDeltaBits)) return pc_delta; 308 if (is_uintn(pc_delta, kSmallPCDeltaBits)) return pc_delta;
305 WriteExtraTag(kPCJumpExtraTag, kVariableLengthPCJumpTopTag); 309 WriteExtraTag(kPCJumpExtraTag, kVariableLengthPCJumpTopTag);
306 uint32_t pc_jump = pc_delta >> kSmallPCDeltaBits; 310 uint32_t pc_jump = pc_delta >> kSmallPCDeltaBits;
307 ASSERT(pc_jump > 0); 311 ASSERT(pc_jump > 0);
308 // Write kChunkBits size chunks of the pc_jump. 312 // Write kChunkBits size chunks of the pc_jump.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 350
347 void RelocInfoWriter::WriteExtraTaggedIntData(int data_delta, int top_tag) { 351 void RelocInfoWriter::WriteExtraTaggedIntData(int data_delta, int top_tag) {
348 WriteExtraTag(kDataJumpExtraTag, top_tag); 352 WriteExtraTag(kDataJumpExtraTag, top_tag);
349 for (int i = 0; i < kIntSize; i++) { 353 for (int i = 0; i < kIntSize; i++) {
350 *--pos_ = static_cast<byte>(data_delta); 354 *--pos_ = static_cast<byte>(data_delta);
351 // Signed right shift is arithmetic shift. Tested in test-utils.cc. 355 // Signed right shift is arithmetic shift. Tested in test-utils.cc.
352 data_delta = data_delta >> kBitsPerByte; 356 data_delta = data_delta >> kBitsPerByte;
353 } 357 }
354 } 358 }
355 359
360
361 #if !defined(V8_TARGET_ARCH_X64)
356 void RelocInfoWriter::WriteExtraTaggedConstPoolData(int data) { 362 void RelocInfoWriter::WriteExtraTaggedConstPoolData(int data) {
357 WriteExtraTag(kConstPoolExtraTag, kConstPoolTag); 363 WriteExtraTag(kConstPoolExtraTag, kConstPoolTag);
358 for (int i = 0; i < kIntSize; i++) { 364 for (int i = 0; i < kIntSize; i++) {
359 *--pos_ = static_cast<byte>(data); 365 *--pos_ = static_cast<byte>(data);
360 // Signed right shift is arithmetic shift. Tested in test-utils.cc. 366 // Signed right shift is arithmetic shift. Tested in test-utils.cc.
361 data = data >> kBitsPerByte; 367 data = data >> kBitsPerByte;
362 } 368 }
363 } 369 }
370 #else
371 void RelocInfoWriter::WriteExtraTaggedDeoptEntryData(int data) {
372 WriteExtraTag(kDeoptEntryExtraTag, kDeoptEntryTag);
373 for (int i = 0; i < kIntSize; i++) {
374 *--pos_ = static_cast<byte>(data);
375 // Signed right shift is arithmetic shift. Tested in test-utils.cc.
376 data = data >> kBitsPerByte;
377 }
378 }
379 #endif
380
364 381
365 void RelocInfoWriter::WriteExtraTaggedData(intptr_t data_delta, int top_tag) { 382 void RelocInfoWriter::WriteExtraTaggedData(intptr_t data_delta, int top_tag) {
366 WriteExtraTag(kDataJumpExtraTag, top_tag); 383 WriteExtraTag(kDataJumpExtraTag, top_tag);
367 for (int i = 0; i < kIntptrSize; i++) { 384 for (int i = 0; i < kIntptrSize; i++) {
368 *--pos_ = static_cast<byte>(data_delta); 385 *--pos_ = static_cast<byte>(data_delta);
369 // Signed right shift is arithmetic shift. Tested in test-utils.cc. 386 // Signed right shift is arithmetic shift. Tested in test-utils.cc.
370 data_delta = data_delta >> kBitsPerByte; 387 data_delta = data_delta >> kBitsPerByte;
371 } 388 }
372 } 389 }
373 390
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 // Otherwise, use costly encoding. 435 // Otherwise, use costly encoding.
419 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); 436 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag);
420 WriteExtraTaggedIntData(pos_delta, pos_type_tag); 437 WriteExtraTaggedIntData(pos_delta, pos_type_tag);
421 } 438 }
422 last_position_ = static_cast<int>(rinfo->data()); 439 last_position_ = static_cast<int>(rinfo->data());
423 } else if (RelocInfo::IsComment(rmode)) { 440 } else if (RelocInfo::IsComment(rmode)) {
424 // Comments are normally not generated, so we use the costly encoding. 441 // Comments are normally not generated, so we use the costly encoding.
425 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); 442 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag);
426 WriteExtraTaggedData(rinfo->data(), kCommentTag); 443 WriteExtraTaggedData(rinfo->data(), kCommentTag);
427 ASSERT(begin_pos - pos_ >= RelocInfo::kMinRelocCommentSize); 444 ASSERT(begin_pos - pos_ >= RelocInfo::kMinRelocCommentSize);
445 #if !defined(V8_TARGET_ARCH_X64)
428 } else if (RelocInfo::IsConstPool(rmode)) { 446 } else if (RelocInfo::IsConstPool(rmode)) {
429 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); 447 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag);
430 WriteExtraTaggedConstPoolData(static_cast<int>(rinfo->data())); 448 WriteExtraTaggedConstPoolData(static_cast<int>(rinfo->data()));
449 #else
450 } else if (RelocInfo::IsDeoptEntry(rmode)) {
451 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag);
452 WriteExtraTaggedDeoptEntryData(static_cast<int>(rinfo->data()));
453 #endif
431 } else { 454 } else {
432 ASSERT(rmode > RelocInfo::LAST_COMPACT_ENUM); 455 ASSERT(rmode > RelocInfo::LAST_COMPACT_ENUM);
433 int saved_mode = rmode - RelocInfo::LAST_COMPACT_ENUM; 456 int saved_mode = rmode - RelocInfo::LAST_COMPACT_ENUM;
434 // For all other modes we simply use the mode as the extra tag. 457 // For all other modes we simply use the mode as the extra tag.
435 // None of these modes need a data component. 458 // None of these modes need a data component.
436 ASSERT(saved_mode < kPCJumpExtraTag && saved_mode < kDataJumpExtraTag); 459 ASSERT(saved_mode < kPCJumpExtraTag && saved_mode < kDataJumpExtraTag);
437 WriteExtraTaggedPC(pc_delta, saved_mode); 460 WriteExtraTaggedPC(pc_delta, saved_mode);
438 } 461 }
439 last_pc_ = rinfo->pc(); 462 last_pc_ = rinfo->pc();
440 #ifdef DEBUG 463 #ifdef DEBUG
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 Advance(kIntSize); 636 Advance(kIntSize);
614 } 637 }
615 } else { 638 } else {
616 ASSERT(locatable_tag == kCommentTag); 639 ASSERT(locatable_tag == kCommentTag);
617 if (SetMode(RelocInfo::COMMENT)) { 640 if (SetMode(RelocInfo::COMMENT)) {
618 AdvanceReadData(); 641 AdvanceReadData();
619 return; 642 return;
620 } 643 }
621 Advance(kIntptrSize); 644 Advance(kIntptrSize);
622 } 645 }
646 #if !defined(V8_TARGET_ARCH_X64)
623 } else if ((extra_tag == kConstPoolExtraTag) && 647 } else if ((extra_tag == kConstPoolExtraTag) &&
624 (GetTopTag() == kConstPoolTag)) { 648 (GetTopTag() == kConstPoolTag)) {
625 if (SetMode(RelocInfo::CONST_POOL)) { 649 if (SetMode(RelocInfo::CONST_POOL)) {
626 AdvanceReadConstPoolData(); 650 AdvanceReadConstPoolData();
627 return; 651 return;
628 } 652 }
629 Advance(kIntSize); 653 Advance(kIntSize);
654 #else
655 } else if ((extra_tag == kDeoptEntryExtraTag) &&
656 (GetTopTag() == kDeoptEntryTag)) {
657 if (SetMode(RelocInfo::DEOPT_ENTRY)) {
658 AdvanceReadConstPoolData();
659 return;
660 }
661 Advance(kIntSize);
662 #endif
630 } else { 663 } else {
631 AdvanceReadPC(); 664 AdvanceReadPC();
632 int rmode = extra_tag + RelocInfo::LAST_COMPACT_ENUM; 665 int rmode = extra_tag + RelocInfo::LAST_COMPACT_ENUM;
633 if (SetMode(static_cast<RelocInfo::Mode>(rmode))) return; 666 if (SetMode(static_cast<RelocInfo::Mode>(rmode))) return;
634 } 667 }
635 } 668 }
636 } 669 }
637 if (code_age_sequence_ != NULL) { 670 if (code_age_sequence_ != NULL) {
638 byte* old_code_age_sequence = code_age_sequence_; 671 byte* old_code_age_sequence = code_age_sequence_;
639 code_age_sequence_ = NULL; 672 code_age_sequence_ = NULL;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 case RelocInfo::COMMENT: 751 case RelocInfo::COMMENT:
719 return "comment"; 752 return "comment";
720 case RelocInfo::POSITION: 753 case RelocInfo::POSITION:
721 return "position"; 754 return "position";
722 case RelocInfo::STATEMENT_POSITION: 755 case RelocInfo::STATEMENT_POSITION:
723 return "statement position"; 756 return "statement position";
724 case RelocInfo::EXTERNAL_REFERENCE: 757 case RelocInfo::EXTERNAL_REFERENCE:
725 return "external reference"; 758 return "external reference";
726 case RelocInfo::INTERNAL_REFERENCE: 759 case RelocInfo::INTERNAL_REFERENCE:
727 return "internal reference"; 760 return "internal reference";
761 #if !defined(V8_TARGET_ARCH_X64)
728 case RelocInfo::CONST_POOL: 762 case RelocInfo::CONST_POOL:
729 return "constant pool"; 763 return "constant pool";
764 #else
765 case RelocInfo::DEOPT_ENTRY:
766 return "deopt entry";
767 #endif
730 case RelocInfo::DEBUG_BREAK_SLOT: 768 case RelocInfo::DEBUG_BREAK_SLOT:
731 #ifndef ENABLE_DEBUGGER_SUPPORT 769 #ifndef ENABLE_DEBUGGER_SUPPORT
732 UNREACHABLE(); 770 UNREACHABLE();
733 #endif 771 #endif
734 return "debug break slot"; 772 return "debug break slot";
735 case RelocInfo::CODE_AGE_SEQUENCE: 773 case RelocInfo::CODE_AGE_SEQUENCE:
736 return "code_age_sequence"; 774 return "code_age_sequence";
737 case RelocInfo::NUMBER_OF_MODES: 775 case RelocInfo::NUMBER_OF_MODES:
738 UNREACHABLE(); 776 UNREACHABLE();
739 return "number_of_modes"; 777 return "number_of_modes";
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 CHECK(code->address() == HeapObject::cast(found)->address()); 845 CHECK(code->address() == HeapObject::cast(found)->address());
808 break; 846 break;
809 } 847 }
810 case RUNTIME_ENTRY: 848 case RUNTIME_ENTRY:
811 case JS_RETURN: 849 case JS_RETURN:
812 case COMMENT: 850 case COMMENT:
813 case POSITION: 851 case POSITION:
814 case STATEMENT_POSITION: 852 case STATEMENT_POSITION:
815 case EXTERNAL_REFERENCE: 853 case EXTERNAL_REFERENCE:
816 case INTERNAL_REFERENCE: 854 case INTERNAL_REFERENCE:
855 #if !defined(V8_TARGET_ARCH_X64)
817 case CONST_POOL: 856 case CONST_POOL:
857 #else
858 case DEOPT_ENTRY:
859 #endif
818 case DEBUG_BREAK_SLOT: 860 case DEBUG_BREAK_SLOT:
819 case NONE: 861 case NONE:
820 break; 862 break;
821 case NUMBER_OF_MODES: 863 case NUMBER_OF_MODES:
822 UNREACHABLE(); 864 UNREACHABLE();
823 break; 865 break;
824 case CODE_AGE_SEQUENCE: 866 case CODE_AGE_SEQUENCE:
825 ASSERT(Code::IsYoungSequence(pc_) || code_age_stub()->IsCode()); 867 ASSERT(Code::IsYoungSequence(pc_) || code_age_stub()->IsCode());
826 break; 868 break;
827 } 869 }
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); 1591 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position);
1550 state_.written_position = state_.current_position; 1592 state_.written_position = state_.current_position;
1551 written = true; 1593 written = true;
1552 } 1594 }
1553 1595
1554 // Return whether something was written. 1596 // Return whether something was written.
1555 return written; 1597 return written;
1556 } 1598 }
1557 1599
1558 } } // namespace v8::internal 1600 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698