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

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

Issue 2184063002: [stubs] Cleanup CodeFactory. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix Created 4 years, 4 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') | no next file » | 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 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 // Indicate that we've handled this case. 810 // Indicate that we've handled this case.
811 DCHECK(UseVector()); 811 DCHECK(UseVector());
812 vector_set_ = true; 812 vector_set_ = true;
813 break; 813 break;
814 case GENERIC: 814 case GENERIC:
815 UNREACHABLE(); 815 UNREACHABLE();
816 break; 816 break;
817 } 817 }
818 } 818 }
819 819
820 Handle<Code> LoadIC::initialize_stub_in_optimized_code(Isolate* isolate) {
821 if (FLAG_tf_load_ic_stub) {
822 return LoadICTFStub(isolate).GetCode();
823 }
824 return LoadICStub(isolate).GetCode();
825 }
826
827 Handle<Code> LoadGlobalIC::initialize_stub_in_optimized_code(
828 Isolate* isolate, ExtraICState extra_state) {
829 return LoadGlobalICStub(isolate, LoadGlobalICState(extra_state)).GetCode();
830 }
831
832 Handle<Code> KeyedLoadIC::initialize_stub_in_optimized_code(Isolate* isolate) {
833 if (FLAG_tf_load_ic_stub) {
834 return KeyedLoadICTFStub(isolate).GetCode();
835 }
836 return KeyedLoadICStub(isolate).GetCode();
837 }
838
839 Handle<Code> KeyedStoreIC::initialize_stub_in_optimized_code(
840 Isolate* isolate, LanguageMode language_mode) {
841 StoreICState state = StoreICState(language_mode);
842 return KeyedStoreICStub(isolate, state).GetCode();
843 }
844
845
846 Handle<Code> KeyedStoreIC::ChooseMegamorphicStub(Isolate* isolate, 820 Handle<Code> KeyedStoreIC::ChooseMegamorphicStub(Isolate* isolate,
847 ExtraICState extra_state) { 821 ExtraICState extra_state) {
848 LanguageMode mode = StoreICState::GetLanguageMode(extra_state); 822 LanguageMode mode = StoreICState::GetLanguageMode(extra_state);
849 return is_strict(mode) 823 return is_strict(mode)
850 ? isolate->builtins()->KeyedStoreIC_Megamorphic_Strict() 824 ? isolate->builtins()->KeyedStoreIC_Megamorphic_Strict()
851 : isolate->builtins()->KeyedStoreIC_Megamorphic(); 825 : isolate->builtins()->KeyedStoreIC_Megamorphic();
852 } 826 }
853 827
854 Handle<Object> LoadIC::SimpleFieldLoad(FieldIndex index) { 828 Handle<Object> LoadIC::SimpleFieldLoad(FieldIndex index) {
855 if (FLAG_tf_load_ic_stub) { 829 if (FLAG_tf_load_ic_stub) {
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 JSObject::MakePrototypesFast(object, kStartAtPrototype, isolate()); 1561 JSObject::MakePrototypesFast(object, kStartAtPrototype, isolate());
1588 } 1562 }
1589 LookupIterator it(object, name); 1563 LookupIterator it(object, name);
1590 if (FLAG_use_ic) UpdateCaches(&it, value, store_mode); 1564 if (FLAG_use_ic) UpdateCaches(&it, value, store_mode);
1591 1565
1592 MAYBE_RETURN_NULL( 1566 MAYBE_RETURN_NULL(
1593 Object::SetProperty(&it, value, language_mode(), store_mode)); 1567 Object::SetProperty(&it, value, language_mode(), store_mode));
1594 return value; 1568 return value;
1595 } 1569 }
1596 1570
1597 Handle<Code> CallIC::initialize_stub_in_optimized_code(
1598 Isolate* isolate, int argc, ConvertReceiverMode mode,
1599 TailCallMode tail_call_mode) {
1600 CallICStub stub(isolate, CallICState(argc, mode, tail_call_mode));
1601 Handle<Code> code = stub.GetCode();
1602 return code;
1603 }
1604
1605 Handle<Code> StoreIC::initialize_stub_in_optimized_code(
1606 Isolate* isolate, LanguageMode language_mode) {
1607 StoreICStub stub(isolate, StoreICState(language_mode));
1608 return stub.GetCode();
1609 }
1610
1611 void StoreIC::UpdateCaches(LookupIterator* lookup, Handle<Object> value, 1571 void StoreIC::UpdateCaches(LookupIterator* lookup, Handle<Object> value,
1612 JSReceiver::StoreFromKeyed store_mode) { 1572 JSReceiver::StoreFromKeyed store_mode) {
1613 if (state() == UNINITIALIZED) { 1573 if (state() == UNINITIALIZED) {
1614 // This is the first time we execute this inline cache. Set the target to 1574 // This is the first time we execute this inline cache. Set the target to
1615 // the pre monomorphic stub to delay setting the monomorphic state. 1575 // the pre monomorphic stub to delay setting the monomorphic state.
1616 ConfigureVectorState(PREMONOMORPHIC, Handle<Object>()); 1576 ConfigureVectorState(PREMONOMORPHIC, Handle<Object>());
1617 TRACE_IC("StoreIC", lookup->name()); 1577 TRACE_IC("StoreIC", lookup->name());
1618 return; 1578 return;
1619 } 1579 }
1620 1580
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after
2722 2682
2723 Code* CompareIC::GetRawUninitialized(Isolate* isolate, Token::Value op) { 2683 Code* CompareIC::GetRawUninitialized(Isolate* isolate, Token::Value op) {
2724 CompareICStub stub(isolate, op, CompareICState::UNINITIALIZED, 2684 CompareICStub stub(isolate, op, CompareICState::UNINITIALIZED,
2725 CompareICState::UNINITIALIZED, 2685 CompareICState::UNINITIALIZED,
2726 CompareICState::UNINITIALIZED); 2686 CompareICState::UNINITIALIZED);
2727 Code* code = NULL; 2687 Code* code = NULL;
2728 CHECK(stub.FindCodeInCache(&code)); 2688 CHECK(stub.FindCodeInCache(&code));
2729 return code; 2689 return code;
2730 } 2690 }
2731 2691
2732 Handle<Code> CompareIC::GetUninitialized(Isolate* isolate, Token::Value op) {
2733 CompareICStub stub(isolate, op, CompareICState::UNINITIALIZED,
2734 CompareICState::UNINITIALIZED,
2735 CompareICState::UNINITIALIZED);
2736 return stub.GetCode();
2737 }
2738
2739
2740 Code* CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) { 2692 Code* CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) {
2741 HandleScope scope(isolate()); 2693 HandleScope scope(isolate());
2742 CompareICStub old_stub(target()->stub_key(), isolate()); 2694 CompareICStub old_stub(target()->stub_key(), isolate());
2743 CompareICState::State new_left = 2695 CompareICState::State new_left =
2744 CompareICState::NewInputState(old_stub.left(), x); 2696 CompareICState::NewInputState(old_stub.left(), x);
2745 CompareICState::State new_right = 2697 CompareICState::State new_right =
2746 CompareICState::NewInputState(old_stub.right(), y); 2698 CompareICState::NewInputState(old_stub.right(), y);
2747 CompareICState::State state = CompareICState::TargetState( 2699 CompareICState::State state = CompareICState::TargetState(
2748 isolate(), old_stub.state(), old_stub.left(), old_stub.right(), op_, 2700 isolate(), old_stub.state(), old_stub.left(), old_stub.right(), op_,
2749 HasInlinedSmiCode(address()), x, y); 2701 HasInlinedSmiCode(address()), x, y);
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
3039 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, 2991 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC,
3040 vector->GetKind(vector_slot)); 2992 vector->GetKind(vector_slot));
3041 KeyedLoadICNexus nexus(vector, vector_slot); 2993 KeyedLoadICNexus nexus(vector, vector_slot);
3042 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); 2994 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
3043 ic.UpdateState(receiver, key); 2995 ic.UpdateState(receiver, key);
3044 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); 2996 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key));
3045 } 2997 }
3046 } 2998 }
3047 } // namespace internal 2999 } // namespace internal
3048 } // namespace v8 3000 } // namespace v8
OLDNEW
« no previous file with comments | « src/ic/ic.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698