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

Side by Side Diff: src/assembler.cc

Issue 10837037: Age code to allow reclaiming old unexecuted functions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 8 years, 1 month 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
« no previous file with comments | « src/assembler.h ('k') | src/builtins.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 // Signed right shift is arithmetic shift. Tested in test-utils.cc. 306 // Signed right shift is arithmetic shift. Tested in test-utils.cc.
307 data_delta = data_delta >> kBitsPerByte; 307 data_delta = data_delta >> kBitsPerByte;
308 } 308 }
309 } 309 }
310 310
311 311
312 void RelocInfoWriter::Write(const RelocInfo* rinfo) { 312 void RelocInfoWriter::Write(const RelocInfo* rinfo) {
313 #ifdef DEBUG 313 #ifdef DEBUG
314 byte* begin_pos = pos_; 314 byte* begin_pos = pos_;
315 #endif 315 #endif
316 ASSERT(rinfo->rmode() < RelocInfo::NUMBER_OF_MODES);
316 ASSERT(rinfo->pc() - last_pc_ >= 0); 317 ASSERT(rinfo->pc() - last_pc_ >= 0);
317 ASSERT(RelocInfo::LAST_STANDARD_NONCOMPACT_ENUM - RelocInfo::LAST_COMPACT_ENUM 318 ASSERT(RelocInfo::LAST_STANDARD_NONCOMPACT_ENUM - RelocInfo::LAST_COMPACT_ENUM
318 <= kMaxStandardNonCompactModes); 319 <= kMaxStandardNonCompactModes);
319 // Use unsigned delta-encoding for pc. 320 // Use unsigned delta-encoding for pc.
320 uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_); 321 uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_);
321 RelocInfo::Mode rmode = rinfo->rmode(); 322 RelocInfo::Mode rmode = rinfo->rmode();
322 323
323 // The two most common modes are given small tags, and usually fit in a byte. 324 // The two most common modes are given small tags, and usually fit in a byte.
324 if (rmode == RelocInfo::EMBEDDED_OBJECT) { 325 if (rmode == RelocInfo::EMBEDDED_OBJECT) {
325 WriteTaggedPC(pc_delta, kEmbeddedObjectTag); 326 WriteTaggedPC(pc_delta, kEmbeddedObjectTag);
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 return; 564 return;
564 } 565 }
565 Advance(kIntSize); 566 Advance(kIntSize);
566 } else { 567 } else {
567 AdvanceReadPC(); 568 AdvanceReadPC();
568 int rmode = extra_tag + RelocInfo::LAST_COMPACT_ENUM; 569 int rmode = extra_tag + RelocInfo::LAST_COMPACT_ENUM;
569 if (SetMode(static_cast<RelocInfo::Mode>(rmode))) return; 570 if (SetMode(static_cast<RelocInfo::Mode>(rmode))) return;
570 } 571 }
571 } 572 }
572 } 573 }
574 if (code_age_sequence_ != NULL) {
575 byte* old_code_age_sequence = code_age_sequence_;
576 code_age_sequence_ = NULL;
577 if (SetMode(RelocInfo::CODE_AGE_SEQUENCE)) {
578 rinfo_.data_ = 0;
579 rinfo_.pc_ = old_code_age_sequence;
580 return;
581 }
582 }
573 done_ = true; 583 done_ = true;
574 } 584 }
575 585
576 586
577 RelocIterator::RelocIterator(Code* code, int mode_mask) { 587 RelocIterator::RelocIterator(Code* code, int mode_mask) {
578 rinfo_.host_ = code; 588 rinfo_.host_ = code;
579 rinfo_.pc_ = code->instruction_start(); 589 rinfo_.pc_ = code->instruction_start();
580 rinfo_.data_ = 0; 590 rinfo_.data_ = 0;
581 // Relocation info is read backwards. 591 // Relocation info is read backwards.
582 pos_ = code->relocation_start() + code->relocation_size(); 592 pos_ = code->relocation_start() + code->relocation_size();
583 end_ = code->relocation_start(); 593 end_ = code->relocation_start();
584 done_ = false; 594 done_ = false;
585 mode_mask_ = mode_mask; 595 mode_mask_ = mode_mask;
586 last_id_ = 0; 596 last_id_ = 0;
587 last_position_ = 0; 597 last_position_ = 0;
598 byte* sequence = code->FindCodeAgeSequence();
599 if (sequence != NULL && !Code::IsYoungSequence(sequence)) {
600 code_age_sequence_ = sequence;
601 } else {
602 code_age_sequence_ = NULL;
603 }
588 if (mode_mask_ == 0) pos_ = end_; 604 if (mode_mask_ == 0) pos_ = end_;
589 next(); 605 next();
590 } 606 }
591 607
592 608
593 RelocIterator::RelocIterator(const CodeDesc& desc, int mode_mask) { 609 RelocIterator::RelocIterator(const CodeDesc& desc, int mode_mask) {
594 rinfo_.pc_ = desc.buffer; 610 rinfo_.pc_ = desc.buffer;
595 rinfo_.data_ = 0; 611 rinfo_.data_ = 0;
596 // Relocation info is read backwards. 612 // Relocation info is read backwards.
597 pos_ = desc.buffer + desc.buffer_size; 613 pos_ = desc.buffer + desc.buffer_size;
598 end_ = pos_ - desc.reloc_size; 614 end_ = pos_ - desc.reloc_size;
599 done_ = false; 615 done_ = false;
600 mode_mask_ = mode_mask; 616 mode_mask_ = mode_mask;
601 last_id_ = 0; 617 last_id_ = 0;
602 last_position_ = 0; 618 last_position_ = 0;
619 code_age_sequence_ = NULL;
603 if (mode_mask_ == 0) pos_ = end_; 620 if (mode_mask_ == 0) pos_ = end_;
604 next(); 621 next();
605 } 622 }
606 623
607 624
608 // ----------------------------------------------------------------------------- 625 // -----------------------------------------------------------------------------
609 // Implementation of RelocInfo 626 // Implementation of RelocInfo
610 627
611 628
612 #ifdef ENABLE_DISASSEMBLER 629 #ifdef ENABLE_DISASSEMBLER
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 return "external reference"; 662 return "external reference";
646 case RelocInfo::INTERNAL_REFERENCE: 663 case RelocInfo::INTERNAL_REFERENCE:
647 return "internal reference"; 664 return "internal reference";
648 case RelocInfo::CONST_POOL: 665 case RelocInfo::CONST_POOL:
649 return "constant pool"; 666 return "constant pool";
650 case RelocInfo::DEBUG_BREAK_SLOT: 667 case RelocInfo::DEBUG_BREAK_SLOT:
651 #ifndef ENABLE_DEBUGGER_SUPPORT 668 #ifndef ENABLE_DEBUGGER_SUPPORT
652 UNREACHABLE(); 669 UNREACHABLE();
653 #endif 670 #endif
654 return "debug break slot"; 671 return "debug break slot";
672 case RelocInfo::CODE_AGE_SEQUENCE:
673 return "code_age_sequence";
655 case RelocInfo::NUMBER_OF_MODES: 674 case RelocInfo::NUMBER_OF_MODES:
656 UNREACHABLE(); 675 UNREACHABLE();
657 return "number_of_modes"; 676 return "number_of_modes";
658 } 677 }
659 return "unknown relocation type"; 678 return "unknown relocation type";
660 } 679 }
661 680
662 681
663 void RelocInfo::Print(FILE* out) { 682 void RelocInfo::Print(FILE* out) {
664 PrintF(out, "%p %s", pc_, RelocModeName(rmode_)); 683 PrintF(out, "%p %s", pc_, RelocModeName(rmode_));
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 case STATEMENT_POSITION: 751 case STATEMENT_POSITION:
733 case EXTERNAL_REFERENCE: 752 case EXTERNAL_REFERENCE:
734 case INTERNAL_REFERENCE: 753 case INTERNAL_REFERENCE:
735 case CONST_POOL: 754 case CONST_POOL:
736 case DEBUG_BREAK_SLOT: 755 case DEBUG_BREAK_SLOT:
737 case NONE: 756 case NONE:
738 break; 757 break;
739 case NUMBER_OF_MODES: 758 case NUMBER_OF_MODES:
740 UNREACHABLE(); 759 UNREACHABLE();
741 break; 760 break;
761 case CODE_AGE_SEQUENCE:
762 ASSERT(Code::IsYoungSequence(pc_) || code_age_stub()->IsCode());
763 break;
742 } 764 }
743 } 765 }
744 #endif // VERIFY_HEAP 766 #endif // VERIFY_HEAP
745 767
746 768
747 // ----------------------------------------------------------------------------- 769 // -----------------------------------------------------------------------------
748 // Implementation of ExternalReference 770 // Implementation of ExternalReference
749 771
750 void ExternalReference::SetUp() { 772 void ExternalReference::SetUp() {
751 double_constants.min_int = kMinInt; 773 double_constants.min_int = kMinInt;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(V8::Random))); 889 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(V8::Random)));
868 } 890 }
869 891
870 892
871 ExternalReference ExternalReference::get_date_field_function( 893 ExternalReference ExternalReference::get_date_field_function(
872 Isolate* isolate) { 894 Isolate* isolate) {
873 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(JSDate::GetField))); 895 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(JSDate::GetField)));
874 } 896 }
875 897
876 898
899 ExternalReference ExternalReference::get_make_code_young_function(
900 Isolate* isolate) {
901 return ExternalReference(Redirect(
902 isolate, FUNCTION_ADDR(Code::MakeCodeAgeSequenceYoung)));
903 }
904
905
877 ExternalReference ExternalReference::date_cache_stamp(Isolate* isolate) { 906 ExternalReference ExternalReference::date_cache_stamp(Isolate* isolate) {
878 return ExternalReference(isolate->date_cache()->stamp_address()); 907 return ExternalReference(isolate->date_cache()->stamp_address());
879 } 908 }
880 909
881 910
882 ExternalReference ExternalReference::transcendental_cache_array_address( 911 ExternalReference ExternalReference::transcendental_cache_array_address(
883 Isolate* isolate) { 912 Isolate* isolate) {
884 return ExternalReference( 913 return ExternalReference(
885 isolate->transcendental_cache()->cache_array_address()); 914 isolate->transcendental_cache()->cache_array_address());
886 } 915 }
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); 1395 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position);
1367 state_.written_position = state_.current_position; 1396 state_.written_position = state_.current_position;
1368 written = true; 1397 written = true;
1369 } 1398 }
1370 1399
1371 // Return whether something was written. 1400 // Return whether something was written.
1372 return written; 1401 return written;
1373 } 1402 }
1374 1403
1375 } } // namespace v8::internal 1404 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/assembler.h ('k') | src/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698