Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: src/elements.cc

Issue 1375003002: Teach JSReceiver::GetKeys() how to include symbols (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebased Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/elements.h ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/elements.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698