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

Side by Side Diff: src/objects.cc

Issue 1026113004: Reload length of retained_maps array after GC. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove debug output Created 5 years, 9 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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 <iomanip> 5 #include <iomanip>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 8259 matching lines...) Expand 10 before | Expand all | Expand 10 after
8270 } 8270 }
8271 casted_result->set_last_used_index(target_index - 1 - kFirstIndex); 8271 casted_result->set_last_used_index(target_index - 1 - kFirstIndex);
8272 for (; target_index < result->length(); ++target_index) { 8272 for (; target_index < result->length(); ++target_index) {
8273 result->set(target_index, Smi::FromInt(0)); 8273 result->set(target_index, Smi::FromInt(0));
8274 } 8274 }
8275 } 8275 }
8276 return casted_result; 8276 return casted_result;
8277 } 8277 }
8278 8278
8279 8279
8280 Handle<ArrayList> ArrayList::Add(Handle<ArrayList> array, Handle<Object> obj) { 8280 Handle<ArrayList> ArrayList::Add(Handle<ArrayList> array, Handle<Object> obj,
8281 AddMode mode) {
8281 int length = array->Length(); 8282 int length = array->Length();
8282 array = EnsureSpace(array, length + 1); 8283 array = EnsureSpace(array, length + 1);
8284 if (mode == kReloadLengthAfterAllocation) {
8285 length = array->Length();
Jarin 2015/03/24 13:50:04 Would it make sense to here (and in the other Add
ulan 2015/03/24 14:01:36 Done.
8286 }
8283 array->Set(length, *obj); 8287 array->Set(length, *obj);
8284 array->SetLength(length + 1); 8288 array->SetLength(length + 1);
8285 return array; 8289 return array;
8286 } 8290 }
8287 8291
8288 8292
8289 Handle<ArrayList> ArrayList::Add(Handle<ArrayList> array, Handle<Object> obj1, 8293 Handle<ArrayList> ArrayList::Add(Handle<ArrayList> array, Handle<Object> obj1,
8290 Handle<Object> obj2) { 8294 Handle<Object> obj2, AddMode mode) {
8291 int length = array->Length(); 8295 int length = array->Length();
8292 array = EnsureSpace(array, length + 2); 8296 array = EnsureSpace(array, length + 2);
8297 if (mode == kReloadLengthAfterAllocation) {
8298 length = array->Length();
8299 }
8293 array->Set(length, *obj1); 8300 array->Set(length, *obj1);
8294 array->Set(length + 1, *obj2); 8301 array->Set(length + 1, *obj2);
8295 array->SetLength(length + 2); 8302 array->SetLength(length + 2);
8296 return array; 8303 return array;
8297 } 8304 }
8298 8305
8299 8306
8300 Handle<ArrayList> ArrayList::EnsureSpace(Handle<ArrayList> array, int length) { 8307 Handle<ArrayList> ArrayList::EnsureSpace(Handle<ArrayList> array, int length) {
8301 int capacity = array->length(); 8308 int capacity = array->length();
8309 bool empty = (capacity == 0);
8302 if (capacity < kFirstIndex + length) { 8310 if (capacity < kFirstIndex + length) {
8303 capacity = kFirstIndex + length; 8311 capacity = kFirstIndex + length;
8304 capacity = capacity + Max(capacity / 2, 2); 8312 capacity = capacity + Max(capacity / 2, 2);
8305 array = Handle<ArrayList>::cast(FixedArray::CopySize(array, capacity)); 8313 array = Handle<ArrayList>::cast(FixedArray::CopySize(array, capacity));
8314 if (empty) array->SetLength(0);
8306 } 8315 }
8307 return array; 8316 return array;
8308 } 8317 }
8309 8318
8310 8319
8311 Handle<DescriptorArray> DescriptorArray::Allocate(Isolate* isolate, 8320 Handle<DescriptorArray> DescriptorArray::Allocate(Isolate* isolate,
8312 int number_of_descriptors, 8321 int number_of_descriptors,
8313 int slack) { 8322 int slack) {
8314 DCHECK(0 <= number_of_descriptors); 8323 DCHECK(0 <= number_of_descriptors);
8315 Factory* factory = isolate->factory(); 8324 Factory* factory = isolate->factory();
(...skipping 8790 matching lines...) Expand 10 before | Expand all | Expand 10 after
17106 CompilationInfo* info) { 17115 CompilationInfo* info) {
17107 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( 17116 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo(
17108 handle(cell->dependent_code(), info->isolate()), 17117 handle(cell->dependent_code(), info->isolate()),
17109 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); 17118 DependentCode::kPropertyCellChangedGroup, info->object_wrapper());
17110 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); 17119 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
17111 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 17120 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
17112 cell, info->zone()); 17121 cell, info->zone());
17113 } 17122 }
17114 17123
17115 } } // namespace v8::internal 17124 } } // namespace v8::internal
OLDNEW
« src/objects.h ('K') | « src/objects.h ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698