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

Side by Side Diff: src/elements.cc

Issue 1397063002: [runtime] Fancify KeyAccumulator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: documentation + cleanup 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') | src/objects.cc » ('J')
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 KeyFilter filter) final { 873 AddKeyConversion convert) 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
879 int prev_key_count = accumulator->GetLength();
880 for (uint32_t i = 0; i < add_length; i++) { 879 for (uint32_t i = 0; i < add_length; i++) {
881 if (!ElementsAccessorSubclass::HasEntryImpl(*from, i)) continue; 880 if (!ElementsAccessorSubclass::HasEntryImpl(*from, i)) continue;
882 Handle<Object> value = ElementsAccessorSubclass::GetImpl(from, i); 881 Handle<Object> value = ElementsAccessorSubclass::GetImpl(from, i);
883 DCHECK(!value->IsTheHole()); 882 DCHECK(!value->IsTheHole());
884 DCHECK(!value->IsAccessorPair()); 883 DCHECK(!value->IsAccessorPair());
885 DCHECK(!value->IsExecutableAccessorInfo()); 884 DCHECK(!value->IsExecutableAccessorInfo());
886 if (filter == SKIP_SYMBOLS && value->IsSymbol()) { 885 accumulator->AddKey(value, convert);
887 continue;
888 }
889 accumulator->AddKey(value, prev_key_count);
890 } 886 }
891 } 887 }
892 888
893 static uint32_t GetCapacityImpl(JSObject* holder, 889 static uint32_t GetCapacityImpl(JSObject* holder,
894 FixedArrayBase* backing_store) { 890 FixedArrayBase* backing_store) {
895 return backing_store->length(); 891 return backing_store->length();
896 } 892 }
897 893
898 uint32_t GetCapacity(JSObject* holder, FixedArrayBase* backing_store) final { 894 virtual uint32_t GetCapacity(JSObject* holder,
895 FixedArrayBase* backing_store) final {
899 return ElementsAccessorSubclass::GetCapacityImpl(holder, backing_store); 896 return ElementsAccessorSubclass::GetCapacityImpl(holder, backing_store);
900 } 897 }
901 898
902 static bool HasEntryImpl(FixedArrayBase* backing_store, uint32_t entry) { 899 static bool HasEntryImpl(FixedArrayBase* backing_store, uint32_t entry) {
903 return true; 900 return true;
904 } 901 }
905 902
906 static uint32_t GetIndexForEntryImpl(FixedArrayBase* backing_store, 903 static uint32_t GetIndexForEntryImpl(FixedArrayBase* backing_store,
907 uint32_t entry) { 904 uint32_t entry) {
908 return entry; 905 return entry;
(...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after
2326 } 2323 }
2327 } 2324 }
2328 2325
2329 DCHECK(j == result_len); 2326 DCHECK(j == result_len);
2330 return result_array; 2327 return result_array;
2331 } 2328 }
2332 2329
2333 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; 2330 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL;
2334 } // namespace internal 2331 } // namespace internal
2335 } // namespace v8 2332 } // namespace v8
OLDNEW
« no previous file with comments | « src/elements.h ('k') | src/objects.h » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698