| 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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 Address address = Deoptimizer::GetDeoptimizationEntry( | 589 Address address = Deoptimizer::GetDeoptimizationEntry( |
| 590 isolate, | 590 isolate, |
| 591 entry, | 591 entry, |
| 592 Deoptimizer::LAZY, | 592 Deoptimizer::LAZY, |
| 593 Deoptimizer::CALCULATE_ENTRY_ADDRESS); | 593 Deoptimizer::CALCULATE_ENTRY_ADDRESS); |
| 594 Add(address, LAZY_DEOPTIMIZATION, 64 + entry, "lazy_deopt"); | 594 Add(address, LAZY_DEOPTIMIZATION, 64 + entry, "lazy_deopt"); |
| 595 } | 595 } |
| 596 } | 596 } |
| 597 | 597 |
| 598 | 598 |
| 599 ExternalReferenceEncoder::ExternalReferenceEncoder() | 599 ExternalReferenceEncoder::ExternalReferenceEncoder(Isolate* isolate) |
| 600 : encodings_(Match), | 600 : encodings_(Match), |
| 601 isolate_(Isolate::Current()) { | 601 isolate_(isolate) { |
| 602 ExternalReferenceTable* external_references = | 602 ExternalReferenceTable* external_references = |
| 603 ExternalReferenceTable::instance(isolate_); | 603 ExternalReferenceTable::instance(isolate_); |
| 604 for (int i = 0; i < external_references->size(); ++i) { | 604 for (int i = 0; i < external_references->size(); ++i) { |
| 605 Put(external_references->address(i), i); | 605 Put(external_references->address(i), i); |
| 606 } | 606 } |
| 607 } | 607 } |
| 608 | 608 |
| 609 | 609 |
| 610 uint32_t ExternalReferenceEncoder::Encode(Address key) const { | 610 uint32_t ExternalReferenceEncoder::Encode(Address key) const { |
| 611 int index = IndexOf(key); | 611 int index = IndexOf(key); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 631 : static_cast<int>(reinterpret_cast<intptr_t>(entry->value)); | 631 : static_cast<int>(reinterpret_cast<intptr_t>(entry->value)); |
| 632 } | 632 } |
| 633 | 633 |
| 634 | 634 |
| 635 void ExternalReferenceEncoder::Put(Address key, int index) { | 635 void ExternalReferenceEncoder::Put(Address key, int index) { |
| 636 HashMap::Entry* entry = encodings_.Lookup(key, Hash(key), true); | 636 HashMap::Entry* entry = encodings_.Lookup(key, Hash(key), true); |
| 637 entry->value = reinterpret_cast<void*>(index); | 637 entry->value = reinterpret_cast<void*>(index); |
| 638 } | 638 } |
| 639 | 639 |
| 640 | 640 |
| 641 ExternalReferenceDecoder::ExternalReferenceDecoder() | 641 ExternalReferenceDecoder::ExternalReferenceDecoder(Isolate* isolate) |
| 642 : encodings_(NewArray<Address*>(kTypeCodeCount)), | 642 : encodings_(NewArray<Address*>(kTypeCodeCount)), |
| 643 isolate_(Isolate::Current()) { | 643 isolate_(isolate) { |
| 644 ExternalReferenceTable* external_references = | 644 ExternalReferenceTable* external_references = |
| 645 ExternalReferenceTable::instance(isolate_); | 645 ExternalReferenceTable::instance(isolate_); |
| 646 for (int type = kFirstTypeCode; type < kTypeCodeCount; ++type) { | 646 for (int type = kFirstTypeCode; type < kTypeCodeCount; ++type) { |
| 647 int max = external_references->max_id(type) + 1; | 647 int max = external_references->max_id(type) + 1; |
| 648 encodings_[type] = NewArray<Address>(max + 1); | 648 encodings_[type] = NewArray<Address>(max + 1); |
| 649 } | 649 } |
| 650 for (int i = 0; i < external_references->size(); ++i) { | 650 for (int i = 0; i < external_references->size(); ++i) { |
| 651 Put(external_references->code(i), external_references->address(i)); | 651 Put(external_references->code(i), external_references->address(i)); |
| 652 } | 652 } |
| 653 } | 653 } |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 } | 773 } |
| 774 | 774 |
| 775 NameMap address_to_name_map_; | 775 NameMap address_to_name_map_; |
| 776 Isolate* isolate_; | 776 Isolate* isolate_; |
| 777 }; | 777 }; |
| 778 | 778 |
| 779 | 779 |
| 780 CodeAddressMap* Serializer::code_address_map_ = NULL; | 780 CodeAddressMap* Serializer::code_address_map_ = NULL; |
| 781 | 781 |
| 782 | 782 |
| 783 void Serializer::Enable() { | 783 void Serializer::Enable(Isolate* isolate) { |
| 784 if (!serialization_enabled_) { | 784 if (!serialization_enabled_) { |
| 785 ASSERT(!too_late_to_enable_now_); | 785 ASSERT(!too_late_to_enable_now_); |
| 786 } | 786 } |
| 787 if (serialization_enabled_) return; | 787 if (serialization_enabled_) return; |
| 788 serialization_enabled_ = true; | 788 serialization_enabled_ = true; |
| 789 i::Isolate* isolate = Isolate::Current(); | |
| 790 isolate->InitializeLoggingAndCounters(); | 789 isolate->InitializeLoggingAndCounters(); |
| 791 code_address_map_ = new CodeAddressMap(isolate); | 790 code_address_map_ = new CodeAddressMap(isolate); |
| 792 } | 791 } |
| 793 | 792 |
| 794 | 793 |
| 795 void Serializer::Disable() { | 794 void Serializer::Disable() { |
| 796 if (!serialization_enabled_) return; | 795 if (!serialization_enabled_) return; |
| 797 serialization_enabled_ = false; | 796 serialization_enabled_ = false; |
| 798 delete code_address_map_; | 797 delete code_address_map_; |
| 799 code_address_map_ = NULL; | 798 code_address_map_ = NULL; |
| 800 } | 799 } |
| 801 | 800 |
| 802 | 801 |
| 803 Deserializer::Deserializer(SnapshotByteSource* source) | 802 Deserializer::Deserializer(SnapshotByteSource* source) |
| 804 : isolate_(NULL), | 803 : isolate_(NULL), |
| 805 source_(source), | 804 source_(source), |
| 806 external_reference_decoder_(NULL) { | 805 external_reference_decoder_(NULL) { |
| 807 for (int i = 0; i < LAST_SPACE + 1; i++) { | 806 for (int i = 0; i < LAST_SPACE + 1; i++) { |
| 808 reservations_[i] = kUninitializedReservation; | 807 reservations_[i] = kUninitializedReservation; |
| 809 } | 808 } |
| 810 } | 809 } |
| 811 | 810 |
| 812 | 811 |
| 813 void Deserializer::Deserialize() { | 812 void Deserializer::Deserialize(Isolate* isolate) { |
| 814 isolate_ = Isolate::Current(); | 813 isolate_ = isolate; |
| 815 ASSERT(isolate_ != NULL); | 814 ASSERT(isolate_ != NULL); |
| 816 isolate_->heap()->ReserveSpace(reservations_, &high_water_[0]); | 815 isolate_->heap()->ReserveSpace(reservations_, &high_water_[0]); |
| 817 // No active threads. | 816 // No active threads. |
| 818 ASSERT_EQ(NULL, isolate_->thread_manager()->FirstThreadStateInUse()); | 817 ASSERT_EQ(NULL, isolate_->thread_manager()->FirstThreadStateInUse()); |
| 819 // No active handles. | 818 // No active handles. |
| 820 ASSERT(isolate_->handle_scope_implementer()->blocks()->is_empty()); | 819 ASSERT(isolate_->handle_scope_implementer()->blocks()->is_empty()); |
| 821 ASSERT_EQ(NULL, external_reference_decoder_); | 820 ASSERT_EQ(NULL, external_reference_decoder_); |
| 822 external_reference_decoder_ = new ExternalReferenceDecoder(); | 821 external_reference_decoder_ = new ExternalReferenceDecoder(); |
| 823 isolate_->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG); | 822 isolate_->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG); |
| 824 isolate_->heap()->RepairFreeListsAfterBoot(); | 823 isolate_->heap()->RepairFreeListsAfterBoot(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 843 ExternalAsciiString::cast(source)->update_data_cache(); | 842 ExternalAsciiString::cast(source)->update_data_cache(); |
| 844 } | 843 } |
| 845 } | 844 } |
| 846 | 845 |
| 847 // Issue code events for newly deserialized code objects. | 846 // Issue code events for newly deserialized code objects. |
| 848 LOG_CODE_EVENT(isolate_, LogCodeObjects()); | 847 LOG_CODE_EVENT(isolate_, LogCodeObjects()); |
| 849 LOG_CODE_EVENT(isolate_, LogCompiledFunctions()); | 848 LOG_CODE_EVENT(isolate_, LogCompiledFunctions()); |
| 850 } | 849 } |
| 851 | 850 |
| 852 | 851 |
| 853 void Deserializer::DeserializePartial(Object** root) { | 852 void Deserializer::DeserializePartial(Isolate* isolate, Object** root) { |
| 854 isolate_ = Isolate::Current(); | 853 isolate_ = isolate; |
| 855 for (int i = NEW_SPACE; i < kNumberOfSpaces; i++) { | 854 for (int i = NEW_SPACE; i < kNumberOfSpaces; i++) { |
| 856 ASSERT(reservations_[i] != kUninitializedReservation); | 855 ASSERT(reservations_[i] != kUninitializedReservation); |
| 857 } | 856 } |
| 858 isolate_->heap()->ReserveSpace(reservations_, &high_water_[0]); | 857 isolate_->heap()->ReserveSpace(reservations_, &high_water_[0]); |
| 859 if (external_reference_decoder_ == NULL) { | 858 if (external_reference_decoder_ == NULL) { |
| 860 external_reference_decoder_ = new ExternalReferenceDecoder(); | 859 external_reference_decoder_ = new ExternalReferenceDecoder(); |
| 861 } | 860 } |
| 862 | 861 |
| 863 // Keep track of the code space start and end pointers in case new | 862 // Keep track of the code space start and end pointers in case new |
| 864 // code objects were unserialized | 863 // code objects were unserialized |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 int bytes = 1; | 1269 int bytes = 1; |
| 1271 if (integer > 0xff) bytes = 2; | 1270 if (integer > 0xff) bytes = 2; |
| 1272 if (integer > 0xffff) bytes = 3; | 1271 if (integer > 0xffff) bytes = 3; |
| 1273 integer |= bytes; | 1272 integer |= bytes; |
| 1274 Put(static_cast<int>(integer & 0xff), "IntPart1"); | 1273 Put(static_cast<int>(integer & 0xff), "IntPart1"); |
| 1275 if (bytes > 1) Put(static_cast<int>((integer >> 8) & 0xff), "IntPart2"); | 1274 if (bytes > 1) Put(static_cast<int>((integer >> 8) & 0xff), "IntPart2"); |
| 1276 if (bytes > 2) Put(static_cast<int>((integer >> 16) & 0xff), "IntPart3"); | 1275 if (bytes > 2) Put(static_cast<int>((integer >> 16) & 0xff), "IntPart3"); |
| 1277 } | 1276 } |
| 1278 | 1277 |
| 1279 | 1278 |
| 1280 Serializer::Serializer(SnapshotByteSink* sink) | 1279 Serializer::Serializer(Isolate* isolate, SnapshotByteSink* sink) |
| 1281 : sink_(sink), | 1280 : isolate_(isolate), |
| 1281 sink_(sink), |
| 1282 current_root_index_(0), | 1282 current_root_index_(0), |
| 1283 external_reference_encoder_(new ExternalReferenceEncoder), | 1283 external_reference_encoder_(new ExternalReferenceEncoder(isolate)), |
| 1284 root_index_wave_front_(0) { | 1284 root_index_wave_front_(0) { |
| 1285 isolate_ = Isolate::Current(); | |
| 1286 // The serializer is meant to be used only to generate initial heap images | 1285 // The serializer is meant to be used only to generate initial heap images |
| 1287 // from a context in which there is only one isolate. | 1286 // from a context in which there is only one isolate. |
| 1288 ASSERT(isolate_->IsDefaultIsolate()); | 1287 ASSERT(isolate_->IsDefaultIsolate()); |
| 1289 for (int i = 0; i <= LAST_SPACE; i++) { | 1288 for (int i = 0; i <= LAST_SPACE; i++) { |
| 1290 fullness_[i] = 0; | 1289 fullness_[i] = 0; |
| 1291 } | 1290 } |
| 1292 } | 1291 } |
| 1293 | 1292 |
| 1294 | 1293 |
| 1295 Serializer::~Serializer() { | 1294 Serializer::~Serializer() { |
| 1296 delete external_reference_encoder_; | 1295 delete external_reference_encoder_; |
| 1297 } | 1296 } |
| 1298 | 1297 |
| 1299 | 1298 |
| 1300 void StartupSerializer::SerializeStrongReferences() { | 1299 void StartupSerializer::SerializeStrongReferences() { |
| 1301 Isolate* isolate = Isolate::Current(); | 1300 Isolate* isolate = this->isolate(); |
| 1302 // No active threads. | 1301 // No active threads. |
| 1303 CHECK_EQ(NULL, Isolate::Current()->thread_manager()->FirstThreadStateInUse()); | 1302 CHECK_EQ(NULL, isolate->thread_manager()->FirstThreadStateInUse()); |
| 1304 // No active or weak handles. | 1303 // No active or weak handles. |
| 1305 CHECK(isolate->handle_scope_implementer()->blocks()->is_empty()); | 1304 CHECK(isolate->handle_scope_implementer()->blocks()->is_empty()); |
| 1306 CHECK_EQ(0, isolate->global_handles()->NumberOfWeakHandles()); | 1305 CHECK_EQ(0, isolate->global_handles()->NumberOfWeakHandles()); |
| 1307 CHECK_EQ(0, isolate->eternal_handles()->NumberOfHandles()); | 1306 CHECK_EQ(0, isolate->eternal_handles()->NumberOfHandles()); |
| 1308 // We don't support serializing installed extensions. | 1307 // We don't support serializing installed extensions. |
| 1309 CHECK(!isolate->has_installed_extensions()); | 1308 CHECK(!isolate->has_installed_extensions()); |
| 1310 | 1309 |
| 1311 HEAP->IterateStrongRoots(this, VISIT_ONLY_STRONG); | 1310 HEAP->IterateStrongRoots(this, VISIT_ONLY_STRONG); |
| 1312 } | 1311 } |
| 1313 | 1312 |
| 1314 | 1313 |
| 1315 void PartialSerializer::Serialize(Object** object) { | 1314 void PartialSerializer::Serialize(Object** object) { |
| 1316 this->VisitPointer(object); | 1315 this->VisitPointer(object); |
| 1317 Pad(); | 1316 Pad(); |
| 1318 } | 1317 } |
| 1319 | 1318 |
| 1320 | 1319 |
| 1321 void Serializer::VisitPointers(Object** start, Object** end) { | 1320 void Serializer::VisitPointers(Object** start, Object** end) { |
| 1322 Isolate* isolate = Isolate::Current(); | 1321 Isolate* isolate = this->isolate();; |
| 1323 | 1322 |
| 1324 for (Object** current = start; current < end; current++) { | 1323 for (Object** current = start; current < end; current++) { |
| 1325 if (start == isolate->heap()->roots_array_start()) { | 1324 if (start == isolate->heap()->roots_array_start()) { |
| 1326 root_index_wave_front_ = | 1325 root_index_wave_front_ = |
| 1327 Max(root_index_wave_front_, static_cast<intptr_t>(current - start)); | 1326 Max(root_index_wave_front_, static_cast<intptr_t>(current - start)); |
| 1328 } | 1327 } |
| 1329 if (reinterpret_cast<Address>(current) == | 1328 if (reinterpret_cast<Address>(current) == |
| 1330 isolate->heap()->store_buffer()->TopAddress()) { | 1329 isolate->heap()->store_buffer()->TopAddress()) { |
| 1331 sink_->Put(kSkip, "Skip"); | 1330 sink_->Put(kSkip, "Skip"); |
| 1332 sink_->PutInt(kPointerSize, "SkipOneWord"); | 1331 sink_->PutInt(kPointerSize, "SkipOneWord"); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1343 | 1342 |
| 1344 | 1343 |
| 1345 // This ensures that the partial snapshot cache keeps things alive during GC and | 1344 // This ensures that the partial snapshot cache keeps things alive during GC and |
| 1346 // tracks their movement. When it is called during serialization of the startup | 1345 // tracks their movement. When it is called during serialization of the startup |
| 1347 // snapshot nothing happens. When the partial (context) snapshot is created, | 1346 // snapshot nothing happens. When the partial (context) snapshot is created, |
| 1348 // this array is populated with the pointers that the partial snapshot will | 1347 // this array is populated with the pointers that the partial snapshot will |
| 1349 // need. As that happens we emit serialized objects to the startup snapshot | 1348 // need. As that happens we emit serialized objects to the startup snapshot |
| 1350 // that correspond to the elements of this cache array. On deserialization we | 1349 // that correspond to the elements of this cache array. On deserialization we |
| 1351 // therefore need to visit the cache array. This fills it up with pointers to | 1350 // therefore need to visit the cache array. This fills it up with pointers to |
| 1352 // deserialized objects. | 1351 // deserialized objects. |
| 1353 void SerializerDeserializer::Iterate(ObjectVisitor* visitor) { | 1352 void SerializerDeserializer::Iterate(Isolate* isolate, |
| 1353 ObjectVisitor* visitor) { |
| 1354 if (Serializer::enabled()) return; | 1354 if (Serializer::enabled()) return; |
| 1355 Isolate* isolate = Isolate::Current(); | |
| 1356 for (int i = 0; ; i++) { | 1355 for (int i = 0; ; i++) { |
| 1357 if (isolate->serialize_partial_snapshot_cache_length() <= i) { | 1356 if (isolate->serialize_partial_snapshot_cache_length() <= i) { |
| 1358 // Extend the array ready to get a value from the visitor when | 1357 // Extend the array ready to get a value from the visitor when |
| 1359 // deserializing. | 1358 // deserializing. |
| 1360 isolate->PushToPartialSnapshotCache(Smi::FromInt(0)); | 1359 isolate->PushToPartialSnapshotCache(Smi::FromInt(0)); |
| 1361 } | 1360 } |
| 1362 Object** cache = isolate->serialize_partial_snapshot_cache(); | 1361 Object** cache = isolate->serialize_partial_snapshot_cache(); |
| 1363 visitor->VisitPointers(&cache[i], &cache[i + 1]); | 1362 visitor->VisitPointers(&cache[i], &cache[i + 1]); |
| 1364 // Sentinel is the undefined object, which is a root so it will not normally | 1363 // Sentinel is the undefined object, which is a root so it will not normally |
| 1365 // be found in the cache. | 1364 // be found in the cache. |
| 1366 if (cache[i] == isolate->heap()->undefined_value()) { | 1365 if (cache[i] == isolate->heap()->undefined_value()) { |
| 1367 break; | 1366 break; |
| 1368 } | 1367 } |
| 1369 } | 1368 } |
| 1370 } | 1369 } |
| 1371 | 1370 |
| 1372 | 1371 |
| 1373 int PartialSerializer::PartialSnapshotCacheIndex(HeapObject* heap_object) { | 1372 int PartialSerializer::PartialSnapshotCacheIndex(HeapObject* heap_object) { |
| 1374 Isolate* isolate = Isolate::Current(); | 1373 Isolate* isolate = this->isolate(); |
| 1375 | 1374 |
| 1376 for (int i = 0; | 1375 for (int i = 0; |
| 1377 i < isolate->serialize_partial_snapshot_cache_length(); | 1376 i < isolate->serialize_partial_snapshot_cache_length(); |
| 1378 i++) { | 1377 i++) { |
| 1379 Object* entry = isolate->serialize_partial_snapshot_cache()[i]; | 1378 Object* entry = isolate->serialize_partial_snapshot_cache()[i]; |
| 1380 if (entry == heap_object) return i; | 1379 if (entry == heap_object) return i; |
| 1381 } | 1380 } |
| 1382 | 1381 |
| 1383 // We didn't find the object in the cache. So we add it to the cache and | 1382 // We didn't find the object in the cache. So we add it to the cache and |
| 1384 // then visit the pointer so that it becomes part of the startup snapshot | 1383 // then visit the pointer so that it becomes part of the startup snapshot |
| 1385 // and we can refer to it from the partial snapshot. | 1384 // and we can refer to it from the partial snapshot. |
| 1386 int length = isolate->serialize_partial_snapshot_cache_length(); | 1385 int length = isolate->serialize_partial_snapshot_cache_length(); |
| 1387 isolate->PushToPartialSnapshotCache(heap_object); | 1386 isolate->PushToPartialSnapshotCache(heap_object); |
| 1388 startup_serializer_->VisitPointer(reinterpret_cast<Object**>(&heap_object)); | 1387 startup_serializer_->VisitPointer(reinterpret_cast<Object**>(&heap_object)); |
| 1389 // We don't recurse from the startup snapshot generator into the partial | 1388 // We don't recurse from the startup snapshot generator into the partial |
| 1390 // snapshot generator. | 1389 // snapshot generator. |
| 1391 ASSERT(length == isolate->serialize_partial_snapshot_cache_length() - 1); | 1390 ASSERT(length == isolate->serialize_partial_snapshot_cache_length() - 1); |
| 1392 return length; | 1391 return length; |
| 1393 } | 1392 } |
| 1394 | 1393 |
| 1395 | 1394 |
| 1396 int Serializer::RootIndex(HeapObject* heap_object, HowToCode from) { | 1395 int Serializer::RootIndex(HeapObject* heap_object, HowToCode from) { |
| 1397 Heap* heap = HEAP; | 1396 Heap* heap = isolate()->heap(); |
| 1398 if (heap->InNewSpace(heap_object)) return kInvalidRootIndex; | 1397 if (heap->InNewSpace(heap_object)) return kInvalidRootIndex; |
| 1399 for (int i = 0; i < root_index_wave_front_; i++) { | 1398 for (int i = 0; i < root_index_wave_front_; i++) { |
| 1400 Object* root = heap->roots_array_start()[i]; | 1399 Object* root = heap->roots_array_start()[i]; |
| 1401 if (!root->IsSmi() && root == heap_object) { | 1400 if (!root->IsSmi() && root == heap_object) { |
| 1402 #if V8_TARGET_ARCH_MIPS | 1401 #if V8_TARGET_ARCH_MIPS |
| 1403 if (from == kFromCode) { | 1402 if (from == kFromCode) { |
| 1404 // In order to avoid code bloat in the deserializer we don't have | 1403 // In order to avoid code bloat in the deserializer we don't have |
| 1405 // support for the encoding that specifies a particular root should | 1404 // support for the encoding that specifies a particular root should |
| 1406 // be written into the lui/ori instructions on MIPS. Therefore we | 1405 // be written into the lui/ori instructions on MIPS. Therefore we |
| 1407 // should not generate such serialization data for MIPS. | 1406 // should not generate such serialization data for MIPS. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1477 } | 1476 } |
| 1478 } | 1477 } |
| 1479 | 1478 |
| 1480 | 1479 |
| 1481 void StartupSerializer::SerializeWeakReferences() { | 1480 void StartupSerializer::SerializeWeakReferences() { |
| 1482 // This phase comes right after the partial serialization (of the snapshot). | 1481 // This phase comes right after the partial serialization (of the snapshot). |
| 1483 // After we have done the partial serialization the partial snapshot cache | 1482 // After we have done the partial serialization the partial snapshot cache |
| 1484 // will contain some references needed to decode the partial snapshot. We | 1483 // will contain some references needed to decode the partial snapshot. We |
| 1485 // add one entry with 'undefined' which is the sentinel that the deserializer | 1484 // add one entry with 'undefined' which is the sentinel that the deserializer |
| 1486 // uses to know it is done deserializing the array. | 1485 // uses to know it is done deserializing the array. |
| 1487 Isolate* isolate = Isolate::Current(); | 1486 Object* undefined = isolate()->heap()->undefined_value(); |
| 1488 Object* undefined = isolate->heap()->undefined_value(); | |
| 1489 VisitPointer(&undefined); | 1487 VisitPointer(&undefined); |
| 1490 HEAP->IterateWeakRoots(this, VISIT_ALL); | 1488 HEAP->IterateWeakRoots(this, VISIT_ALL); |
| 1491 Pad(); | 1489 Pad(); |
| 1492 } | 1490 } |
| 1493 | 1491 |
| 1494 | 1492 |
| 1495 void Serializer::PutRoot(int root_index, | 1493 void Serializer::PutRoot(int root_index, |
| 1496 HeapObject* object, | 1494 HeapObject* object, |
| 1497 SerializerDeserializer::HowToCode how_to_code, | 1495 SerializerDeserializer::HowToCode how_to_code, |
| 1498 SerializerDeserializer::WhereToPoint where_to_point, | 1496 SerializerDeserializer::WhereToPoint where_to_point, |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1857 | 1855 |
| 1858 bool SnapshotByteSource::AtEOF() { | 1856 bool SnapshotByteSource::AtEOF() { |
| 1859 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false; | 1857 if (0u + length_ - position_ > 2 * sizeof(uint32_t)) return false; |
| 1860 for (int x = position_; x < length_; x++) { | 1858 for (int x = position_; x < length_; x++) { |
| 1861 if (data_[x] != SerializerDeserializer::nop()) return false; | 1859 if (data_[x] != SerializerDeserializer::nop()) return false; |
| 1862 } | 1860 } |
| 1863 return true; | 1861 return true; |
| 1864 } | 1862 } |
| 1865 | 1863 |
| 1866 } } // namespace v8::internal | 1864 } } // namespace v8::internal |
| OLD | NEW |