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/startup-serializer.h" | 5 #include "src/snapshot/startup-serializer.h" |
6 | 6 |
7 #include "src/objects-inl.h" | 7 #include "src/objects-inl.h" |
8 #include "src/v8threads.h" | 8 #include "src/v8threads.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 serializing_builtins_ = (tag == VisitorSynchronization::kHandleScope); | 109 serializing_builtins_ = (tag == VisitorSynchronization::kHandleScope); |
110 sink_.Put(kSynchronize, "Synchronize"); | 110 sink_.Put(kSynchronize, "Synchronize"); |
111 } | 111 } |
112 | 112 |
113 void StartupSerializer::SerializeStrongReferences() { | 113 void StartupSerializer::SerializeStrongReferences() { |
114 Isolate* isolate = this->isolate(); | 114 Isolate* isolate = this->isolate(); |
115 // No active threads. | 115 // No active threads. |
116 CHECK_NULL(isolate->thread_manager()->FirstThreadStateInUse()); | 116 CHECK_NULL(isolate->thread_manager()->FirstThreadStateInUse()); |
117 // No active or weak handles. | 117 // No active or weak handles. |
118 CHECK(isolate->handle_scope_implementer()->blocks()->is_empty()); | 118 CHECK(isolate->handle_scope_implementer()->blocks()->is_empty()); |
119 CHECK_EQ(0, isolate->global_handles()->NumberOfWeakHandles()); | 119 CHECK_EQ(0, isolate->global_handles()->global_handles_count()); |
120 CHECK_EQ(0, isolate->eternal_handles()->NumberOfHandles()); | 120 CHECK_EQ(0, isolate->eternal_handles()->NumberOfHandles()); |
121 // We don't support serializing installed extensions. | |
122 CHECK(!isolate->has_installed_extensions()); | |
123 // First visit immortal immovables to make sure they end up in the first page. | 121 // First visit immortal immovables to make sure they end up in the first page. |
124 serializing_immortal_immovables_roots_ = true; | 122 serializing_immortal_immovables_roots_ = true; |
125 isolate->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG_ROOT_LIST); | 123 isolate->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG_ROOT_LIST); |
126 // Check that immortal immovable roots are allocated on the first page. | 124 // Check that immortal immovable roots are allocated on the first page. |
127 CHECK(HasNotExceededFirstPageOfEachSpace()); | 125 CHECK(HasNotExceededFirstPageOfEachSpace()); |
128 serializing_immortal_immovables_roots_ = false; | 126 serializing_immortal_immovables_roots_ = false; |
129 // Visit the rest of the strong roots. | 127 // Visit the rest of the strong roots. |
130 // Clear the stack limits to make the snapshot reproducible. | 128 // Clear the stack limits to make the snapshot reproducible. |
131 // Reset it again afterwards. | 129 // Reset it again afterwards. |
132 isolate->heap()->ClearStackLimits(); | 130 isolate->heap()->ClearStackLimits(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 if (root_index == Heap::kStackLimitRootIndex || | 170 if (root_index == Heap::kStackLimitRootIndex || |
173 root_index == Heap::kRealStackLimitRootIndex) { | 171 root_index == Heap::kRealStackLimitRootIndex) { |
174 return true; | 172 return true; |
175 } | 173 } |
176 return Heap::RootIsImmortalImmovable(root_index) != | 174 return Heap::RootIsImmortalImmovable(root_index) != |
177 serializing_immortal_immovables_roots_; | 175 serializing_immortal_immovables_roots_; |
178 } | 176 } |
179 | 177 |
180 } // namespace internal | 178 } // namespace internal |
181 } // namespace v8 | 179 } // namespace v8 |
OLD | NEW |