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

Side by Side Diff: src/ic.cc

Issue 203333004: Handlification of JSArray::SetElementsLength(). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing review notes Created 6 years, 9 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.cc ('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 1795 matching lines...) Expand 10 before | Expand all | Expand 10 after
1806 ASSERT(args.length() == 3); 1806 ASSERT(args.length() == 3);
1807 StoreIC ic(IC::EXTRA_CALL_FRAME, isolate); 1807 StoreIC ic(IC::EXTRA_CALL_FRAME, isolate);
1808 Handle<Object> receiver = args.at<Object>(0); 1808 Handle<Object> receiver = args.at<Object>(0);
1809 Handle<String> key = args.at<String>(1); 1809 Handle<String> key = args.at<String>(1);
1810 ic.UpdateState(receiver, key); 1810 ic.UpdateState(receiver, key);
1811 return ic.Store(receiver, key, args.at<Object>(2)); 1811 return ic.Store(receiver, key, args.at<Object>(2));
1812 } 1812 }
1813 1813
1814 1814
1815 RUNTIME_FUNCTION(MaybeObject*, StoreIC_ArrayLength) { 1815 RUNTIME_FUNCTION(MaybeObject*, StoreIC_ArrayLength) {
1816 SealHandleScope shs(isolate); 1816 HandleScope scope(isolate);
1817 1817
1818 ASSERT(args.length() == 2); 1818 ASSERT(args.length() == 2);
1819 JSArray* receiver = JSArray::cast(args[0]); 1819 Handle<JSArray> receiver = args.at<JSArray>(0);
1820 Object* len = args[1]; 1820 Handle<Object> len = args.at<Object>(1);
1821 1821
1822 // The generated code should filter out non-Smis before we get here. 1822 // The generated code should filter out non-Smis before we get here.
1823 ASSERT(len->IsSmi()); 1823 ASSERT(len->IsSmi());
1824 1824
1825 #ifdef DEBUG 1825 #ifdef DEBUG
1826 // The length property has to be a writable callback property. 1826 // The length property has to be a writable callback property.
1827 LookupResult debug_lookup(isolate); 1827 LookupResult debug_lookup(isolate);
1828 receiver->LocalLookup(isolate->heap()->length_string(), &debug_lookup); 1828 receiver->LocalLookup(isolate->heap()->length_string(), &debug_lookup);
1829 ASSERT(debug_lookup.IsPropertyCallbacks() && !debug_lookup.IsReadOnly()); 1829 ASSERT(debug_lookup.IsPropertyCallbacks() && !debug_lookup.IsReadOnly());
1830 #endif 1830 #endif
1831 1831
1832 Object* result; 1832 RETURN_IF_EMPTY_HANDLE(isolate,
1833 MaybeObject* maybe_result = receiver->SetElementsLength(len); 1833 JSArray::SetElementsLength(receiver, len));
1834 if (!maybe_result->To(&result)) return maybe_result; 1834 return *len;
1835
1836 return len;
1837 } 1835 }
1838 1836
1839 1837
1840 // Extend storage is called in a store inline cache when 1838 // Extend storage is called in a store inline cache when
1841 // it is necessary to extend the properties array of a 1839 // it is necessary to extend the properties array of a
1842 // JSObject. 1840 // JSObject.
1843 RUNTIME_FUNCTION(MaybeObject*, SharedStoreIC_ExtendStorage) { 1841 RUNTIME_FUNCTION(MaybeObject*, SharedStoreIC_ExtendStorage) {
1844 SealHandleScope shs(isolate); 1842 SealHandleScope shs(isolate);
1845 ASSERT(args.length() == 3); 1843 ASSERT(args.length() == 3);
1846 1844
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
2837 #undef ADDR 2835 #undef ADDR
2838 }; 2836 };
2839 2837
2840 2838
2841 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2839 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2842 return IC_utilities[id]; 2840 return IC_utilities[id];
2843 } 2841 }
2844 2842
2845 2843
2846 } } // namespace v8::internal 2844 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/elements.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698