OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
750 dest_space = isolate->heap()->lo_space(); \ | 750 dest_space = isolate->heap()->lo_space(); \ |
751 } | 751 } |
752 | 752 |
753 | 753 |
754 static const int kUnknownOffsetFromStart = -1; | 754 static const int kUnknownOffsetFromStart = -1; |
755 | 755 |
756 | 756 |
757 void Deserializer::ReadChunk(Object** current, | 757 void Deserializer::ReadChunk(Object** current, |
758 Object** limit, | 758 Object** limit, |
759 int source_space, | 759 int source_space, |
760 Address address) { | 760 Address address) { |
Lasse Reichstein
2011/10/24 12:06:58
When is address passed as NULL?
Why?
I.e., please
| |
761 Isolate* const isolate = isolate_; | 761 Isolate* const isolate = isolate_; |
762 while (current < limit) { | 762 while (current < limit) { |
763 int data = source_->Get(); | 763 int data = source_->Get(); |
764 switch (data) { | 764 switch (data) { |
765 #define CASE_STATEMENT(where, how, within, space_number) \ | 765 #define CASE_STATEMENT(where, how, within, space_number) \ |
766 case where + how + within + space_number: \ | 766 case where + how + within + space_number: \ |
767 ASSERT((where & ~kPointedToMask) == 0); \ | 767 ASSERT((where & ~kPointedToMask) == 0); \ |
768 ASSERT((how & ~kHowToCodeMask) == 0); \ | 768 ASSERT((how & ~kHowToCodeMask) == 0); \ |
769 ASSERT((within & ~kWhereToPointMask) == 0); \ | 769 ASSERT((within & ~kWhereToPointMask) == 0); \ |
770 ASSERT((space_number & ~kSpaceMask) == 0); | 770 ASSERT((space_number & ~kSpaceMask) == 0); |
(...skipping 27 matching lines...) Expand all Loading... | |
798 if (source_space != CELL_SPACE && \ | 798 if (source_space != CELL_SPACE && \ |
799 source_space != CODE_SPACE && \ | 799 source_space != CODE_SPACE && \ |
800 source_space != OLD_DATA_SPACE) { \ | 800 source_space != OLD_DATA_SPACE) { \ |
801 emit_write_barrier = true; \ | 801 emit_write_barrier = true; \ |
802 } \ | 802 } \ |
803 int cache_index = source_->GetInt(); \ | 803 int cache_index = source_->GetInt(); \ |
804 new_object = isolate->serialize_partial_snapshot_cache() \ | 804 new_object = isolate->serialize_partial_snapshot_cache() \ |
805 [cache_index]; \ | 805 [cache_index]; \ |
806 } else if (where == kExternalReference) { \ | 806 } else if (where == kExternalReference) { \ |
807 int reference_id = source_->GetInt(); \ | 807 int reference_id = source_->GetInt(); \ |
808 Address address = external_reference_decoder_-> \ | 808 Address address = external_reference_decoder_-> \ |
Lasse Reichstein
2011/10/24 12:06:58
Could we call this variable something else, so it
| |
809 Decode(reference_id); \ | 809 Decode(reference_id); \ |
810 new_object = reinterpret_cast<Object*>(address); \ | 810 new_object = reinterpret_cast<Object*>(address); \ |
811 } else if (where == kBackref) { \ | 811 } else if (where == kBackref) { \ |
812 emit_write_barrier = (space_number == NEW_SPACE && \ | 812 emit_write_barrier = (space_number == NEW_SPACE && \ |
813 source_space != NEW_SPACE && \ | 813 source_space != NEW_SPACE && \ |
814 source_space != CELL_SPACE); \ | 814 source_space != CELL_SPACE); \ |
815 new_object = GetAddressFromEnd(data & kSpaceMask); \ | 815 new_object = GetAddressFromEnd(data & kSpaceMask); \ |
816 } else { \ | 816 } else { \ |
817 ASSERT(where == kFromStart); \ | 817 ASSERT(where == kFromStart); \ |
818 if (offset_from_start == kUnknownOffsetFromStart) { \ | 818 if (offset_from_start == kUnknownOffsetFromStart) { \ |
(...skipping 19 matching lines...) Expand all Loading... | |
838 reinterpret_cast<Address>(new_object)); \ | 838 reinterpret_cast<Address>(new_object)); \ |
839 if (within == kFirstInstruction) { \ | 839 if (within == kFirstInstruction) { \ |
840 location_of_branch_data += Assembler::kCallTargetSize; \ | 840 location_of_branch_data += Assembler::kCallTargetSize; \ |
841 current = reinterpret_cast<Object**>(location_of_branch_data); \ | 841 current = reinterpret_cast<Object**>(location_of_branch_data); \ |
842 current_was_incremented = true; \ | 842 current_was_incremented = true; \ |
843 } \ | 843 } \ |
844 } else { \ | 844 } else { \ |
845 *current = new_object; \ | 845 *current = new_object; \ |
846 } \ | 846 } \ |
847 } \ | 847 } \ |
848 if (emit_write_barrier) { \ | 848 if (emit_write_barrier && address != NULL) { \ |
849 isolate->heap()->RecordWrite(address, static_cast<int>( \ | 849 isolate->heap()->RecordWrite(address, static_cast<int>( \ |
850 reinterpret_cast<Address>(current) - address)); \ | 850 reinterpret_cast<Address>(current) - address)); \ |
851 } \ | 851 } \ |
852 if (!current_was_incremented) { \ | 852 if (!current_was_incremented) { \ |
853 current++; /* Increment current if it wasn't done above. */ \ | 853 current++; /* Increment current if it wasn't done above. */ \ |
854 } \ | 854 } \ |
855 break; \ | 855 break; \ |
856 } \ | 856 } \ |
857 | 857 |
858 // This generates a case and a body for each space. The large object spaces are | 858 // This generates a case and a body for each space. The large object spaces are |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1649 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); | 1649 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); |
1650 } | 1650 } |
1651 } | 1651 } |
1652 int allocation_address = fullness_[space]; | 1652 int allocation_address = fullness_[space]; |
1653 fullness_[space] = allocation_address + size; | 1653 fullness_[space] = allocation_address + size; |
1654 return allocation_address; | 1654 return allocation_address; |
1655 } | 1655 } |
1656 | 1656 |
1657 | 1657 |
1658 } } // namespace v8::internal | 1658 } } // namespace v8::internal |
OLD | NEW |