OLD | NEW |
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 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 Object** limit, | 769 Object** limit, |
770 int source_space, | 770 int source_space, |
771 Address current_object_address) { | 771 Address current_object_address) { |
772 Isolate* const isolate = isolate_; | 772 Isolate* const isolate = isolate_; |
773 // Write barrier support costs around 1% in startup time. In fact there | 773 // Write barrier support costs around 1% in startup time. In fact there |
774 // are no new space objects in current boot snapshots, so it's not needed, | 774 // are no new space objects in current boot snapshots, so it's not needed, |
775 // but that may change. | 775 // but that may change. |
776 bool write_barrier_needed = (current_object_address != NULL && | 776 bool write_barrier_needed = (current_object_address != NULL && |
777 source_space != NEW_SPACE && | 777 source_space != NEW_SPACE && |
778 source_space != CELL_SPACE && | 778 source_space != CELL_SPACE && |
| 779 source_space != PROPERTY_CELL_SPACE && |
779 source_space != CODE_SPACE && | 780 source_space != CODE_SPACE && |
780 source_space != OLD_DATA_SPACE); | 781 source_space != OLD_DATA_SPACE); |
781 while (current < limit) { | 782 while (current < limit) { |
782 int data = source_->Get(); | 783 int data = source_->Get(); |
783 switch (data) { | 784 switch (data) { |
784 #define CASE_STATEMENT(where, how, within, space_number) \ | 785 #define CASE_STATEMENT(where, how, within, space_number) \ |
785 case where + how + within + space_number: \ | 786 case where + how + within + space_number: \ |
786 ASSERT((where & ~kPointedToMask) == 0); \ | 787 ASSERT((where & ~kPointedToMask) == 0); \ |
787 ASSERT((how & ~kHowToCodeMask) == 0); \ | 788 ASSERT((how & ~kHowToCodeMask) == 0); \ |
788 ASSERT((within & ~kWhereToPointMask) == 0); \ | 789 ASSERT((within & ~kWhereToPointMask) == 0); \ |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 emit_write_barrier = (space_number == NEW_SPACE); \ | 830 emit_write_barrier = (space_number == NEW_SPACE); \ |
830 new_object = GetAddressFromEnd(data & kSpaceMask); \ | 831 new_object = GetAddressFromEnd(data & kSpaceMask); \ |
831 } \ | 832 } \ |
832 if (within == kInnerPointer) { \ | 833 if (within == kInnerPointer) { \ |
833 if (space_number != CODE_SPACE || new_object->IsCode()) { \ | 834 if (space_number != CODE_SPACE || new_object->IsCode()) { \ |
834 Code* new_code_object = reinterpret_cast<Code*>(new_object); \ | 835 Code* new_code_object = reinterpret_cast<Code*>(new_object); \ |
835 new_object = reinterpret_cast<Object*>( \ | 836 new_object = reinterpret_cast<Object*>( \ |
836 new_code_object->instruction_start()); \ | 837 new_code_object->instruction_start()); \ |
837 } else { \ | 838 } else { \ |
838 ASSERT(space_number == CODE_SPACE); \ | 839 ASSERT(space_number == CODE_SPACE); \ |
839 JSGlobalPropertyCell* cell = \ | 840 Cell* cell = Cell::cast(new_object); \ |
840 JSGlobalPropertyCell::cast(new_object); \ | |
841 new_object = reinterpret_cast<Object*>( \ | 841 new_object = reinterpret_cast<Object*>( \ |
842 cell->ValueAddress()); \ | 842 cell->ValueAddress()); \ |
843 } \ | 843 } \ |
844 } \ | 844 } \ |
845 if (how == kFromCode) { \ | 845 if (how == kFromCode) { \ |
846 Address location_of_branch_data = \ | 846 Address location_of_branch_data = \ |
847 reinterpret_cast<Address>(current); \ | 847 reinterpret_cast<Address>(current); \ |
848 Assembler::deserialization_set_special_target_at( \ | 848 Assembler::deserialization_set_special_target_at( \ |
849 location_of_branch_data, \ | 849 location_of_branch_data, \ |
850 reinterpret_cast<Address>(new_object)); \ | 850 reinterpret_cast<Address>(new_object)); \ |
(...skipping 19 matching lines...) Expand all Loading... |
870 // This generates a case and a body for the new space (which has to do extra | 870 // This generates a case and a body for the new space (which has to do extra |
871 // write barrier handling) and handles the other spaces with 8 fall-through | 871 // write barrier handling) and handles the other spaces with 8 fall-through |
872 // cases and one body. | 872 // cases and one body. |
873 #define ALL_SPACES(where, how, within) \ | 873 #define ALL_SPACES(where, how, within) \ |
874 CASE_STATEMENT(where, how, within, NEW_SPACE) \ | 874 CASE_STATEMENT(where, how, within, NEW_SPACE) \ |
875 CASE_BODY(where, how, within, NEW_SPACE) \ | 875 CASE_BODY(where, how, within, NEW_SPACE) \ |
876 CASE_STATEMENT(where, how, within, OLD_DATA_SPACE) \ | 876 CASE_STATEMENT(where, how, within, OLD_DATA_SPACE) \ |
877 CASE_STATEMENT(where, how, within, OLD_POINTER_SPACE) \ | 877 CASE_STATEMENT(where, how, within, OLD_POINTER_SPACE) \ |
878 CASE_STATEMENT(where, how, within, CODE_SPACE) \ | 878 CASE_STATEMENT(where, how, within, CODE_SPACE) \ |
879 CASE_STATEMENT(where, how, within, CELL_SPACE) \ | 879 CASE_STATEMENT(where, how, within, CELL_SPACE) \ |
| 880 CASE_STATEMENT(where, how, within, PROPERTY_CELL_SPACE) \ |
880 CASE_STATEMENT(where, how, within, MAP_SPACE) \ | 881 CASE_STATEMENT(where, how, within, MAP_SPACE) \ |
881 CASE_BODY(where, how, within, kAnyOldSpace) | 882 CASE_BODY(where, how, within, kAnyOldSpace) |
882 | 883 |
883 #define FOUR_CASES(byte_code) \ | 884 #define FOUR_CASES(byte_code) \ |
884 case byte_code: \ | 885 case byte_code: \ |
885 case byte_code + 1: \ | 886 case byte_code + 1: \ |
886 case byte_code + 2: \ | 887 case byte_code + 2: \ |
887 case byte_code + 3: | 888 case byte_code + 3: |
888 | 889 |
889 #define SIXTEEN_CASES(byte_code) \ | 890 #define SIXTEEN_CASES(byte_code) \ |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1557 | 1558 |
1558 | 1559 |
1559 void Serializer::ObjectSerializer::VisitCodeEntry(Address entry_address) { | 1560 void Serializer::ObjectSerializer::VisitCodeEntry(Address entry_address) { |
1560 Code* target = Code::cast(Code::GetObjectFromEntryAddress(entry_address)); | 1561 Code* target = Code::cast(Code::GetObjectFromEntryAddress(entry_address)); |
1561 int skip = OutputRawData(entry_address, kCanReturnSkipInsteadOfSkipping); | 1562 int skip = OutputRawData(entry_address, kCanReturnSkipInsteadOfSkipping); |
1562 serializer_->SerializeObject(target, kPlain, kInnerPointer, skip); | 1563 serializer_->SerializeObject(target, kPlain, kInnerPointer, skip); |
1563 bytes_processed_so_far_ += kPointerSize; | 1564 bytes_processed_so_far_ += kPointerSize; |
1564 } | 1565 } |
1565 | 1566 |
1566 | 1567 |
1567 void Serializer::ObjectSerializer::VisitGlobalPropertyCell(RelocInfo* rinfo) { | 1568 void Serializer::ObjectSerializer::VisitCell(RelocInfo* rinfo) { |
1568 ASSERT(rinfo->rmode() == RelocInfo::GLOBAL_PROPERTY_CELL); | 1569 ASSERT(rinfo->rmode() == RelocInfo::CELL); |
1569 JSGlobalPropertyCell* cell = | 1570 Cell* cell = Cell::cast(rinfo->target_cell()); |
1570 JSGlobalPropertyCell::cast(rinfo->target_cell()); | |
1571 int skip = OutputRawData(rinfo->pc(), kCanReturnSkipInsteadOfSkipping); | 1571 int skip = OutputRawData(rinfo->pc(), kCanReturnSkipInsteadOfSkipping); |
1572 serializer_->SerializeObject(cell, kPlain, kInnerPointer, skip); | 1572 serializer_->SerializeObject(cell, kPlain, kInnerPointer, skip); |
1573 } | 1573 } |
1574 | 1574 |
1575 | 1575 |
1576 void Serializer::ObjectSerializer::VisitExternalAsciiString( | 1576 void Serializer::ObjectSerializer::VisitExternalAsciiString( |
1577 v8::String::ExternalAsciiStringResource** resource_pointer) { | 1577 v8::String::ExternalAsciiStringResource** resource_pointer) { |
1578 Address references_start = reinterpret_cast<Address>(resource_pointer); | 1578 Address references_start = reinterpret_cast<Address>(resource_pointer); |
1579 OutputRawData(references_start); | 1579 OutputRawData(references_start); |
1580 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { | 1580 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1685 | 1685 |
1686 bool SnapshotByteSource::AtEOF() { | 1686 bool SnapshotByteSource::AtEOF() { |
1687 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false; | 1687 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false; |
1688 for (int x = position_; x < length_; x++) { | 1688 for (int x = position_; x < length_; x++) { |
1689 if (data_[x] != SerializerDeserializer::nop()) return false; | 1689 if (data_[x] != SerializerDeserializer::nop()) return false; |
1690 } | 1690 } |
1691 return true; | 1691 return true; |
1692 } | 1692 } |
1693 | 1693 |
1694 } } // namespace v8::internal | 1694 } } // namespace v8::internal |
OLD | NEW |