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

Side by Side Diff: src/elements.cc

Issue 1144883002: Start adding support for elements to the LookupIterator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Deconfuse exotic integer handling Created 5 years, 7 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/lookup.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/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/messages.h" 10 #include "src/messages.h"
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(obj, backing_store)) { 623 if (key < ElementsAccessorSubclass::GetCapacityImpl(*obj, *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(obj, backing_store)) { 641 if (key >=
642 ElementsAccessorSubclass::GetCapacityImpl(*obj, *backing_store)) {
642 return ABSENT; 643 return ABSENT;
643 } 644 }
644 return 645 return
645 Handle<BackingStore>::cast(backing_store)->is_the_hole(key) 646 Handle<BackingStore>::cast(backing_store)->is_the_hole(key)
646 ? ABSENT : NONE; 647 ? ABSENT : NONE;
647 } 648 }
648 649
649 MUST_USE_RESULT virtual MaybeHandle<AccessorPair> GetAccessorPair( 650 MUST_USE_RESULT virtual MaybeHandle<AccessorPair> GetAccessorPair(
650 Handle<JSObject> holder, uint32_t key, 651 Handle<JSObject> holder, uint32_t key,
651 Handle<FixedArrayBase> backing_store) final { 652 Handle<FixedArrayBase> backing_store) final {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 #ifdef ENABLE_SLOW_DCHECKS 745 #ifdef ENABLE_SLOW_DCHECKS
745 if (FLAG_enable_slow_asserts) { 746 if (FLAG_enable_slow_asserts) {
746 for (int i = 0; i < len0; i++) { 747 for (int i = 0; i < len0; i++) {
747 DCHECK(!to->get(i)->IsTheHole()); 748 DCHECK(!to->get(i)->IsTheHole());
748 } 749 }
749 } 750 }
750 #endif 751 #endif
751 752
752 // Optimize if 'other' is empty. 753 // Optimize if 'other' is empty.
753 // We cannot optimize if 'this' is empty, as other may have holes. 754 // We cannot optimize if 'this' is empty, as other may have holes.
754 uint32_t len1 = ElementsAccessorSubclass::GetCapacityImpl(holder, from); 755 uint32_t len1 = ElementsAccessorSubclass::GetCapacityImpl(*holder, *from);
755 if (len1 == 0) return to; 756 if (len1 == 0) return to;
756 757
757 Isolate* isolate = from->GetIsolate(); 758 Isolate* isolate = from->GetIsolate();
758 759
759 // Compute how many elements are not in other. 760 // Compute how many elements are not in other.
760 uint32_t extra = 0; 761 uint32_t extra = 0;
761 for (uint32_t y = 0; y < len1; y++) { 762 for (uint32_t y = 0; y < len1; y++) {
762 uint32_t key = ElementsAccessorSubclass::GetKeyForIndexImpl(from, y); 763 uint32_t key = ElementsAccessorSubclass::GetKeyForIndexImpl(*from, y);
763 if (ElementsAccessorSubclass::HasElementImpl(holder, key, from)) { 764 if (ElementsAccessorSubclass::HasElementImpl(holder, key, from)) {
764 Handle<Object> value; 765 Handle<Object> value;
765 ASSIGN_RETURN_ON_EXCEPTION( 766 ASSIGN_RETURN_ON_EXCEPTION(
766 isolate, value, 767 isolate, value,
767 ElementsAccessorSubclass::GetImpl(receiver, holder, key, from), 768 ElementsAccessorSubclass::GetImpl(receiver, holder, key, from),
768 FixedArray); 769 FixedArray);
769 770
770 DCHECK(!value->IsTheHole()); 771 DCHECK(!value->IsTheHole());
771 if (filter == FixedArray::NON_SYMBOL_KEYS && value->IsSymbol()) { 772 if (filter == FixedArray::NON_SYMBOL_KEYS && value->IsSymbol()) {
772 continue; 773 continue;
(...skipping 15 matching lines...) Expand all
788 WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc); 789 WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc);
789 for (int i = 0; i < len0; i++) { 790 for (int i = 0; i < len0; i++) {
790 Object* e = to->get(i); 791 Object* e = to->get(i);
791 DCHECK(e->IsString() || e->IsNumber()); 792 DCHECK(e->IsString() || e->IsNumber());
792 result->set(i, e, mode); 793 result->set(i, e, mode);
793 } 794 }
794 } 795 }
795 // Fill in the extra values. 796 // Fill in the extra values.
796 uint32_t index = 0; 797 uint32_t index = 0;
797 for (uint32_t y = 0; y < len1; y++) { 798 for (uint32_t y = 0; y < len1; y++) {
798 uint32_t key = 799 uint32_t key = ElementsAccessorSubclass::GetKeyForIndexImpl(*from, y);
799 ElementsAccessorSubclass::GetKeyForIndexImpl(from, y);
800 if (ElementsAccessorSubclass::HasElementImpl(holder, key, from)) { 800 if (ElementsAccessorSubclass::HasElementImpl(holder, key, from)) {
801 Handle<Object> value; 801 Handle<Object> value;
802 ASSIGN_RETURN_ON_EXCEPTION( 802 ASSIGN_RETURN_ON_EXCEPTION(
803 isolate, value, 803 isolate, value,
804 ElementsAccessorSubclass::GetImpl(receiver, holder, key, from), 804 ElementsAccessorSubclass::GetImpl(receiver, holder, key, from),
805 FixedArray); 805 FixedArray);
806 if (filter == FixedArray::NON_SYMBOL_KEYS && value->IsSymbol()) { 806 if (filter == FixedArray::NON_SYMBOL_KEYS && value->IsSymbol()) {
807 continue; 807 continue;
808 } 808 }
809 if (!value->IsTheHole() && !HasKey(to, value)) { 809 if (!value->IsTheHole() && !HasKey(to, value)) {
810 result->set(len0 + index, *value); 810 result->set(len0 + index, *value);
811 index++; 811 index++;
812 } 812 }
813 } 813 }
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<JSObject> holder, 820 static uint32_t GetCapacityImpl(JSObject* holder,
821 Handle<FixedArrayBase> backing_store) { 821 FixedArrayBase* backing_store) {
822 return backing_store->length(); 822 return backing_store->length();
823 } 823 }
824 824
825 uint32_t GetCapacity(Handle<JSObject> holder, 825 uint32_t GetCapacity(JSObject* holder, FixedArrayBase* backing_store) final {
826 Handle<FixedArrayBase> backing_store) final {
827 return ElementsAccessorSubclass::GetCapacityImpl(holder, backing_store); 826 return ElementsAccessorSubclass::GetCapacityImpl(holder, backing_store);
828 } 827 }
829 828
830 static uint32_t GetKeyForIndexImpl(Handle<FixedArrayBase> backing_store, 829 static uint32_t GetKeyForIndexImpl(FixedArrayBase* backing_store,
831 uint32_t index) { 830 uint32_t index) {
832 return index; 831 return index;
833 } 832 }
834 833
835 virtual uint32_t GetKeyForIndex(Handle<FixedArrayBase> backing_store, 834 virtual uint32_t GetKeyForIndex(FixedArrayBase* backing_store,
836 uint32_t index) final { 835 uint32_t index) final {
837 return ElementsAccessorSubclass::GetKeyForIndexImpl(backing_store, index); 836 return ElementsAccessorSubclass::GetKeyForIndexImpl(backing_store, index);
838 } 837 }
839 838
839 static uint32_t GetIndexForKeyImpl(FixedArrayBase* backing_store,
840 uint32_t key) {
841 return key;
842 }
843
844 virtual uint32_t GetIndexForKey(FixedArrayBase* backing_store,
845 uint32_t key) final {
846 return ElementsAccessorSubclass::GetIndexForKeyImpl(backing_store, key);
847 }
848
849 static PropertyDetails GetDetailsImpl(FixedArrayBase* backing_store,
850 uint32_t index) {
851 return PropertyDetails(NONE, DATA, 0, PropertyCellType::kNoCell);
852 }
853
854 virtual PropertyDetails GetDetails(FixedArrayBase* backing_store,
855 uint32_t index) final {
856 return ElementsAccessorSubclass::GetDetailsImpl(backing_store, index);
857 }
858
840 private: 859 private:
841 DISALLOW_COPY_AND_ASSIGN(ElementsAccessorBase); 860 DISALLOW_COPY_AND_ASSIGN(ElementsAccessorBase);
842 }; 861 };
843 862
844 863
845 // Super class for all fast element arrays. 864 // Super class for all fast element arrays.
846 template<typename FastElementsAccessorSubclass, 865 template<typename FastElementsAccessorSubclass,
847 typename KindTraits> 866 typename KindTraits>
848 class FastElementsAccessor 867 class FastElementsAccessor
849 : public ElementsAccessorBase<FastElementsAccessorSubclass, KindTraits> { 868 : public ElementsAccessorBase<FastElementsAccessorSubclass, KindTraits> {
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 typedef TypedElementsAccessor<Kind> AccessorClass; 1274 typedef TypedElementsAccessor<Kind> AccessorClass;
1256 1275
1257 friend class ElementsAccessorBase<AccessorClass, 1276 friend class ElementsAccessorBase<AccessorClass,
1258 ElementsKindTraits<Kind> >; 1277 ElementsKindTraits<Kind> >;
1259 1278
1260 MUST_USE_RESULT static MaybeHandle<Object> GetImpl( 1279 MUST_USE_RESULT static MaybeHandle<Object> GetImpl(
1261 Handle<Object> receiver, 1280 Handle<Object> receiver,
1262 Handle<JSObject> obj, 1281 Handle<JSObject> obj,
1263 uint32_t key, 1282 uint32_t key,
1264 Handle<FixedArrayBase> backing_store) { 1283 Handle<FixedArrayBase> backing_store) {
1265 if (key < AccessorClass::GetCapacityImpl(obj, backing_store)) { 1284 if (key < AccessorClass::GetCapacityImpl(*obj, *backing_store)) {
1266 return BackingStore::get(Handle<BackingStore>::cast(backing_store), key); 1285 return BackingStore::get(Handle<BackingStore>::cast(backing_store), key);
1267 } else { 1286 } else {
1268 return backing_store->GetIsolate()->factory()->undefined_value(); 1287 return backing_store->GetIsolate()->factory()->undefined_value();
1269 } 1288 }
1270 } 1289 }
1271 1290
1272 MUST_USE_RESULT static PropertyAttributes GetAttributesImpl( 1291 MUST_USE_RESULT static PropertyAttributes GetAttributesImpl(
1273 Handle<JSObject> obj, 1292 Handle<JSObject> obj,
1274 uint32_t key, 1293 uint32_t key,
1275 Handle<FixedArrayBase> backing_store) { 1294 Handle<FixedArrayBase> backing_store) {
1276 return key < AccessorClass::GetCapacityImpl(obj, backing_store) ? NONE 1295 return key < AccessorClass::GetCapacityImpl(*obj, *backing_store) ? NONE
1277 : ABSENT; 1296 : ABSENT;
1278 } 1297 }
1279 1298
1280 MUST_USE_RESULT static MaybeHandle<Object> SetLengthImpl( 1299 MUST_USE_RESULT static MaybeHandle<Object> SetLengthImpl(
1281 Handle<JSObject> obj, 1300 Handle<JSObject> obj,
1282 Handle<Object> length, 1301 Handle<Object> length,
1283 Handle<FixedArrayBase> backing_store) { 1302 Handle<FixedArrayBase> backing_store) {
1284 // External arrays do not support changing their length. 1303 // External arrays do not support changing their length.
1285 UNREACHABLE(); 1304 UNREACHABLE();
1286 return obj; 1305 return obj;
1287 } 1306 }
1288 1307
1289 MUST_USE_RESULT virtual MaybeHandle<Object> Delete( 1308 MUST_USE_RESULT virtual MaybeHandle<Object> Delete(
1290 Handle<JSObject> obj, uint32_t key, LanguageMode language_mode) final { 1309 Handle<JSObject> obj, uint32_t key, LanguageMode language_mode) final {
1291 // External arrays always ignore deletes. 1310 // External arrays always ignore deletes.
1292 return obj->GetIsolate()->factory()->true_value(); 1311 return obj->GetIsolate()->factory()->true_value();
1293 } 1312 }
1294 1313
1295 static bool HasElementImpl(Handle<JSObject> holder, uint32_t key, 1314 static bool HasElementImpl(Handle<JSObject> holder, uint32_t key,
1296 Handle<FixedArrayBase> backing_store) { 1315 Handle<FixedArrayBase> backing_store) {
1297 uint32_t capacity = AccessorClass::GetCapacityImpl(holder, backing_store); 1316 uint32_t capacity = AccessorClass::GetCapacityImpl(*holder, *backing_store);
1298 return key < capacity; 1317 return key < capacity;
1299 } 1318 }
1300 1319
1301 static uint32_t GetCapacityImpl(Handle<JSObject> holder, 1320 static uint32_t GetCapacityImpl(JSObject* holder,
1302 Handle<FixedArrayBase> backing_store) { 1321 FixedArrayBase* backing_store) {
1303 Handle<JSArrayBufferView> view = Handle<JSArrayBufferView>::cast(holder); 1322 JSArrayBufferView* view = JSArrayBufferView::cast(holder);
1304 if (view->WasNeutered()) return 0; 1323 if (view->WasNeutered()) return 0;
1305 return backing_store->length(); 1324 return backing_store->length();
1306 } 1325 }
1307 }; 1326 };
1308 1327
1309 1328
1310 1329
1311 #define EXTERNAL_ELEMENTS_ACCESSOR(Type, type, TYPE, ctype, size) \ 1330 #define EXTERNAL_ELEMENTS_ACCESSOR(Type, type, TYPE, ctype, size) \
1312 typedef TypedElementsAccessor<EXTERNAL_##TYPE##_ELEMENTS> \ 1331 typedef TypedElementsAccessor<EXTERNAL_##TYPE##_ELEMENTS> \
1313 External##Type##ElementsAccessor; 1332 External##Type##ElementsAccessor;
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1495 return MaybeHandle<AccessorPair>(); 1514 return MaybeHandle<AccessorPair>();
1496 } 1515 }
1497 1516
1498 static bool HasElementImpl(Handle<JSObject> holder, uint32_t key, 1517 static bool HasElementImpl(Handle<JSObject> holder, uint32_t key,
1499 Handle<FixedArrayBase> store) { 1518 Handle<FixedArrayBase> store) {
1500 Handle<SeededNumberDictionary> backing_store = 1519 Handle<SeededNumberDictionary> backing_store =
1501 Handle<SeededNumberDictionary>::cast(store); 1520 Handle<SeededNumberDictionary>::cast(store);
1502 return backing_store->FindEntry(key) != SeededNumberDictionary::kNotFound; 1521 return backing_store->FindEntry(key) != SeededNumberDictionary::kNotFound;
1503 } 1522 }
1504 1523
1505 static uint32_t GetKeyForIndexImpl(Handle<FixedArrayBase> store, 1524 static uint32_t GetKeyForIndexImpl(FixedArrayBase* store, uint32_t index) {
1506 uint32_t index) {
1507 DisallowHeapAllocation no_gc; 1525 DisallowHeapAllocation no_gc;
1508 Handle<SeededNumberDictionary> dict = 1526 SeededNumberDictionary* dict = SeededNumberDictionary::cast(store);
1509 Handle<SeededNumberDictionary>::cast(store);
1510 Object* key = dict->KeyAt(index); 1527 Object* key = dict->KeyAt(index);
1511 return Smi::cast(key)->value(); 1528 return Smi::cast(key)->value();
1512 } 1529 }
1530
1531 static uint32_t GetIndexForKeyImpl(FixedArrayBase* store, uint32_t index) {
Jakob Kummerow 2015/05/19 17:01:14 nit: "...ForKey..." should take a "uint32_t key" p
1532 DisallowHeapAllocation no_gc;
1533 SeededNumberDictionary* dict = SeededNumberDictionary::cast(store);
1534 int entry = dict->FindEntry(index);
1535 if (entry == SeededNumberDictionary::kNotFound) {
1536 return kMaxUInt32;
1537 }
1538 return static_cast<uint32_t>(entry);
1539 }
1540
1541 static PropertyDetails GetDetailsImpl(FixedArrayBase* backing_store,
1542 uint32_t index) {
1543 return SeededNumberDictionary::cast(backing_store)->DetailsAt(index);
1544 }
1513 }; 1545 };
1514 1546
1515 1547
1516 class SloppyArgumentsElementsAccessor : public ElementsAccessorBase< 1548 class SloppyArgumentsElementsAccessor : public ElementsAccessorBase<
1517 SloppyArgumentsElementsAccessor, 1549 SloppyArgumentsElementsAccessor,
1518 ElementsKindTraits<SLOPPY_ARGUMENTS_ELEMENTS> > { 1550 ElementsKindTraits<SLOPPY_ARGUMENTS_ELEMENTS> > {
1519 public: 1551 public:
1520 explicit SloppyArgumentsElementsAccessor(const char* name) 1552 explicit SloppyArgumentsElementsAccessor(const char* name)
1521 : ElementsAccessorBase< 1553 : ElementsAccessorBase<
1522 SloppyArgumentsElementsAccessor, 1554 SloppyArgumentsElementsAccessor,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 return isolate->factory()->true_value(); 1664 return isolate->factory()->true_value();
1633 } 1665 }
1634 1666
1635 static void CopyElementsImpl(FixedArrayBase* from, uint32_t from_start, 1667 static void CopyElementsImpl(FixedArrayBase* from, uint32_t from_start,
1636 FixedArrayBase* to, ElementsKind from_kind, 1668 FixedArrayBase* to, ElementsKind from_kind,
1637 uint32_t to_start, int packed_size, 1669 uint32_t to_start, int packed_size,
1638 int copy_size) { 1670 int copy_size) {
1639 UNREACHABLE(); 1671 UNREACHABLE();
1640 } 1672 }
1641 1673
1642 static uint32_t GetCapacityImpl(Handle<JSObject> holder, 1674 static uint32_t GetCapacityImpl(JSObject* holder,
1643 Handle<FixedArrayBase> backing_store) { 1675 FixedArrayBase* backing_store) {
1644 Handle<FixedArray> parameter_map = Handle<FixedArray>::cast(backing_store); 1676 FixedArray* parameter_map = FixedArray::cast(backing_store);
1645 Handle<FixedArrayBase> arguments( 1677 FixedArrayBase* arguments = FixedArrayBase::cast(parameter_map->get(1));
1646 FixedArrayBase::cast(parameter_map->get(1)));
1647 return Max(static_cast<uint32_t>(parameter_map->length() - 2), 1678 return Max(static_cast<uint32_t>(parameter_map->length() - 2),
1648 ForArray(arguments)->GetCapacity(holder, arguments)); 1679 ForArray(arguments)->GetCapacity(holder, arguments));
1649 } 1680 }
1650 1681
1651 static uint32_t GetKeyForIndexImpl(Handle<FixedArrayBase> dict, 1682 static uint32_t GetKeyForIndexImpl(FixedArrayBase* dict, uint32_t index) {
1652 uint32_t index) {
1653 return index; 1683 return index;
1654 } 1684 }
1655 1685
1686 static uint32_t GetIndexForKeyImpl(FixedArrayBase* dict, uint32_t key) {
1687 return key;
1688 }
1689
1690 static PropertyDetails GetDetailsImpl(FixedArrayBase* backing_store,
1691 uint32_t index) {
1692 return PropertyDetails(NONE, DATA, 0, PropertyCellType::kNoCell);
1693 }
1694
1695
1656 private: 1696 private:
1657 static Handle<Object> GetParameterMapArg(Handle<JSObject> holder, 1697 static Handle<Object> GetParameterMapArg(Handle<JSObject> holder,
1658 Handle<FixedArray> parameter_map, 1698 Handle<FixedArray> parameter_map,
1659 uint32_t key) { 1699 uint32_t key) {
1660 Isolate* isolate = holder->GetIsolate(); 1700 Isolate* isolate = holder->GetIsolate();
1661 uint32_t length = holder->IsJSArray() 1701 uint32_t length = holder->IsJSArray()
1662 ? Smi::cast(Handle<JSArray>::cast(holder)->length())->value() 1702 ? Smi::cast(Handle<JSArray>::cast(holder)->length())->value()
1663 : parameter_map->length(); 1703 : parameter_map->length();
1664 return key < (length - 2) 1704 return key < (length - 2)
1665 ? handle(parameter_map->get(key + 2), isolate) 1705 ? handle(parameter_map->get(key + 2), isolate)
1666 : Handle<Object>::cast(isolate->factory()->the_hole_value()); 1706 : Handle<Object>::cast(isolate->factory()->the_hole_value());
1667 } 1707 }
1668 }; 1708 };
1669 1709
1670 1710
1671 ElementsAccessor* ElementsAccessor::ForArray(Handle<FixedArrayBase> array) { 1711 ElementsAccessor* ElementsAccessor::ForArray(FixedArrayBase* array) {
1672 return elements_accessors_[ElementsKindForArray(*array)]; 1712 return elements_accessors_[ElementsKindForArray(array)];
1673 } 1713 }
1674 1714
1675 1715
1716 ElementsAccessor* ElementsAccessor::ForArray(Handle<FixedArrayBase> array) {
1717 return ForArray(*array);
1718 }
1719
1720
1676 void ElementsAccessor::InitializeOncePerProcess() { 1721 void ElementsAccessor::InitializeOncePerProcess() {
1677 static ElementsAccessor* accessor_array[] = { 1722 static ElementsAccessor* accessor_array[] = {
1678 #define ACCESSOR_ARRAY(Class, Kind, Store) new Class(#Kind), 1723 #define ACCESSOR_ARRAY(Class, Kind, Store) new Class(#Kind),
1679 ELEMENTS_LIST(ACCESSOR_ARRAY) 1724 ELEMENTS_LIST(ACCESSOR_ARRAY)
1680 #undef ACCESSOR_ARRAY 1725 #undef ACCESSOR_ARRAY
1681 }; 1726 };
1682 1727
1683 STATIC_ASSERT((sizeof(accessor_array) / sizeof(*accessor_array)) == 1728 STATIC_ASSERT((sizeof(accessor_array) / sizeof(*accessor_array)) ==
1684 kElementsKindCount); 1729 kElementsKindCount);
1685 1730
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1851 UNREACHABLE(); 1896 UNREACHABLE();
1852 break; 1897 break;
1853 } 1898 }
1854 1899
1855 array->set_elements(*elms); 1900 array->set_elements(*elms);
1856 array->set_length(Smi::FromInt(number_of_elements)); 1901 array->set_length(Smi::FromInt(number_of_elements));
1857 return array; 1902 return array;
1858 } 1903 }
1859 1904
1860 } } // namespace v8::internal 1905 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/elements.h ('k') | src/lookup.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698