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 3198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3209 : WordShr(index_node, IntPtrConstant(-element_size_shift))); | 3209 : WordShr(index_node, IntPtrConstant(-element_size_shift))); |
3210 } | 3210 } |
3211 | 3211 |
3212 compiler::Node* CodeStubAssembler::LoadTypeFeedbackVectorForStub() { | 3212 compiler::Node* CodeStubAssembler::LoadTypeFeedbackVectorForStub() { |
3213 Node* function = | 3213 Node* function = |
3214 LoadFromParentFrame(JavaScriptFrameConstants::kFunctionOffset); | 3214 LoadFromParentFrame(JavaScriptFrameConstants::kFunctionOffset); |
3215 Node* literals = LoadObjectField(function, JSFunction::kLiteralsOffset); | 3215 Node* literals = LoadObjectField(function, JSFunction::kLiteralsOffset); |
3216 return LoadObjectField(literals, LiteralsArray::kFeedbackVectorOffset); | 3216 return LoadObjectField(literals, LiteralsArray::kFeedbackVectorOffset); |
3217 } | 3217 } |
3218 | 3218 |
| 3219 void CodeStubAssembler::UpdateFeedback(compiler::Node* feedback, |
| 3220 compiler::Node* type_feedback_vector, |
| 3221 compiler::Node* slot_id) { |
| 3222 Label combine_feedback(this), record_feedback(this), end(this); |
| 3223 |
| 3224 Node* previous_feedback = |
| 3225 LoadFixedArrayElement(type_feedback_vector, slot_id); |
| 3226 Node* is_uninitialized = WordEqual( |
| 3227 previous_feedback, |
| 3228 HeapConstant(TypeFeedbackVector::UninitializedSentinel(isolate()))); |
| 3229 BranchIf(is_uninitialized, &record_feedback, &combine_feedback); |
| 3230 |
| 3231 Bind(&record_feedback); |
| 3232 { |
| 3233 StoreFixedArrayElement(type_feedback_vector, slot_id, SmiTag(feedback), |
| 3234 SKIP_WRITE_BARRIER); |
| 3235 Goto(&end); |
| 3236 } |
| 3237 |
| 3238 Bind(&combine_feedback); |
| 3239 { |
| 3240 Node* untagged_previous_feedback = SmiUntag(previous_feedback); |
| 3241 Node* combined_feedback = Word32Or(untagged_previous_feedback, feedback); |
| 3242 StoreFixedArrayElement(type_feedback_vector, slot_id, |
| 3243 SmiTag(combined_feedback), SKIP_WRITE_BARRIER); |
| 3244 Goto(&end); |
| 3245 } |
| 3246 |
| 3247 Bind(&end); |
| 3248 } |
| 3249 |
3219 compiler::Node* CodeStubAssembler::LoadReceiverMap(compiler::Node* receiver) { | 3250 compiler::Node* CodeStubAssembler::LoadReceiverMap(compiler::Node* receiver) { |
3220 Variable var_receiver_map(this, MachineRepresentation::kTagged); | 3251 Variable var_receiver_map(this, MachineRepresentation::kTagged); |
3221 // TODO(ishell): defer blocks when it works. | 3252 // TODO(ishell): defer blocks when it works. |
3222 Label load_smi_map(this /*, Label::kDeferred*/), load_receiver_map(this), | 3253 Label load_smi_map(this /*, Label::kDeferred*/), load_receiver_map(this), |
3223 if_result(this); | 3254 if_result(this); |
3224 | 3255 |
3225 Branch(WordIsSmi(receiver), &load_smi_map, &load_receiver_map); | 3256 Branch(WordIsSmi(receiver), &load_smi_map, &load_receiver_map); |
3226 Bind(&load_smi_map); | 3257 Bind(&load_smi_map); |
3227 { | 3258 { |
3228 var_receiver_map.Bind(LoadRoot(Heap::kHeapNumberMapRootIndex)); | 3259 var_receiver_map.Bind(LoadRoot(Heap::kHeapNumberMapRootIndex)); |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3718 Heap::kTheHoleValueRootIndex); | 3749 Heap::kTheHoleValueRootIndex); |
3719 | 3750 |
3720 // Store the WeakCell in the feedback vector. | 3751 // Store the WeakCell in the feedback vector. |
3721 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, | 3752 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, |
3722 CodeStubAssembler::SMI_PARAMETERS); | 3753 CodeStubAssembler::SMI_PARAMETERS); |
3723 return cell; | 3754 return cell; |
3724 } | 3755 } |
3725 | 3756 |
3726 } // namespace internal | 3757 } // namespace internal |
3727 } // namespace v8 | 3758 } // namespace v8 |
OLD | NEW |