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

Side by Side Diff: src/elements.cc

Issue 1182603002: Reland of Remove GetAttributes from the mix to avoid another virtual dispatch. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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-inl.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 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 length = fixed_array_base->length(); 576 length = fixed_array_base->length();
577 } 577 }
578 ElementsAccessorSubclass::ValidateContents(holder, length); 578 ElementsAccessorSubclass::ValidateContents(holder, length);
579 } 579 }
580 580
581 void Validate(Handle<JSObject> holder) final { 581 void Validate(Handle<JSObject> holder) final {
582 DisallowHeapAllocation no_gc; 582 DisallowHeapAllocation no_gc;
583 ElementsAccessorSubclass::ValidateImpl(holder); 583 ElementsAccessorSubclass::ValidateImpl(holder);
584 } 584 }
585 585
586 static bool HasElementImpl(Handle<JSObject> holder, uint32_t key,
587 Handle<FixedArrayBase> backing_store) {
588 return ElementsAccessorSubclass::GetAttributesImpl(
589 *holder, key, *backing_store) != ABSENT;
590 }
591
592 virtual bool HasElement(Handle<JSObject> holder, uint32_t key, 586 virtual bool HasElement(Handle<JSObject> holder, uint32_t key,
593 Handle<FixedArrayBase> backing_store) final { 587 Handle<FixedArrayBase> backing_store) final {
594 return ElementsAccessorSubclass::HasElementImpl(holder, key, backing_store); 588 return ElementsAccessorSubclass::GetIndexForKeyImpl(*holder, *backing_store,
589 key) != kMaxUInt32;
595 } 590 }
596 591
597 virtual Handle<Object> Get(Handle<JSObject> holder, uint32_t key, 592 virtual Handle<Object> Get(Handle<JSObject> holder, uint32_t key,
598 Handle<FixedArrayBase> backing_store) final { 593 Handle<FixedArrayBase> backing_store) final {
599 if (!IsExternalArrayElementsKind(ElementsTraits::Kind) && 594 if (!IsExternalArrayElementsKind(ElementsTraits::Kind) &&
600 FLAG_trace_js_array_abuse) { 595 FLAG_trace_js_array_abuse) {
601 CheckArrayAbuse(holder, "elements read", key); 596 CheckArrayAbuse(holder, "elements read", key);
602 } 597 }
603 598
604 if (IsExternalArrayElementsKind(ElementsTraits::Kind) && 599 if (IsExternalArrayElementsKind(ElementsTraits::Kind) &&
(...skipping 21 matching lines...) Expand all
626 621
627 static Handle<Object> SetImpl(Handle<JSObject> obj, uint32_t key, 622 static Handle<Object> SetImpl(Handle<JSObject> obj, uint32_t key,
628 Handle<FixedArrayBase> backing_store, 623 Handle<FixedArrayBase> backing_store,
629 Handle<Object> value) { 624 Handle<Object> value) {
630 CHECK(key < 625 CHECK(key <
631 ElementsAccessorSubclass::GetCapacityImpl(*obj, *backing_store)); 626 ElementsAccessorSubclass::GetCapacityImpl(*obj, *backing_store));
632 return BackingStore::SetValue( 627 return BackingStore::SetValue(
633 obj, Handle<BackingStore>::cast(backing_store), key, value); 628 obj, Handle<BackingStore>::cast(backing_store), key, value);
634 } 629 }
635 630
636 virtual PropertyAttributes GetAttributes(
637 JSObject* holder, uint32_t key, FixedArrayBase* backing_store) final {
638 return ElementsAccessorSubclass::GetAttributesImpl(holder, key,
639 backing_store);
640 }
641
642 static PropertyAttributes GetAttributesImpl(JSObject* obj, uint32_t key,
643 FixedArrayBase* backing_store) {
644 if (key >= ElementsAccessorSubclass::GetCapacityImpl(obj, backing_store)) {
645 return ABSENT;
646 }
647 return BackingStore::cast(backing_store)->is_the_hole(key) ? ABSENT : NONE;
648 }
649
650 virtual MaybeHandle<AccessorPair> GetAccessorPair( 631 virtual MaybeHandle<AccessorPair> GetAccessorPair(
651 Handle<JSObject> holder, uint32_t key, 632 Handle<JSObject> holder, uint32_t key,
652 Handle<FixedArrayBase> backing_store) final { 633 Handle<FixedArrayBase> backing_store) final {
653 return ElementsAccessorSubclass::GetAccessorPairImpl(holder, key, 634 return ElementsAccessorSubclass::GetAccessorPairImpl(holder, key,
654 backing_store); 635 backing_store);
655 } 636 }
656 637
657 static MaybeHandle<AccessorPair> GetAccessorPairImpl( 638 static MaybeHandle<AccessorPair> GetAccessorPairImpl(
658 Handle<JSObject> obj, uint32_t key, 639 Handle<JSObject> obj, uint32_t key,
659 Handle<FixedArrayBase> backing_store) { 640 Handle<FixedArrayBase> backing_store) {
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 static uint32_t GetKeyForIndexImpl(FixedArrayBase* backing_store, 816 static uint32_t GetKeyForIndexImpl(FixedArrayBase* backing_store,
836 uint32_t index) { 817 uint32_t index) {
837 return index; 818 return index;
838 } 819 }
839 820
840 virtual uint32_t GetKeyForIndex(FixedArrayBase* backing_store, 821 virtual uint32_t GetKeyForIndex(FixedArrayBase* backing_store,
841 uint32_t index) final { 822 uint32_t index) final {
842 return ElementsAccessorSubclass::GetKeyForIndexImpl(backing_store, index); 823 return ElementsAccessorSubclass::GetKeyForIndexImpl(backing_store, index);
843 } 824 }
844 825
845 static uint32_t GetIndexForKeyImpl(FixedArrayBase* backing_store, 826 static uint32_t GetIndexForKeyImpl(JSObject* holder,
827 FixedArrayBase* backing_store,
846 uint32_t key) { 828 uint32_t key) {
847 return key; 829 return key < ElementsAccessorSubclass::GetCapacityImpl(holder,
830 backing_store) &&
831 !BackingStore::cast(backing_store)->is_the_hole(key)
832 ? key
833 : kMaxUInt32;
848 } 834 }
849 835
850 virtual uint32_t GetIndexForKey(FixedArrayBase* backing_store, 836 virtual uint32_t GetIndexForKey(JSObject* holder,
837 FixedArrayBase* backing_store,
851 uint32_t key) final { 838 uint32_t key) final {
852 return ElementsAccessorSubclass::GetIndexForKeyImpl(backing_store, key); 839 return ElementsAccessorSubclass::GetIndexForKeyImpl(holder, backing_store,
840 key);
853 } 841 }
854 842
855 static PropertyDetails GetDetailsImpl(FixedArrayBase* backing_store, 843 static PropertyDetails GetDetailsImpl(FixedArrayBase* backing_store,
856 uint32_t index) { 844 uint32_t index) {
857 return PropertyDetails(NONE, DATA, 0, PropertyCellType::kNoCell); 845 return PropertyDetails(NONE, DATA, 0, PropertyCellType::kNoCell);
858 } 846 }
859 847
860 virtual PropertyDetails GetDetails(FixedArrayBase* backing_store, 848 virtual PropertyDetails GetDetails(FixedArrayBase* backing_store,
861 uint32_t index) final { 849 uint32_t index) final {
862 return ElementsAccessorSubclass::GetDetailsImpl(backing_store, index); 850 return ElementsAccessorSubclass::GetDetailsImpl(backing_store, index);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 } 975 }
988 } 976 }
989 } 977 }
990 } 978 }
991 979
992 virtual void Delete(Handle<JSObject> obj, uint32_t key, 980 virtual void Delete(Handle<JSObject> obj, uint32_t key,
993 LanguageMode language_mode) final { 981 LanguageMode language_mode) final {
994 DeleteCommon(obj, key, language_mode); 982 DeleteCommon(obj, key, language_mode);
995 } 983 }
996 984
997 static bool HasElementImpl(
998 Handle<JSObject> holder,
999 uint32_t key,
1000 Handle<FixedArrayBase> backing_store) {
1001 if (key >= static_cast<uint32_t>(backing_store->length())) {
1002 return false;
1003 }
1004 return !Handle<BackingStore>::cast(backing_store)->is_the_hole(key);
1005 }
1006
1007 static bool HasIndexImpl(FixedArrayBase* backing_store, uint32_t index) { 985 static bool HasIndexImpl(FixedArrayBase* backing_store, uint32_t index) {
1008 return !BackingStore::cast(backing_store)->is_the_hole(index); 986 return !BackingStore::cast(backing_store)->is_the_hole(index);
1009 } 987 }
1010 988
1011 static void ValidateContents(Handle<JSObject> holder, int length) { 989 static void ValidateContents(Handle<JSObject> holder, int length) {
1012 #if DEBUG 990 #if DEBUG
1013 Isolate* isolate = holder->GetIsolate(); 991 Isolate* isolate = holder->GetIsolate();
1014 HandleScope scope(isolate); 992 HandleScope scope(isolate);
1015 Handle<FixedArrayBase> elements(holder->elements(), isolate); 993 Handle<FixedArrayBase> elements(holder->elements(), isolate);
1016 Map* map = elements->map(); 994 Map* map = elements->map();
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 1264
1287 static Handle<Object> GetImpl(Handle<JSObject> obj, uint32_t key, 1265 static Handle<Object> GetImpl(Handle<JSObject> obj, uint32_t key,
1288 Handle<FixedArrayBase> backing_store) { 1266 Handle<FixedArrayBase> backing_store) {
1289 if (key < AccessorClass::GetCapacityImpl(*obj, *backing_store)) { 1267 if (key < AccessorClass::GetCapacityImpl(*obj, *backing_store)) {
1290 return BackingStore::get(Handle<BackingStore>::cast(backing_store), key); 1268 return BackingStore::get(Handle<BackingStore>::cast(backing_store), key);
1291 } else { 1269 } else {
1292 return backing_store->GetIsolate()->factory()->undefined_value(); 1270 return backing_store->GetIsolate()->factory()->undefined_value();
1293 } 1271 }
1294 } 1272 }
1295 1273
1296 static PropertyAttributes GetAttributesImpl(JSObject* obj, uint32_t key,
1297 FixedArrayBase* backing_store) {
1298 return key < AccessorClass::GetCapacityImpl(obj, backing_store)
1299 ? DONT_DELETE
1300 : ABSENT;
1301 }
1302
1303 static PropertyDetails GetDetailsImpl(FixedArrayBase* backing_store, 1274 static PropertyDetails GetDetailsImpl(FixedArrayBase* backing_store,
1304 uint32_t index) { 1275 uint32_t index) {
1305 return PropertyDetails(DONT_DELETE, DATA, 0, PropertyCellType::kNoCell); 1276 return PropertyDetails(DONT_DELETE, DATA, 0, PropertyCellType::kNoCell);
1306 } 1277 }
1307 1278
1308 MUST_USE_RESULT static MaybeHandle<Object> SetLengthImpl( 1279 MUST_USE_RESULT static MaybeHandle<Object> SetLengthImpl(
1309 Handle<JSObject> obj, 1280 Handle<JSObject> obj,
1310 Handle<Object> length, 1281 Handle<Object> length,
1311 Handle<FixedArrayBase> backing_store) { 1282 Handle<FixedArrayBase> backing_store) {
1312 // External arrays do not support changing their length. 1283 // External arrays do not support changing their length.
1313 UNREACHABLE(); 1284 UNREACHABLE();
1314 return obj; 1285 return obj;
1315 } 1286 }
1316 1287
1317 virtual void Delete(Handle<JSObject> obj, uint32_t key, 1288 virtual void Delete(Handle<JSObject> obj, uint32_t key,
1318 LanguageMode language_mode) final { 1289 LanguageMode language_mode) final {
1319 // External arrays always ignore deletes. 1290 // External arrays always ignore deletes.
1320 } 1291 }
1321 1292
1322 static bool HasElementImpl(Handle<JSObject> holder, uint32_t key, 1293 static uint32_t GetIndexForKeyImpl(JSObject* holder,
1323 Handle<FixedArrayBase> backing_store) { 1294 FixedArrayBase* backing_store,
1324 uint32_t capacity = AccessorClass::GetCapacityImpl(*holder, *backing_store); 1295 uint32_t key) {
1325 return key < capacity; 1296 return key < AccessorClass::GetCapacityImpl(holder, backing_store)
1297 ? key
1298 : kMaxUInt32;
1326 } 1299 }
1327 1300
1328 static uint32_t GetCapacityImpl(JSObject* holder, 1301 static uint32_t GetCapacityImpl(JSObject* holder,
1329 FixedArrayBase* backing_store) { 1302 FixedArrayBase* backing_store) {
1330 JSArrayBufferView* view = JSArrayBufferView::cast(holder); 1303 JSArrayBufferView* view = JSArrayBufferView::cast(holder);
1331 if (view->WasNeutered()) return 0; 1304 if (view->WasNeutered()) return 0;
1332 return backing_store->length(); 1305 return backing_store->length();
1333 } 1306 }
1334 }; 1307 };
1335 1308
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1478 Handle<FixedArrayBase> store, 1451 Handle<FixedArrayBase> store,
1479 Handle<Object> value) { 1452 Handle<Object> value) {
1480 Handle<SeededNumberDictionary> backing_store = 1453 Handle<SeededNumberDictionary> backing_store =
1481 Handle<SeededNumberDictionary>::cast(store); 1454 Handle<SeededNumberDictionary>::cast(store);
1482 int entry = backing_store->FindEntry(key); 1455 int entry = backing_store->FindEntry(key);
1483 DCHECK_NE(SeededNumberDictionary::kNotFound, entry); 1456 DCHECK_NE(SeededNumberDictionary::kNotFound, entry);
1484 backing_store->ValueAtPut(entry, *value); 1457 backing_store->ValueAtPut(entry, *value);
1485 return value; 1458 return value;
1486 } 1459 }
1487 1460
1488 static PropertyAttributes GetAttributesImpl(JSObject* obj, uint32_t key,
1489 FixedArrayBase* backing_store) {
1490 SeededNumberDictionary* dictionary =
1491 SeededNumberDictionary::cast(backing_store);
1492 int entry = dictionary->FindEntry(key);
1493 if (entry != SeededNumberDictionary::kNotFound) {
1494 return dictionary->DetailsAt(entry).attributes();
1495 }
1496 return ABSENT;
1497 }
1498
1499 static MaybeHandle<AccessorPair> GetAccessorPairImpl( 1461 static MaybeHandle<AccessorPair> GetAccessorPairImpl(
1500 Handle<JSObject> obj, uint32_t key, Handle<FixedArrayBase> store) { 1462 Handle<JSObject> obj, uint32_t key, Handle<FixedArrayBase> store) {
1501 Handle<SeededNumberDictionary> backing_store = 1463 Handle<SeededNumberDictionary> backing_store =
1502 Handle<SeededNumberDictionary>::cast(store); 1464 Handle<SeededNumberDictionary>::cast(store);
1503 int entry = backing_store->FindEntry(key); 1465 int entry = backing_store->FindEntry(key);
1504 if (entry != SeededNumberDictionary::kNotFound && 1466 if (entry != SeededNumberDictionary::kNotFound &&
1505 backing_store->DetailsAt(entry).type() == ACCESSOR_CONSTANT && 1467 backing_store->DetailsAt(entry).type() == ACCESSOR_CONSTANT &&
1506 backing_store->ValueAt(entry)->IsAccessorPair()) { 1468 backing_store->ValueAt(entry)->IsAccessorPair()) {
1507 return handle(AccessorPair::cast(backing_store->ValueAt(entry))); 1469 return handle(AccessorPair::cast(backing_store->ValueAt(entry)));
1508 } 1470 }
1509 return MaybeHandle<AccessorPair>(); 1471 return MaybeHandle<AccessorPair>();
1510 } 1472 }
1511 1473
1512 static bool HasElementImpl(Handle<JSObject> holder, uint32_t key,
1513 Handle<FixedArrayBase> store) {
1514 Handle<SeededNumberDictionary> backing_store =
1515 Handle<SeededNumberDictionary>::cast(store);
1516 return backing_store->FindEntry(key) != SeededNumberDictionary::kNotFound;
1517 }
1518
1519 static bool HasIndexImpl(FixedArrayBase* store, uint32_t index) { 1474 static bool HasIndexImpl(FixedArrayBase* store, uint32_t index) {
1520 DisallowHeapAllocation no_gc; 1475 DisallowHeapAllocation no_gc;
1521 SeededNumberDictionary* dict = SeededNumberDictionary::cast(store); 1476 SeededNumberDictionary* dict = SeededNumberDictionary::cast(store);
1522 Object* key = dict->KeyAt(index); 1477 Object* key = dict->KeyAt(index);
1523 return !key->IsTheHole(); 1478 return !key->IsTheHole();
1524 } 1479 }
1525 1480
1526 static uint32_t GetKeyForIndexImpl(FixedArrayBase* store, uint32_t index) { 1481 static uint32_t GetKeyForIndexImpl(FixedArrayBase* store, uint32_t index) {
1527 DisallowHeapAllocation no_gc; 1482 DisallowHeapAllocation no_gc;
1528 SeededNumberDictionary* dict = SeededNumberDictionary::cast(store); 1483 SeededNumberDictionary* dict = SeededNumberDictionary::cast(store);
1529 Object* key = dict->KeyAt(index); 1484 Object* key = dict->KeyAt(index);
1530 return Smi::cast(key)->value(); 1485 return Smi::cast(key)->value();
1531 } 1486 }
1532 1487
1533 static uint32_t GetIndexForKeyImpl(FixedArrayBase* store, uint32_t key) { 1488 static uint32_t GetIndexForKeyImpl(JSObject* holder, FixedArrayBase* store,
1489 uint32_t key) {
1534 DisallowHeapAllocation no_gc; 1490 DisallowHeapAllocation no_gc;
1535 SeededNumberDictionary* dict = SeededNumberDictionary::cast(store); 1491 SeededNumberDictionary* dict = SeededNumberDictionary::cast(store);
1536 int entry = dict->FindEntry(key); 1492 int entry = dict->FindEntry(key);
1537 if (entry == SeededNumberDictionary::kNotFound) { 1493 return entry == SeededNumberDictionary::kNotFound
1538 return kMaxUInt32; 1494 ? kMaxUInt32
1539 } 1495 : static_cast<uint32_t>(entry);
1540 return static_cast<uint32_t>(entry);
1541 } 1496 }
1542 1497
1543 static PropertyDetails GetDetailsImpl(FixedArrayBase* backing_store, 1498 static PropertyDetails GetDetailsImpl(FixedArrayBase* backing_store,
1544 uint32_t index) { 1499 uint32_t index) {
1545 return SeededNumberDictionary::cast(backing_store)->DetailsAt(index); 1500 return SeededNumberDictionary::cast(backing_store)->DetailsAt(index);
1546 } 1501 }
1547 }; 1502 };
1548 1503
1549 1504
1550 class SloppyArgumentsElementsAccessor : public ElementsAccessorBase< 1505 class SloppyArgumentsElementsAccessor : public ElementsAccessorBase<
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1601 int context_index = Smi::cast(probe)->value(); 1556 int context_index = Smi::cast(probe)->value();
1602 DCHECK(!context->get(context_index)->IsTheHole()); 1557 DCHECK(!context->get(context_index)->IsTheHole());
1603 context->set(context_index, *value); 1558 context->set(context_index, *value);
1604 return value; 1559 return value;
1605 } 1560 }
1606 Handle<FixedArray> arguments(FixedArray::cast(parameter_map->get(1))); 1561 Handle<FixedArray> arguments(FixedArray::cast(parameter_map->get(1)));
1607 return ElementsAccessor::ForArray(arguments) 1562 return ElementsAccessor::ForArray(arguments)
1608 ->Set(obj, key, arguments, value); 1563 ->Set(obj, key, arguments, value);
1609 } 1564 }
1610 1565
1611 static PropertyAttributes GetAttributesImpl(JSObject* obj, uint32_t key,
1612 FixedArrayBase* backing_store) {
1613 FixedArray* parameter_map = FixedArray::cast(backing_store);
1614 Object* probe = GetParameterMapArg(parameter_map, key);
1615 if (!probe->IsTheHole()) {
1616 return NONE;
1617 } else {
1618 // If not aliased, check the arguments.
1619 FixedArray* arguments = FixedArray::cast(parameter_map->get(1));
1620 return ElementsAccessor::ForArray(arguments)
1621 ->GetAttributes(obj, key, arguments);
1622 }
1623 }
1624
1625 static MaybeHandle<AccessorPair> GetAccessorPairImpl( 1566 static MaybeHandle<AccessorPair> GetAccessorPairImpl(
1626 Handle<JSObject> obj, uint32_t key, Handle<FixedArrayBase> parameters) { 1567 Handle<JSObject> obj, uint32_t key, Handle<FixedArrayBase> parameters) {
1627 Handle<FixedArray> parameter_map = Handle<FixedArray>::cast(parameters); 1568 Handle<FixedArray> parameter_map = Handle<FixedArray>::cast(parameters);
1628 Handle<Object> probe(GetParameterMapArg(*parameter_map, key), 1569 Handle<Object> probe(GetParameterMapArg(*parameter_map, key),
1629 obj->GetIsolate()); 1570 obj->GetIsolate());
1630 if (!probe->IsTheHole()) { 1571 if (!probe->IsTheHole()) {
1631 return MaybeHandle<AccessorPair>(); 1572 return MaybeHandle<AccessorPair>();
1632 } else { 1573 } else {
1633 // If not aliased, check the arguments. 1574 // If not aliased, check the arguments.
1634 Handle<FixedArray> arguments(FixedArray::cast(parameter_map->get(1))); 1575 Handle<FixedArray> arguments(FixedArray::cast(parameter_map->get(1)));
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1699 static uint32_t GetKeyForIndexImpl(FixedArrayBase* parameters, 1640 static uint32_t GetKeyForIndexImpl(FixedArrayBase* parameters,
1700 uint32_t index) { 1641 uint32_t index) {
1701 FixedArray* parameter_map = FixedArray::cast(parameters); 1642 FixedArray* parameter_map = FixedArray::cast(parameters);
1702 uint32_t length = parameter_map->length() - 2; 1643 uint32_t length = parameter_map->length() - 2;
1703 if (index < length) return index; 1644 if (index < length) return index;
1704 1645
1705 FixedArray* arguments = FixedArray::cast(parameter_map->get(1)); 1646 FixedArray* arguments = FixedArray::cast(parameter_map->get(1));
1706 return ForArray(arguments)->GetKeyForIndex(arguments, index - length); 1647 return ForArray(arguments)->GetKeyForIndex(arguments, index - length);
1707 } 1648 }
1708 1649
1709 static uint32_t GetIndexForKeyImpl(FixedArrayBase* parameters, uint32_t key) { 1650 static uint32_t GetIndexForKeyImpl(JSObject* holder,
1651 FixedArrayBase* parameters, uint32_t key) {
1710 FixedArray* parameter_map = FixedArray::cast(parameters); 1652 FixedArray* parameter_map = FixedArray::cast(parameters);
1711 Object* probe = GetParameterMapArg(parameter_map, key); 1653 Object* probe = GetParameterMapArg(parameter_map, key);
1712 if (!probe->IsTheHole()) return key; 1654 if (!probe->IsTheHole()) return key;
1713 1655
1714 uint32_t length = parameter_map->length() - 2;
1715 FixedArray* arguments = FixedArray::cast(parameter_map->get(1)); 1656 FixedArray* arguments = FixedArray::cast(parameter_map->get(1));
1716 return length + 1657 uint32_t index = ElementsAccessor::ForArray(arguments)
1717 ElementsAccessor::ForArray(arguments) 1658 ->GetIndexForKey(holder, arguments, key);
1718 ->GetIndexForKey(arguments, key); 1659 if (index == kMaxUInt32) return index;
1660 return (parameter_map->length() - 2) + index;
1719 } 1661 }
1720 1662
1721 static PropertyDetails GetDetailsImpl(FixedArrayBase* parameters, 1663 static PropertyDetails GetDetailsImpl(FixedArrayBase* parameters,
1722 uint32_t index) { 1664 uint32_t index) {
1723 FixedArray* parameter_map = FixedArray::cast(parameters); 1665 FixedArray* parameter_map = FixedArray::cast(parameters);
1724 uint32_t length = parameter_map->length() - 2; 1666 uint32_t length = parameter_map->length() - 2;
1725 if (index < length) { 1667 if (index < length) {
1726 return PropertyDetails(NONE, DATA, 0, PropertyCellType::kNoCell); 1668 return PropertyDetails(NONE, DATA, 0, PropertyCellType::kNoCell);
1727 } 1669 }
1728 index -= length; 1670 index -= length;
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1929 break; 1871 break;
1930 } 1872 }
1931 1873
1932 array->set_elements(*elms); 1874 array->set_elements(*elms);
1933 array->set_length(Smi::FromInt(number_of_elements)); 1875 array->set_length(Smi::FromInt(number_of_elements));
1934 return array; 1876 return array;
1935 } 1877 }
1936 1878
1937 } // namespace internal 1879 } // namespace internal
1938 } // namespace v8 1880 } // namespace v8
OLDNEW
« no previous file with comments | « src/elements.h ('k') | src/lookup-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698