OLD | NEW |
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 Loading... |
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 Loading... |
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 rinfo_.pc_ = code_age_sequence_; |
| 576 code_age_sequence_ = NULL; |
| 577 rinfo_.data_ = 0; |
| 578 if (SetMode(RelocInfo::CODE_AGE_SEQUENCE)) { |
| 579 return; |
| 580 } |
| 581 } |
573 done_ = true; | 582 done_ = true; |
574 } | 583 } |
575 | 584 |
576 | 585 |
577 RelocIterator::RelocIterator(Code* code, int mode_mask) { | 586 RelocIterator::RelocIterator(Code* code, int mode_mask) { |
578 rinfo_.host_ = code; | 587 rinfo_.host_ = code; |
579 rinfo_.pc_ = code->instruction_start(); | 588 rinfo_.pc_ = code->instruction_start(); |
580 rinfo_.data_ = 0; | 589 rinfo_.data_ = 0; |
581 // Relocation info is read backwards. | 590 // Relocation info is read backwards. |
582 pos_ = code->relocation_start() + code->relocation_size(); | 591 pos_ = code->relocation_start() + code->relocation_size(); |
583 end_ = code->relocation_start(); | 592 end_ = code->relocation_start(); |
584 done_ = false; | 593 done_ = false; |
585 mode_mask_ = mode_mask; | 594 mode_mask_ = mode_mask; |
586 last_id_ = 0; | 595 last_id_ = 0; |
587 last_position_ = 0; | 596 last_position_ = 0; |
| 597 code_age_sequence_ = code->FindCodeAgeSequence(); |
588 if (mode_mask_ == 0) pos_ = end_; | 598 if (mode_mask_ == 0) pos_ = end_; |
589 next(); | 599 next(); |
590 } | 600 } |
591 | 601 |
592 | 602 |
593 RelocIterator::RelocIterator(const CodeDesc& desc, int mode_mask) { | 603 RelocIterator::RelocIterator(const CodeDesc& desc, int mode_mask) { |
594 rinfo_.pc_ = desc.buffer; | 604 rinfo_.pc_ = desc.buffer; |
595 rinfo_.data_ = 0; | 605 rinfo_.data_ = 0; |
596 // Relocation info is read backwards. | 606 // Relocation info is read backwards. |
597 pos_ = desc.buffer + desc.buffer_size; | 607 pos_ = desc.buffer + desc.buffer_size; |
598 end_ = pos_ - desc.reloc_size; | 608 end_ = pos_ - desc.reloc_size; |
599 done_ = false; | 609 done_ = false; |
600 mode_mask_ = mode_mask; | 610 mode_mask_ = mode_mask; |
601 last_id_ = 0; | 611 last_id_ = 0; |
602 last_position_ = 0; | 612 last_position_ = 0; |
| 613 code_age_sequence_ = NULL; |
603 if (mode_mask_ == 0) pos_ = end_; | 614 if (mode_mask_ == 0) pos_ = end_; |
604 next(); | 615 next(); |
605 } | 616 } |
606 | 617 |
607 | 618 |
608 // ----------------------------------------------------------------------------- | 619 // ----------------------------------------------------------------------------- |
609 // Implementation of RelocInfo | 620 // Implementation of RelocInfo |
610 | 621 |
611 | 622 |
612 #ifdef ENABLE_DISASSEMBLER | 623 #ifdef ENABLE_DISASSEMBLER |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 return "external reference"; | 656 return "external reference"; |
646 case RelocInfo::INTERNAL_REFERENCE: | 657 case RelocInfo::INTERNAL_REFERENCE: |
647 return "internal reference"; | 658 return "internal reference"; |
648 case RelocInfo::CONST_POOL: | 659 case RelocInfo::CONST_POOL: |
649 return "constant pool"; | 660 return "constant pool"; |
650 case RelocInfo::DEBUG_BREAK_SLOT: | 661 case RelocInfo::DEBUG_BREAK_SLOT: |
651 #ifndef ENABLE_DEBUGGER_SUPPORT | 662 #ifndef ENABLE_DEBUGGER_SUPPORT |
652 UNREACHABLE(); | 663 UNREACHABLE(); |
653 #endif | 664 #endif |
654 return "debug break slot"; | 665 return "debug break slot"; |
| 666 case RelocInfo::CODE_AGE_SEQUENCE: |
| 667 return "code_age_sequence"; |
655 case RelocInfo::NUMBER_OF_MODES: | 668 case RelocInfo::NUMBER_OF_MODES: |
656 UNREACHABLE(); | 669 UNREACHABLE(); |
657 return "number_of_modes"; | 670 return "number_of_modes"; |
658 } | 671 } |
659 return "unknown relocation type"; | 672 return "unknown relocation type"; |
660 } | 673 } |
661 | 674 |
662 | 675 |
663 void RelocInfo::Print(FILE* out) { | 676 void RelocInfo::Print(FILE* out) { |
664 PrintF(out, "%p %s", pc_, RelocModeName(rmode_)); | 677 PrintF(out, "%p %s", pc_, RelocModeName(rmode_)); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 case STATEMENT_POSITION: | 745 case STATEMENT_POSITION: |
733 case EXTERNAL_REFERENCE: | 746 case EXTERNAL_REFERENCE: |
734 case INTERNAL_REFERENCE: | 747 case INTERNAL_REFERENCE: |
735 case CONST_POOL: | 748 case CONST_POOL: |
736 case DEBUG_BREAK_SLOT: | 749 case DEBUG_BREAK_SLOT: |
737 case NONE: | 750 case NONE: |
738 break; | 751 break; |
739 case NUMBER_OF_MODES: | 752 case NUMBER_OF_MODES: |
740 UNREACHABLE(); | 753 UNREACHABLE(); |
741 break; | 754 break; |
| 755 case CODE_AGE_SEQUENCE: |
| 756 Code* stub = code_age_stub(); |
| 757 ASSERT(stub == NULL || stub->IsCode()); |
| 758 break; |
742 } | 759 } |
743 } | 760 } |
744 #endif // DEBUG | 761 #endif // DEBUG |
745 | 762 |
746 | 763 |
747 // ----------------------------------------------------------------------------- | 764 // ----------------------------------------------------------------------------- |
748 // Implementation of ExternalReference | 765 // Implementation of ExternalReference |
749 | 766 |
750 void ExternalReference::SetUp() { | 767 void ExternalReference::SetUp() { |
751 double_constants.min_int = kMinInt; | 768 double_constants.min_int = kMinInt; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(V8::Random))); | 884 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(V8::Random))); |
868 } | 885 } |
869 | 886 |
870 | 887 |
871 ExternalReference ExternalReference::get_date_field_function( | 888 ExternalReference ExternalReference::get_date_field_function( |
872 Isolate* isolate) { | 889 Isolate* isolate) { |
873 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(JSDate::GetField))); | 890 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(JSDate::GetField))); |
874 } | 891 } |
875 | 892 |
876 | 893 |
| 894 ExternalReference ExternalReference::get_make_code_young_function( |
| 895 Isolate* isolate) { |
| 896 return ExternalReference(Redirect( |
| 897 isolate, FUNCTION_ADDR(Code::MakeCodeAgeSequenceYoung))); |
| 898 } |
| 899 |
| 900 |
877 ExternalReference ExternalReference::date_cache_stamp(Isolate* isolate) { | 901 ExternalReference ExternalReference::date_cache_stamp(Isolate* isolate) { |
878 return ExternalReference(isolate->date_cache()->stamp_address()); | 902 return ExternalReference(isolate->date_cache()->stamp_address()); |
879 } | 903 } |
880 | 904 |
881 | 905 |
882 ExternalReference ExternalReference::transcendental_cache_array_address( | 906 ExternalReference ExternalReference::transcendental_cache_array_address( |
883 Isolate* isolate) { | 907 Isolate* isolate) { |
884 return ExternalReference( | 908 return ExternalReference( |
885 isolate->transcendental_cache()->cache_array_address()); | 909 isolate->transcendental_cache()->cache_array_address()); |
886 } | 910 } |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); | 1390 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); |
1367 state_.written_position = state_.current_position; | 1391 state_.written_position = state_.current_position; |
1368 written = true; | 1392 written = true; |
1369 } | 1393 } |
1370 | 1394 |
1371 // Return whether something was written. | 1395 // Return whether something was written. |
1372 return written; | 1396 return written; |
1373 } | 1397 } |
1374 | 1398 |
1375 } } // namespace v8::internal | 1399 } } // namespace v8::internal |
OLD | NEW |