| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } | 96 } |
| 97 | 97 |
| 98 isolate_->heap()->set_native_contexts_list( | 98 isolate_->heap()->set_native_contexts_list( |
| 99 isolate_->heap()->undefined_value()); | 99 isolate_->heap()->undefined_value()); |
| 100 // The allocation site list is build during root iteration, but if no sites | 100 // The allocation site list is build during root iteration, but if no sites |
| 101 // were encountered then it needs to be initialized to undefined. | 101 // were encountered then it needs to be initialized to undefined. |
| 102 if (isolate_->heap()->allocation_sites_list() == Smi::kZero) { | 102 if (isolate_->heap()->allocation_sites_list() == Smi::FromInt(0)) { |
| 103 isolate_->heap()->set_allocation_sites_list( | 103 isolate_->heap()->set_allocation_sites_list( |
| 104 isolate_->heap()->undefined_value()); | 104 isolate_->heap()->undefined_value()); |
| 105 } | 105 } |
| 106 | 106 |
| 107 // Issue code events for newly deserialized code objects. | 107 // Issue code events for newly deserialized code objects. |
| 108 LOG_CODE_EVENT(isolate_, LogCodeObjects()); | 108 LOG_CODE_EVENT(isolate_, LogCodeObjects()); |
| 109 LOG_CODE_EVENT(isolate_, LogBytecodeHandlers()); | 109 LOG_CODE_EVENT(isolate_, LogBytecodeHandlers()); |
| 110 LOG_CODE_EVENT(isolate_, LogCompiledFunctions()); | 110 LOG_CODE_EVENT(isolate_, LogCompiledFunctions()); |
| 111 } | 111 } |
| 112 | 112 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 } | 270 } |
| 271 } | 271 } |
| 272 if (obj->IsAllocationSite()) { | 272 if (obj->IsAllocationSite()) { |
| 273 DCHECK(obj->IsAllocationSite()); | 273 DCHECK(obj->IsAllocationSite()); |
| 274 // Allocation sites are present in the snapshot, and must be linked into | 274 // Allocation sites are present in the snapshot, and must be linked into |
| 275 // a list at deserialization time. | 275 // a list at deserialization time. |
| 276 AllocationSite* site = AllocationSite::cast(obj); | 276 AllocationSite* site = AllocationSite::cast(obj); |
| 277 // TODO(mvstanton): consider treating the heap()->allocation_sites_list() | 277 // TODO(mvstanton): consider treating the heap()->allocation_sites_list() |
| 278 // as a (weak) root. If this root is relocated correctly, this becomes | 278 // as a (weak) root. If this root is relocated correctly, this becomes |
| 279 // unnecessary. | 279 // unnecessary. |
| 280 if (isolate_->heap()->allocation_sites_list() == Smi::kZero) { | 280 if (isolate_->heap()->allocation_sites_list() == Smi::FromInt(0)) { |
| 281 site->set_weak_next(isolate_->heap()->undefined_value()); | 281 site->set_weak_next(isolate_->heap()->undefined_value()); |
| 282 } else { | 282 } else { |
| 283 site->set_weak_next(isolate_->heap()->allocation_sites_list()); | 283 site->set_weak_next(isolate_->heap()->allocation_sites_list()); |
| 284 } | 284 } |
| 285 isolate_->heap()->set_allocation_sites_list(site); | 285 isolate_->heap()->set_allocation_sites_list(site); |
| 286 } else if (obj->IsCode()) { | 286 } else if (obj->IsCode()) { |
| 287 // We flush all code pages after deserializing the startup snapshot. In that | 287 // We flush all code pages after deserializing the startup snapshot. In that |
| 288 // case, we only need to remember code objects in the large object space. | 288 // case, we only need to remember code objects in the large object space. |
| 289 // When deserializing user code, remember each individual code object. | 289 // When deserializing user code, remember each individual code object. |
| 290 if (deserializing_user_code() || space == LO_SPACE) { | 290 if (deserializing_user_code() || space == LO_SPACE) { |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 | 825 |
| 826 default: | 826 default: |
| 827 CHECK(false); | 827 CHECK(false); |
| 828 } | 828 } |
| 829 } | 829 } |
| 830 CHECK_EQ(limit, current); | 830 CHECK_EQ(limit, current); |
| 831 return true; | 831 return true; |
| 832 } | 832 } |
| 833 } // namespace internal | 833 } // namespace internal |
| 834 } // namespace v8 | 834 } // namespace v8 |
| OLD | NEW |