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

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

Issue 2452543003: Don't wrap roots in Handle just to dereference immediately. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « src/frames.cc ('k') | src/messages.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/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 2354 matching lines...) Expand 10 before | Expand all | Expand 10 after
2365 FeedbackVectorSlotKind kind = vector->GetKind(vector_slot); 2365 FeedbackVectorSlotKind kind = vector->GetKind(vector_slot);
2366 if (kind == FeedbackVectorSlotKind::LOAD_IC) { 2366 if (kind == FeedbackVectorSlotKind::LOAD_IC) {
2367 Handle<Name> key = args.at<Name>(1); 2367 Handle<Name> key = args.at<Name>(1);
2368 LoadICNexus nexus(vector, vector_slot); 2368 LoadICNexus nexus(vector, vector_slot);
2369 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2369 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2370 ic.UpdateState(receiver, key); 2370 ic.UpdateState(receiver, key);
2371 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); 2371 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
2372 2372
2373 } else if (kind == FeedbackVectorSlotKind::LOAD_GLOBAL_IC) { 2373 } else if (kind == FeedbackVectorSlotKind::LOAD_GLOBAL_IC) {
2374 Handle<Name> key(vector->GetName(vector_slot), isolate); 2374 Handle<Name> key(vector->GetName(vector_slot), isolate);
2375 DCHECK_NE(*key, *isolate->factory()->empty_string()); 2375 DCHECK_NE(*key, isolate->heap()->empty_string());
2376 DCHECK_EQ(*isolate->global_object(), *receiver); 2376 DCHECK_EQ(*isolate->global_object(), *receiver);
2377 LoadGlobalICNexus nexus(vector, vector_slot); 2377 LoadGlobalICNexus nexus(vector, vector_slot);
2378 LoadGlobalIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2378 LoadGlobalIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2379 ic.UpdateState(receiver, key); 2379 ic.UpdateState(receiver, key);
2380 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(key)); 2380 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(key));
2381 2381
2382 } else { 2382 } else {
2383 Handle<Name> key = args.at<Name>(1); 2383 Handle<Name> key = args.at<Name>(1);
2384 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, kind); 2384 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, kind);
2385 KeyedLoadICNexus nexus(vector, vector_slot); 2385 KeyedLoadICNexus nexus(vector, vector_slot);
2386 KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2386 KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2387 ic.UpdateState(receiver, key); 2387 ic.UpdateState(receiver, key);
2388 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); 2388 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
2389 } 2389 }
2390 } 2390 }
2391 2391
2392 // Used from ic-<arch>.cc. 2392 // Used from ic-<arch>.cc.
2393 RUNTIME_FUNCTION(Runtime_LoadGlobalIC_Miss) { 2393 RUNTIME_FUNCTION(Runtime_LoadGlobalIC_Miss) {
2394 TimerEventScope<TimerEventIcMiss> timer(isolate); 2394 TimerEventScope<TimerEventIcMiss> timer(isolate);
2395 HandleScope scope(isolate); 2395 HandleScope scope(isolate);
2396 DCHECK_EQ(2, args.length()); 2396 DCHECK_EQ(2, args.length());
2397 // Runtime functions don't follow the IC's calling convention. 2397 // Runtime functions don't follow the IC's calling convention.
2398 Handle<JSGlobalObject> global = isolate->global_object(); 2398 Handle<JSGlobalObject> global = isolate->global_object();
2399 Handle<Smi> slot = args.at<Smi>(0); 2399 Handle<Smi> slot = args.at<Smi>(0);
2400 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(1); 2400 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(1);
2401 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); 2401 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value());
2402 DCHECK_EQ(FeedbackVectorSlotKind::LOAD_GLOBAL_IC, 2402 DCHECK_EQ(FeedbackVectorSlotKind::LOAD_GLOBAL_IC,
2403 vector->GetKind(vector_slot)); 2403 vector->GetKind(vector_slot));
2404 Handle<String> name(vector->GetName(vector_slot), isolate); 2404 Handle<String> name(vector->GetName(vector_slot), isolate);
2405 DCHECK_NE(*name, *isolate->factory()->empty_string()); 2405 DCHECK_NE(*name, isolate->heap()->empty_string());
2406 2406
2407 LoadGlobalICNexus nexus(vector, vector_slot); 2407 LoadGlobalICNexus nexus(vector, vector_slot);
2408 LoadGlobalIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2408 LoadGlobalIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2409 ic.UpdateState(global, name); 2409 ic.UpdateState(global, name);
2410 2410
2411 Handle<Object> result; 2411 Handle<Object> result;
2412 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(name)); 2412 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(name));
2413 return *result; 2413 return *result;
2414 } 2414 }
2415 2415
2416 RUNTIME_FUNCTION(Runtime_LoadGlobalIC_Slow) { 2416 RUNTIME_FUNCTION(Runtime_LoadGlobalIC_Slow) {
2417 HandleScope scope(isolate); 2417 HandleScope scope(isolate);
2418 DCHECK_EQ(2, args.length()); 2418 DCHECK_EQ(2, args.length());
2419 CONVERT_SMI_ARG_CHECKED(slot, 0); 2419 CONVERT_SMI_ARG_CHECKED(slot, 0);
2420 CONVERT_ARG_HANDLE_CHECKED(TypeFeedbackVector, vector, 1); 2420 CONVERT_ARG_HANDLE_CHECKED(TypeFeedbackVector, vector, 1);
2421 2421
2422 FeedbackVectorSlot vector_slot = vector->ToSlot(slot); 2422 FeedbackVectorSlot vector_slot = vector->ToSlot(slot);
2423 DCHECK_EQ(FeedbackVectorSlotKind::LOAD_GLOBAL_IC, 2423 DCHECK_EQ(FeedbackVectorSlotKind::LOAD_GLOBAL_IC,
2424 vector->GetKind(vector_slot)); 2424 vector->GetKind(vector_slot));
2425 Handle<String> name(vector->GetName(vector_slot), isolate); 2425 Handle<String> name(vector->GetName(vector_slot), isolate);
2426 DCHECK_NE(*name, *isolate->factory()->empty_string()); 2426 DCHECK_NE(*name, isolate->heap()->empty_string());
2427 2427
2428 Handle<JSGlobalObject> global = isolate->global_object(); 2428 Handle<JSGlobalObject> global = isolate->global_object();
2429 2429
2430 Handle<ScriptContextTable> script_contexts( 2430 Handle<ScriptContextTable> script_contexts(
2431 global->native_context()->script_context_table()); 2431 global->native_context()->script_context_table());
2432 2432
2433 ScriptContextTable::LookupResult lookup_result; 2433 ScriptContextTable::LookupResult lookup_result;
2434 if (ScriptContextTable::Lookup(script_contexts, name, &lookup_result)) { 2434 if (ScriptContextTable::Lookup(script_contexts, name, &lookup_result)) {
2435 Handle<Context> script_context = ScriptContextTable::GetContext( 2435 Handle<Context> script_context = ScriptContextTable::GetContext(
2436 script_contexts, lookup_result.context_index); 2436 script_contexts, lookup_result.context_index);
2437 Handle<Object> result = 2437 Handle<Object> result =
2438 FixedArray::get(*script_context, lookup_result.slot_index, isolate); 2438 FixedArray::get(*script_context, lookup_result.slot_index, isolate);
2439 if (*result == *isolate->factory()->the_hole_value()) { 2439 if (*result == isolate->heap()->the_hole_value()) {
2440 THROW_NEW_ERROR_RETURN_FAILURE( 2440 THROW_NEW_ERROR_RETURN_FAILURE(
2441 isolate, NewReferenceError(MessageTemplate::kNotDefined, name)); 2441 isolate, NewReferenceError(MessageTemplate::kNotDefined, name));
2442 } 2442 }
2443 return *result; 2443 return *result;
2444 } 2444 }
2445 2445
2446 Handle<Object> result; 2446 Handle<Object> result;
2447 bool is_found = false; 2447 bool is_found = false;
2448 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 2448 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2449 isolate, result, 2449 isolate, result,
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
3006 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state()); 3006 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state());
3007 it.Next(); 3007 it.Next();
3008 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 3008 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
3009 Object::GetProperty(&it)); 3009 Object::GetProperty(&it));
3010 } 3010 }
3011 3011
3012 return *result; 3012 return *result;
3013 } 3013 }
3014 } // namespace internal 3014 } // namespace internal
3015 } // namespace v8 3015 } // namespace v8
OLDNEW
« no previous file with comments | « src/frames.cc ('k') | src/messages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698