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 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 // Details: The idea is that allocations actually happen only in case of | 863 // Details: The idea is that allocations actually happen only in case of |
864 // copying from object with fast double elements to object with object | 864 // copying from object with fast double elements to object with object |
865 // elements. In all the other cases there are no allocations performed and | 865 // elements. In all the other cases there are no allocations performed and |
866 // handle creation causes noticeable performance degradation of the builtin. | 866 // handle creation causes noticeable performance degradation of the builtin. |
867 ElementsAccessorSubclass::CopyElementsImpl( | 867 ElementsAccessorSubclass::CopyElementsImpl( |
868 from, from_start, *to, from_kind, to_start, packed_size, copy_size); | 868 from, from_start, *to, from_kind, to_start, packed_size, copy_size); |
869 } | 869 } |
870 | 870 |
871 virtual void AddElementsToKeyAccumulator(Handle<JSObject> receiver, | 871 virtual void AddElementsToKeyAccumulator(Handle<JSObject> receiver, |
872 KeyAccumulator* accumulator, | 872 KeyAccumulator* accumulator, |
873 FixedArray::KeyFilter filter) final { | 873 KeyFilter filter) final { |
874 Handle<FixedArrayBase> from(receiver->elements()); | 874 Handle<FixedArrayBase> from(receiver->elements()); |
875 uint32_t add_length = | 875 uint32_t add_length = |
876 ElementsAccessorSubclass::GetCapacityImpl(*receiver, *from); | 876 ElementsAccessorSubclass::GetCapacityImpl(*receiver, *from); |
877 if (add_length == 0) return; | 877 if (add_length == 0) return; |
878 accumulator->PrepareForComparisons(add_length); | 878 accumulator->PrepareForComparisons(add_length); |
879 int prev_key_count = accumulator->GetLength(); | 879 int prev_key_count = accumulator->GetLength(); |
880 for (uint32_t i = 0; i < add_length; i++) { | 880 for (uint32_t i = 0; i < add_length; i++) { |
881 if (!ElementsAccessorSubclass::HasEntryImpl(*from, i)) continue; | 881 if (!ElementsAccessorSubclass::HasEntryImpl(*from, i)) continue; |
882 Handle<Object> value = ElementsAccessorSubclass::GetImpl(from, i); | 882 Handle<Object> value = ElementsAccessorSubclass::GetImpl(from, i); |
883 DCHECK(!value->IsTheHole()); | 883 DCHECK(!value->IsTheHole()); |
884 DCHECK(!value->IsAccessorPair()); | 884 DCHECK(!value->IsAccessorPair()); |
885 DCHECK(!value->IsExecutableAccessorInfo()); | 885 DCHECK(!value->IsExecutableAccessorInfo()); |
886 if (filter == FixedArray::NON_SYMBOL_KEYS && value->IsSymbol()) { | 886 if (filter == SKIP_SYMBOLS && value->IsSymbol()) { |
887 continue; | 887 continue; |
888 } | 888 } |
889 accumulator->AddKey(value, prev_key_count); | 889 accumulator->AddKey(value, prev_key_count); |
890 } | 890 } |
891 } | 891 } |
892 | 892 |
893 static uint32_t GetCapacityImpl(JSObject* holder, | 893 static uint32_t GetCapacityImpl(JSObject* holder, |
894 FixedArrayBase* backing_store) { | 894 FixedArrayBase* backing_store) { |
895 return backing_store->length(); | 895 return backing_store->length(); |
896 } | 896 } |
(...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2326 } | 2326 } |
2327 } | 2327 } |
2328 | 2328 |
2329 DCHECK(j == result_len); | 2329 DCHECK(j == result_len); |
2330 return result_array; | 2330 return result_array; |
2331 } | 2331 } |
2332 | 2332 |
2333 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; | 2333 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; |
2334 } // namespace internal | 2334 } // namespace internal |
2335 } // namespace v8 | 2335 } // namespace v8 |
OLD | NEW |