Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: src/snapshot/startup-serializer.cc

Issue 1859063003: [serializer] make snapshot reproducible. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/snapshot/mksnapshot.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 CHECK_EQ(0, isolate->eternal_handles()->NumberOfHandles()); 106 CHECK_EQ(0, isolate->eternal_handles()->NumberOfHandles());
107 // We don't support serializing installed extensions. 107 // We don't support serializing installed extensions.
108 CHECK(!isolate->has_installed_extensions()); 108 CHECK(!isolate->has_installed_extensions());
109 // First visit immortal immovables to make sure they end up in the first page. 109 // First visit immortal immovables to make sure they end up in the first page.
110 serializing_immortal_immovables_roots_ = true; 110 serializing_immortal_immovables_roots_ = true;
111 isolate->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG_ROOT_LIST); 111 isolate->heap()->IterateStrongRoots(this, VISIT_ONLY_STRONG_ROOT_LIST);
112 // Check that immortal immovable roots are allocated on the first page. 112 // Check that immortal immovable roots are allocated on the first page.
113 CHECK(HasNotExceededFirstPageOfEachSpace()); 113 CHECK(HasNotExceededFirstPageOfEachSpace());
114 serializing_immortal_immovables_roots_ = false; 114 serializing_immortal_immovables_roots_ = false;
115 // Visit the rest of the strong roots. 115 // Visit the rest of the strong roots.
116 // Clear the stack limits to make the snapshot reproducible.
117 // Reset it again afterwards.
118 isolate->heap()->ClearStackLimits();
116 isolate->heap()->IterateSmiRoots(this); 119 isolate->heap()->IterateSmiRoots(this);
120 isolate->heap()->SetStackLimits();
121
117 isolate->heap()->IterateStrongRoots(this, 122 isolate->heap()->IterateStrongRoots(this,
118 VISIT_ONLY_STRONG_FOR_SERIALIZATION); 123 VISIT_ONLY_STRONG_FOR_SERIALIZATION);
119 } 124 }
120 125
121 void StartupSerializer::VisitPointers(Object** start, Object** end) { 126 void StartupSerializer::VisitPointers(Object** start, Object** end) {
122 if (start == isolate()->heap()->roots_array_start()) { 127 if (start == isolate()->heap()->roots_array_start()) {
123 // Serializing the root list needs special handling: 128 // Serializing the root list needs special handling:
124 // - The first pass over the root list only serializes immortal immovables. 129 // - The first pass over the root list only serializes immortal immovables.
125 // - The second pass over the root list serializes the rest. 130 // - The second pass over the root list serializes the rest.
126 // - Only root list elements that have been fully serialized can be 131 // - Only root list elements that have been fully serialized can be
(...skipping 26 matching lines...) Expand all
153 if (root_index == Heap::kStackLimitRootIndex || 158 if (root_index == Heap::kStackLimitRootIndex ||
154 root_index == Heap::kRealStackLimitRootIndex) { 159 root_index == Heap::kRealStackLimitRootIndex) {
155 return true; 160 return true;
156 } 161 }
157 return Heap::RootIsImmortalImmovable(root_index) != 162 return Heap::RootIsImmortalImmovable(root_index) !=
158 serializing_immortal_immovables_roots_; 163 serializing_immortal_immovables_roots_;
159 } 164 }
160 165
161 } // namespace internal 166 } // namespace internal
162 } // namespace v8 167 } // namespace v8
OLDNEW
« no previous file with comments | « src/snapshot/mksnapshot.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698