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