Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: src/serialize.cc

Issue 8382031: Revert 9763 after build bot failures. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 current_object_address) { 760 Address current_object_address) {
761 Isolate* const isolate = isolate_; 761 Isolate* const isolate = isolate_;
762 bool write_barrier_needed = (current_object_address != NULL &&
763 source_space != NEW_SPACE &&
764 source_space != CELL_SPACE &&
765 source_space == OLD_DATA_SPACE);
Lasse Reichstein 2011/10/25 08:40:34 Should the last one have been != ?
766 while (current < limit) { 762 while (current < limit) {
767 int data = source_->Get(); 763 int data = source_->Get();
768 switch (data) { 764 switch (data) {
769 #define CASE_STATEMENT(where, how, within, space_number) \ 765 #define CASE_STATEMENT(where, how, within, space_number) \
770 case where + how + within + space_number: \ 766 case where + how + within + space_number: \
771 ASSERT((where & ~kPointedToMask) == 0); \ 767 ASSERT((where & ~kPointedToMask) == 0); \
772 ASSERT((how & ~kHowToCodeMask) == 0); \ 768 ASSERT((how & ~kHowToCodeMask) == 0); \
773 ASSERT((within & ~kWhereToPointMask) == 0); \ 769 ASSERT((within & ~kWhereToPointMask) == 0); \
774 ASSERT((space_number & ~kSpaceMask) == 0); 770 ASSERT((space_number & ~kSpaceMask) == 0);
775 771
776 #define CASE_BODY(where, how, within, space_number_if_any, offset_from_start) \ 772 #define CASE_BODY(where, how, within, space_number_if_any, offset_from_start) \
777 { \ 773 { \
778 bool emit_write_barrier = false; \ 774 bool emit_write_barrier = false; \
779 bool current_was_incremented = false; \ 775 bool current_was_incremented = false; \
780 int space_number = space_number_if_any == kAnyOldSpace ? \ 776 int space_number = space_number_if_any == kAnyOldSpace ? \
781 (data & kSpaceMask) : space_number_if_any; \ 777 (data & kSpaceMask) : space_number_if_any; \
782 if (where == kNewObject && how == kPlain && within == kStartOfObject) {\ 778 if (where == kNewObject && how == kPlain && within == kStartOfObject) {\
783 ASSIGN_DEST_SPACE(space_number) \ 779 ASSIGN_DEST_SPACE(space_number) \
784 ReadObject(space_number, dest_space, current); \ 780 ReadObject(space_number, dest_space, current); \
785 emit_write_barrier = (space_number == NEW_SPACE); \ 781 emit_write_barrier = (space_number == NEW_SPACE && \
782 source_space != NEW_SPACE && \
783 source_space != CELL_SPACE); \
786 } else { \ 784 } else { \
787 Object* new_object = NULL; /* May not be a real Object pointer. */ \ 785 Object* new_object = NULL; /* May not be a real Object pointer. */ \
788 if (where == kNewObject) { \ 786 if (where == kNewObject) { \
789 ASSIGN_DEST_SPACE(space_number) \ 787 ASSIGN_DEST_SPACE(space_number) \
790 ReadObject(space_number, dest_space, &new_object); \ 788 ReadObject(space_number, dest_space, &new_object); \
791 } else if (where == kRootArray) { \ 789 } else if (where == kRootArray) { \
792 emit_write_barrier = true; \ 790 if (source_space != CELL_SPACE && \
791 source_space != CODE_SPACE && \
792 source_space != OLD_DATA_SPACE) { \
793 emit_write_barrier = true; \
794 } \
793 int root_id = source_->GetInt(); \ 795 int root_id = source_->GetInt(); \
794 new_object = isolate->heap()->roots_array_start()[root_id]; \ 796 new_object = isolate->heap()->roots_array_start()[root_id]; \
795 } else if (where == kPartialSnapshotCache) { \ 797 } else if (where == kPartialSnapshotCache) { \
796 emit_write_barrier = true; \ 798 if (source_space != CELL_SPACE && \
799 source_space != CODE_SPACE && \
800 source_space != OLD_DATA_SPACE) { \
801 emit_write_barrier = true; \
802 } \
797 int cache_index = source_->GetInt(); \ 803 int cache_index = source_->GetInt(); \
798 new_object = isolate->serialize_partial_snapshot_cache() \ 804 new_object = isolate->serialize_partial_snapshot_cache() \
799 [cache_index]; \ 805 [cache_index]; \
800 } else if (where == kExternalReference) { \ 806 } else if (where == kExternalReference) { \
801 int reference_id = source_->GetInt(); \ 807 int reference_id = source_->GetInt(); \
802 Address address = external_reference_decoder_-> \ 808 Address address = external_reference_decoder_-> \
803 Decode(reference_id); \ 809 Decode(reference_id); \
804 new_object = reinterpret_cast<Object*>(address); \ 810 new_object = reinterpret_cast<Object*>(address); \
805 } else if (where == kBackref) { \ 811 } else if (where == kBackref) { \
806 emit_write_barrier = (space_number == NEW_SPACE); \ 812 emit_write_barrier = (space_number == NEW_SPACE && \
813 source_space != NEW_SPACE && \
814 source_space != CELL_SPACE); \
807 new_object = GetAddressFromEnd(data & kSpaceMask); \ 815 new_object = GetAddressFromEnd(data & kSpaceMask); \
808 } else { \ 816 } else { \
809 ASSERT(where == kFromStart); \ 817 ASSERT(where == kFromStart); \
810 if (offset_from_start == kUnknownOffsetFromStart) { \ 818 if (offset_from_start == kUnknownOffsetFromStart) { \
811 emit_write_barrier = (space_number == NEW_SPACE); \ 819 emit_write_barrier = (space_number == NEW_SPACE && \
820 source_space != NEW_SPACE && \
821 source_space != CELL_SPACE); \
812 new_object = GetAddressFromStart(data & kSpaceMask); \ 822 new_object = GetAddressFromStart(data & kSpaceMask); \
813 } else { \ 823 } else { \
814 Address object_address = pages_[space_number][0] + \ 824 Address object_address = pages_[space_number][0] + \
815 (offset_from_start << kObjectAlignmentBits); \ 825 (offset_from_start << kObjectAlignmentBits); \
816 new_object = HeapObject::FromAddress(object_address); \ 826 new_object = HeapObject::FromAddress(object_address); \
817 } \ 827 } \
818 } \ 828 } \
819 if (within == kFirstInstruction) { \ 829 if (within == kFirstInstruction) { \
820 Code* new_code_object = reinterpret_cast<Code*>(new_object); \ 830 Code* new_code_object = reinterpret_cast<Code*>(new_object); \
821 new_object = reinterpret_cast<Object*>( \ 831 new_object = reinterpret_cast<Object*>( \
822 new_code_object->instruction_start()); \ 832 new_code_object->instruction_start()); \
823 } \ 833 } \
824 if (how == kFromCode) { \ 834 if (how == kFromCode) { \
825 Address location_of_branch_data = \ 835 Address location_of_branch_data = \
826 reinterpret_cast<Address>(current); \ 836 reinterpret_cast<Address>(current); \
827 Assembler::set_target_at(location_of_branch_data, \ 837 Assembler::set_target_at(location_of_branch_data, \
828 reinterpret_cast<Address>(new_object)); \ 838 reinterpret_cast<Address>(new_object)); \
829 if (within == kFirstInstruction) { \ 839 if (within == kFirstInstruction) { \
830 location_of_branch_data += Assembler::kCallTargetSize; \ 840 location_of_branch_data += Assembler::kCallTargetSize; \
831 current = reinterpret_cast<Object**>(location_of_branch_data); \ 841 current = reinterpret_cast<Object**>(location_of_branch_data); \
832 current_was_incremented = true; \ 842 current_was_incremented = true; \
833 } \ 843 } \
834 } else { \ 844 } else { \
835 *current = new_object; \ 845 *current = new_object; \
836 } \ 846 } \
837 } \ 847 } \
838 if (emit_write_barrier && write_barrier_needed) { \ 848 if (emit_write_barrier && current_object_address != NULL) { \
839 Address current_address = reinterpret_cast<Address>(current); \ 849 Address current_address = reinterpret_cast<Address>(current); \
840 isolate->heap()->RecordWrite( \ 850 isolate->heap()->RecordWrite( \
841 current_object_address, \ 851 current_object_address, \
842 static_cast<int>(current_address - current_object_address)); \ 852 static_cast<int>(current_address - current_object_address)); \
843 } \ 853 } \
844 if (!current_was_incremented) { \ 854 if (!current_was_incremented) { \
845 current++; \ 855 current++; /* Increment current if it wasn't done above. */ \
846 } \ 856 } \
847 break; \ 857 break; \
848 } \ 858 } \
849 859
850 // This generates a case and a body for each space. The large object spaces are 860 // This generates a case and a body for each space. The large object spaces are
851 // very rare in snapshots so they are grouped in one body. 861 // very rare in snapshots so they are grouped in one body.
852 #define ONE_PER_SPACE(where, how, within) \ 862 #define ONE_PER_SPACE(where, how, within) \
853 CASE_STATEMENT(where, how, within, NEW_SPACE) \ 863 CASE_STATEMENT(where, how, within, NEW_SPACE) \
854 CASE_BODY(where, how, within, NEW_SPACE, kUnknownOffsetFromStart) \ 864 CASE_BODY(where, how, within, NEW_SPACE, kUnknownOffsetFromStart) \
855 CASE_STATEMENT(where, how, within, OLD_DATA_SPACE) \ 865 CASE_STATEMENT(where, how, within, OLD_DATA_SPACE) \
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize); 1651 fullness_[space] = RoundUp(fullness_[space], Page::kPageSize);
1642 } 1652 }
1643 } 1653 }
1644 int allocation_address = fullness_[space]; 1654 int allocation_address = fullness_[space];
1645 fullness_[space] = allocation_address + size; 1655 fullness_[space] = allocation_address + size;
1646 return allocation_address; 1656 return allocation_address;
1647 } 1657 }
1648 1658
1649 1659
1650 } } // namespace v8::internal 1660 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698