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

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

Issue 2662113005: [ic] Introduce IsXyzIC() predicates. (Closed)
Patch Set: Created 3 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
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 <iostream> 7 #include <iostream>
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/api-arguments-inl.h" 10 #include "src/api-arguments-inl.h"
(...skipping 2543 matching lines...) Expand 10 before | Expand all | Expand 10 after
2554 // Runtime functions don't follow the IC's calling convention. 2554 // Runtime functions don't follow the IC's calling convention.
2555 Handle<Object> receiver = args.at(0); 2555 Handle<Object> receiver = args.at(0);
2556 Handle<Name> key = args.at<Name>(1); 2556 Handle<Name> key = args.at<Name>(1);
2557 Handle<Smi> slot = args.at<Smi>(2); 2557 Handle<Smi> slot = args.at<Smi>(2);
2558 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); 2558 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3);
2559 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); 2559 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value());
2560 // A monomorphic or polymorphic KeyedLoadIC with a string key can call the 2560 // A monomorphic or polymorphic KeyedLoadIC with a string key can call the
2561 // LoadIC miss handler if the handler misses. Since the vector Nexus is 2561 // LoadIC miss handler if the handler misses. Since the vector Nexus is
2562 // set up outside the IC, handle that here. 2562 // set up outside the IC, handle that here.
2563 FeedbackVectorSlotKind kind = vector->GetKind(vector_slot); 2563 FeedbackVectorSlotKind kind = vector->GetKind(vector_slot);
2564 if (kind == FeedbackVectorSlotKind::LOAD_IC) { 2564 if (IsLoadICKind(kind)) {
2565 LoadICNexus nexus(vector, vector_slot); 2565 LoadICNexus nexus(vector, vector_slot);
2566 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2566 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2567 ic.UpdateState(receiver, key); 2567 ic.UpdateState(receiver, key);
2568 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); 2568 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
2569 2569
2570 } else if (kind == FeedbackVectorSlotKind::LOAD_GLOBAL_IC) { 2570 } else if (IsLoadGlobalICKind(kind)) {
2571 DCHECK_EQ(*isolate->global_object(), *receiver); 2571 DCHECK_EQ(*isolate->global_object(), *receiver);
2572 LoadGlobalICNexus nexus(vector, vector_slot); 2572 LoadGlobalICNexus nexus(vector, vector_slot);
2573 LoadGlobalIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2573 LoadGlobalIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2574 ic.UpdateState(receiver, key); 2574 ic.UpdateState(receiver, key);
2575 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(key)); 2575 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(key));
2576 2576
2577 } else { 2577 } else {
2578 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, kind); 2578 DCHECK(IsKeyedLoadICKind(kind));
2579 KeyedLoadICNexus nexus(vector, vector_slot); 2579 KeyedLoadICNexus nexus(vector, vector_slot);
2580 KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2580 KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2581 ic.UpdateState(receiver, key); 2581 ic.UpdateState(receiver, key);
2582 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); 2582 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
2583 } 2583 }
2584 } 2584 }
2585 2585
2586 // Used from ic-<arch>.cc. 2586 // Used from ic-<arch>.cc.
2587 RUNTIME_FUNCTION(Runtime_LoadGlobalIC_Miss) { 2587 RUNTIME_FUNCTION(Runtime_LoadGlobalIC_Miss) {
2588 HandleScope scope(isolate); 2588 HandleScope scope(isolate);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
2664 RUNTIME_FUNCTION(Runtime_StoreIC_Miss) { 2664 RUNTIME_FUNCTION(Runtime_StoreIC_Miss) {
2665 HandleScope scope(isolate); 2665 HandleScope scope(isolate);
2666 DCHECK_EQ(5, args.length()); 2666 DCHECK_EQ(5, args.length());
2667 // Runtime functions don't follow the IC's calling convention. 2667 // Runtime functions don't follow the IC's calling convention.
2668 Handle<Object> value = args.at(0); 2668 Handle<Object> value = args.at(0);
2669 Handle<Smi> slot = args.at<Smi>(1); 2669 Handle<Smi> slot = args.at<Smi>(1);
2670 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(2); 2670 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(2);
2671 Handle<Object> receiver = args.at(3); 2671 Handle<Object> receiver = args.at(3);
2672 Handle<Name> key = args.at<Name>(4); 2672 Handle<Name> key = args.at<Name>(4);
2673 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); 2673 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value());
2674 if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::STORE_IC) { 2674 if (vector->IsStoreIC(vector_slot)) {
2675 StoreICNexus nexus(vector, vector_slot); 2675 StoreICNexus nexus(vector, vector_slot);
2676 StoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2676 StoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2677 ic.UpdateState(receiver, key); 2677 ic.UpdateState(receiver, key);
2678 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value)); 2678 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value));
2679 } else { 2679 } else {
2680 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC, 2680 DCHECK(vector->IsKeyedStoreIC(vector_slot));
2681 vector->GetKind(vector_slot));
2682 KeyedStoreICNexus nexus(vector, vector_slot); 2681 KeyedStoreICNexus nexus(vector, vector_slot);
2683 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); 2682 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
2684 ic.UpdateState(receiver, key); 2683 ic.UpdateState(receiver, key);
2685 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value)); 2684 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value));
2686 } 2685 }
2687 } 2686 }
2688 2687
2689 2688
2690 // Used from ic-<arch>.cc. 2689 // Used from ic-<arch>.cc.
2691 RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Miss) { 2690 RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Miss) {
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
3199 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state()); 3198 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state());
3200 it.Next(); 3199 it.Next();
3201 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 3200 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
3202 Object::GetProperty(&it)); 3201 Object::GetProperty(&it));
3203 } 3202 }
3204 3203
3205 return *result; 3204 return *result;
3206 } 3205 }
3207 } // namespace internal 3206 } // namespace internal
3208 } // namespace v8 3207 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698