| 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 14487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14498 return used; | 14498 return used; |
| 14499 } | 14499 } |
| 14500 | 14500 |
| 14501 | 14501 |
| 14502 int JSObject::GetFastElementsUsage() { | 14502 int JSObject::GetFastElementsUsage() { |
| 14503 FixedArrayBase* store = elements(); | 14503 FixedArrayBase* store = elements(); |
| 14504 switch (GetElementsKind()) { | 14504 switch (GetElementsKind()) { |
| 14505 case FAST_SMI_ELEMENTS: | 14505 case FAST_SMI_ELEMENTS: |
| 14506 case FAST_DOUBLE_ELEMENTS: | 14506 case FAST_DOUBLE_ELEMENTS: |
| 14507 case FAST_ELEMENTS: | 14507 case FAST_ELEMENTS: |
| 14508 // Only JSArray have packed elements. | 14508 return IsJSArray() ? Smi::cast(JSArray::cast(this)->length())->value() |
| 14509 return Smi::cast(JSArray::cast(this)->length())->value(); | 14509 : store->length(); |
| 14510 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: | 14510 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: |
| 14511 store = FixedArray::cast(FixedArray::cast(store)->get(1)); | 14511 store = FixedArray::cast(FixedArray::cast(store)->get(1)); |
| 14512 // Fall through. | 14512 // Fall through. |
| 14513 case FAST_HOLEY_SMI_ELEMENTS: | 14513 case FAST_HOLEY_SMI_ELEMENTS: |
| 14514 case FAST_HOLEY_ELEMENTS: | 14514 case FAST_HOLEY_ELEMENTS: |
| 14515 return FastHoleyElementsUsage(this, FixedArray::cast(store)); | 14515 return FastHoleyElementsUsage(this, FixedArray::cast(store)); |
| 14516 case FAST_HOLEY_DOUBLE_ELEMENTS: | 14516 case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 14517 if (elements()->length() == 0) return 0; | 14517 if (elements()->length() == 0) return 0; |
| 14518 return FastHoleyElementsUsage(this, FixedDoubleArray::cast(store)); | 14518 return FastHoleyElementsUsage(this, FixedDoubleArray::cast(store)); |
| 14519 | 14519 |
| (...skipping 3381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17901 if (cell->value() != *new_value) { | 17901 if (cell->value() != *new_value) { |
| 17902 cell->set_value(*new_value); | 17902 cell->set_value(*new_value); |
| 17903 Isolate* isolate = cell->GetIsolate(); | 17903 Isolate* isolate = cell->GetIsolate(); |
| 17904 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 17904 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 17905 isolate, DependentCode::kPropertyCellChangedGroup); | 17905 isolate, DependentCode::kPropertyCellChangedGroup); |
| 17906 } | 17906 } |
| 17907 } | 17907 } |
| 17908 | 17908 |
| 17909 } // namespace internal | 17909 } // namespace internal |
| 17910 } // namespace v8 | 17910 } // namespace v8 |
| OLD | NEW |