| 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/v8.h" | 5 #include "src/v8.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/elements.h" | 9 #include "src/elements.h" |
| 10 #include "src/objects.h" | 10 #include "src/objects.h" |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 template <typename ElementsAccessorSubclass, | 553 template <typename ElementsAccessorSubclass, |
| 554 typename ElementsTraitsParam> | 554 typename ElementsTraitsParam> |
| 555 class ElementsAccessorBase : public ElementsAccessor { | 555 class ElementsAccessorBase : public ElementsAccessor { |
| 556 protected: | 556 protected: |
| 557 explicit ElementsAccessorBase(const char* name) | 557 explicit ElementsAccessorBase(const char* name) |
| 558 : ElementsAccessor(name) { } | 558 : ElementsAccessor(name) { } |
| 559 | 559 |
| 560 typedef ElementsTraitsParam ElementsTraits; | 560 typedef ElementsTraitsParam ElementsTraits; |
| 561 typedef typename ElementsTraitsParam::BackingStore BackingStore; | 561 typedef typename ElementsTraitsParam::BackingStore BackingStore; |
| 562 | 562 |
| 563 ElementsKind kind() const FINAL { return ElementsTraits::Kind; } | 563 ElementsKind kind() const final { return ElementsTraits::Kind; } |
| 564 | 564 |
| 565 static void ValidateContents(Handle<JSObject> holder, int length) { | 565 static void ValidateContents(Handle<JSObject> holder, int length) { |
| 566 } | 566 } |
| 567 | 567 |
| 568 static void ValidateImpl(Handle<JSObject> holder) { | 568 static void ValidateImpl(Handle<JSObject> holder) { |
| 569 Handle<FixedArrayBase> fixed_array_base(holder->elements()); | 569 Handle<FixedArrayBase> fixed_array_base(holder->elements()); |
| 570 if (!fixed_array_base->IsHeapObject()) return; | 570 if (!fixed_array_base->IsHeapObject()) return; |
| 571 // Arrays that have been shifted in place can't be verified. | 571 // Arrays that have been shifted in place can't be verified. |
| 572 if (fixed_array_base->IsFiller()) return; | 572 if (fixed_array_base->IsFiller()) return; |
| 573 int length = 0; | 573 int length = 0; |
| 574 if (holder->IsJSArray()) { | 574 if (holder->IsJSArray()) { |
| 575 Object* length_obj = Handle<JSArray>::cast(holder)->length(); | 575 Object* length_obj = Handle<JSArray>::cast(holder)->length(); |
| 576 if (length_obj->IsSmi()) { | 576 if (length_obj->IsSmi()) { |
| 577 length = Smi::cast(length_obj)->value(); | 577 length = Smi::cast(length_obj)->value(); |
| 578 } | 578 } |
| 579 } else { | 579 } else { |
| 580 length = fixed_array_base->length(); | 580 length = fixed_array_base->length(); |
| 581 } | 581 } |
| 582 ElementsAccessorSubclass::ValidateContents(holder, length); | 582 ElementsAccessorSubclass::ValidateContents(holder, length); |
| 583 } | 583 } |
| 584 | 584 |
| 585 void Validate(Handle<JSObject> holder) FINAL { | 585 void Validate(Handle<JSObject> holder) final { |
| 586 DisallowHeapAllocation no_gc; | 586 DisallowHeapAllocation no_gc; |
| 587 ElementsAccessorSubclass::ValidateImpl(holder); | 587 ElementsAccessorSubclass::ValidateImpl(holder); |
| 588 } | 588 } |
| 589 | 589 |
| 590 static bool HasElementImpl(Handle<JSObject> holder, uint32_t key, | 590 static bool HasElementImpl(Handle<JSObject> holder, uint32_t key, |
| 591 Handle<FixedArrayBase> backing_store) { | 591 Handle<FixedArrayBase> backing_store) { |
| 592 return ElementsAccessorSubclass::GetAttributesImpl(holder, key, | 592 return ElementsAccessorSubclass::GetAttributesImpl(holder, key, |
| 593 backing_store) != ABSENT; | 593 backing_store) != ABSENT; |
| 594 } | 594 } |
| 595 | 595 |
| 596 virtual bool HasElement(Handle<JSObject> holder, uint32_t key, | 596 virtual bool HasElement(Handle<JSObject> holder, uint32_t key, |
| 597 Handle<FixedArrayBase> backing_store) FINAL { | 597 Handle<FixedArrayBase> backing_store) final { |
| 598 return ElementsAccessorSubclass::HasElementImpl(holder, key, backing_store); | 598 return ElementsAccessorSubclass::HasElementImpl(holder, key, backing_store); |
| 599 } | 599 } |
| 600 | 600 |
| 601 MUST_USE_RESULT virtual MaybeHandle<Object> Get( | 601 MUST_USE_RESULT virtual MaybeHandle<Object> Get( |
| 602 Handle<Object> receiver, Handle<JSObject> holder, uint32_t key, | 602 Handle<Object> receiver, Handle<JSObject> holder, uint32_t key, |
| 603 Handle<FixedArrayBase> backing_store) FINAL { | 603 Handle<FixedArrayBase> backing_store) final { |
| 604 if (!IsExternalArrayElementsKind(ElementsTraits::Kind) && | 604 if (!IsExternalArrayElementsKind(ElementsTraits::Kind) && |
| 605 FLAG_trace_js_array_abuse) { | 605 FLAG_trace_js_array_abuse) { |
| 606 CheckArrayAbuse(holder, "elements read", key); | 606 CheckArrayAbuse(holder, "elements read", key); |
| 607 } | 607 } |
| 608 | 608 |
| 609 if (IsExternalArrayElementsKind(ElementsTraits::Kind) && | 609 if (IsExternalArrayElementsKind(ElementsTraits::Kind) && |
| 610 FLAG_trace_external_array_abuse) { | 610 FLAG_trace_external_array_abuse) { |
| 611 CheckArrayAbuse(holder, "external elements read", key); | 611 CheckArrayAbuse(holder, "external elements read", key); |
| 612 } | 612 } |
| 613 | 613 |
| 614 return ElementsAccessorSubclass::GetImpl( | 614 return ElementsAccessorSubclass::GetImpl( |
| 615 receiver, holder, key, backing_store); | 615 receiver, holder, key, backing_store); |
| 616 } | 616 } |
| 617 | 617 |
| 618 MUST_USE_RESULT static MaybeHandle<Object> GetImpl( | 618 MUST_USE_RESULT static MaybeHandle<Object> GetImpl( |
| 619 Handle<Object> receiver, | 619 Handle<Object> receiver, |
| 620 Handle<JSObject> obj, | 620 Handle<JSObject> obj, |
| 621 uint32_t key, | 621 uint32_t key, |
| 622 Handle<FixedArrayBase> backing_store) { | 622 Handle<FixedArrayBase> backing_store) { |
| 623 if (key < ElementsAccessorSubclass::GetCapacityImpl(backing_store)) { | 623 if (key < ElementsAccessorSubclass::GetCapacityImpl(backing_store)) { |
| 624 return BackingStore::get(Handle<BackingStore>::cast(backing_store), key); | 624 return BackingStore::get(Handle<BackingStore>::cast(backing_store), key); |
| 625 } else { | 625 } else { |
| 626 return backing_store->GetIsolate()->factory()->the_hole_value(); | 626 return backing_store->GetIsolate()->factory()->the_hole_value(); |
| 627 } | 627 } |
| 628 } | 628 } |
| 629 | 629 |
| 630 MUST_USE_RESULT virtual PropertyAttributes GetAttributes( | 630 MUST_USE_RESULT virtual PropertyAttributes GetAttributes( |
| 631 Handle<JSObject> holder, uint32_t key, | 631 Handle<JSObject> holder, uint32_t key, |
| 632 Handle<FixedArrayBase> backing_store) FINAL { | 632 Handle<FixedArrayBase> backing_store) final { |
| 633 return ElementsAccessorSubclass::GetAttributesImpl(holder, key, | 633 return ElementsAccessorSubclass::GetAttributesImpl(holder, key, |
| 634 backing_store); | 634 backing_store); |
| 635 } | 635 } |
| 636 | 636 |
| 637 MUST_USE_RESULT static PropertyAttributes GetAttributesImpl( | 637 MUST_USE_RESULT static PropertyAttributes GetAttributesImpl( |
| 638 Handle<JSObject> obj, | 638 Handle<JSObject> obj, |
| 639 uint32_t key, | 639 uint32_t key, |
| 640 Handle<FixedArrayBase> backing_store) { | 640 Handle<FixedArrayBase> backing_store) { |
| 641 if (key >= ElementsAccessorSubclass::GetCapacityImpl(backing_store)) { | 641 if (key >= ElementsAccessorSubclass::GetCapacityImpl(backing_store)) { |
| 642 return ABSENT; | 642 return ABSENT; |
| 643 } | 643 } |
| 644 return | 644 return |
| 645 Handle<BackingStore>::cast(backing_store)->is_the_hole(key) | 645 Handle<BackingStore>::cast(backing_store)->is_the_hole(key) |
| 646 ? ABSENT : NONE; | 646 ? ABSENT : NONE; |
| 647 } | 647 } |
| 648 | 648 |
| 649 MUST_USE_RESULT virtual MaybeHandle<AccessorPair> GetAccessorPair( | 649 MUST_USE_RESULT virtual MaybeHandle<AccessorPair> GetAccessorPair( |
| 650 Handle<JSObject> holder, uint32_t key, | 650 Handle<JSObject> holder, uint32_t key, |
| 651 Handle<FixedArrayBase> backing_store) FINAL { | 651 Handle<FixedArrayBase> backing_store) final { |
| 652 return ElementsAccessorSubclass::GetAccessorPairImpl(holder, key, | 652 return ElementsAccessorSubclass::GetAccessorPairImpl(holder, key, |
| 653 backing_store); | 653 backing_store); |
| 654 } | 654 } |
| 655 | 655 |
| 656 MUST_USE_RESULT static MaybeHandle<AccessorPair> GetAccessorPairImpl( | 656 MUST_USE_RESULT static MaybeHandle<AccessorPair> GetAccessorPairImpl( |
| 657 Handle<JSObject> obj, | 657 Handle<JSObject> obj, |
| 658 uint32_t key, | 658 uint32_t key, |
| 659 Handle<FixedArrayBase> backing_store) { | 659 Handle<FixedArrayBase> backing_store) { |
| 660 return MaybeHandle<AccessorPair>(); | 660 return MaybeHandle<AccessorPair>(); |
| 661 } | 661 } |
| 662 | 662 |
| 663 MUST_USE_RESULT virtual MaybeHandle<Object> SetLength( | 663 MUST_USE_RESULT virtual MaybeHandle<Object> SetLength( |
| 664 Handle<JSArray> array, Handle<Object> length) FINAL { | 664 Handle<JSArray> array, Handle<Object> length) final { |
| 665 return ElementsAccessorSubclass::SetLengthImpl( | 665 return ElementsAccessorSubclass::SetLengthImpl( |
| 666 array, length, handle(array->elements())); | 666 array, length, handle(array->elements())); |
| 667 } | 667 } |
| 668 | 668 |
| 669 MUST_USE_RESULT static MaybeHandle<Object> SetLengthImpl( | 669 MUST_USE_RESULT static MaybeHandle<Object> SetLengthImpl( |
| 670 Handle<JSObject> obj, | 670 Handle<JSObject> obj, |
| 671 Handle<Object> length, | 671 Handle<Object> length, |
| 672 Handle<FixedArrayBase> backing_store); | 672 Handle<FixedArrayBase> backing_store); |
| 673 | 673 |
| 674 virtual void SetCapacityAndLength(Handle<JSArray> array, int capacity, | 674 virtual void SetCapacityAndLength(Handle<JSArray> array, int capacity, |
| 675 int length) FINAL { | 675 int length) final { |
| 676 ElementsAccessorSubclass:: | 676 ElementsAccessorSubclass:: |
| 677 SetFastElementsCapacityAndLength(array, capacity, length); | 677 SetFastElementsCapacityAndLength(array, capacity, length); |
| 678 } | 678 } |
| 679 | 679 |
| 680 static void SetFastElementsCapacityAndLength( | 680 static void SetFastElementsCapacityAndLength( |
| 681 Handle<JSObject> obj, | 681 Handle<JSObject> obj, |
| 682 int capacity, | 682 int capacity, |
| 683 int length) { | 683 int length) { |
| 684 UNIMPLEMENTED(); | 684 UNIMPLEMENTED(); |
| 685 } | 685 } |
| 686 | 686 |
| 687 MUST_USE_RESULT virtual MaybeHandle<Object> Delete( | 687 MUST_USE_RESULT virtual MaybeHandle<Object> Delete( |
| 688 Handle<JSObject> obj, uint32_t key, | 688 Handle<JSObject> obj, uint32_t key, |
| 689 LanguageMode language_mode) OVERRIDE = 0; | 689 LanguageMode language_mode) override = 0; |
| 690 | 690 |
| 691 static void CopyElementsImpl(FixedArrayBase* from, uint32_t from_start, | 691 static void CopyElementsImpl(FixedArrayBase* from, uint32_t from_start, |
| 692 FixedArrayBase* to, ElementsKind from_kind, | 692 FixedArrayBase* to, ElementsKind from_kind, |
| 693 uint32_t to_start, int packed_size, | 693 uint32_t to_start, int packed_size, |
| 694 int copy_size) { | 694 int copy_size) { |
| 695 UNREACHABLE(); | 695 UNREACHABLE(); |
| 696 } | 696 } |
| 697 | 697 |
| 698 virtual void CopyElements(Handle<FixedArrayBase> from, uint32_t from_start, | 698 virtual void CopyElements(Handle<FixedArrayBase> from, uint32_t from_start, |
| 699 ElementsKind from_kind, Handle<FixedArrayBase> to, | 699 ElementsKind from_kind, Handle<FixedArrayBase> to, |
| 700 uint32_t to_start, int copy_size) FINAL { | 700 uint32_t to_start, int copy_size) final { |
| 701 DCHECK(!from.is_null()); | 701 DCHECK(!from.is_null()); |
| 702 // NOTE: the ElementsAccessorSubclass::CopyElementsImpl() methods | 702 // NOTE: the ElementsAccessorSubclass::CopyElementsImpl() methods |
| 703 // violate the handlified function signature convention: | 703 // violate the handlified function signature convention: |
| 704 // raw pointer parameters in the function that allocates. This is done | 704 // raw pointer parameters in the function that allocates. This is done |
| 705 // intentionally to avoid ArrayConcat() builtin performance degradation. | 705 // intentionally to avoid ArrayConcat() builtin performance degradation. |
| 706 // See the comment in another ElementsAccessorBase::CopyElements() for | 706 // See the comment in another ElementsAccessorBase::CopyElements() for |
| 707 // details. | 707 // details. |
| 708 ElementsAccessorSubclass::CopyElementsImpl(*from, from_start, *to, | 708 ElementsAccessorSubclass::CopyElementsImpl(*from, from_start, *to, |
| 709 from_kind, to_start, | 709 from_kind, to_start, |
| 710 kPackedSizeNotKnown, copy_size); | 710 kPackedSizeNotKnown, copy_size); |
| 711 } | 711 } |
| 712 | 712 |
| 713 virtual void CopyElements(JSObject* from_holder, uint32_t from_start, | 713 virtual void CopyElements(JSObject* from_holder, uint32_t from_start, |
| 714 ElementsKind from_kind, Handle<FixedArrayBase> to, | 714 ElementsKind from_kind, Handle<FixedArrayBase> to, |
| 715 uint32_t to_start, int copy_size) FINAL { | 715 uint32_t to_start, int copy_size) final { |
| 716 int packed_size = kPackedSizeNotKnown; | 716 int packed_size = kPackedSizeNotKnown; |
| 717 bool is_packed = IsFastPackedElementsKind(from_kind) && | 717 bool is_packed = IsFastPackedElementsKind(from_kind) && |
| 718 from_holder->IsJSArray(); | 718 from_holder->IsJSArray(); |
| 719 if (is_packed) { | 719 if (is_packed) { |
| 720 packed_size = | 720 packed_size = |
| 721 Smi::cast(JSArray::cast(from_holder)->length())->value(); | 721 Smi::cast(JSArray::cast(from_holder)->length())->value(); |
| 722 if (copy_size >= 0 && packed_size > copy_size) { | 722 if (copy_size >= 0 && packed_size > copy_size) { |
| 723 packed_size = copy_size; | 723 packed_size = copy_size; |
| 724 } | 724 } |
| 725 } | 725 } |
| 726 FixedArrayBase* from = from_holder->elements(); | 726 FixedArrayBase* from = from_holder->elements(); |
| 727 // NOTE: the ElementsAccessorSubclass::CopyElementsImpl() methods | 727 // NOTE: the ElementsAccessorSubclass::CopyElementsImpl() methods |
| 728 // violate the handlified function signature convention: | 728 // violate the handlified function signature convention: |
| 729 // raw pointer parameters in the function that allocates. This is done | 729 // raw pointer parameters in the function that allocates. This is done |
| 730 // intentionally to avoid ArrayConcat() builtin performance degradation. | 730 // intentionally to avoid ArrayConcat() builtin performance degradation. |
| 731 // | 731 // |
| 732 // Details: The idea is that allocations actually happen only in case of | 732 // Details: The idea is that allocations actually happen only in case of |
| 733 // copying from object with fast double elements to object with object | 733 // copying from object with fast double elements to object with object |
| 734 // elements. In all the other cases there are no allocations performed and | 734 // elements. In all the other cases there are no allocations performed and |
| 735 // handle creation causes noticeable performance degradation of the builtin. | 735 // handle creation causes noticeable performance degradation of the builtin. |
| 736 ElementsAccessorSubclass::CopyElementsImpl( | 736 ElementsAccessorSubclass::CopyElementsImpl( |
| 737 from, from_start, *to, from_kind, to_start, packed_size, copy_size); | 737 from, from_start, *to, from_kind, to_start, packed_size, copy_size); |
| 738 } | 738 } |
| 739 | 739 |
| 740 virtual MaybeHandle<FixedArray> AddElementsToFixedArray( | 740 virtual MaybeHandle<FixedArray> AddElementsToFixedArray( |
| 741 Handle<Object> receiver, Handle<JSObject> holder, Handle<FixedArray> to, | 741 Handle<Object> receiver, Handle<JSObject> holder, Handle<FixedArray> to, |
| 742 Handle<FixedArrayBase> from, FixedArray::KeyFilter filter) FINAL { | 742 Handle<FixedArrayBase> from, FixedArray::KeyFilter filter) final { |
| 743 int len0 = to->length(); | 743 int len0 = to->length(); |
| 744 #ifdef ENABLE_SLOW_DCHECKS | 744 #ifdef ENABLE_SLOW_DCHECKS |
| 745 if (FLAG_enable_slow_asserts) { | 745 if (FLAG_enable_slow_asserts) { |
| 746 for (int i = 0; i < len0; i++) { | 746 for (int i = 0; i < len0; i++) { |
| 747 DCHECK(!to->get(i)->IsTheHole()); | 747 DCHECK(!to->get(i)->IsTheHole()); |
| 748 } | 748 } |
| 749 } | 749 } |
| 750 #endif | 750 #endif |
| 751 | 751 |
| 752 // Optimize if 'other' is empty. | 752 // Optimize if 'other' is empty. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 } | 814 } |
| 815 DCHECK(extra == index); | 815 DCHECK(extra == index); |
| 816 return result; | 816 return result; |
| 817 } | 817 } |
| 818 | 818 |
| 819 protected: | 819 protected: |
| 820 static uint32_t GetCapacityImpl(Handle<FixedArrayBase> backing_store) { | 820 static uint32_t GetCapacityImpl(Handle<FixedArrayBase> backing_store) { |
| 821 return backing_store->length(); | 821 return backing_store->length(); |
| 822 } | 822 } |
| 823 | 823 |
| 824 uint32_t GetCapacity(Handle<FixedArrayBase> backing_store) FINAL { | 824 uint32_t GetCapacity(Handle<FixedArrayBase> backing_store) final { |
| 825 return ElementsAccessorSubclass::GetCapacityImpl(backing_store); | 825 return ElementsAccessorSubclass::GetCapacityImpl(backing_store); |
| 826 } | 826 } |
| 827 | 827 |
| 828 static uint32_t GetKeyForIndexImpl(Handle<FixedArrayBase> backing_store, | 828 static uint32_t GetKeyForIndexImpl(Handle<FixedArrayBase> backing_store, |
| 829 uint32_t index) { | 829 uint32_t index) { |
| 830 return index; | 830 return index; |
| 831 } | 831 } |
| 832 | 832 |
| 833 virtual uint32_t GetKeyForIndex(Handle<FixedArrayBase> backing_store, | 833 virtual uint32_t GetKeyForIndex(Handle<FixedArrayBase> backing_store, |
| 834 uint32_t index) FINAL { | 834 uint32_t index) final { |
| 835 return ElementsAccessorSubclass::GetKeyForIndexImpl(backing_store, index); | 835 return ElementsAccessorSubclass::GetKeyForIndexImpl(backing_store, index); |
| 836 } | 836 } |
| 837 | 837 |
| 838 private: | 838 private: |
| 839 DISALLOW_COPY_AND_ASSIGN(ElementsAccessorBase); | 839 DISALLOW_COPY_AND_ASSIGN(ElementsAccessorBase); |
| 840 }; | 840 }; |
| 841 | 841 |
| 842 | 842 |
| 843 // Super class for all fast element arrays. | 843 // Super class for all fast element arrays. |
| 844 template<typename FastElementsAccessorSubclass, | 844 template<typename FastElementsAccessorSubclass, |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 } | 958 } |
| 959 if (4 * num_used <= backing_store->length()) { | 959 if (4 * num_used <= backing_store->length()) { |
| 960 JSObject::NormalizeElements(obj); | 960 JSObject::NormalizeElements(obj); |
| 961 } | 961 } |
| 962 } | 962 } |
| 963 } | 963 } |
| 964 return isolate->factory()->true_value(); | 964 return isolate->factory()->true_value(); |
| 965 } | 965 } |
| 966 | 966 |
| 967 virtual MaybeHandle<Object> Delete(Handle<JSObject> obj, uint32_t key, | 967 virtual MaybeHandle<Object> Delete(Handle<JSObject> obj, uint32_t key, |
| 968 LanguageMode language_mode) FINAL { | 968 LanguageMode language_mode) final { |
| 969 return DeleteCommon(obj, key, language_mode); | 969 return DeleteCommon(obj, key, language_mode); |
| 970 } | 970 } |
| 971 | 971 |
| 972 static bool HasElementImpl( | 972 static bool HasElementImpl( |
| 973 Handle<JSObject> holder, | 973 Handle<JSObject> holder, |
| 974 uint32_t key, | 974 uint32_t key, |
| 975 Handle<FixedArrayBase> backing_store) { | 975 Handle<FixedArrayBase> backing_store) { |
| 976 if (key >= static_cast<uint32_t>(backing_store->length())) { | 976 if (key >= static_cast<uint32_t>(backing_store->length())) { |
| 977 return false; | 977 return false; |
| 978 } | 978 } |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1279 MUST_USE_RESULT static MaybeHandle<Object> SetLengthImpl( | 1279 MUST_USE_RESULT static MaybeHandle<Object> SetLengthImpl( |
| 1280 Handle<JSObject> obj, | 1280 Handle<JSObject> obj, |
| 1281 Handle<Object> length, | 1281 Handle<Object> length, |
| 1282 Handle<FixedArrayBase> backing_store) { | 1282 Handle<FixedArrayBase> backing_store) { |
| 1283 // External arrays do not support changing their length. | 1283 // External arrays do not support changing their length. |
| 1284 UNREACHABLE(); | 1284 UNREACHABLE(); |
| 1285 return obj; | 1285 return obj; |
| 1286 } | 1286 } |
| 1287 | 1287 |
| 1288 MUST_USE_RESULT virtual MaybeHandle<Object> Delete( | 1288 MUST_USE_RESULT virtual MaybeHandle<Object> Delete( |
| 1289 Handle<JSObject> obj, uint32_t key, LanguageMode language_mode) FINAL { | 1289 Handle<JSObject> obj, uint32_t key, LanguageMode language_mode) final { |
| 1290 // External arrays always ignore deletes. | 1290 // External arrays always ignore deletes. |
| 1291 return obj->GetIsolate()->factory()->true_value(); | 1291 return obj->GetIsolate()->factory()->true_value(); |
| 1292 } | 1292 } |
| 1293 | 1293 |
| 1294 static bool HasElementImpl(Handle<JSObject> holder, uint32_t key, | 1294 static bool HasElementImpl(Handle<JSObject> holder, uint32_t key, |
| 1295 Handle<FixedArrayBase> backing_store) { | 1295 Handle<FixedArrayBase> backing_store) { |
| 1296 uint32_t capacity = | 1296 uint32_t capacity = |
| 1297 AccessorClass::GetCapacityImpl(backing_store); | 1297 AccessorClass::GetCapacityImpl(backing_store); |
| 1298 return key < capacity; | 1298 return key < capacity; |
| 1299 } | 1299 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1427 int copy_size) { | 1427 int copy_size) { |
| 1428 UNREACHABLE(); | 1428 UNREACHABLE(); |
| 1429 } | 1429 } |
| 1430 | 1430 |
| 1431 | 1431 |
| 1432 protected: | 1432 protected: |
| 1433 friend class ElementsAccessorBase<DictionaryElementsAccessor, | 1433 friend class ElementsAccessorBase<DictionaryElementsAccessor, |
| 1434 ElementsKindTraits<DICTIONARY_ELEMENTS> >; | 1434 ElementsKindTraits<DICTIONARY_ELEMENTS> >; |
| 1435 | 1435 |
| 1436 MUST_USE_RESULT virtual MaybeHandle<Object> Delete( | 1436 MUST_USE_RESULT virtual MaybeHandle<Object> Delete( |
| 1437 Handle<JSObject> obj, uint32_t key, LanguageMode language_mode) FINAL { | 1437 Handle<JSObject> obj, uint32_t key, LanguageMode language_mode) final { |
| 1438 return DeleteCommon(obj, key, language_mode); | 1438 return DeleteCommon(obj, key, language_mode); |
| 1439 } | 1439 } |
| 1440 | 1440 |
| 1441 MUST_USE_RESULT static MaybeHandle<Object> GetImpl( | 1441 MUST_USE_RESULT static MaybeHandle<Object> GetImpl( |
| 1442 Handle<Object> receiver, | 1442 Handle<Object> receiver, |
| 1443 Handle<JSObject> obj, | 1443 Handle<JSObject> obj, |
| 1444 uint32_t key, | 1444 uint32_t key, |
| 1445 Handle<FixedArrayBase> store) { | 1445 Handle<FixedArrayBase> store) { |
| 1446 Handle<SeededNumberDictionary> backing_store = | 1446 Handle<SeededNumberDictionary> backing_store = |
| 1447 Handle<SeededNumberDictionary>::cast(store); | 1447 Handle<SeededNumberDictionary>::cast(store); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1593 Handle<JSObject> obj, | 1593 Handle<JSObject> obj, |
| 1594 Handle<Object> length, | 1594 Handle<Object> length, |
| 1595 Handle<FixedArrayBase> parameter_map) { | 1595 Handle<FixedArrayBase> parameter_map) { |
| 1596 // TODO(mstarzinger): This was never implemented but will be used once we | 1596 // TODO(mstarzinger): This was never implemented but will be used once we |
| 1597 // correctly implement [[DefineOwnProperty]] on arrays. | 1597 // correctly implement [[DefineOwnProperty]] on arrays. |
| 1598 UNIMPLEMENTED(); | 1598 UNIMPLEMENTED(); |
| 1599 return obj; | 1599 return obj; |
| 1600 } | 1600 } |
| 1601 | 1601 |
| 1602 MUST_USE_RESULT virtual MaybeHandle<Object> Delete( | 1602 MUST_USE_RESULT virtual MaybeHandle<Object> Delete( |
| 1603 Handle<JSObject> obj, uint32_t key, LanguageMode language_mode) FINAL { | 1603 Handle<JSObject> obj, uint32_t key, LanguageMode language_mode) final { |
| 1604 Isolate* isolate = obj->GetIsolate(); | 1604 Isolate* isolate = obj->GetIsolate(); |
| 1605 Handle<FixedArray> parameter_map(FixedArray::cast(obj->elements())); | 1605 Handle<FixedArray> parameter_map(FixedArray::cast(obj->elements())); |
| 1606 Handle<Object> probe = GetParameterMapArg(obj, parameter_map, key); | 1606 Handle<Object> probe = GetParameterMapArg(obj, parameter_map, key); |
| 1607 if (!probe->IsTheHole()) { | 1607 if (!probe->IsTheHole()) { |
| 1608 // TODO(kmillikin): We could check if this was the last aliased | 1608 // TODO(kmillikin): We could check if this was the last aliased |
| 1609 // parameter, and revert to normal elements in that case. That | 1609 // parameter, and revert to normal elements in that case. That |
| 1610 // would enable GC of the context. | 1610 // would enable GC of the context. |
| 1611 parameter_map->set_the_hole(key + 2); | 1611 parameter_map->set_the_hole(key + 2); |
| 1612 } else { | 1612 } else { |
| 1613 Handle<FixedArray> arguments(FixedArray::cast(parameter_map->get(1))); | 1613 Handle<FixedArray> arguments(FixedArray::cast(parameter_map->get(1))); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1843 UNREACHABLE(); | 1843 UNREACHABLE(); |
| 1844 break; | 1844 break; |
| 1845 } | 1845 } |
| 1846 | 1846 |
| 1847 array->set_elements(*elms); | 1847 array->set_elements(*elms); |
| 1848 array->set_length(Smi::FromInt(number_of_elements)); | 1848 array->set_length(Smi::FromInt(number_of_elements)); |
| 1849 return array; | 1849 return array; |
| 1850 } | 1850 } |
| 1851 | 1851 |
| 1852 } } // namespace v8::internal | 1852 } } // namespace v8::internal |
| OLD | NEW |