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

Side by Side Diff: src/elements.cc

Issue 225683003: ElementsAccessor::GetAccessorPair() handlified. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: ElementsAccessor::GetAccessorPair() handlified. Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/elements.h ('k') | src/objects.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 JSObject* obj, 725 JSObject* obj,
726 uint32_t key, 726 uint32_t key,
727 FixedArrayBase* backing_store) { 727 FixedArrayBase* backing_store) {
728 if (key >= ElementsAccessorSubclass::GetCapacityImpl(backing_store)) { 728 if (key >= ElementsAccessorSubclass::GetCapacityImpl(backing_store)) {
729 return NONEXISTENT; 729 return NONEXISTENT;
730 } 730 }
731 return BackingStore::cast(backing_store)->is_the_hole(key) 731 return BackingStore::cast(backing_store)->is_the_hole(key)
732 ? NONEXISTENT : FIELD; 732 ? NONEXISTENT : FIELD;
733 } 733 }
734 734
735 MUST_USE_RESULT virtual AccessorPair* GetAccessorPair( 735 MUST_USE_RESULT virtual MaybeHandle<AccessorPair> GetAccessorPair(
736 Object* receiver, 736 Handle<Object> receiver,
737 JSObject* holder, 737 Handle<JSObject> holder,
738 uint32_t key, 738 uint32_t key,
739 FixedArrayBase* backing_store) V8_FINAL V8_OVERRIDE { 739 Handle<FixedArrayBase> backing_store) V8_FINAL V8_OVERRIDE {
740 if (backing_store == NULL) {
741 backing_store = holder->elements();
742 }
743 return ElementsAccessorSubclass::GetAccessorPairImpl( 740 return ElementsAccessorSubclass::GetAccessorPairImpl(
744 receiver, holder, key, backing_store); 741 receiver, holder, key, backing_store);
745 } 742 }
746 743
747 MUST_USE_RESULT static AccessorPair* GetAccessorPairImpl( 744 MUST_USE_RESULT static MaybeHandle<AccessorPair> GetAccessorPairImpl(
748 Object* receiver, 745 Handle<Object> receiver,
749 JSObject* obj, 746 Handle<JSObject> obj,
750 uint32_t key, 747 uint32_t key,
751 FixedArrayBase* backing_store) { 748 Handle<FixedArrayBase> backing_store) {
752 return NULL; 749 return MaybeHandle<AccessorPair>();
753 } 750 }
754 751
755 MUST_USE_RESULT virtual Handle<Object> SetLength( 752 MUST_USE_RESULT virtual Handle<Object> SetLength(
756 Handle<JSArray> array, 753 Handle<JSArray> array,
757 Handle<Object> length) V8_FINAL V8_OVERRIDE { 754 Handle<Object> length) V8_FINAL V8_OVERRIDE {
758 return ElementsAccessorSubclass::SetLengthImpl( 755 return ElementsAccessorSubclass::SetLengthImpl(
759 array, length, handle(array->elements())); 756 array, length, handle(array->elements()));
760 } 757 }
761 758
762 MUST_USE_RESULT static Handle<Object> SetLengthImpl( 759 MUST_USE_RESULT static Handle<Object> SetLengthImpl(
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 uint32_t key, 1645 uint32_t key,
1649 FixedArrayBase* store) { 1646 FixedArrayBase* store) {
1650 SeededNumberDictionary* backing_store = SeededNumberDictionary::cast(store); 1647 SeededNumberDictionary* backing_store = SeededNumberDictionary::cast(store);
1651 int entry = backing_store->FindEntry(key); 1648 int entry = backing_store->FindEntry(key);
1652 if (entry != SeededNumberDictionary::kNotFound) { 1649 if (entry != SeededNumberDictionary::kNotFound) {
1653 return backing_store->DetailsAt(entry).type(); 1650 return backing_store->DetailsAt(entry).type();
1654 } 1651 }
1655 return NONEXISTENT; 1652 return NONEXISTENT;
1656 } 1653 }
1657 1654
1658 MUST_USE_RESULT static AccessorPair* GetAccessorPairImpl( 1655 MUST_USE_RESULT static MaybeHandle<AccessorPair> GetAccessorPairImpl(
1659 Object* receiver, 1656 Handle<Object> receiver,
1660 JSObject* obj, 1657 Handle<JSObject> obj,
1661 uint32_t key, 1658 uint32_t key,
1662 FixedArrayBase* store) { 1659 Handle<FixedArrayBase> store) {
1663 SeededNumberDictionary* backing_store = SeededNumberDictionary::cast(store); 1660 Handle<SeededNumberDictionary> backing_store =
1661 Handle<SeededNumberDictionary>::cast(store);
1664 int entry = backing_store->FindEntry(key); 1662 int entry = backing_store->FindEntry(key);
1665 if (entry != SeededNumberDictionary::kNotFound && 1663 if (entry != SeededNumberDictionary::kNotFound &&
1666 backing_store->DetailsAt(entry).type() == CALLBACKS && 1664 backing_store->DetailsAt(entry).type() == CALLBACKS &&
1667 backing_store->ValueAt(entry)->IsAccessorPair()) { 1665 backing_store->ValueAt(entry)->IsAccessorPair()) {
1668 return AccessorPair::cast(backing_store->ValueAt(entry)); 1666 return handle(AccessorPair::cast(backing_store->ValueAt(entry)));
1669 } 1667 }
1670 return NULL; 1668 return MaybeHandle<AccessorPair>();
1671 } 1669 }
1672 1670
1673 static bool HasElementImpl(Object* receiver, 1671 static bool HasElementImpl(Object* receiver,
1674 JSObject* holder, 1672 JSObject* holder,
1675 uint32_t key, 1673 uint32_t key,
1676 FixedArrayBase* backing_store) { 1674 FixedArrayBase* backing_store) {
1677 return SeededNumberDictionary::cast(backing_store)->FindEntry(key) != 1675 return SeededNumberDictionary::cast(backing_store)->FindEntry(key) !=
1678 SeededNumberDictionary::kNotFound; 1676 SeededNumberDictionary::kNotFound;
1679 } 1677 }
1680 1678
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1759 if (!probe->IsTheHole()) { 1757 if (!probe->IsTheHole()) {
1760 return FIELD; 1758 return FIELD;
1761 } else { 1759 } else {
1762 // If not aliased, check the arguments. 1760 // If not aliased, check the arguments.
1763 FixedArray* arguments = FixedArray::cast(parameter_map->get(1)); 1761 FixedArray* arguments = FixedArray::cast(parameter_map->get(1));
1764 return ElementsAccessor::ForArray(arguments)->GetType( 1762 return ElementsAccessor::ForArray(arguments)->GetType(
1765 receiver, obj, key, arguments); 1763 receiver, obj, key, arguments);
1766 } 1764 }
1767 } 1765 }
1768 1766
1769 MUST_USE_RESULT static AccessorPair* GetAccessorPairImpl( 1767 MUST_USE_RESULT static MaybeHandle<AccessorPair> GetAccessorPairImpl(
1770 Object* receiver, 1768 Handle<Object> receiver,
1771 JSObject* obj, 1769 Handle<JSObject> obj,
1772 uint32_t key, 1770 uint32_t key,
1773 FixedArrayBase* parameters) { 1771 Handle<FixedArrayBase> parameters) {
1774 FixedArray* parameter_map = FixedArray::cast(parameters); 1772 Handle<FixedArray> parameter_map = Handle<FixedArray>::cast(parameters);
1775 Object* probe = GetParameterMapArg(obj, parameter_map, key); 1773 Handle<Object> probe = GetParameterMapArg(obj, parameter_map, key);
1776 if (!probe->IsTheHole()) { 1774 if (!probe->IsTheHole()) {
1777 return NULL; 1775 return MaybeHandle<AccessorPair>();
1778 } else { 1776 } else {
1779 // If not aliased, check the arguments. 1777 // If not aliased, check the arguments.
1780 FixedArray* arguments = FixedArray::cast(parameter_map->get(1)); 1778 Handle<FixedArray> arguments(FixedArray::cast(parameter_map->get(1)));
1781 return ElementsAccessor::ForArray(arguments)->GetAccessorPair( 1779 return ElementsAccessor::ForArray(arguments)->GetAccessorPair(
1782 receiver, obj, key, arguments); 1780 receiver, obj, key, arguments);
1783 } 1781 }
1784 } 1782 }
1785 1783
1786 MUST_USE_RESULT static Handle<Object> SetLengthImpl( 1784 MUST_USE_RESULT static Handle<Object> SetLengthImpl(
1787 Handle<JSObject> obj, 1785 Handle<JSObject> obj,
1788 Handle<Object> length, 1786 Handle<Object> length,
1789 Handle<FixedArrayBase> parameter_map) { 1787 Handle<FixedArrayBase> parameter_map) {
1790 // TODO(mstarzinger): This was never implemented but will be used once we 1788 // TODO(mstarzinger): This was never implemented but will be used once we
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 UNREACHABLE(); 2063 UNREACHABLE();
2066 break; 2064 break;
2067 } 2065 }
2068 2066
2069 array->set_elements(*elms); 2067 array->set_elements(*elms);
2070 array->set_length(Smi::FromInt(number_of_elements)); 2068 array->set_length(Smi::FromInt(number_of_elements));
2071 return array; 2069 return array;
2072 } 2070 }
2073 2071
2074 } } // namespace v8::internal 2072 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/elements.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698