| OLD | NEW |
| 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.h" | 8 #include "src/api.h" |
| 9 #include "src/api-arguments.h" | 9 #include "src/api-arguments.h" |
| 10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 break; | 797 break; |
| 798 case DEBUG_STUB: | 798 case DEBUG_STUB: |
| 799 break; | 799 break; |
| 800 case GENERIC: | 800 case GENERIC: |
| 801 UNREACHABLE(); | 801 UNREACHABLE(); |
| 802 break; | 802 break; |
| 803 } | 803 } |
| 804 } | 804 } |
| 805 | 805 |
| 806 Handle<Code> LoadIC::initialize_stub_in_optimized_code( | 806 Handle<Code> LoadIC::initialize_stub_in_optimized_code( |
| 807 Isolate* isolate, ExtraICState extra_state, State initialization_state) { | 807 Isolate* isolate, ExtraICState extra_state) { |
| 808 return LoadICStub(isolate, LoadICState(extra_state)).GetCode(); | 808 return LoadICStub(isolate, LoadICState(extra_state)).GetCode(); |
| 809 } | 809 } |
| 810 | 810 |
| 811 Handle<Code> KeyedLoadIC::initialize_stub_in_optimized_code( | 811 Handle<Code> KeyedLoadIC::initialize_stub_in_optimized_code( |
| 812 Isolate* isolate, State initialization_state, ExtraICState extra_state) { | 812 Isolate* isolate, ExtraICState extra_state) { |
| 813 if (initialization_state != MEGAMORPHIC) { | 813 return KeyedLoadICStub(isolate, LoadICState(extra_state)).GetCode(); |
| 814 return KeyedLoadICStub(isolate, LoadICState(extra_state)).GetCode(); | 814 } |
| 815 } | 815 |
| 816 return isolate->builtins()->KeyedLoadIC_Megamorphic(); | 816 Handle<Code> KeyedStoreIC::initialize_stub_in_optimized_code( |
| 817 Isolate* isolate, LanguageMode language_mode) { |
| 818 StoreICState state = StoreICState(language_mode); |
| 819 return VectorKeyedStoreICStub(isolate, state).GetCode(); |
| 817 } | 820 } |
| 818 | 821 |
| 819 | 822 |
| 820 Handle<Code> KeyedStoreIC::initialize_stub_in_optimized_code( | |
| 821 Isolate* isolate, LanguageMode language_mode, State initialization_state) { | |
| 822 StoreICState state = StoreICState(language_mode); | |
| 823 if (initialization_state != MEGAMORPHIC) { | |
| 824 return VectorKeyedStoreICStub(isolate, state).GetCode(); | |
| 825 } | |
| 826 return ChooseMegamorphicStub(isolate, state.GetExtraICState()); | |
| 827 } | |
| 828 | |
| 829 | |
| 830 Handle<Code> KeyedStoreIC::ChooseMegamorphicStub(Isolate* isolate, | 823 Handle<Code> KeyedStoreIC::ChooseMegamorphicStub(Isolate* isolate, |
| 831 ExtraICState extra_state) { | 824 ExtraICState extra_state) { |
| 832 LanguageMode mode = StoreICState::GetLanguageMode(extra_state); | 825 LanguageMode mode = StoreICState::GetLanguageMode(extra_state); |
| 833 return is_strict(mode) | 826 return is_strict(mode) |
| 834 ? isolate->builtins()->KeyedStoreIC_Megamorphic_Strict() | 827 ? isolate->builtins()->KeyedStoreIC_Megamorphic_Strict() |
| 835 : isolate->builtins()->KeyedStoreIC_Megamorphic(); | 828 : isolate->builtins()->KeyedStoreIC_Megamorphic(); |
| 836 } | 829 } |
| 837 | 830 |
| 838 | 831 |
| 839 Handle<Code> LoadIC::SimpleFieldLoad(FieldIndex index) { | 832 Handle<Code> LoadIC::SimpleFieldLoad(FieldIndex index) { |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 } | 1534 } |
| 1542 | 1535 |
| 1543 Handle<Code> CallIC::initialize_stub_in_optimized_code( | 1536 Handle<Code> CallIC::initialize_stub_in_optimized_code( |
| 1544 Isolate* isolate, int argc, ConvertReceiverMode mode, | 1537 Isolate* isolate, int argc, ConvertReceiverMode mode, |
| 1545 TailCallMode tail_call_mode) { | 1538 TailCallMode tail_call_mode) { |
| 1546 CallICStub stub(isolate, CallICState(argc, mode, tail_call_mode)); | 1539 CallICStub stub(isolate, CallICState(argc, mode, tail_call_mode)); |
| 1547 Handle<Code> code = stub.GetCode(); | 1540 Handle<Code> code = stub.GetCode(); |
| 1548 return code; | 1541 return code; |
| 1549 } | 1542 } |
| 1550 | 1543 |
| 1551 | |
| 1552 Handle<Code> StoreIC::initialize_stub_in_optimized_code( | 1544 Handle<Code> StoreIC::initialize_stub_in_optimized_code( |
| 1553 Isolate* isolate, LanguageMode language_mode, State initialization_state) { | 1545 Isolate* isolate, LanguageMode language_mode) { |
| 1554 DCHECK(initialization_state == UNINITIALIZED || | 1546 VectorStoreICStub stub(isolate, StoreICState(language_mode)); |
| 1555 initialization_state == PREMONOMORPHIC || | 1547 return stub.GetCode(); |
| 1556 initialization_state == MEGAMORPHIC); | |
| 1557 if (initialization_state != MEGAMORPHIC) { | |
| 1558 VectorStoreICStub stub(isolate, StoreICState(language_mode)); | |
| 1559 return stub.GetCode(); | |
| 1560 } | |
| 1561 | |
| 1562 return is_strict(language_mode) | |
| 1563 ? isolate->builtins()->StoreIC_Megamorphic_Strict() | |
| 1564 : isolate->builtins()->StoreIC_Megamorphic(); | |
| 1565 } | 1548 } |
| 1566 | 1549 |
| 1567 Handle<Code> StoreIC::slow_stub() const { | 1550 Handle<Code> StoreIC::slow_stub() const { |
| 1568 return isolate()->builtins()->StoreIC_Slow(); | 1551 return isolate()->builtins()->StoreIC_Slow(); |
| 1569 } | 1552 } |
| 1570 | 1553 |
| 1571 | 1554 |
| 1572 void StoreIC::UpdateCaches(LookupIterator* lookup, Handle<Object> value, | 1555 void StoreIC::UpdateCaches(LookupIterator* lookup, Handle<Object> value, |
| 1573 JSReceiver::StoreFromKeyed store_mode) { | 1556 JSReceiver::StoreFromKeyed store_mode) { |
| 1574 if (state() == UNINITIALIZED) { | 1557 if (state() == UNINITIALIZED) { |
| (...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2950 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, | 2933 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, |
| 2951 vector->GetKind(vector_slot)); | 2934 vector->GetKind(vector_slot)); |
| 2952 KeyedLoadICNexus nexus(vector, vector_slot); | 2935 KeyedLoadICNexus nexus(vector, vector_slot); |
| 2953 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 2936 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
| 2954 ic.UpdateState(receiver, key); | 2937 ic.UpdateState(receiver, key); |
| 2955 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); | 2938 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); |
| 2956 } | 2939 } |
| 2957 } | 2940 } |
| 2958 } // namespace internal | 2941 } // namespace internal |
| 2959 } // namespace v8 | 2942 } // namespace v8 |
| OLD | NEW |