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

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

Issue 2084913006: [ic] Let LoadGlobalIC load the variable name from TypeFeedbackMetadata. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@fix-load-ic-slow-stub
Patch Set: Addressing comments Created 4 years, 5 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/code-stubs.cc ('k') | src/interface-descriptors.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 // 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/ic/ic.h" 5 #include "src/ic/ic.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api-arguments-inl.h" 8 #include "src/api-arguments-inl.h"
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/arguments.h" 10 #include "src/arguments.h"
(...skipping 2244 matching lines...) Expand 10 before | Expand all | Expand 10 after
2255 return *function; 2255 return *function;
2256 } 2256 }
2257 2257
2258 2258
2259 // Used from ic-<arch>.cc. 2259 // Used from ic-<arch>.cc.
2260 RUNTIME_FUNCTION(Runtime_LoadIC_Miss) { 2260 RUNTIME_FUNCTION(Runtime_LoadIC_Miss) {
2261 TimerEventScope<TimerEventIcMiss> timer(isolate); 2261 TimerEventScope<TimerEventIcMiss> timer(isolate);
2262 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss"); 2262 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
2263 HandleScope scope(isolate); 2263 HandleScope scope(isolate);
2264 Handle<Object> receiver = args.at<Object>(0); 2264 Handle<Object> receiver = args.at<Object>(0);
2265 Handle<Name> key = args.at<Name>(1);
2266 2265
2267 DCHECK_EQ(4, args.length()); 2266 DCHECK_EQ(4, args.length());
2268 Handle<Smi> slot = args.at<Smi>(2); 2267 Handle<Smi> slot = args.at<Smi>(2);
2269 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); 2268 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3);
2270 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); 2269 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value());
2271 // A monomorphic or polymorphic KeyedLoadIC with a string key can call the 2270 // A monomorphic or polymorphic KeyedLoadIC with a string key can call the
2272 // LoadIC miss handler if the handler misses. Since the vector Nexus is 2271 // LoadIC miss handler if the handler misses. Since the vector Nexus is
2273 // set up outside the IC, handle that here. 2272 // set up outside the IC, handle that here.
2274 FeedbackVectorSlotKind kind = vector->GetKind(vector_slot); 2273 FeedbackVectorSlotKind kind = vector->GetKind(vector_slot);
2275 if (kind == FeedbackVectorSlotKind::LOAD_IC) { 2274 if (kind == FeedbackVectorSlotKind::LOAD_IC) {
2275 Handle<Name> key = args.at<Name>(1);
2276 LoadICNexus nexus(vector, vector_slot); 2276 LoadICNexus nexus(vector, vector_slot);
2277 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2277 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2278 ic.UpdateState(receiver, key); 2278 ic.UpdateState(receiver, key);
2279 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); 2279 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
2280 2280
2281 } else if (kind == FeedbackVectorSlotKind::LOAD_GLOBAL_IC) { 2281 } else if (kind == FeedbackVectorSlotKind::LOAD_GLOBAL_IC) {
2282 Handle<Name> key(vector->GetName(vector_slot), isolate);
2283 DCHECK_NE(*key, *isolate->factory()->empty_string());
2282 DCHECK_EQ(*isolate->global_object(), *receiver); 2284 DCHECK_EQ(*isolate->global_object(), *receiver);
2283 LoadGlobalICNexus nexus(vector, vector_slot); 2285 LoadGlobalICNexus nexus(vector, vector_slot);
2284 LoadGlobalIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2286 LoadGlobalIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2285 ic.UpdateState(receiver, key); 2287 ic.UpdateState(receiver, key);
2286 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(key)); 2288 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(key));
2287 2289
2288 } else { 2290 } else {
2291 Handle<Name> key = args.at<Name>(1);
2289 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, kind); 2292 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, kind);
2290 KeyedLoadICNexus nexus(vector, vector_slot); 2293 KeyedLoadICNexus nexus(vector, vector_slot);
2291 KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2294 KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2292 ic.UpdateState(receiver, key); 2295 ic.UpdateState(receiver, key);
2293 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); 2296 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
2294 } 2297 }
2295 } 2298 }
2296 2299
2297 // Used from ic-<arch>.cc. 2300 // Used from ic-<arch>.cc.
2298 RUNTIME_FUNCTION(Runtime_LoadGlobalIC_Miss) { 2301 RUNTIME_FUNCTION(Runtime_LoadGlobalIC_Miss) {
2299 TimerEventScope<TimerEventIcMiss> timer(isolate); 2302 TimerEventScope<TimerEventIcMiss> timer(isolate);
2300 HandleScope scope(isolate); 2303 HandleScope scope(isolate);
2301 DCHECK_EQ(3, args.length()); 2304 DCHECK_EQ(2, args.length());
2302 Handle<JSGlobalObject> global = isolate->global_object(); 2305 Handle<JSGlobalObject> global = isolate->global_object();
2303 Handle<Name> name = args.at<Name>(0); 2306 Handle<Smi> slot = args.at<Smi>(0);
2304 Handle<Smi> slot = args.at<Smi>(1); 2307 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(1);
2305 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(2);
2306 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); 2308 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value());
2307 DCHECK_EQ(FeedbackVectorSlotKind::LOAD_GLOBAL_IC, 2309 DCHECK_EQ(FeedbackVectorSlotKind::LOAD_GLOBAL_IC,
2308 vector->GetKind(vector_slot)); 2310 vector->GetKind(vector_slot));
2311 Handle<String> name(vector->GetName(vector_slot), isolate);
2312 DCHECK_NE(*name, *isolate->factory()->empty_string());
2309 2313
2310 LoadGlobalICNexus nexus(vector, vector_slot); 2314 LoadGlobalICNexus nexus(vector, vector_slot);
2311 LoadGlobalIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2315 LoadGlobalIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2312 ic.UpdateState(global, name); 2316 ic.UpdateState(global, name);
2313 2317
2314 Handle<Object> result; 2318 Handle<Object> result;
2315 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(name)); 2319 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(name));
2316 return *result; 2320 return *result;
2317 } 2321 }
2318 2322
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
2989 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, 2993 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC,
2990 vector->GetKind(vector_slot)); 2994 vector->GetKind(vector_slot));
2991 KeyedLoadICNexus nexus(vector, vector_slot); 2995 KeyedLoadICNexus nexus(vector, vector_slot);
2992 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); 2996 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
2993 ic.UpdateState(receiver, key); 2997 ic.UpdateState(receiver, key);
2994 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); 2998 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
2995 } 2999 }
2996 } 3000 }
2997 } // namespace internal 3001 } // namespace internal
2998 } // namespace v8 3002 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/interface-descriptors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698