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

Side by Side Diff: runtime/vm/raw_object.cc

Issue 2968003004: Revert "The current growth strategy for growable arrays allocates a backing array of size 2 at (emp… (Closed)
Patch Set: Created 3 years, 5 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 | « runtime/vm/raw_object.h ('k') | runtime/vm/service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/raw_object.h" 5 #include "vm/raw_object.h"
6 6
7 #include "vm/become.h" 7 #include "vm/become.h"
8 #include "vm/class_table.h" 8 #include "vm/class_table.h"
9 #include "vm/dart.h" 9 #include "vm/dart.h"
10 #include "vm/freelist.h" 10 #include "vm/freelist.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 RawClass* raw_class = isolate->GetClassForHeapWalkAt(class_id); 192 RawClass* raw_class = isolate->GetClassForHeapWalkAt(class_id);
193 instance_size = raw_class->ptr()->instance_size_in_words_ 193 instance_size = raw_class->ptr()->instance_size_in_words_
194 << kWordSizeLog2; 194 << kWordSizeLog2;
195 } 195 }
196 } 196 }
197 ASSERT(instance_size != 0); 197 ASSERT(instance_size != 0);
198 #if defined(DEBUG) 198 #if defined(DEBUG)
199 uint32_t tags = ptr()->tags_; 199 uint32_t tags = ptr()->tags_;
200 intptr_t tags_size = SizeTag::decode(tags); 200 intptr_t tags_size = SizeTag::decode(tags);
201 if ((class_id == kArrayCid) && (instance_size > tags_size && tags_size > 0)) { 201 if ((class_id == kArrayCid) && (instance_size > tags_size && tags_size > 0)) {
202 // TODO(22501): Array::MakeFixedLength could be in the process of shrinking 202 // TODO(22501): Array::MakeArray could be in the process of shrinking
203 // the array (see comment therein), having already updated the tags but not 203 // the array (see comment therein), having already updated the tags but not
204 // yet set the new length. Wait a millisecond and try again. 204 // yet set the new length. Wait a millisecond and try again.
205 int retries_remaining = 1000; // ... but not forever. 205 int retries_remaining = 1000; // ... but not forever.
206 do { 206 do {
207 OS::Sleep(1); 207 OS::Sleep(1);
208 const RawArray* raw_array = reinterpret_cast<const RawArray*>(this); 208 const RawArray* raw_array = reinterpret_cast<const RawArray*>(this);
209 intptr_t array_length = Smi::Value(raw_array->ptr()->length_); 209 intptr_t array_length = Smi::Value(raw_array->ptr()->length_);
210 instance_size = Array::InstanceSize(array_length); 210 instance_size = Array::InstanceSize(array_length);
211 } while ((instance_size > tags_size) && (--retries_remaining > 0)); 211 } while ((instance_size > tags_size) && (--retries_remaining > 0));
212 } 212 }
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 intptr_t RawUserTag::VisitUserTagPointers(RawUserTag* raw_obj, 1003 intptr_t RawUserTag::VisitUserTagPointers(RawUserTag* raw_obj,
1004 ObjectPointerVisitor* visitor) { 1004 ObjectPointerVisitor* visitor) {
1005 // Make sure that we got here with the tagged pointer as this. 1005 // Make sure that we got here with the tagged pointer as this.
1006 ASSERT(raw_obj->IsHeapObject()); 1006 ASSERT(raw_obj->IsHeapObject());
1007 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); 1007 visitor->VisitPointers(raw_obj->from(), raw_obj->to());
1008 return UserTag::InstanceSize(); 1008 return UserTag::InstanceSize();
1009 } 1009 }
1010 1010
1011 1011
1012 } // namespace dart 1012 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.h ('k') | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698