| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/code-stub-assembler.h" | 5 #include "src/code-stub-assembler.h" |
| 6 #include "src/code-factory.h" | 6 #include "src/code-factory.h" |
| 7 #include "src/frames-inl.h" | 7 #include "src/frames-inl.h" |
| 8 #include "src/frames.h" | 8 #include "src/frames.h" |
| 9 #include "src/ic/stub-cache.h" | 9 #include "src/ic/stub-cache.h" |
| 10 | 10 |
| (...skipping 2720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2731 Word32And(code_flags, | 2731 Word32And(code_flags, |
| 2732 Int32Constant(~Code::kFlagsNotUsedInLookup))), | 2732 Int32Constant(~Code::kFlagsNotUsedInLookup))), |
| 2733 if_miss); | 2733 if_miss); |
| 2734 | 2734 |
| 2735 // We found the handler. | 2735 // We found the handler. |
| 2736 var_handler->Bind(code); | 2736 var_handler->Bind(code); |
| 2737 Goto(if_handler); | 2737 Goto(if_handler); |
| 2738 } | 2738 } |
| 2739 | 2739 |
| 2740 void CodeStubAssembler::TryProbeStubCache( | 2740 void CodeStubAssembler::TryProbeStubCache( |
| 2741 StubCache* stub_cache, Code::Flags flags, compiler::Node* receiver, | 2741 StubCache* stub_cache, compiler::Node* receiver, compiler::Node* name, |
| 2742 compiler::Node* name, Label* if_handler, Variable* var_handler, | 2742 Label* if_handler, Variable* var_handler, Label* if_miss) { |
| 2743 Label* if_miss) { | 2743 Code::Flags flags = Code::RemoveHolderFromFlags( |
| 2744 Code::ComputeHandlerFlags(stub_cache->ic_kind())); |
| 2745 |
| 2744 Label try_secondary(this), miss(this); | 2746 Label try_secondary(this), miss(this); |
| 2745 | 2747 |
| 2746 Counters* counters = isolate()->counters(); | 2748 Counters* counters = isolate()->counters(); |
| 2747 IncrementCounter(counters->megamorphic_stub_cache_probes(), 1); | 2749 IncrementCounter(counters->megamorphic_stub_cache_probes(), 1); |
| 2748 | 2750 |
| 2749 // Check that the {receiver} isn't a smi. | 2751 // Check that the {receiver} isn't a smi. |
| 2750 GotoIf(WordIsSmi(receiver), &miss); | 2752 GotoIf(WordIsSmi(receiver), &miss); |
| 2751 | 2753 |
| 2752 Node* receiver_map = LoadMap(receiver); | 2754 Node* receiver_map = LoadMap(receiver); |
| 2753 | 2755 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2801 &miss, 2); | 2803 &miss, 2); |
| 2802 } | 2804 } |
| 2803 | 2805 |
| 2804 Bind(&try_megamorphic); | 2806 Bind(&try_megamorphic); |
| 2805 { | 2807 { |
| 2806 // Check megamorphic case. | 2808 // Check megamorphic case. |
| 2807 GotoUnless( | 2809 GotoUnless( |
| 2808 WordEqual(feedback, LoadRoot(Heap::kmegamorphic_symbolRootIndex)), | 2810 WordEqual(feedback, LoadRoot(Heap::kmegamorphic_symbolRootIndex)), |
| 2809 &miss); | 2811 &miss); |
| 2810 | 2812 |
| 2811 Code::Flags code_flags = | 2813 TryProbeStubCache(isolate()->load_stub_cache(), p->receiver, p->name, |
| 2812 Code::RemoveHolderFromFlags(Code::ComputeHandlerFlags(Code::LOAD_IC)); | |
| 2813 | |
| 2814 TryProbeStubCache(isolate()->stub_cache(), code_flags, p->receiver, p->name, | |
| 2815 &if_handler, &var_handler, &miss); | 2814 &if_handler, &var_handler, &miss); |
| 2816 } | 2815 } |
| 2817 Bind(&miss); | 2816 Bind(&miss); |
| 2818 { | 2817 { |
| 2819 TailCallRuntime(Runtime::kLoadIC_Miss, p->context, p->receiver, p->name, | 2818 TailCallRuntime(Runtime::kLoadIC_Miss, p->context, p->receiver, p->name, |
| 2820 p->slot, p->vector); | 2819 p->slot, p->vector); |
| 2821 } | 2820 } |
| 2822 } | 2821 } |
| 2823 | 2822 |
| 2824 void CodeStubAssembler::LoadGlobalIC(const LoadICParameters* p) { | 2823 void CodeStubAssembler::LoadGlobalIC(const LoadICParameters* p) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2854 } | 2853 } |
| 2855 Bind(&miss); | 2854 Bind(&miss); |
| 2856 { | 2855 { |
| 2857 TailCallRuntime(Runtime::kLoadGlobalIC_Miss, p->context, p->slot, | 2856 TailCallRuntime(Runtime::kLoadGlobalIC_Miss, p->context, p->slot, |
| 2858 p->vector); | 2857 p->vector); |
| 2859 } | 2858 } |
| 2860 } | 2859 } |
| 2861 | 2860 |
| 2862 } // namespace internal | 2861 } // namespace internal |
| 2863 } // namespace v8 | 2862 } // namespace v8 |
| OLD | NEW |