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

Side by Side Diff: src/snapshot/serializer-common.cc

Issue 2801073006: Decouple root visitors from object visitors. (Closed)
Patch Set: rebase Created 3 years, 7 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
« no previous file with comments | « src/snapshot/serializer-common.h ('k') | src/snapshot/startup-serializer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/snapshot/serializer-common.h" 5 #include "src/snapshot/serializer-common.h"
6 6
7 #include "src/external-reference-table.h" 7 #include "src/external-reference-table.h"
8 #include "src/ic/stub-cache.h" 8 #include "src/ic/stub-cache.h"
9 #include "src/list-inl.h" 9 #include "src/list-inl.h"
10 #include "src/objects-inl.h" 10 #include "src/objects-inl.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 owns_data_ = true; 60 owns_data_ = true;
61 DCHECK(IsAligned(reinterpret_cast<intptr_t>(data_), kPointerAlignment)); 61 DCHECK(IsAligned(reinterpret_cast<intptr_t>(data_), kPointerAlignment));
62 } 62 }
63 63
64 // The partial snapshot cache is terminated by undefined. We visit the 64 // The partial snapshot cache is terminated by undefined. We visit the
65 // partial snapshot... 65 // partial snapshot...
66 // - during deserialization to populate it. 66 // - during deserialization to populate it.
67 // - during normal GC to keep its content alive. 67 // - during normal GC to keep its content alive.
68 // - not during serialization. The partial serializer adds to it explicitly. 68 // - not during serialization. The partial serializer adds to it explicitly.
69 DISABLE_CFI_PERF 69 DISABLE_CFI_PERF
70 void SerializerDeserializer::Iterate(Isolate* isolate, ObjectVisitor* visitor) { 70 void SerializerDeserializer::Iterate(Isolate* isolate, RootVisitor* visitor) {
71 List<Object*>* cache = isolate->partial_snapshot_cache(); 71 List<Object*>* cache = isolate->partial_snapshot_cache();
72 for (int i = 0;; ++i) { 72 for (int i = 0;; ++i) {
73 // Extend the array ready to get a value when deserializing. 73 // Extend the array ready to get a value when deserializing.
74 if (cache->length() <= i) cache->Add(Smi::kZero); 74 if (cache->length() <= i) cache->Add(Smi::kZero);
75 // During deserialization, the visitor populates the partial snapshot cache 75 // During deserialization, the visitor populates the partial snapshot cache
76 // and eventually terminates the cache with undefined. 76 // and eventually terminates the cache with undefined.
77 visitor->VisitPointer(&cache->at(i)); 77 visitor->VisitRootPointer(Root::kPartialSnapshotCache, &cache->at(i));
78 if (cache->at(i)->IsUndefined(isolate)) break; 78 if (cache->at(i)->IsUndefined(isolate)) break;
79 } 79 }
80 } 80 }
81 81
82 bool SerializerDeserializer::CanBeDeferred(HeapObject* o) { 82 bool SerializerDeserializer::CanBeDeferred(HeapObject* o) {
83 return !o->IsString() && !o->IsScript(); 83 return !o->IsString() && !o->IsScript();
84 } 84 }
85 85
86 void SerializerDeserializer::RestoreExternalReferenceRedirectors( 86 void SerializerDeserializer::RestoreExternalReferenceRedirectors(
87 List<AccessorInfo*>* accessor_infos) { 87 List<AccessorInfo*>* accessor_infos) {
88 // Restore wiped accessor infos. 88 // Restore wiped accessor infos.
89 for (AccessorInfo* info : *accessor_infos) { 89 for (AccessorInfo* info : *accessor_infos) {
90 Foreign::cast(info->js_getter()) 90 Foreign::cast(info->js_getter())
91 ->set_foreign_address(info->redirected_getter()); 91 ->set_foreign_address(info->redirected_getter());
92 } 92 }
93 } 93 }
94 94
95 } // namespace internal 95 } // namespace internal
96 } // namespace v8 96 } // namespace v8
OLDNEW
« no previous file with comments | « src/snapshot/serializer-common.h ('k') | src/snapshot/startup-serializer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698