| 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/handler-configuration.h" | 9 #include "src/ic/handler-configuration.h" |
| 10 #include "src/ic/stub-cache.h" | 10 #include "src/ic/stub-cache.h" |
| (...skipping 3868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3879 | 3879 |
| 3880 var_holder.Bind(proto); | 3880 var_holder.Bind(proto); |
| 3881 var_holder_map.Bind(map); | 3881 var_holder_map.Bind(map); |
| 3882 var_holder_instance_type.Bind(instance_type); | 3882 var_holder_instance_type.Bind(instance_type); |
| 3883 Goto(&loop); | 3883 Goto(&loop); |
| 3884 } | 3884 } |
| 3885 } | 3885 } |
| 3886 } | 3886 } |
| 3887 | 3887 |
| 3888 Node* CodeStubAssembler::OrdinaryHasInstance(Node* context, Node* callable, | 3888 Node* CodeStubAssembler::OrdinaryHasInstance(Node* context, Node* callable, |
| 3889 Node* object) { | 3889 Node* object, |
| 3890 VectorSlotPair feedback) { |
| 3890 Variable var_result(this, MachineRepresentation::kTagged); | 3891 Variable var_result(this, MachineRepresentation::kTagged); |
| 3891 Label return_false(this), return_true(this), | 3892 Label return_false(this), return_true(this), |
| 3892 return_runtime(this, Label::kDeferred), return_result(this); | 3893 return_runtime(this, Label::kDeferred), return_result(this); |
| 3893 | 3894 |
| 3894 // Goto runtime if {object} is a Smi. | 3895 // Goto runtime if {object} is a Smi. |
| 3895 GotoIf(WordIsSmi(object), &return_runtime); | 3896 GotoIf(WordIsSmi(object), &return_runtime); |
| 3896 | 3897 |
| 3897 // Load map of {object}. | 3898 // Load map of {object}. |
| 3898 Node* object_map = LoadMap(object); | 3899 Node* object_map = LoadMap(object); |
| 3899 | 3900 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4004 | 4005 |
| 4005 Bind(&return_false); | 4006 Bind(&return_false); |
| 4006 StoreRoot(Heap::kInstanceofCacheAnswerRootIndex, BooleanConstant(false)); | 4007 StoreRoot(Heap::kInstanceofCacheAnswerRootIndex, BooleanConstant(false)); |
| 4007 var_result.Bind(BooleanConstant(false)); | 4008 var_result.Bind(BooleanConstant(false)); |
| 4008 Goto(&return_result); | 4009 Goto(&return_result); |
| 4009 | 4010 |
| 4010 Bind(&return_runtime); | 4011 Bind(&return_runtime); |
| 4011 { | 4012 { |
| 4012 // Invalidate the global instanceof cache. | 4013 // Invalidate the global instanceof cache. |
| 4013 StoreRoot(Heap::kInstanceofCacheFunctionRootIndex, SmiConstant(0)); | 4014 StoreRoot(Heap::kInstanceofCacheFunctionRootIndex, SmiConstant(0)); |
| 4015 |
| 4016 // Record megamorphic {feedback} if requested; we use this feedback to |
| 4017 // guard a bunch of speculative optimizations in TurboFand (and Crankshaft) |
| 4018 // that just deoptimize in case of funny inputs to instanceof. |
| 4019 if (feedback.IsValid()) { |
| 4020 Node* megamorphic_sentinel = |
| 4021 HeapConstant(TypeFeedbackVector::MegamorphicSentinel(isolate())); |
| 4022 StoreFixedArrayElement(feedback.vector(), feedback.index(), |
| 4023 megamorphic_sentinel, SKIP_WRITE_BARRIER); |
| 4024 } |
| 4025 |
| 4014 // Fallback to the runtime implementation. | 4026 // Fallback to the runtime implementation. |
| 4015 var_result.Bind( | 4027 var_result.Bind( |
| 4016 CallRuntime(Runtime::kOrdinaryHasInstance, context, callable, object)); | 4028 CallRuntime(Runtime::kOrdinaryHasInstance, context, callable, object)); |
| 4017 } | 4029 } |
| 4018 Goto(&return_result); | 4030 Goto(&return_result); |
| 4019 | 4031 |
| 4020 Bind(&return_result); | 4032 Bind(&return_result); |
| 4021 return var_result.value(); | 4033 return var_result.value(); |
| 4022 } | 4034 } |
| 4023 | 4035 |
| (...skipping 1615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5639 Heap::kTheHoleValueRootIndex); | 5651 Heap::kTheHoleValueRootIndex); |
| 5640 | 5652 |
| 5641 // Store the WeakCell in the feedback vector. | 5653 // Store the WeakCell in the feedback vector. |
| 5642 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, | 5654 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, |
| 5643 CodeStubAssembler::SMI_PARAMETERS); | 5655 CodeStubAssembler::SMI_PARAMETERS); |
| 5644 return cell; | 5656 return cell; |
| 5645 } | 5657 } |
| 5646 | 5658 |
| 5647 } // namespace internal | 5659 } // namespace internal |
| 5648 } // namespace v8 | 5660 } // namespace v8 |
| OLD | NEW |