| 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 14159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14170 Object* length = JSArray::cast(object)->length(); | 14170 Object* length = JSArray::cast(object)->length(); |
| 14171 if (!length->IsSmi()) return false; | 14171 if (!length->IsSmi()) return false; |
| 14172 *new_capacity = static_cast<uint32_t>(Smi::cast(length)->value()); | 14172 *new_capacity = static_cast<uint32_t>(Smi::cast(length)->value()); |
| 14173 } else { | 14173 } else { |
| 14174 *new_capacity = dictionary->max_number_key() + 1; | 14174 *new_capacity = dictionary->max_number_key() + 1; |
| 14175 } | 14175 } |
| 14176 *new_capacity = Max(index + 1, *new_capacity); | 14176 *new_capacity = Max(index + 1, *new_capacity); |
| 14177 | 14177 |
| 14178 uint32_t dictionary_size = static_cast<uint32_t>(dictionary->Capacity()) * | 14178 uint32_t dictionary_size = static_cast<uint32_t>(dictionary->Capacity()) * |
| 14179 SeededNumberDictionary::kEntrySize; | 14179 SeededNumberDictionary::kEntrySize; |
| 14180 |
| 14181 // Turn fast if the dictionary only saves 50% space. |
| 14180 return 2 * dictionary_size >= *new_capacity; | 14182 return 2 * dictionary_size >= *new_capacity; |
| 14181 } | 14183 } |
| 14182 | 14184 |
| 14183 | 14185 |
| 14184 // static | 14186 // static |
| 14185 MaybeHandle<Object> JSObject::AddDataElement(Handle<JSObject> object, | 14187 MaybeHandle<Object> JSObject::AddDataElement(Handle<JSObject> object, |
| 14186 uint32_t index, | 14188 uint32_t index, |
| 14187 Handle<Object> value, | 14189 Handle<Object> value, |
| 14188 PropertyAttributes attributes) { | 14190 PropertyAttributes attributes) { |
| 14189 MAYBE_RETURN_NULL( | 14191 MAYBE_RETURN_NULL( |
| (...skipping 3711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17901 if (cell->value() != *new_value) { | 17903 if (cell->value() != *new_value) { |
| 17902 cell->set_value(*new_value); | 17904 cell->set_value(*new_value); |
| 17903 Isolate* isolate = cell->GetIsolate(); | 17905 Isolate* isolate = cell->GetIsolate(); |
| 17904 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 17906 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 17905 isolate, DependentCode::kPropertyCellChangedGroup); | 17907 isolate, DependentCode::kPropertyCellChangedGroup); |
| 17906 } | 17908 } |
| 17907 } | 17909 } |
| 17908 | 17910 |
| 17909 } // namespace internal | 17911 } // namespace internal |
| 17910 } // namespace v8 | 17912 } // namespace v8 |
| OLD | NEW |