| OLD | NEW |
| 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 "src/objects.h" | 5 #include "src/objects.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <iomanip> | 8 #include <iomanip> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 | 10 |
| (...skipping 10375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10386 if (mode == kReloadLengthAfterAllocation) { | 10386 if (mode == kReloadLengthAfterAllocation) { |
| 10387 length = array->Length(); | 10387 length = array->Length(); |
| 10388 } | 10388 } |
| 10389 array->Set(length, *obj1); | 10389 array->Set(length, *obj1); |
| 10390 array->Set(length + 1, *obj2); | 10390 array->Set(length + 1, *obj2); |
| 10391 array->SetLength(length + 2); | 10391 array->SetLength(length + 2); |
| 10392 return array; | 10392 return array; |
| 10393 } | 10393 } |
| 10394 | 10394 |
| 10395 | 10395 |
| 10396 bool ArrayList::IsFull() { |
| 10397 int capacity = length(); |
| 10398 return kFirstIndex + Length() == capacity; |
| 10399 } |
| 10400 |
| 10401 |
| 10396 Handle<ArrayList> ArrayList::EnsureSpace(Handle<ArrayList> array, int length) { | 10402 Handle<ArrayList> ArrayList::EnsureSpace(Handle<ArrayList> array, int length) { |
| 10397 int capacity = array->length(); | 10403 int capacity = array->length(); |
| 10398 bool empty = (capacity == 0); | 10404 bool empty = (capacity == 0); |
| 10399 if (capacity < kFirstIndex + length) { | 10405 if (capacity < kFirstIndex + length) { |
| 10400 Isolate* isolate = array->GetIsolate(); | 10406 Isolate* isolate = array->GetIsolate(); |
| 10401 int new_capacity = kFirstIndex + length; | 10407 int new_capacity = kFirstIndex + length; |
| 10402 new_capacity = new_capacity + Max(new_capacity / 2, 2); | 10408 new_capacity = new_capacity + Max(new_capacity / 2, 2); |
| 10403 int grow_by = new_capacity - capacity; | 10409 int grow_by = new_capacity - capacity; |
| 10404 array = Handle<ArrayList>::cast( | 10410 array = Handle<ArrayList>::cast( |
| 10405 isolate->factory()->CopyFixedArrayAndGrow(array, grow_by)); | 10411 isolate->factory()->CopyFixedArrayAndGrow(array, grow_by)); |
| (...skipping 8823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19229 if (cell->value() != *new_value) { | 19235 if (cell->value() != *new_value) { |
| 19230 cell->set_value(*new_value); | 19236 cell->set_value(*new_value); |
| 19231 Isolate* isolate = cell->GetIsolate(); | 19237 Isolate* isolate = cell->GetIsolate(); |
| 19232 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19238 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 19233 isolate, DependentCode::kPropertyCellChangedGroup); | 19239 isolate, DependentCode::kPropertyCellChangedGroup); |
| 19234 } | 19240 } |
| 19235 } | 19241 } |
| 19236 | 19242 |
| 19237 } // namespace internal | 19243 } // namespace internal |
| 19238 } // namespace v8 | 19244 } // namespace v8 |
| OLD | NEW |