OLD | NEW |
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 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1370 // This ensures that the partial snapshot cache keeps things alive during GC and | 1370 // This ensures that the partial snapshot cache keeps things alive during GC and |
1371 // tracks their movement. When it is called during serialization of the startup | 1371 // tracks their movement. When it is called during serialization of the startup |
1372 // snapshot nothing happens. When the partial (context) snapshot is created, | 1372 // snapshot nothing happens. When the partial (context) snapshot is created, |
1373 // this array is populated with the pointers that the partial snapshot will | 1373 // this array is populated with the pointers that the partial snapshot will |
1374 // need. As that happens we emit serialized objects to the startup snapshot | 1374 // need. As that happens we emit serialized objects to the startup snapshot |
1375 // that correspond to the elements of this cache array. On deserialization we | 1375 // that correspond to the elements of this cache array. On deserialization we |
1376 // therefore need to visit the cache array. This fills it up with pointers to | 1376 // therefore need to visit the cache array. This fills it up with pointers to |
1377 // deserialized objects. | 1377 // deserialized objects. |
1378 void SerializerDeserializer::Iterate(Isolate* isolate, | 1378 void SerializerDeserializer::Iterate(Isolate* isolate, |
1379 ObjectVisitor* visitor) { | 1379 ObjectVisitor* visitor) { |
1380 if (Serializer::enabled()) return; | 1380 if (Serializer::enabled(isolate)) return; |
1381 for (int i = 0; ; i++) { | 1381 for (int i = 0; ; i++) { |
1382 if (isolate->serialize_partial_snapshot_cache_length() <= i) { | 1382 if (isolate->serialize_partial_snapshot_cache_length() <= i) { |
1383 // Extend the array ready to get a value from the visitor when | 1383 // Extend the array ready to get a value from the visitor when |
1384 // deserializing. | 1384 // deserializing. |
1385 isolate->PushToPartialSnapshotCache(Smi::FromInt(0)); | 1385 isolate->PushToPartialSnapshotCache(Smi::FromInt(0)); |
1386 } | 1386 } |
1387 Object** cache = isolate->serialize_partial_snapshot_cache(); | 1387 Object** cache = isolate->serialize_partial_snapshot_cache(); |
1388 visitor->VisitPointers(&cache[i], &cache[i + 1]); | 1388 visitor->VisitPointers(&cache[i], &cache[i + 1]); |
1389 // Sentinel is the undefined object, which is a root so it will not normally | 1389 // Sentinel is the undefined object, which is a root so it will not normally |
1390 // be found in the cache. | 1390 // be found in the cache. |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1904 | 1904 |
1905 bool SnapshotByteSource::AtEOF() { | 1905 bool SnapshotByteSource::AtEOF() { |
1906 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false; | 1906 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false; |
1907 for (int x = position_; x < length_; x++) { | 1907 for (int x = position_; x < length_; x++) { |
1908 if (data_[x] != SerializerDeserializer::nop()) return false; | 1908 if (data_[x] != SerializerDeserializer::nop()) return false; |
1909 } | 1909 } |
1910 return true; | 1910 return true; |
1911 } | 1911 } |
1912 | 1912 |
1913 } } // namespace v8::internal | 1913 } } // namespace v8::internal |
OLD | NEW |