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

Side by Side Diff: src/ic/ic.cc

Issue 878103002: Revert of Continue learning for calls in optimized code when we have no type feedback. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@navier
Patch Set: Created 5 years, 11 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/ic/ic.h ('k') | src/x64/lithium-codegen-x64.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 // 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/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 Code* IC::GetOriginalCode() const { 216 Code* IC::GetOriginalCode() const {
217 HandleScope scope(isolate()); 217 HandleScope scope(isolate());
218 Handle<SharedFunctionInfo> shared(GetSharedFunctionInfo(), isolate()); 218 Handle<SharedFunctionInfo> shared(GetSharedFunctionInfo(), isolate());
219 DCHECK(Debug::HasDebugInfo(shared)); 219 DCHECK(Debug::HasDebugInfo(shared));
220 Code* original_code = Debug::GetDebugInfo(shared)->original_code(); 220 Code* original_code = Debug::GetDebugInfo(shared)->original_code();
221 DCHECK(original_code->IsCode()); 221 DCHECK(original_code->IsCode());
222 return original_code; 222 return original_code;
223 } 223 }
224 224
225 225
226 bool IC::AddressIsOptimizedCode() const {
227 Object* maybe_function =
228 Memory::Object_at(fp() + JavaScriptFrameConstants::kFunctionOffset);
229 if (maybe_function->IsJSFunction()) {
230 JSFunction* function = JSFunction::cast(maybe_function);
231 return function->IsOptimized();
232 }
233 return false;
234 }
235
236
237 static void LookupForRead(LookupIterator* it) { 226 static void LookupForRead(LookupIterator* it) {
238 for (; it->IsFound(); it->Next()) { 227 for (; it->IsFound(); it->Next()) {
239 switch (it->state()) { 228 switch (it->state()) {
240 case LookupIterator::NOT_FOUND: 229 case LookupIterator::NOT_FOUND:
241 case LookupIterator::TRANSITION: 230 case LookupIterator::TRANSITION:
242 UNREACHABLE(); 231 UNREACHABLE();
243 case LookupIterator::JSPROXY: 232 case LookupIterator::JSPROXY:
244 return; 233 return;
245 case LookupIterator::INTERCEPTOR: { 234 case LookupIterator::INTERCEPTOR: {
246 // If there is a getter, return; otherwise loop to perform the lookup. 235 // If there is a getter, return; otherwise loop to perform the lookup.
(...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after
2148 DCHECK(FLAG_use_ic && function->IsJSFunction()); 2137 DCHECK(FLAG_use_ic && function->IsJSFunction());
2149 2138
2150 // Are we the array function? 2139 // Are we the array function?
2151 Handle<JSFunction> array_function = 2140 Handle<JSFunction> array_function =
2152 Handle<JSFunction>(isolate()->native_context()->array_function()); 2141 Handle<JSFunction>(isolate()->native_context()->array_function());
2153 if (array_function.is_identical_to(Handle<JSFunction>::cast(function))) { 2142 if (array_function.is_identical_to(Handle<JSFunction>::cast(function))) {
2154 // Alter the slot. 2143 // Alter the slot.
2155 CallICNexus* nexus = casted_nexus<CallICNexus>(); 2144 CallICNexus* nexus = casted_nexus<CallICNexus>();
2156 nexus->ConfigureMonomorphicArray(); 2145 nexus->ConfigureMonomorphicArray();
2157 2146
2158 // Vector-based ICs have a different calling convention in optimized code 2147 CallIC_ArrayTrampolineStub stub(isolate(), callic_state);
2159 // than full code so the correct stub has to be chosen. 2148 set_target(*stub.GetCode());
2160 if (AddressIsOptimizedCode()) {
2161 CallIC_ArrayStub stub(isolate(), callic_state);
2162 set_target(*stub.GetCode());
2163 } else {
2164 CallIC_ArrayTrampolineStub stub(isolate(), callic_state);
2165 set_target(*stub.GetCode());
2166 }
2167
2168 Handle<String> name; 2149 Handle<String> name;
2169 if (array_function->shared()->name()->IsString()) { 2150 if (array_function->shared()->name()->IsString()) {
2170 name = Handle<String>(String::cast(array_function->shared()->name()), 2151 name = Handle<String>(String::cast(array_function->shared()->name()),
2171 isolate()); 2152 isolate());
2172 } 2153 }
2173 TRACE_IC("CallIC", name); 2154 TRACE_IC("CallIC", name);
2174 OnTypeFeedbackChanged(isolate(), get_host(), nexus->vector(), state(), 2155 OnTypeFeedbackChanged(isolate(), get_host(), nexus->vector(), state(),
2175 MONOMORPHIC); 2156 MONOMORPHIC);
2176 return true; 2157 return true;
2177 } 2158 }
2178 return false; 2159 return false;
2179 } 2160 }
2180 2161
2181 2162
2182 void CallIC::PatchMegamorphic(Handle<Object> function) { 2163 void CallIC::PatchMegamorphic(Handle<Object> function) {
2183 CallICState callic_state(target()->extra_ic_state()); 2164 CallICState callic_state(target()->extra_ic_state());
2184 2165
2185 // We are going generic. 2166 // We are going generic.
2186 CallICNexus* nexus = casted_nexus<CallICNexus>(); 2167 CallICNexus* nexus = casted_nexus<CallICNexus>();
2187 nexus->ConfigureGeneric(); 2168 nexus->ConfigureGeneric();
2188 2169
2189 // Vector-based ICs have a different calling convention in optimized code 2170 CallICTrampolineStub stub(isolate(), callic_state);
2190 // than full code so the correct stub has to be chosen. 2171 Handle<Code> code = stub.GetCode();
2191 if (AddressIsOptimizedCode()) { 2172 set_target(*code);
2192 CallICStub stub(isolate(), callic_state);
2193 set_target(*stub.GetCode());
2194 } else {
2195 CallICTrampolineStub stub(isolate(), callic_state);
2196 set_target(*stub.GetCode());
2197 }
2198 2173
2199 Handle<Object> name = isolate()->factory()->empty_string(); 2174 Handle<Object> name = isolate()->factory()->empty_string();
2200 if (function->IsJSFunction()) { 2175 if (function->IsJSFunction()) {
2201 Handle<JSFunction> js_function = Handle<JSFunction>::cast(function); 2176 Handle<JSFunction> js_function = Handle<JSFunction>::cast(function);
2202 name = handle(js_function->shared()->name(), isolate()); 2177 name = handle(js_function->shared()->name(), isolate());
2203 } 2178 }
2204 2179
2205 TRACE_IC("CallIC", name); 2180 TRACE_IC("CallIC", name);
2206 OnTypeFeedbackChanged(isolate(), get_host(), nexus->vector(), state(), 2181 OnTypeFeedbackChanged(isolate(), get_host(), nexus->vector(), state(),
2207 GENERIC); 2182 GENERIC);
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
3004 static const Address IC_utilities[] = { 2979 static const Address IC_utilities[] = {
3005 #define ADDR(name) FUNCTION_ADDR(name), 2980 #define ADDR(name) FUNCTION_ADDR(name),
3006 IC_UTIL_LIST(ADDR) NULL 2981 IC_UTIL_LIST(ADDR) NULL
3007 #undef ADDR 2982 #undef ADDR
3008 }; 2983 };
3009 2984
3010 2985
3011 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } 2986 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; }
3012 } 2987 }
3013 } // namespace v8::internal 2988 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic/ic.h ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698