| 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/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
| (...skipping 2801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2812 } | 2812 } |
| 2813 } | 2813 } |
| 2814 *nof_items = count; | 2814 *nof_items = count; |
| 2815 return Just(true); | 2815 return Just(true); |
| 2816 } | 2816 } |
| 2817 | 2817 |
| 2818 static Maybe<bool> IncludesValueImpl(Isolate* isolate, | 2818 static Maybe<bool> IncludesValueImpl(Isolate* isolate, |
| 2819 Handle<JSObject> receiver, | 2819 Handle<JSObject> receiver, |
| 2820 Handle<Object> value, | 2820 Handle<Object> value, |
| 2821 uint32_t start_from, uint32_t length) { | 2821 uint32_t start_from, uint32_t length) { |
| 2822 DCHECK(JSObject::PrototypeHasNoElements(isolate, *receiver)); | |
| 2823 DisallowHeapAllocation no_gc; | 2822 DisallowHeapAllocation no_gc; |
| 2824 | 2823 |
| 2825 // TODO(caitp): return Just(false) here when implementing strict throwing on | 2824 // TODO(caitp): return Just(false) here when implementing strict throwing on |
| 2826 // neutered views. | 2825 // neutered views. |
| 2827 if (WasNeutered(*receiver)) { | 2826 if (WasNeutered(*receiver)) { |
| 2828 return Just(value->IsUndefined(isolate) && length > start_from); | 2827 return Just(value->IsUndefined(isolate) && length > start_from); |
| 2829 } | 2828 } |
| 2830 | 2829 |
| 2831 BackingStore* elements = BackingStore::cast(receiver->elements()); | 2830 BackingStore* elements = BackingStore::cast(receiver->elements()); |
| 2832 if (value->IsUndefined(isolate) && | 2831 if (value->IsUndefined(isolate) && |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2867 if (std::isnan(element_k)) return Just(true); | 2866 if (std::isnan(element_k)) return Just(true); |
| 2868 } | 2867 } |
| 2869 return Just(false); | 2868 return Just(false); |
| 2870 } | 2869 } |
| 2871 } | 2870 } |
| 2872 | 2871 |
| 2873 static Maybe<int64_t> IndexOfValueImpl(Isolate* isolate, | 2872 static Maybe<int64_t> IndexOfValueImpl(Isolate* isolate, |
| 2874 Handle<JSObject> receiver, | 2873 Handle<JSObject> receiver, |
| 2875 Handle<Object> value, | 2874 Handle<Object> value, |
| 2876 uint32_t start_from, uint32_t length) { | 2875 uint32_t start_from, uint32_t length) { |
| 2877 DCHECK(JSObject::PrototypeHasNoElements(isolate, *receiver)); | |
| 2878 DisallowHeapAllocation no_gc; | 2876 DisallowHeapAllocation no_gc; |
| 2879 | 2877 |
| 2880 if (WasNeutered(*receiver)) return Just<int64_t>(-1); | 2878 if (WasNeutered(*receiver)) return Just<int64_t>(-1); |
| 2881 | 2879 |
| 2882 BackingStore* elements = BackingStore::cast(receiver->elements()); | 2880 BackingStore* elements = BackingStore::cast(receiver->elements()); |
| 2883 if (!value->IsNumber()) return Just<int64_t>(-1); | 2881 if (!value->IsNumber()) return Just<int64_t>(-1); |
| 2884 | 2882 |
| 2885 double search_value = value->Number(); | 2883 double search_value = value->Number(); |
| 2886 | 2884 |
| 2887 if (!std::isfinite(search_value)) { | 2885 if (!std::isfinite(search_value)) { |
| (...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3865 insertion_index += len; | 3863 insertion_index += len; |
| 3866 } | 3864 } |
| 3867 | 3865 |
| 3868 DCHECK_EQ(insertion_index, result_len); | 3866 DCHECK_EQ(insertion_index, result_len); |
| 3869 return result_array; | 3867 return result_array; |
| 3870 } | 3868 } |
| 3871 | 3869 |
| 3872 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; | 3870 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; |
| 3873 } // namespace internal | 3871 } // namespace internal |
| 3874 } // namespace v8 | 3872 } // namespace v8 |
| OLD | NEW |