OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "accessors.h" | 7 #include "accessors.h" |
8 #include "api.h" | 8 #include "api.h" |
9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
10 #include "deoptimizer.h" | 10 #include "deoptimizer.h" |
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 // This ensures that the partial snapshot cache keeps things alive during GC and | 1339 // This ensures that the partial snapshot cache keeps things alive during GC and |
1340 // tracks their movement. When it is called during serialization of the startup | 1340 // tracks their movement. When it is called during serialization of the startup |
1341 // snapshot nothing happens. When the partial (context) snapshot is created, | 1341 // snapshot nothing happens. When the partial (context) snapshot is created, |
1342 // this array is populated with the pointers that the partial snapshot will | 1342 // this array is populated with the pointers that the partial snapshot will |
1343 // need. As that happens we emit serialized objects to the startup snapshot | 1343 // need. As that happens we emit serialized objects to the startup snapshot |
1344 // that correspond to the elements of this cache array. On deserialization we | 1344 // that correspond to the elements of this cache array. On deserialization we |
1345 // therefore need to visit the cache array. This fills it up with pointers to | 1345 // therefore need to visit the cache array. This fills it up with pointers to |
1346 // deserialized objects. | 1346 // deserialized objects. |
1347 void SerializerDeserializer::Iterate(Isolate* isolate, | 1347 void SerializerDeserializer::Iterate(Isolate* isolate, |
1348 ObjectVisitor* visitor) { | 1348 ObjectVisitor* visitor) { |
1349 if (Serializer::enabled()) return; | 1349 if (Serializer::enabled(isolate)) return; |
1350 for (int i = 0; ; i++) { | 1350 for (int i = 0; ; i++) { |
1351 if (isolate->serialize_partial_snapshot_cache_length() <= i) { | 1351 if (isolate->serialize_partial_snapshot_cache_length() <= i) { |
1352 // Extend the array ready to get a value from the visitor when | 1352 // Extend the array ready to get a value from the visitor when |
1353 // deserializing. | 1353 // deserializing. |
1354 isolate->PushToPartialSnapshotCache(Smi::FromInt(0)); | 1354 isolate->PushToPartialSnapshotCache(Smi::FromInt(0)); |
1355 } | 1355 } |
1356 Object** cache = isolate->serialize_partial_snapshot_cache(); | 1356 Object** cache = isolate->serialize_partial_snapshot_cache(); |
1357 visitor->VisitPointers(&cache[i], &cache[i + 1]); | 1357 visitor->VisitPointers(&cache[i], &cache[i + 1]); |
1358 // Sentinel is the undefined object, which is a root so it will not normally | 1358 // Sentinel is the undefined object, which is a root so it will not normally |
1359 // be found in the cache. | 1359 // be found in the cache. |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1873 | 1873 |
1874 bool SnapshotByteSource::AtEOF() { | 1874 bool SnapshotByteSource::AtEOF() { |
1875 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false; | 1875 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false; |
1876 for (int x = position_; x < length_; x++) { | 1876 for (int x = position_; x < length_; x++) { |
1877 if (data_[x] != SerializerDeserializer::nop()) return false; | 1877 if (data_[x] != SerializerDeserializer::nop()) return false; |
1878 } | 1878 } |
1879 return true; | 1879 return true; |
1880 } | 1880 } |
1881 | 1881 |
1882 } } // namespace v8::internal | 1882 } } // namespace v8::internal |
OLD | NEW |