OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 8255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8266 FixedArray* elements = FixedArray::cast(object->elements()); | 8266 FixedArray* elements = FixedArray::cast(object->elements()); |
8267 int length = object->IsJSArray() | 8267 int length = object->IsJSArray() |
8268 ? Smi::cast(JSArray::cast(object)->length())->value() | 8268 ? Smi::cast(JSArray::cast(object)->length())->value() |
8269 : elements->length(); | 8269 : elements->length(); |
8270 for (int i = 0; i < length; i++) { | 8270 for (int i = 0; i < length; i++) { |
8271 if (!elements->is_the_hole(i)) return true; | 8271 if (!elements->is_the_hole(i)) return true; |
8272 } | 8272 } |
8273 return false; | 8273 return false; |
8274 } | 8274 } |
8275 case FAST_HOLEY_DOUBLE_ELEMENTS: { | 8275 case FAST_HOLEY_DOUBLE_ELEMENTS: { |
8276 FixedDoubleArray* elements = FixedDoubleArray::cast(object->elements()); | |
8277 int length = object->IsJSArray() | 8276 int length = object->IsJSArray() |
8278 ? Smi::cast(JSArray::cast(object)->length())->value() | 8277 ? Smi::cast(JSArray::cast(object)->length())->value() |
8279 : elements->length(); | 8278 : object->elements()->length(); |
| 8279 // Zero-length arrays would use the empty FixedArray... |
| 8280 if (length == 0) return false; |
| 8281 // ...so only cast to FixedDoubleArray otherwise. |
| 8282 FixedDoubleArray* elements = FixedDoubleArray::cast(object->elements()); |
8280 for (int i = 0; i < length; i++) { | 8283 for (int i = 0; i < length; i++) { |
8281 if (!elements->is_the_hole(i)) return true; | 8284 if (!elements->is_the_hole(i)) return true; |
8282 } | 8285 } |
8283 return false; | 8286 return false; |
8284 } | 8287 } |
8285 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ | 8288 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
8286 case TYPE##_ELEMENTS: | 8289 case TYPE##_ELEMENTS: |
8287 | 8290 |
8288 TYPED_ARRAYS(TYPED_ARRAY_CASE) | 8291 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
8289 #undef TYPED_ARRAY_CASE | 8292 #undef TYPED_ARRAY_CASE |
(...skipping 11314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19604 if (cell->value() != *new_value) { | 19607 if (cell->value() != *new_value) { |
19605 cell->set_value(*new_value); | 19608 cell->set_value(*new_value); |
19606 Isolate* isolate = cell->GetIsolate(); | 19609 Isolate* isolate = cell->GetIsolate(); |
19607 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19610 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
19608 isolate, DependentCode::kPropertyCellChangedGroup); | 19611 isolate, DependentCode::kPropertyCellChangedGroup); |
19609 } | 19612 } |
19610 } | 19613 } |
19611 | 19614 |
19612 } // namespace internal | 19615 } // namespace internal |
19613 } // namespace v8 | 19616 } // namespace v8 |
OLD | NEW |