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

Side by Side Diff: src/elements.cc

Issue 1412223018: [presubmit] Enabling readability/inheritance linter checking. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressing comments Created 5 years, 1 month 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/crankshaft/typing.h ('k') | src/full-codegen/full-codegen.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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 length = fixed_array_base->length(); 499 length = fixed_array_base->length();
500 } 500 }
501 ElementsAccessorSubclass::ValidateContents(holder, length); 501 ElementsAccessorSubclass::ValidateContents(holder, length);
502 } 502 }
503 503
504 void Validate(Handle<JSObject> holder) final { 504 void Validate(Handle<JSObject> holder) final {
505 DisallowHeapAllocation no_gc; 505 DisallowHeapAllocation no_gc;
506 ElementsAccessorSubclass::ValidateImpl(holder); 506 ElementsAccessorSubclass::ValidateImpl(holder);
507 } 507 }
508 508
509 virtual bool IsPacked(Handle<JSObject> holder, 509 bool IsPacked(Handle<JSObject> holder, Handle<FixedArrayBase> backing_store,
510 Handle<FixedArrayBase> backing_store, uint32_t start, 510 uint32_t start, uint32_t end) final {
511 uint32_t end) final {
512 return ElementsAccessorSubclass::IsPackedImpl(holder, backing_store, start, 511 return ElementsAccessorSubclass::IsPackedImpl(holder, backing_store, start,
513 end); 512 end);
514 } 513 }
515 514
516 static bool IsPackedImpl(Handle<JSObject> holder, 515 static bool IsPackedImpl(Handle<JSObject> holder,
517 Handle<FixedArrayBase> backing_store, uint32_t start, 516 Handle<FixedArrayBase> backing_store, uint32_t start,
518 uint32_t end) { 517 uint32_t end) {
519 if (IsFastPackedElementsKind(kind())) return true; 518 if (IsFastPackedElementsKind(kind())) return true;
520 for (uint32_t i = start; i < end; i++) { 519 for (uint32_t i = start; i < end; i++) {
521 if (!ElementsAccessorSubclass::HasElementImpl(holder, i, backing_store, 520 if (!ElementsAccessorSubclass::HasElementImpl(holder, i, backing_store,
(...skipping 15 matching lines...) Expand all
537 ElementsKind packed_kind = GetPackedElementsKind(kind()); 536 ElementsKind packed_kind = GetPackedElementsKind(kind());
538 Handle<Map> new_map = 537 Handle<Map> new_map =
539 JSObject::GetElementsTransitionMap(array, packed_kind); 538 JSObject::GetElementsTransitionMap(array, packed_kind);
540 JSObject::MigrateToMap(array, new_map); 539 JSObject::MigrateToMap(array, new_map);
541 if (FLAG_trace_elements_transitions) { 540 if (FLAG_trace_elements_transitions) {
542 JSObject::PrintElementsTransition(stdout, array, kind(), backing_store, 541 JSObject::PrintElementsTransition(stdout, array, kind(), backing_store,
543 packed_kind, backing_store); 542 packed_kind, backing_store);
544 } 543 }
545 } 544 }
546 545
547 virtual bool HasElement(Handle<JSObject> holder, uint32_t index, 546 bool HasElement(Handle<JSObject> holder, uint32_t index,
548 Handle<FixedArrayBase> backing_store, 547 Handle<FixedArrayBase> backing_store,
549 PropertyAttributes filter) final { 548 PropertyAttributes filter) final {
550 return ElementsAccessorSubclass::HasElementImpl(holder, index, 549 return ElementsAccessorSubclass::HasElementImpl(holder, index,
551 backing_store, filter); 550 backing_store, filter);
552 } 551 }
553 552
554 static bool HasElementImpl(Handle<JSObject> holder, uint32_t index, 553 static bool HasElementImpl(Handle<JSObject> holder, uint32_t index,
555 Handle<FixedArrayBase> backing_store, 554 Handle<FixedArrayBase> backing_store,
556 PropertyAttributes filter) { 555 PropertyAttributes filter) {
557 return ElementsAccessorSubclass::GetEntryForIndexImpl( 556 return ElementsAccessorSubclass::GetEntryForIndexImpl(
558 *holder, *backing_store, index, filter) != kMaxUInt32; 557 *holder, *backing_store, index, filter) != kMaxUInt32;
559 } 558 }
560 559
561 virtual Handle<Object> Get(Handle<FixedArrayBase> backing_store, 560 Handle<Object> Get(Handle<FixedArrayBase> backing_store,
562 uint32_t entry) final { 561 uint32_t entry) final {
563 return ElementsAccessorSubclass::GetImpl(backing_store, entry); 562 return ElementsAccessorSubclass::GetImpl(backing_store, entry);
564 } 563 }
565 564
566 static Handle<Object> GetImpl(Handle<FixedArrayBase> backing_store, 565 static Handle<Object> GetImpl(Handle<FixedArrayBase> backing_store,
567 uint32_t entry) { 566 uint32_t entry) {
568 uint32_t index = GetIndexForEntryImpl(*backing_store, entry); 567 uint32_t index = GetIndexForEntryImpl(*backing_store, entry);
569 return BackingStore::get(Handle<BackingStore>::cast(backing_store), index); 568 return BackingStore::get(Handle<BackingStore>::cast(backing_store), index);
570 } 569 }
571 570
572 virtual void Set(FixedArrayBase* backing_store, uint32_t entry, 571 void Set(FixedArrayBase* backing_store, uint32_t entry, Object* value) final {
573 Object* value) final {
574 ElementsAccessorSubclass::SetImpl(backing_store, entry, value); 572 ElementsAccessorSubclass::SetImpl(backing_store, entry, value);
575 } 573 }
576 574
577 static inline void SetImpl(FixedArrayBase* backing_store, uint32_t entry, 575 static inline void SetImpl(FixedArrayBase* backing_store, uint32_t entry,
578 Object* value) { 576 Object* value) {
579 UNREACHABLE(); 577 UNREACHABLE();
580 } 578 }
581 579
582 580
583 static inline void SetImpl(FixedArrayBase* backing_store, uint32_t entry, 581 static inline void SetImpl(FixedArrayBase* backing_store, uint32_t entry,
584 Object* value, WriteBarrierMode mode) { 582 Object* value, WriteBarrierMode mode) {
585 UNREACHABLE(); 583 UNREACHABLE();
586 } 584 }
587 585
588 virtual void Reconfigure(Handle<JSObject> object, 586 void Reconfigure(Handle<JSObject> object, Handle<FixedArrayBase> store,
589 Handle<FixedArrayBase> store, uint32_t entry, 587 uint32_t entry, Handle<Object> value,
590 Handle<Object> value, 588 PropertyAttributes attributes) final {
591 PropertyAttributes attributes) final {
592 ElementsAccessorSubclass::ReconfigureImpl(object, store, entry, value, 589 ElementsAccessorSubclass::ReconfigureImpl(object, store, entry, value,
593 attributes); 590 attributes);
594 } 591 }
595 592
596 static void ReconfigureImpl(Handle<JSObject> object, 593 static void ReconfigureImpl(Handle<JSObject> object,
597 Handle<FixedArrayBase> store, uint32_t entry, 594 Handle<FixedArrayBase> store, uint32_t entry,
598 Handle<Object> value, 595 Handle<Object> value,
599 PropertyAttributes attributes) { 596 PropertyAttributes attributes) {
600 UNREACHABLE(); 597 UNREACHABLE();
601 } 598 }
602 599
603 virtual void Add(Handle<JSObject> object, uint32_t index, 600 void Add(Handle<JSObject> object, uint32_t index, Handle<Object> value,
604 Handle<Object> value, PropertyAttributes attributes, 601 PropertyAttributes attributes, uint32_t new_capacity) final {
605 uint32_t new_capacity) final {
606 ElementsAccessorSubclass::AddImpl(object, index, value, attributes, 602 ElementsAccessorSubclass::AddImpl(object, index, value, attributes,
607 new_capacity); 603 new_capacity);
608 } 604 }
609 605
610 static void AddImpl(Handle<JSObject> object, uint32_t index, 606 static void AddImpl(Handle<JSObject> object, uint32_t index,
611 Handle<Object> value, PropertyAttributes attributes, 607 Handle<Object> value, PropertyAttributes attributes,
612 uint32_t new_capacity) { 608 uint32_t new_capacity) {
613 UNREACHABLE(); 609 UNREACHABLE();
614 } 610 }
615 611
616 virtual uint32_t Push(Handle<JSArray> receiver, 612 uint32_t Push(Handle<JSArray> receiver, Handle<FixedArrayBase> backing_store,
617 Handle<FixedArrayBase> backing_store, Arguments* args, 613 Arguments* args, uint32_t push_size) final {
618 uint32_t push_size) final {
619 return ElementsAccessorSubclass::PushImpl(receiver, backing_store, args, 614 return ElementsAccessorSubclass::PushImpl(receiver, backing_store, args,
620 push_size); 615 push_size);
621 } 616 }
622 617
623 static uint32_t PushImpl(Handle<JSArray> receiver, 618 static uint32_t PushImpl(Handle<JSArray> receiver,
624 Handle<FixedArrayBase> elms_obj, Arguments* args, 619 Handle<FixedArrayBase> elms_obj, Arguments* args,
625 uint32_t push_sized) { 620 uint32_t push_sized) {
626 UNREACHABLE(); 621 UNREACHABLE();
627 return 0; 622 return 0;
628 } 623 }
629 624
630 virtual uint32_t Unshift(Handle<JSArray> receiver, 625 uint32_t Unshift(Handle<JSArray> receiver,
631 Handle<FixedArrayBase> backing_store, 626 Handle<FixedArrayBase> backing_store, Arguments* args,
632 Arguments* args, uint32_t unshift_size) final { 627 uint32_t unshift_size) final {
633 return ElementsAccessorSubclass::UnshiftImpl(receiver, backing_store, args, 628 return ElementsAccessorSubclass::UnshiftImpl(receiver, backing_store, args,
634 unshift_size); 629 unshift_size);
635 } 630 }
636 631
637 static uint32_t UnshiftImpl(Handle<JSArray> receiver, 632 static uint32_t UnshiftImpl(Handle<JSArray> receiver,
638 Handle<FixedArrayBase> elms_obj, Arguments* args, 633 Handle<FixedArrayBase> elms_obj, Arguments* args,
639 uint32_t unshift_size) { 634 uint32_t unshift_size) {
640 UNREACHABLE(); 635 UNREACHABLE();
641 return 0; 636 return 0;
642 } 637 }
643 638
644 virtual Handle<JSArray> Slice(Handle<JSObject> receiver, 639 Handle<JSArray> Slice(Handle<JSObject> receiver,
645 Handle<FixedArrayBase> backing_store, 640 Handle<FixedArrayBase> backing_store, uint32_t start,
646 uint32_t start, uint32_t end) final { 641 uint32_t end) final {
647 return ElementsAccessorSubclass::SliceImpl(receiver, backing_store, start, 642 return ElementsAccessorSubclass::SliceImpl(receiver, backing_store, start,
648 end); 643 end);
649 } 644 }
650 645
651 static Handle<JSArray> SliceImpl(Handle<JSObject> receiver, 646 static Handle<JSArray> SliceImpl(Handle<JSObject> receiver,
652 Handle<FixedArrayBase> backing_store, 647 Handle<FixedArrayBase> backing_store,
653 uint32_t start, uint32_t end) { 648 uint32_t start, uint32_t end) {
654 UNREACHABLE(); 649 UNREACHABLE();
655 return Handle<JSArray>(); 650 return Handle<JSArray>();
656 } 651 }
657 652
658 virtual Handle<JSArray> Splice(Handle<JSArray> receiver, 653 Handle<JSArray> Splice(Handle<JSArray> receiver,
659 Handle<FixedArrayBase> backing_store, 654 Handle<FixedArrayBase> backing_store, uint32_t start,
660 uint32_t start, uint32_t delete_count, 655 uint32_t delete_count, Arguments* args,
661 Arguments* args, uint32_t add_count) final { 656 uint32_t add_count) final {
662 return ElementsAccessorSubclass::SpliceImpl(receiver, backing_store, start, 657 return ElementsAccessorSubclass::SpliceImpl(receiver, backing_store, start,
663 delete_count, args, add_count); 658 delete_count, args, add_count);
664 } 659 }
665 660
666 static Handle<JSArray> SpliceImpl(Handle<JSArray> receiver, 661 static Handle<JSArray> SpliceImpl(Handle<JSArray> receiver,
667 Handle<FixedArrayBase> backing_store, 662 Handle<FixedArrayBase> backing_store,
668 uint32_t start, uint32_t delete_count, 663 uint32_t start, uint32_t delete_count,
669 Arguments* args, uint32_t add_count) { 664 Arguments* args, uint32_t add_count) {
670 UNREACHABLE(); 665 UNREACHABLE();
671 return Handle<JSArray>(); 666 return Handle<JSArray>();
672 } 667 }
673 668
674 virtual Handle<Object> Pop(Handle<JSArray> receiver, 669 Handle<Object> Pop(Handle<JSArray> receiver,
675 Handle<FixedArrayBase> backing_store) final { 670 Handle<FixedArrayBase> backing_store) final {
676 return ElementsAccessorSubclass::PopImpl(receiver, backing_store); 671 return ElementsAccessorSubclass::PopImpl(receiver, backing_store);
677 } 672 }
678 673
679 static Handle<Object> PopImpl(Handle<JSArray> receiver, 674 static Handle<Object> PopImpl(Handle<JSArray> receiver,
680 Handle<FixedArrayBase> backing_store) { 675 Handle<FixedArrayBase> backing_store) {
681 UNREACHABLE(); 676 UNREACHABLE();
682 return Handle<Object>(); 677 return Handle<Object>();
683 } 678 }
684 679
685 virtual Handle<Object> Shift(Handle<JSArray> receiver, 680 Handle<Object> Shift(Handle<JSArray> receiver,
686 Handle<FixedArrayBase> backing_store) final { 681 Handle<FixedArrayBase> backing_store) final {
687 return ElementsAccessorSubclass::ShiftImpl(receiver, backing_store); 682 return ElementsAccessorSubclass::ShiftImpl(receiver, backing_store);
688 } 683 }
689 684
690 static Handle<Object> ShiftImpl(Handle<JSArray> receiver, 685 static Handle<Object> ShiftImpl(Handle<JSArray> receiver,
691 Handle<FixedArrayBase> backing_store) { 686 Handle<FixedArrayBase> backing_store) {
692 UNREACHABLE(); 687 UNREACHABLE();
693 return Handle<Object>(); 688 return Handle<Object>();
694 } 689 }
695 690
696 virtual void SetLength(Handle<JSArray> array, uint32_t length) final { 691 void SetLength(Handle<JSArray> array, uint32_t length) final {
697 ElementsAccessorSubclass::SetLengthImpl(array, length, 692 ElementsAccessorSubclass::SetLengthImpl(array, length,
698 handle(array->elements())); 693 handle(array->elements()));
699 } 694 }
700 695
701 static void SetLengthImpl(Handle<JSArray> array, uint32_t length, 696 static void SetLengthImpl(Handle<JSArray> array, uint32_t length,
702 Handle<FixedArrayBase> backing_store) { 697 Handle<FixedArrayBase> backing_store) {
703 DCHECK(!array->SetLengthWouldNormalize(length)); 698 DCHECK(!array->SetLengthWouldNormalize(length));
704 DCHECK(IsFastElementsKind(array->GetElementsKind())); 699 DCHECK(IsFastElementsKind(array->GetElementsKind()));
705 uint32_t old_length = 0; 700 uint32_t old_length = 0;
706 CHECK(array->length()->ToArrayIndex(&old_length)); 701 CHECK(array->length()->ToArrayIndex(&old_length));
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 801
807 // Transition through the allocation site as well if present. 802 // Transition through the allocation site as well if present.
808 JSObject::UpdateAllocationSite(object, to_kind); 803 JSObject::UpdateAllocationSite(object, to_kind);
809 804
810 if (FLAG_trace_elements_transitions) { 805 if (FLAG_trace_elements_transitions) {
811 JSObject::PrintElementsTransition(stdout, object, from_kind, old_elements, 806 JSObject::PrintElementsTransition(stdout, object, from_kind, old_elements,
812 to_kind, elements); 807 to_kind, elements);
813 } 808 }
814 } 809 }
815 810
816 virtual void GrowCapacityAndConvert(Handle<JSObject> object, 811 void GrowCapacityAndConvert(Handle<JSObject> object,
817 uint32_t capacity) final { 812 uint32_t capacity) final {
818 ElementsAccessorSubclass::GrowCapacityAndConvertImpl(object, capacity); 813 ElementsAccessorSubclass::GrowCapacityAndConvertImpl(object, capacity);
819 } 814 }
820 815
821 virtual void Delete(Handle<JSObject> obj, uint32_t entry) final { 816 void Delete(Handle<JSObject> obj, uint32_t entry) final {
822 ElementsAccessorSubclass::DeleteImpl(obj, entry); 817 ElementsAccessorSubclass::DeleteImpl(obj, entry);
823 } 818 }
824 819
825 static void CopyElementsImpl(FixedArrayBase* from, uint32_t from_start, 820 static void CopyElementsImpl(FixedArrayBase* from, uint32_t from_start,
826 FixedArrayBase* to, ElementsKind from_kind, 821 FixedArrayBase* to, ElementsKind from_kind,
827 uint32_t to_start, int packed_size, 822 uint32_t to_start, int packed_size,
828 int copy_size) { 823 int copy_size) {
829 UNREACHABLE(); 824 UNREACHABLE();
830 } 825 }
831 826
832 virtual void CopyElements(Handle<FixedArrayBase> from, uint32_t from_start, 827 void CopyElements(Handle<FixedArrayBase> from, uint32_t from_start,
833 ElementsKind from_kind, Handle<FixedArrayBase> to, 828 ElementsKind from_kind, Handle<FixedArrayBase> to,
834 uint32_t to_start, int copy_size) final { 829 uint32_t to_start, int copy_size) final {
835 DCHECK(!from.is_null()); 830 DCHECK(!from.is_null());
836 // NOTE: the ElementsAccessorSubclass::CopyElementsImpl() methods 831 // NOTE: the ElementsAccessorSubclass::CopyElementsImpl() methods
837 // violate the handlified function signature convention: 832 // violate the handlified function signature convention:
838 // raw pointer parameters in the function that allocates. This is done 833 // raw pointer parameters in the function that allocates. This is done
839 // intentionally to avoid ArrayConcat() builtin performance degradation. 834 // intentionally to avoid ArrayConcat() builtin performance degradation.
840 // See the comment in another ElementsAccessorBase::CopyElements() for 835 // See the comment in another ElementsAccessorBase::CopyElements() for
841 // details. 836 // details.
842 ElementsAccessorSubclass::CopyElementsImpl(*from, from_start, *to, 837 ElementsAccessorSubclass::CopyElementsImpl(*from, from_start, *to,
843 from_kind, to_start, 838 from_kind, to_start,
844 kPackedSizeNotKnown, copy_size); 839 kPackedSizeNotKnown, copy_size);
845 } 840 }
846 841
847 virtual void CopyElements(JSObject* from_holder, uint32_t from_start, 842 void CopyElements(JSObject* from_holder, uint32_t from_start,
848 ElementsKind from_kind, Handle<FixedArrayBase> to, 843 ElementsKind from_kind, Handle<FixedArrayBase> to,
849 uint32_t to_start, int copy_size) final { 844 uint32_t to_start, int copy_size) final {
850 int packed_size = kPackedSizeNotKnown; 845 int packed_size = kPackedSizeNotKnown;
851 bool is_packed = IsFastPackedElementsKind(from_kind) && 846 bool is_packed = IsFastPackedElementsKind(from_kind) &&
852 from_holder->IsJSArray(); 847 from_holder->IsJSArray();
853 if (is_packed) { 848 if (is_packed) {
854 packed_size = 849 packed_size =
855 Smi::cast(JSArray::cast(from_holder)->length())->value(); 850 Smi::cast(JSArray::cast(from_holder)->length())->value();
856 if (copy_size >= 0 && packed_size > copy_size) { 851 if (copy_size >= 0 && packed_size > copy_size) {
857 packed_size = copy_size; 852 packed_size = copy_size;
858 } 853 }
859 } 854 }
(...skipping 25 matching lines...) Expand all
885 } 880 }
886 if (range < length) length = range; 881 if (range < length) length = range;
887 for (uint32_t i = offset; i < length; i++) { 882 for (uint32_t i = offset; i < length; i++) {
888 if (!ElementsAccessorSubclass::HasElementImpl(object, i, backing_store, 883 if (!ElementsAccessorSubclass::HasElementImpl(object, i, backing_store,
889 filter)) 884 filter))
890 continue; 885 continue;
891 keys->AddKey(i); 886 keys->AddKey(i);
892 } 887 }
893 } 888 }
894 889
895 virtual void CollectElementIndices(Handle<JSObject> object, 890 void CollectElementIndices(Handle<JSObject> object,
896 Handle<FixedArrayBase> backing_store, 891 Handle<FixedArrayBase> backing_store,
897 KeyAccumulator* keys, uint32_t range, 892 KeyAccumulator* keys, uint32_t range,
898 PropertyAttributes filter, 893 PropertyAttributes filter, uint32_t offset) final {
899 uint32_t offset) final {
900 ElementsAccessorSubclass::CollectElementIndicesImpl( 894 ElementsAccessorSubclass::CollectElementIndicesImpl(
901 object, backing_store, keys, range, filter, offset); 895 object, backing_store, keys, range, filter, offset);
902 }; 896 };
903 897
904 virtual void AddElementsToKeyAccumulator(Handle<JSObject> receiver, 898 void AddElementsToKeyAccumulator(Handle<JSObject> receiver,
905 KeyAccumulator* accumulator, 899 KeyAccumulator* accumulator,
906 AddKeyConversion convert) final { 900 AddKeyConversion convert) final {
907 Handle<FixedArrayBase> from(receiver->elements()); 901 Handle<FixedArrayBase> from(receiver->elements());
908 uint32_t add_length = 902 uint32_t add_length =
909 ElementsAccessorSubclass::GetCapacityImpl(*receiver, *from); 903 ElementsAccessorSubclass::GetCapacityImpl(*receiver, *from);
910 if (add_length == 0) return; 904 if (add_length == 0) return;
911 905
912 for (uint32_t i = 0; i < add_length; i++) { 906 for (uint32_t i = 0; i < add_length; i++) {
913 if (!ElementsAccessorSubclass::HasEntryImpl(*from, i)) continue; 907 if (!ElementsAccessorSubclass::HasEntryImpl(*from, i)) continue;
914 Handle<Object> value = ElementsAccessorSubclass::GetImpl(from, i); 908 Handle<Object> value = ElementsAccessorSubclass::GetImpl(from, i);
915 DCHECK(!value->IsTheHole()); 909 DCHECK(!value->IsTheHole());
916 DCHECK(!value->IsAccessorPair()); 910 DCHECK(!value->IsAccessorPair());
917 DCHECK(!value->IsExecutableAccessorInfo()); 911 DCHECK(!value->IsExecutableAccessorInfo());
918 accumulator->AddKey(value, convert); 912 accumulator->AddKey(value, convert);
919 } 913 }
920 } 914 }
921 915
922 static uint32_t GetCapacityImpl(JSObject* holder, 916 static uint32_t GetCapacityImpl(JSObject* holder,
923 FixedArrayBase* backing_store) { 917 FixedArrayBase* backing_store) {
924 return backing_store->length(); 918 return backing_store->length();
925 } 919 }
926 920
927 virtual uint32_t GetCapacity(JSObject* holder, 921 uint32_t GetCapacity(JSObject* holder, FixedArrayBase* backing_store) final {
928 FixedArrayBase* backing_store) final {
929 return ElementsAccessorSubclass::GetCapacityImpl(holder, backing_store); 922 return ElementsAccessorSubclass::GetCapacityImpl(holder, backing_store);
930 } 923 }
931 924
932 static bool HasEntryImpl(FixedArrayBase* backing_store, uint32_t entry) { 925 static bool HasEntryImpl(FixedArrayBase* backing_store, uint32_t entry) {
933 return true; 926 return true;
934 } 927 }
935 928
936 static uint32_t GetIndexForEntryImpl(FixedArrayBase* backing_store, 929 static uint32_t GetIndexForEntryImpl(FixedArrayBase* backing_store,
937 uint32_t entry) { 930 uint32_t entry) {
938 return entry; 931 return entry;
939 } 932 }
940 933
941 static uint32_t GetEntryForIndexImpl(JSObject* holder, 934 static uint32_t GetEntryForIndexImpl(JSObject* holder,
942 FixedArrayBase* backing_store, 935 FixedArrayBase* backing_store,
943 uint32_t index, 936 uint32_t index,
944 PropertyAttributes filter) { 937 PropertyAttributes filter) {
945 if (IsHoleyElementsKind(kind())) { 938 if (IsHoleyElementsKind(kind())) {
946 return index < ElementsAccessorSubclass::GetCapacityImpl(holder, 939 return index < ElementsAccessorSubclass::GetCapacityImpl(holder,
947 backing_store) && 940 backing_store) &&
948 !BackingStore::cast(backing_store)->is_the_hole(index) 941 !BackingStore::cast(backing_store)->is_the_hole(index)
949 ? index 942 ? index
950 : kMaxUInt32; 943 : kMaxUInt32;
951 } else { 944 } else {
952 Smi* smi_length = Smi::cast(JSArray::cast(holder)->length()); 945 Smi* smi_length = Smi::cast(JSArray::cast(holder)->length());
953 uint32_t length = static_cast<uint32_t>(smi_length->value()); 946 uint32_t length = static_cast<uint32_t>(smi_length->value());
954 return index < length ? index : kMaxUInt32; 947 return index < length ? index : kMaxUInt32;
955 } 948 }
956 } 949 }
957 950
958 virtual uint32_t GetEntryForIndex(JSObject* holder, 951 uint32_t GetEntryForIndex(JSObject* holder, FixedArrayBase* backing_store,
959 FixedArrayBase* backing_store, 952 uint32_t index) final {
960 uint32_t index) final {
961 return ElementsAccessorSubclass::GetEntryForIndexImpl(holder, backing_store, 953 return ElementsAccessorSubclass::GetEntryForIndexImpl(holder, backing_store,
962 index, NONE); 954 index, NONE);
963 } 955 }
964 956
965 static PropertyDetails GetDetailsImpl(FixedArrayBase* backing_store, 957 static PropertyDetails GetDetailsImpl(FixedArrayBase* backing_store,
966 uint32_t entry) { 958 uint32_t entry) {
967 return PropertyDetails(NONE, DATA, 0, PropertyCellType::kNoCell); 959 return PropertyDetails(NONE, DATA, 0, PropertyCellType::kNoCell);
968 } 960 }
969 961
970 virtual PropertyDetails GetDetails(FixedArrayBase* backing_store, 962 PropertyDetails GetDetails(FixedArrayBase* backing_store,
971 uint32_t entry) final { 963 uint32_t entry) final {
972 return ElementsAccessorSubclass::GetDetailsImpl(backing_store, entry); 964 return ElementsAccessorSubclass::GetDetailsImpl(backing_store, entry);
973 } 965 }
974 966
975 private: 967 private:
976 DISALLOW_COPY_AND_ASSIGN(ElementsAccessorBase); 968 DISALLOW_COPY_AND_ASSIGN(ElementsAccessorBase);
977 }; 969 };
978 970
979 971
980 class DictionaryElementsAccessor 972 class DictionaryElementsAccessor
981 : public ElementsAccessorBase<DictionaryElementsAccessor, 973 : public ElementsAccessorBase<DictionaryElementsAccessor,
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after
2390 } 2382 }
2391 } 2383 }
2392 2384
2393 DCHECK(j == result_len); 2385 DCHECK(j == result_len);
2394 return result_array; 2386 return result_array;
2395 } 2387 }
2396 2388
2397 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; 2389 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL;
2398 } // namespace internal 2390 } // namespace internal
2399 } // namespace v8 2391 } // namespace v8
OLDNEW
« no previous file with comments | « src/crankshaft/typing.h ('k') | src/full-codegen/full-codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698