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

Side by Side Diff: src/serialize.cc

Issue 36853003: Simplify ObjectVisitor for external references. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 months 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 | « src/serialize.h ('k') | 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 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 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 Object** current = rinfo->target_object_address(); 1675 Object** current = rinfo->target_object_address();
1676 1676
1677 int skip = OutputRawData(rinfo->target_address_address(), 1677 int skip = OutputRawData(rinfo->target_address_address(),
1678 kCanReturnSkipInsteadOfSkipping); 1678 kCanReturnSkipInsteadOfSkipping);
1679 HowToCode representation = rinfo->IsCodedSpecially() ? kFromCode : kPlain; 1679 HowToCode representation = rinfo->IsCodedSpecially() ? kFromCode : kPlain;
1680 serializer_->SerializeObject(*current, representation, kStartOfObject, skip); 1680 serializer_->SerializeObject(*current, representation, kStartOfObject, skip);
1681 bytes_processed_so_far_ += rinfo->target_address_size(); 1681 bytes_processed_so_far_ += rinfo->target_address_size();
1682 } 1682 }
1683 1683
1684 1684
1685 void Serializer::ObjectSerializer::VisitExternalReferences(Address* start, 1685 void Serializer::ObjectSerializer::VisitExternalReference(Address* p) {
1686 Address* end) { 1686 Address references_start = reinterpret_cast<Address>(p);
1687 Address references_start = reinterpret_cast<Address>(start);
1688 int skip = OutputRawData(references_start, kCanReturnSkipInsteadOfSkipping); 1687 int skip = OutputRawData(references_start, kCanReturnSkipInsteadOfSkipping);
1689 1688
1690 for (Address* current = start; current < end; current++) { 1689 sink_->Put(kExternalReference + kPlain + kStartOfObject, "ExternalRef");
1691 sink_->Put(kExternalReference + kPlain + kStartOfObject, "ExternalRef"); 1690 sink_->PutInt(skip, "SkipB4ExternalRef");
1692 sink_->PutInt(skip, "SkipB4ExternalRef"); 1691 int reference_id = serializer_->EncodeExternalReference(*p);
1693 skip = 0; 1692 sink_->PutInt(reference_id, "reference id");
1694 int reference_id = serializer_->EncodeExternalReference(*current); 1693 bytes_processed_so_far_ += kPointerSize;
1695 sink_->PutInt(reference_id, "reference id");
1696 }
1697 bytes_processed_so_far_ += static_cast<int>((end - start) * kPointerSize);
1698 } 1694 }
1699 1695
1700 1696
1701 void Serializer::ObjectSerializer::VisitExternalReference(RelocInfo* rinfo) { 1697 void Serializer::ObjectSerializer::VisitExternalReference(RelocInfo* rinfo) {
1702 Address references_start = rinfo->target_address_address(); 1698 Address references_start = rinfo->target_address_address();
1703 int skip = OutputRawData(references_start, kCanReturnSkipInsteadOfSkipping); 1699 int skip = OutputRawData(references_start, kCanReturnSkipInsteadOfSkipping);
1704 1700
1705 Address* current = rinfo->target_reference_address(); 1701 Address* current = rinfo->target_reference_address();
1706 int representation = rinfo->IsCodedSpecially() ? 1702 int representation = rinfo->IsCodedSpecially() ?
1707 kFromCode + kStartOfObject : kPlain + kStartOfObject; 1703 kFromCode + kStartOfObject : kPlain + kStartOfObject;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1872 1868
1873 bool SnapshotByteSource::AtEOF() { 1869 bool SnapshotByteSource::AtEOF() {
1874 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false; 1870 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false;
1875 for (int x = position_; x < length_; x++) { 1871 for (int x = position_; x < length_; x++) {
1876 if (data_[x] != SerializerDeserializer::nop()) return false; 1872 if (data_[x] != SerializerDeserializer::nop()) return false;
1877 } 1873 }
1878 return true; 1874 return true;
1879 } 1875 }
1880 1876
1881 } } // namespace v8::internal 1877 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/serialize.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698