| 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 9877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9888 if (mode == kReloadLengthAfterAllocation) { | 9888 if (mode == kReloadLengthAfterAllocation) { |
| 9889 length = array->Length(); | 9889 length = array->Length(); |
| 9890 } | 9890 } |
| 9891 array->Set(length, *obj1); | 9891 array->Set(length, *obj1); |
| 9892 array->Set(length + 1, *obj2); | 9892 array->Set(length + 1, *obj2); |
| 9893 array->SetLength(length + 2); | 9893 array->SetLength(length + 2); |
| 9894 return array; | 9894 return array; |
| 9895 } | 9895 } |
| 9896 | 9896 |
| 9897 | 9897 |
| 9898 bool ArrayList::IsFull() { |
| 9899 int capacity = length(); |
| 9900 return kFirstIndex + Length() == capacity; |
| 9901 } |
| 9902 |
| 9903 |
| 9898 Handle<ArrayList> ArrayList::EnsureSpace(Handle<ArrayList> array, int length) { | 9904 Handle<ArrayList> ArrayList::EnsureSpace(Handle<ArrayList> array, int length) { |
| 9899 int capacity = array->length(); | 9905 int capacity = array->length(); |
| 9900 bool empty = (capacity == 0); | 9906 bool empty = (capacity == 0); |
| 9901 if (capacity < kFirstIndex + length) { | 9907 if (capacity < kFirstIndex + length) { |
| 9902 Isolate* isolate = array->GetIsolate(); | 9908 Isolate* isolate = array->GetIsolate(); |
| 9903 int new_capacity = kFirstIndex + length; | 9909 int new_capacity = kFirstIndex + length; |
| 9904 new_capacity = new_capacity + Max(new_capacity / 2, 2); | 9910 new_capacity = new_capacity + Max(new_capacity / 2, 2); |
| 9905 int grow_by = new_capacity - capacity; | 9911 int grow_by = new_capacity - capacity; |
| 9906 array = Handle<ArrayList>::cast( | 9912 array = Handle<ArrayList>::cast( |
| 9907 isolate->factory()->CopyFixedArrayAndGrow(array, grow_by)); | 9913 isolate->factory()->CopyFixedArrayAndGrow(array, grow_by)); |
| (...skipping 8739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18647 if (cell->value() != *new_value) { | 18653 if (cell->value() != *new_value) { |
| 18648 cell->set_value(*new_value); | 18654 cell->set_value(*new_value); |
| 18649 Isolate* isolate = cell->GetIsolate(); | 18655 Isolate* isolate = cell->GetIsolate(); |
| 18650 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 18656 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 18651 isolate, DependentCode::kPropertyCellChangedGroup); | 18657 isolate, DependentCode::kPropertyCellChangedGroup); |
| 18652 } | 18658 } |
| 18653 } | 18659 } |
| 18654 | 18660 |
| 18655 } // namespace internal | 18661 } // namespace internal |
| 18656 } // namespace v8 | 18662 } // namespace v8 |
| OLD | NEW |