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 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 uint32_t key, | 646 uint32_t key, |
647 Handle<FixedArrayBase> backing_store) { | 647 Handle<FixedArrayBase> backing_store) { |
648 if (key >= ElementsAccessorSubclass::GetCapacityImpl(backing_store)) { | 648 if (key >= ElementsAccessorSubclass::GetCapacityImpl(backing_store)) { |
649 return ABSENT; | 649 return ABSENT; |
650 } | 650 } |
651 return | 651 return |
652 Handle<BackingStore>::cast(backing_store)->is_the_hole(key) | 652 Handle<BackingStore>::cast(backing_store)->is_the_hole(key) |
653 ? ABSENT : NONE; | 653 ? ABSENT : NONE; |
654 } | 654 } |
655 | 655 |
656 MUST_USE_RESULT virtual PropertyType GetType( | |
657 Handle<Object> receiver, | |
658 Handle<JSObject> holder, | |
659 uint32_t key, | |
660 Handle<FixedArrayBase> backing_store) V8_FINAL V8_OVERRIDE { | |
661 return ElementsAccessorSubclass::GetTypeImpl( | |
662 receiver, holder, key, backing_store); | |
663 } | |
664 | |
665 MUST_USE_RESULT static PropertyType GetTypeImpl( | |
666 Handle<Object> receiver, | |
667 Handle<JSObject> obj, | |
668 uint32_t key, | |
669 Handle<FixedArrayBase> backing_store) { | |
670 if (key >= ElementsAccessorSubclass::GetCapacityImpl(backing_store)) { | |
671 return NONEXISTENT; | |
672 } | |
673 return | |
674 Handle<BackingStore>::cast(backing_store)->is_the_hole(key) | |
675 ? NONEXISTENT : FIELD; | |
676 } | |
677 | |
678 MUST_USE_RESULT virtual MaybeHandle<AccessorPair> GetAccessorPair( | 656 MUST_USE_RESULT virtual MaybeHandle<AccessorPair> GetAccessorPair( |
679 Handle<Object> receiver, | 657 Handle<Object> receiver, |
680 Handle<JSObject> holder, | 658 Handle<JSObject> holder, |
681 uint32_t key, | 659 uint32_t key, |
682 Handle<FixedArrayBase> backing_store) V8_FINAL V8_OVERRIDE { | 660 Handle<FixedArrayBase> backing_store) V8_FINAL V8_OVERRIDE { |
683 return ElementsAccessorSubclass::GetAccessorPairImpl( | 661 return ElementsAccessorSubclass::GetAccessorPairImpl( |
684 receiver, holder, key, backing_store); | 662 receiver, holder, key, backing_store); |
685 } | 663 } |
686 | 664 |
687 MUST_USE_RESULT static MaybeHandle<AccessorPair> GetAccessorPairImpl( | 665 MUST_USE_RESULT static MaybeHandle<AccessorPair> GetAccessorPairImpl( |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 MUST_USE_RESULT static PropertyAttributes GetAttributesImpl( | 1281 MUST_USE_RESULT static PropertyAttributes GetAttributesImpl( |
1304 Handle<Object> receiver, | 1282 Handle<Object> receiver, |
1305 Handle<JSObject> obj, | 1283 Handle<JSObject> obj, |
1306 uint32_t key, | 1284 uint32_t key, |
1307 Handle<FixedArrayBase> backing_store) { | 1285 Handle<FixedArrayBase> backing_store) { |
1308 return | 1286 return |
1309 key < AccessorClass::GetCapacityImpl(backing_store) | 1287 key < AccessorClass::GetCapacityImpl(backing_store) |
1310 ? NONE : ABSENT; | 1288 ? NONE : ABSENT; |
1311 } | 1289 } |
1312 | 1290 |
1313 MUST_USE_RESULT static PropertyType GetTypeImpl( | |
1314 Handle<Object> receiver, | |
1315 Handle<JSObject> obj, | |
1316 uint32_t key, | |
1317 Handle<FixedArrayBase> backing_store) { | |
1318 return | |
1319 key < AccessorClass::GetCapacityImpl(backing_store) | |
1320 ? FIELD : NONEXISTENT; | |
1321 } | |
1322 | |
1323 MUST_USE_RESULT static MaybeHandle<Object> SetLengthImpl( | 1291 MUST_USE_RESULT static MaybeHandle<Object> SetLengthImpl( |
1324 Handle<JSObject> obj, | 1292 Handle<JSObject> obj, |
1325 Handle<Object> length, | 1293 Handle<Object> length, |
1326 Handle<FixedArrayBase> backing_store) { | 1294 Handle<FixedArrayBase> backing_store) { |
1327 // External arrays do not support changing their length. | 1295 // External arrays do not support changing their length. |
1328 UNREACHABLE(); | 1296 UNREACHABLE(); |
1329 return obj; | 1297 return obj; |
1330 } | 1298 } |
1331 | 1299 |
1332 MUST_USE_RESULT virtual MaybeHandle<Object> Delete( | 1300 MUST_USE_RESULT virtual MaybeHandle<Object> Delete( |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1523 Handle<FixedArrayBase> backing_store) { | 1491 Handle<FixedArrayBase> backing_store) { |
1524 Handle<SeededNumberDictionary> dictionary = | 1492 Handle<SeededNumberDictionary> dictionary = |
1525 Handle<SeededNumberDictionary>::cast(backing_store); | 1493 Handle<SeededNumberDictionary>::cast(backing_store); |
1526 int entry = dictionary->FindEntry(key); | 1494 int entry = dictionary->FindEntry(key); |
1527 if (entry != SeededNumberDictionary::kNotFound) { | 1495 if (entry != SeededNumberDictionary::kNotFound) { |
1528 return dictionary->DetailsAt(entry).attributes(); | 1496 return dictionary->DetailsAt(entry).attributes(); |
1529 } | 1497 } |
1530 return ABSENT; | 1498 return ABSENT; |
1531 } | 1499 } |
1532 | 1500 |
1533 MUST_USE_RESULT static PropertyType GetTypeImpl( | |
1534 Handle<Object> receiver, | |
1535 Handle<JSObject> obj, | |
1536 uint32_t key, | |
1537 Handle<FixedArrayBase> store) { | |
1538 Handle<SeededNumberDictionary> backing_store = | |
1539 Handle<SeededNumberDictionary>::cast(store); | |
1540 int entry = backing_store->FindEntry(key); | |
1541 if (entry != SeededNumberDictionary::kNotFound) { | |
1542 return backing_store->DetailsAt(entry).type(); | |
1543 } | |
1544 return NONEXISTENT; | |
1545 } | |
1546 | |
1547 MUST_USE_RESULT static MaybeHandle<AccessorPair> GetAccessorPairImpl( | 1501 MUST_USE_RESULT static MaybeHandle<AccessorPair> GetAccessorPairImpl( |
1548 Handle<Object> receiver, | 1502 Handle<Object> receiver, |
1549 Handle<JSObject> obj, | 1503 Handle<JSObject> obj, |
1550 uint32_t key, | 1504 uint32_t key, |
1551 Handle<FixedArrayBase> store) { | 1505 Handle<FixedArrayBase> store) { |
1552 Handle<SeededNumberDictionary> backing_store = | 1506 Handle<SeededNumberDictionary> backing_store = |
1553 Handle<SeededNumberDictionary>::cast(store); | 1507 Handle<SeededNumberDictionary>::cast(store); |
1554 int entry = backing_store->FindEntry(key); | 1508 int entry = backing_store->FindEntry(key); |
1555 if (entry != SeededNumberDictionary::kNotFound && | 1509 if (entry != SeededNumberDictionary::kNotFound && |
1556 backing_store->DetailsAt(entry).type() == CALLBACKS && | 1510 backing_store->DetailsAt(entry).type() == CALLBACKS && |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1641 if (!probe->IsTheHole()) { | 1595 if (!probe->IsTheHole()) { |
1642 return NONE; | 1596 return NONE; |
1643 } else { | 1597 } else { |
1644 // If not aliased, check the arguments. | 1598 // If not aliased, check the arguments. |
1645 Handle<FixedArray> arguments(FixedArray::cast(parameter_map->get(1))); | 1599 Handle<FixedArray> arguments(FixedArray::cast(parameter_map->get(1))); |
1646 return ElementsAccessor::ForArray(arguments)->GetAttributes( | 1600 return ElementsAccessor::ForArray(arguments)->GetAttributes( |
1647 receiver, obj, key, arguments); | 1601 receiver, obj, key, arguments); |
1648 } | 1602 } |
1649 } | 1603 } |
1650 | 1604 |
1651 MUST_USE_RESULT static PropertyType GetTypeImpl( | |
1652 Handle<Object> receiver, | |
1653 Handle<JSObject> obj, | |
1654 uint32_t key, | |
1655 Handle<FixedArrayBase> parameters) { | |
1656 Handle<FixedArray> parameter_map = Handle<FixedArray>::cast(parameters); | |
1657 Handle<Object> probe = GetParameterMapArg(obj, parameter_map, key); | |
1658 if (!probe->IsTheHole()) { | |
1659 return FIELD; | |
1660 } else { | |
1661 // If not aliased, check the arguments. | |
1662 Handle<FixedArray> arguments(FixedArray::cast(parameter_map->get(1))); | |
1663 return ElementsAccessor::ForArray(arguments)->GetType( | |
1664 receiver, obj, key, arguments); | |
1665 } | |
1666 } | |
1667 | |
1668 MUST_USE_RESULT static MaybeHandle<AccessorPair> GetAccessorPairImpl( | 1605 MUST_USE_RESULT static MaybeHandle<AccessorPair> GetAccessorPairImpl( |
1669 Handle<Object> receiver, | 1606 Handle<Object> receiver, |
1670 Handle<JSObject> obj, | 1607 Handle<JSObject> obj, |
1671 uint32_t key, | 1608 uint32_t key, |
1672 Handle<FixedArrayBase> parameters) { | 1609 Handle<FixedArrayBase> parameters) { |
1673 Handle<FixedArray> parameter_map = Handle<FixedArray>::cast(parameters); | 1610 Handle<FixedArray> parameter_map = Handle<FixedArray>::cast(parameters); |
1674 Handle<Object> probe = GetParameterMapArg(obj, parameter_map, key); | 1611 Handle<Object> probe = GetParameterMapArg(obj, parameter_map, key); |
1675 if (!probe->IsTheHole()) { | 1612 if (!probe->IsTheHole()) { |
1676 return MaybeHandle<AccessorPair>(); | 1613 return MaybeHandle<AccessorPair>(); |
1677 } else { | 1614 } else { |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1960 UNREACHABLE(); | 1897 UNREACHABLE(); |
1961 break; | 1898 break; |
1962 } | 1899 } |
1963 | 1900 |
1964 array->set_elements(*elms); | 1901 array->set_elements(*elms); |
1965 array->set_length(Smi::FromInt(number_of_elements)); | 1902 array->set_length(Smi::FromInt(number_of_elements)); |
1966 return array; | 1903 return array; |
1967 } | 1904 } |
1968 | 1905 |
1969 } } // namespace v8::internal | 1906 } } // namespace v8::internal |
OLD | NEW |