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

Side by Side Diff: src/ic.cc

Issue 72753002: [Sheriff] Revert "Add support for keyed-call on arrays of fast elements" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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/ic.h ('k') | src/isolate.cc » ('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 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 if (object->IsUndefined() || object->IsNull()) { 797 if (object->IsUndefined() || object->IsNull()) {
798 return TypeError("non_object_property_call", object, key); 798 return TypeError("non_object_property_call", object, key);
799 } 799 }
800 800
801 bool use_ic = MigrateDeprecated(object) 801 bool use_ic = MigrateDeprecated(object)
802 ? false : FLAG_use_ic && !object->IsAccessCheckNeeded(); 802 ? false : FLAG_use_ic && !object->IsAccessCheckNeeded();
803 803
804 if (use_ic && state() != MEGAMORPHIC) { 804 if (use_ic && state() != MEGAMORPHIC) {
805 ASSERT(!object->IsJSGlobalProxy()); 805 ASSERT(!object->IsJSGlobalProxy());
806 int argc = target()->arguments_count(); 806 int argc = target()->arguments_count();
807 Handle<Code> stub; 807 Handle<Code> stub = isolate()->stub_cache()->ComputeCallMegamorphic(
808 808 argc, Code::KEYED_CALL_IC, Code::kNoExtraICState);
809 // Use the KeyedArrayCallStub if the call is of the form array[smi](...), 809 if (object->IsJSObject()) {
810 // where array is an instance of one of the initial array maps (without 810 Handle<JSObject> receiver = Handle<JSObject>::cast(object);
811 // extra named properties). 811 if (receiver->elements()->map() ==
812 // TODO(verwaest): Also support keyed calls on instances of other maps. 812 isolate()->heap()->non_strict_arguments_elements_map()) {
813 if (object->IsJSArray() && key->IsSmi()) { 813 stub = isolate()->stub_cache()->ComputeCallArguments(argc);
814 Handle<JSArray> array = Handle<JSArray>::cast(object);
815 ElementsKind kind = array->map()->elements_kind();
816 if (IsFastObjectElementsKind(kind) &&
817 array->map() == isolate()->get_initial_js_array_map(kind)) {
818 KeyedArrayCallStub stub_gen(IsHoleyElementsKind(kind), argc);
819 stub = stub_gen.GetCode(isolate());
820 } 814 }
821 } 815 }
822 816 ASSERT(!stub.is_null());
823 if (stub.is_null()) {
824 stub = isolate()->stub_cache()->ComputeCallMegamorphic(
825 argc, Code::KEYED_CALL_IC, Code::kNoExtraICState);
826 if (object->IsJSObject()) {
827 Handle<JSObject> receiver = Handle<JSObject>::cast(object);
828 if (receiver->elements()->map() ==
829 isolate()->heap()->non_strict_arguments_elements_map()) {
830 stub = isolate()->stub_cache()->ComputeCallArguments(argc);
831 }
832 }
833 ASSERT(!stub.is_null());
834 }
835 set_target(*stub); 817 set_target(*stub);
836 TRACE_IC("CallIC", key); 818 TRACE_IC("CallIC", key);
837 } 819 }
838 820
839 Handle<Object> result = GetProperty(isolate(), object, key); 821 Handle<Object> result = GetProperty(isolate(), object, key);
840 RETURN_IF_EMPTY_HANDLE(isolate(), result); 822 RETURN_IF_EMPTY_HANDLE(isolate(), result);
841 823
842 // Make receiver an object if the callee requires it. Strict mode or builtin 824 // Make receiver an object if the callee requires it. Strict mode or builtin
843 // functions do not wrap the receiver, non-strict functions and objects 825 // functions do not wrap the receiver, non-strict functions and objects
844 // called as functions do. 826 // called as functions do.
(...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after
2133 HandleScope scope(isolate); 2115 HandleScope scope(isolate);
2134 ASSERT(args.length() == 3); 2116 ASSERT(args.length() == 3);
2135 StoreIC ic(IC::EXTRA_CALL_FRAME, isolate); 2117 StoreIC ic(IC::EXTRA_CALL_FRAME, isolate);
2136 Handle<Object> receiver = args.at<Object>(0); 2118 Handle<Object> receiver = args.at<Object>(0);
2137 Handle<String> key = args.at<String>(1); 2119 Handle<String> key = args.at<String>(1);
2138 ic.UpdateState(receiver, key); 2120 ic.UpdateState(receiver, key);
2139 return ic.Store(receiver, key, args.at<Object>(2)); 2121 return ic.Store(receiver, key, args.at<Object>(2));
2140 } 2122 }
2141 2123
2142 2124
2143 RUNTIME_FUNCTION(MaybeObject*, KeyedCallIC_MissFromStubFailure) {
2144 HandleScope scope(isolate);
2145 ASSERT(args.length() == 2);
2146 KeyedCallIC ic(isolate);
2147 Arguments* caller_args = reinterpret_cast<Arguments*>(args[0]);
2148 Handle<Object> key = args.at<Object>(1);
2149 Handle<Object> receiver((*caller_args)[0], isolate);
2150
2151 ic.UpdateState(receiver, key);
2152 MaybeObject* maybe_result = ic.LoadFunction(receiver, key);
2153 // Result could be a function or a failure.
2154 JSFunction* raw_function = NULL;
2155 if (!maybe_result->To(&raw_function)) return maybe_result;
2156
2157 if (raw_function->is_compiled()) return raw_function;
2158
2159 Handle<JSFunction> function(raw_function, isolate);
2160 JSFunction::CompileLazy(function, CLEAR_EXCEPTION);
2161 return *function;
2162 }
2163
2164
2165 RUNTIME_FUNCTION(MaybeObject*, StoreIC_ArrayLength) { 2125 RUNTIME_FUNCTION(MaybeObject*, StoreIC_ArrayLength) {
2166 SealHandleScope shs(isolate); 2126 SealHandleScope shs(isolate);
2167 2127
2168 ASSERT(args.length() == 2); 2128 ASSERT(args.length() == 2);
2169 JSArray* receiver = JSArray::cast(args[0]); 2129 JSArray* receiver = JSArray::cast(args[0]);
2170 Object* len = args[1]; 2130 Object* len = args[1];
2171 2131
2172 // The generated code should filter out non-Smis before we get here. 2132 // The generated code should filter out non-Smis before we get here.
2173 ASSERT(len->IsSmi()); 2133 ASSERT(len->IsSmi());
2174 2134
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
2770 #undef ADDR 2730 #undef ADDR
2771 }; 2731 };
2772 2732
2773 2733
2774 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2734 Address IC::AddressFromUtilityId(IC::UtilityId id) {
2775 return IC_utilities[id]; 2735 return IC_utilities[id];
2776 } 2736 }
2777 2737
2778 2738
2779 } } // namespace v8::internal 2739 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698