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/deserializer.h" | 5 #include "src/snapshot/deserializer.h" |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/external-reference-table.h" | 8 #include "src/external-reference-table.h" |
9 #include "src/heap/heap.h" | 9 #include "src/heap/heap.h" |
10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 { | 87 { |
88 DisallowHeapAllocation no_gc; | 88 DisallowHeapAllocation no_gc; |
89 isolate_->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG_ROOT_LIST); | 89 isolate_->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG_ROOT_LIST); |
90 isolate_->heap()->IterateSmiRoots(this); | 90 isolate_->heap()->IterateSmiRoots(this); |
91 isolate_->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG); | 91 isolate_->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG); |
92 isolate_->heap()->RepairFreeListsAfterDeserialization(); | 92 isolate_->heap()->RepairFreeListsAfterDeserialization(); |
93 isolate_->heap()->IterateWeakRoots(this, VISIT_ALL); | 93 isolate_->heap()->IterateWeakRoots(this, VISIT_ALL); |
94 DeserializeDeferredObjects(); | 94 DeserializeDeferredObjects(); |
95 FlushICacheForNewIsolate(); | 95 FlushICacheForNewIsolate(); |
| 96 RestoreExternalReferenceRedirectors(&accessor_infos_); |
96 } | 97 } |
97 | 98 |
98 isolate_->heap()->set_native_contexts_list( | 99 isolate_->heap()->set_native_contexts_list( |
99 isolate_->heap()->undefined_value()); | 100 isolate_->heap()->undefined_value()); |
100 // The allocation site list is build during root iteration, but if no sites | 101 // The allocation site list is build during root iteration, but if no sites |
101 // were encountered then it needs to be initialized to undefined. | 102 // were encountered then it needs to be initialized to undefined. |
102 if (isolate_->heap()->allocation_sites_list() == Smi::kZero) { | 103 if (isolate_->heap()->allocation_sites_list() == Smi::kZero) { |
103 isolate_->heap()->set_allocation_sites_list( | 104 isolate_->heap()->set_allocation_sites_list( |
104 isolate_->heap()->undefined_value()); | 105 isolate_->heap()->undefined_value()); |
105 } | 106 } |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 site->set_weak_next(isolate_->heap()->allocation_sites_list()); | 310 site->set_weak_next(isolate_->heap()->allocation_sites_list()); |
310 } | 311 } |
311 isolate_->heap()->set_allocation_sites_list(site); | 312 isolate_->heap()->set_allocation_sites_list(site); |
312 } else if (obj->IsCode()) { | 313 } else if (obj->IsCode()) { |
313 // We flush all code pages after deserializing the startup snapshot. In that | 314 // We flush all code pages after deserializing the startup snapshot. In that |
314 // case, we only need to remember code objects in the large object space. | 315 // case, we only need to remember code objects in the large object space. |
315 // When deserializing user code, remember each individual code object. | 316 // When deserializing user code, remember each individual code object. |
316 if (deserializing_user_code() || space == LO_SPACE) { | 317 if (deserializing_user_code() || space == LO_SPACE) { |
317 new_code_objects_.Add(Code::cast(obj)); | 318 new_code_objects_.Add(Code::cast(obj)); |
318 } | 319 } |
| 320 } else if (obj->IsAccessorInfo()) { |
| 321 if (isolate_->external_reference_redirector()) { |
| 322 accessor_infos_.Add(AccessorInfo::cast(obj)); |
| 323 } |
319 } | 324 } |
320 // Check alignment. | 325 // Check alignment. |
321 DCHECK_EQ(0, Heap::GetFillToAlign(obj->address(), obj->RequiredAlignment())); | 326 DCHECK_EQ(0, Heap::GetFillToAlign(obj->address(), obj->RequiredAlignment())); |
322 return obj; | 327 return obj; |
323 } | 328 } |
324 | 329 |
325 void Deserializer::CommitPostProcessedObjects(Isolate* isolate) { | 330 void Deserializer::CommitPostProcessedObjects(Isolate* isolate) { |
326 StringTable::EnsureCapacityForDeserialization( | 331 StringTable::EnsureCapacityForDeserialization( |
327 isolate, new_internalized_strings_.length()); | 332 isolate, new_internalized_strings_.length()); |
328 for (Handle<String> string : new_internalized_strings_) { | 333 for (Handle<String> string : new_internalized_strings_) { |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 | 856 |
852 default: | 857 default: |
853 CHECK(false); | 858 CHECK(false); |
854 } | 859 } |
855 } | 860 } |
856 CHECK_EQ(limit, current); | 861 CHECK_EQ(limit, current); |
857 return true; | 862 return true; |
858 } | 863 } |
859 } // namespace internal | 864 } // namespace internal |
860 } // namespace v8 | 865 } // namespace v8 |
OLD | NEW |