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 3564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3575 LoadFromParentFrame(JavaScriptFrameConstants::kFunctionOffset); | 3575 LoadFromParentFrame(JavaScriptFrameConstants::kFunctionOffset); |
3576 Node* literals = LoadObjectField(function, JSFunction::kLiteralsOffset); | 3576 Node* literals = LoadObjectField(function, JSFunction::kLiteralsOffset); |
3577 return LoadObjectField(literals, LiteralsArray::kFeedbackVectorOffset); | 3577 return LoadObjectField(literals, LiteralsArray::kFeedbackVectorOffset); |
3578 } | 3578 } |
3579 | 3579 |
3580 void CodeStubAssembler::UpdateFeedback(compiler::Node* feedback, | 3580 void CodeStubAssembler::UpdateFeedback(compiler::Node* feedback, |
3581 compiler::Node* type_feedback_vector, | 3581 compiler::Node* type_feedback_vector, |
3582 compiler::Node* slot_id) { | 3582 compiler::Node* slot_id) { |
3583 Label combine_feedback(this), record_feedback(this), end(this); | 3583 Label combine_feedback(this), record_feedback(this), end(this); |
3584 | 3584 |
| 3585 // This method is used for binary op and compare feedback. These |
| 3586 // vector nodes are initialized with a smi 0, so we can simply OR |
| 3587 // our new feedback in place. |
3585 Node* previous_feedback = | 3588 Node* previous_feedback = |
3586 LoadFixedArrayElement(type_feedback_vector, slot_id); | 3589 LoadFixedArrayElement(type_feedback_vector, slot_id); |
3587 Node* is_uninitialized = WordEqual( | 3590 Node* untagged_previous_feedback = SmiUntag(previous_feedback); |
3588 previous_feedback, | 3591 Node* combined_feedback = Word32Or(untagged_previous_feedback, feedback); |
3589 HeapConstant(TypeFeedbackVector::UninitializedSentinel(isolate()))); | 3592 StoreFixedArrayElement(type_feedback_vector, slot_id, |
3590 BranchIf(is_uninitialized, &record_feedback, &combine_feedback); | 3593 SmiTag(combined_feedback), SKIP_WRITE_BARRIER); |
3591 | |
3592 Bind(&record_feedback); | |
3593 { | |
3594 StoreFixedArrayElement(type_feedback_vector, slot_id, SmiTag(feedback), | |
3595 SKIP_WRITE_BARRIER); | |
3596 Goto(&end); | |
3597 } | |
3598 | |
3599 Bind(&combine_feedback); | |
3600 { | |
3601 Node* untagged_previous_feedback = SmiUntag(previous_feedback); | |
3602 Node* combined_feedback = Word32Or(untagged_previous_feedback, feedback); | |
3603 StoreFixedArrayElement(type_feedback_vector, slot_id, | |
3604 SmiTag(combined_feedback), SKIP_WRITE_BARRIER); | |
3605 Goto(&end); | |
3606 } | |
3607 | |
3608 Bind(&end); | |
3609 } | 3594 } |
3610 | 3595 |
3611 compiler::Node* CodeStubAssembler::LoadReceiverMap(compiler::Node* receiver) { | 3596 compiler::Node* CodeStubAssembler::LoadReceiverMap(compiler::Node* receiver) { |
3612 Variable var_receiver_map(this, MachineRepresentation::kTagged); | 3597 Variable var_receiver_map(this, MachineRepresentation::kTagged); |
3613 // TODO(ishell): defer blocks when it works. | 3598 // TODO(ishell): defer blocks when it works. |
3614 Label load_smi_map(this /*, Label::kDeferred*/), load_receiver_map(this), | 3599 Label load_smi_map(this /*, Label::kDeferred*/), load_receiver_map(this), |
3615 if_result(this); | 3600 if_result(this); |
3616 | 3601 |
3617 Branch(WordIsSmi(receiver), &load_smi_map, &load_receiver_map); | 3602 Branch(WordIsSmi(receiver), &load_smi_map, &load_receiver_map); |
3618 Bind(&load_smi_map); | 3603 Bind(&load_smi_map); |
(...skipping 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5137 Heap::kTheHoleValueRootIndex); | 5122 Heap::kTheHoleValueRootIndex); |
5138 | 5123 |
5139 // Store the WeakCell in the feedback vector. | 5124 // Store the WeakCell in the feedback vector. |
5140 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, | 5125 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, |
5141 CodeStubAssembler::SMI_PARAMETERS); | 5126 CodeStubAssembler::SMI_PARAMETERS); |
5142 return cell; | 5127 return cell; |
5143 } | 5128 } |
5144 | 5129 |
5145 } // namespace internal | 5130 } // namespace internal |
5146 } // namespace v8 | 5131 } // namespace v8 |
OLD | NEW |