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