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

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

Issue 2458603002: [serializer] clean up root list items. (Closed)
Patch Set: Created 4 years, 1 month 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/heap/heap.h ('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/serializer.h" 5 #include "src/snapshot/serializer.h"
6 6
7 #include "src/macro-assembler.h" 7 #include "src/macro-assembler.h"
8 #include "src/snapshot/natives.h" 8 #include "src/snapshot/natives.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 void Serializer::PutRoot(int root_index, HeapObject* object, 205 void Serializer::PutRoot(int root_index, HeapObject* object,
206 SerializerDeserializer::HowToCode how_to_code, 206 SerializerDeserializer::HowToCode how_to_code,
207 SerializerDeserializer::WhereToPoint where_to_point, 207 SerializerDeserializer::WhereToPoint where_to_point,
208 int skip) { 208 int skip) {
209 if (FLAG_trace_serializer) { 209 if (FLAG_trace_serializer) {
210 PrintF(" Encoding root %d:", root_index); 210 PrintF(" Encoding root %d:", root_index);
211 object->ShortPrint(); 211 object->ShortPrint();
212 PrintF("\n"); 212 PrintF("\n");
213 } 213 }
214 214
215 // Assert that the first 32 root array items are a conscious choice. They are
216 // chosen so that the most common ones can be encoded more efficiently.
217 STATIC_ASSERT(Heap::kEmptyDescriptorArrayRootIndex ==
218 kNumberOfRootArrayConstants - 1);
219
215 if (how_to_code == kPlain && where_to_point == kStartOfObject && 220 if (how_to_code == kPlain && where_to_point == kStartOfObject &&
216 root_index < kNumberOfRootArrayConstants && 221 root_index < kNumberOfRootArrayConstants &&
217 !isolate()->heap()->InNewSpace(object)) { 222 !isolate()->heap()->InNewSpace(object)) {
218 if (skip == 0) { 223 if (skip == 0) {
219 sink_.Put(kRootArrayConstants + root_index, "RootConstant"); 224 sink_.Put(kRootArrayConstants + root_index, "RootConstant");
220 } else { 225 } else {
221 sink_.Put(kRootArrayConstantsWithSkip + root_index, "RootConstant"); 226 sink_.Put(kRootArrayConstantsWithSkip + root_index, "RootConstant");
222 sink_.PutInt(skip, "SkipInPutRoot"); 227 sink_.PutInt(skip, "SkipInPutRoot");
223 } 228 }
224 } else { 229 } else {
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 if (to_skip != 0 && return_skip == kIgnoringReturn) { 795 if (to_skip != 0 && return_skip == kIgnoringReturn) {
791 sink_->Put(kSkip, "Skip"); 796 sink_->Put(kSkip, "Skip");
792 sink_->PutInt(to_skip, "SkipDistance"); 797 sink_->PutInt(to_skip, "SkipDistance");
793 to_skip = 0; 798 to_skip = 0;
794 } 799 }
795 return to_skip; 800 return to_skip;
796 } 801 }
797 802
798 } // namespace internal 803 } // namespace internal
799 } // namespace v8 804 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698