OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/elements.h" | 5 #include "src/elements.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/conversions.h" | 8 #include "src/conversions.h" |
9 #include "src/factory.h" | 9 #include "src/factory.h" |
10 #include "src/messages.h" | 10 #include "src/messages.h" |
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 FixedArrayBase* backing_store, | 935 FixedArrayBase* backing_store, |
936 uint32_t index, | 936 uint32_t index, |
937 PropertyAttributes filter) { | 937 PropertyAttributes filter) { |
938 if (IsHoleyElementsKind(kind())) { | 938 if (IsHoleyElementsKind(kind())) { |
939 return index < ElementsAccessorSubclass::GetCapacityImpl(holder, | 939 return index < ElementsAccessorSubclass::GetCapacityImpl(holder, |
940 backing_store) && | 940 backing_store) && |
941 !BackingStore::cast(backing_store)->is_the_hole(index) | 941 !BackingStore::cast(backing_store)->is_the_hole(index) |
942 ? index | 942 ? index |
943 : kMaxUInt32; | 943 : kMaxUInt32; |
944 } else { | 944 } else { |
945 Smi* smi_length = Smi::cast(JSArray::cast(holder)->length()); | 945 uint32_t length = |
946 uint32_t length = static_cast<uint32_t>(smi_length->value()); | 946 holder->IsJSArray() |
| 947 ? static_cast<uint32_t>( |
| 948 Smi::cast(JSArray::cast(holder)->length())->value()) |
| 949 : ElementsAccessorSubclass::GetCapacityImpl(holder, |
| 950 backing_store); |
947 return index < length ? index : kMaxUInt32; | 951 return index < length ? index : kMaxUInt32; |
948 } | 952 } |
949 } | 953 } |
950 | 954 |
951 uint32_t GetEntryForIndex(JSObject* holder, FixedArrayBase* backing_store, | 955 uint32_t GetEntryForIndex(JSObject* holder, FixedArrayBase* backing_store, |
952 uint32_t index) final { | 956 uint32_t index) final { |
953 return ElementsAccessorSubclass::GetEntryForIndexImpl(holder, backing_store, | 957 return ElementsAccessorSubclass::GetEntryForIndexImpl(holder, backing_store, |
954 index, NONE); | 958 index, NONE); |
955 } | 959 } |
956 | 960 |
(...skipping 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2382 } | 2386 } |
2383 } | 2387 } |
2384 | 2388 |
2385 DCHECK(j == result_len); | 2389 DCHECK(j == result_len); |
2386 return result_array; | 2390 return result_array; |
2387 } | 2391 } |
2388 | 2392 |
2389 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; | 2393 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; |
2390 } // namespace internal | 2394 } // namespace internal |
2391 } // namespace v8 | 2395 } // namespace v8 |
OLD | NEW |