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

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

Issue 885593002: Continue learning for calls in crankshaft. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Don't remove inlining text size limit yet, just alter it. Created 5 years, 10 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
226 static void LookupForRead(LookupIterator* it) { 237 static void LookupForRead(LookupIterator* it) {
227 for (; it->IsFound(); it->Next()) { 238 for (; it->IsFound(); it->Next()) {
228 switch (it->state()) { 239 switch (it->state()) {
229 case LookupIterator::NOT_FOUND: 240 case LookupIterator::NOT_FOUND:
230 case LookupIterator::TRANSITION: 241 case LookupIterator::TRANSITION:
231 UNREACHABLE(); 242 UNREACHABLE();
232 case LookupIterator::JSPROXY: 243 case LookupIterator::JSPROXY:
233 return; 244 return;
234 case LookupIterator::INTERCEPTOR: { 245 case LookupIterator::INTERCEPTOR: {
235 // If there is a getter, return; otherwise loop to perform the lookup. 246 // If there is a getter, return; otherwise loop to perform the lookup.
(...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after
2137 DCHECK(FLAG_use_ic && function->IsJSFunction()); 2148 DCHECK(FLAG_use_ic && function->IsJSFunction());
2138 2149
2139 // Are we the array function? 2150 // Are we the array function?
2140 Handle<JSFunction> array_function = 2151 Handle<JSFunction> array_function =
2141 Handle<JSFunction>(isolate()->native_context()->array_function()); 2152 Handle<JSFunction>(isolate()->native_context()->array_function());
2142 if (array_function.is_identical_to(Handle<JSFunction>::cast(function))) { 2153 if (array_function.is_identical_to(Handle<JSFunction>::cast(function))) {
2143 // Alter the slot. 2154 // Alter the slot.
2144 CallICNexus* nexus = casted_nexus<CallICNexus>(); 2155 CallICNexus* nexus = casted_nexus<CallICNexus>();
2145 nexus->ConfigureMonomorphicArray(); 2156 nexus->ConfigureMonomorphicArray();
2146 2157
2147 CallIC_ArrayTrampolineStub stub(isolate(), callic_state); 2158 // Vector-based ICs have a different calling convention in optimized code
2148 set_target(*stub.GetCode()); 2159 // than full code so the correct stub has to be chosen.
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
2149 Handle<String> name; 2168 Handle<String> name;
2150 if (array_function->shared()->name()->IsString()) { 2169 if (array_function->shared()->name()->IsString()) {
2151 name = Handle<String>(String::cast(array_function->shared()->name()), 2170 name = Handle<String>(String::cast(array_function->shared()->name()),
2152 isolate()); 2171 isolate());
2153 } 2172 }
2154 TRACE_IC("CallIC", name); 2173 TRACE_IC("CallIC", name);
2155 OnTypeFeedbackChanged(isolate(), get_host(), nexus->vector(), state(), 2174 OnTypeFeedbackChanged(isolate(), get_host(), nexus->vector(), state(),
2156 MONOMORPHIC); 2175 MONOMORPHIC);
2157 return true; 2176 return true;
2158 } 2177 }
2159 return false; 2178 return false;
2160 } 2179 }
2161 2180
2162 2181
2163 void CallIC::PatchMegamorphic(Handle<Object> function) { 2182 void CallIC::PatchMegamorphic(Handle<Object> function) {
2164 CallICState callic_state(target()->extra_ic_state()); 2183 CallICState callic_state(target()->extra_ic_state());
2165 2184
2166 // We are going generic. 2185 // We are going generic.
2167 CallICNexus* nexus = casted_nexus<CallICNexus>(); 2186 CallICNexus* nexus = casted_nexus<CallICNexus>();
2168 nexus->ConfigureGeneric(); 2187 nexus->ConfigureGeneric();
2169 2188
2170 CallICTrampolineStub stub(isolate(), callic_state); 2189 // Vector-based ICs have a different calling convention in optimized code
2171 Handle<Code> code = stub.GetCode(); 2190 // than full code so the correct stub has to be chosen.
2172 set_target(*code); 2191 if (AddressIsOptimizedCode()) {
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 }
2173 2198
2174 Handle<Object> name = isolate()->factory()->empty_string(); 2199 Handle<Object> name = isolate()->factory()->empty_string();
2175 if (function->IsJSFunction()) { 2200 if (function->IsJSFunction()) {
2176 Handle<JSFunction> js_function = Handle<JSFunction>::cast(function); 2201 Handle<JSFunction> js_function = Handle<JSFunction>::cast(function);
2177 name = handle(js_function->shared()->name(), isolate()); 2202 name = handle(js_function->shared()->name(), isolate());
2178 } 2203 }
2179 2204
2180 TRACE_IC("CallIC", name); 2205 TRACE_IC("CallIC", name);
2181 OnTypeFeedbackChanged(isolate(), get_host(), nexus->vector(), state(), 2206 OnTypeFeedbackChanged(isolate(), get_host(), nexus->vector(), state(),
2182 GENERIC); 2207 GENERIC);
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
2979 static const Address IC_utilities[] = { 3004 static const Address IC_utilities[] = {
2980 #define ADDR(name) FUNCTION_ADDR(name), 3005 #define ADDR(name) FUNCTION_ADDR(name),
2981 IC_UTIL_LIST(ADDR) NULL 3006 IC_UTIL_LIST(ADDR) NULL
2982 #undef ADDR 3007 #undef ADDR
2983 }; 3008 };
2984 3009
2985 3010
2986 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } 3011 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; }
2987 } 3012 }
2988 } // namespace v8::internal 3013 } // 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