OLD | NEW |
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 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // The partial snapshot cache is terminated by undefined. We visit the | 57 // The partial snapshot cache is terminated by undefined. We visit the |
58 // partial snapshot... | 58 // partial snapshot... |
59 // - during deserialization to populate it. | 59 // - during deserialization to populate it. |
60 // - during normal GC to keep its content alive. | 60 // - during normal GC to keep its content alive. |
61 // - not during serialization. The partial serializer adds to it explicitly. | 61 // - not during serialization. The partial serializer adds to it explicitly. |
62 DISABLE_CFI_PERF | 62 DISABLE_CFI_PERF |
63 void SerializerDeserializer::Iterate(Isolate* isolate, ObjectVisitor* visitor) { | 63 void SerializerDeserializer::Iterate(Isolate* isolate, ObjectVisitor* visitor) { |
64 List<Object*>* cache = isolate->partial_snapshot_cache(); | 64 List<Object*>* cache = isolate->partial_snapshot_cache(); |
65 for (int i = 0;; ++i) { | 65 for (int i = 0;; ++i) { |
66 // Extend the array ready to get a value when deserializing. | 66 // Extend the array ready to get a value when deserializing. |
67 if (cache->length() <= i) cache->Add(Smi::kZero); | 67 if (cache->length() <= i) cache->Add(Smi::FromInt(0)); |
68 // During deserialization, the visitor populates the partial snapshot cache | 68 // During deserialization, the visitor populates the partial snapshot cache |
69 // and eventually terminates the cache with undefined. | 69 // and eventually terminates the cache with undefined. |
70 visitor->VisitPointer(&cache->at(i)); | 70 visitor->VisitPointer(&cache->at(i)); |
71 if (cache->at(i)->IsUndefined(isolate)) break; | 71 if (cache->at(i)->IsUndefined(isolate)) break; |
72 } | 72 } |
73 } | 73 } |
74 | 74 |
75 bool SerializerDeserializer::CanBeDeferred(HeapObject* o) { | 75 bool SerializerDeserializer::CanBeDeferred(HeapObject* o) { |
76 return !o->IsString() && !o->IsScript(); | 76 return !o->IsString() && !o->IsScript(); |
77 } | 77 } |
78 | 78 |
79 } // namespace internal | 79 } // namespace internal |
80 } // namespace v8 | 80 } // namespace v8 |
OLD | NEW |