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 #include "src/code-stub-assembler.h" | 4 #include "src/code-stub-assembler.h" |
5 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/frames-inl.h" | 6 #include "src/frames-inl.h" |
7 #include "src/frames.h" | 7 #include "src/frames.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 return SelectConstant(condition, TrueConstant(), FalseConstant(), | 124 return SelectConstant(condition, TrueConstant(), FalseConstant(), |
125 MachineRepresentation::kTagged); | 125 MachineRepresentation::kTagged); |
126 } | 126 } |
127 | 127 |
128 Node* CodeStubAssembler::SelectTaggedConstant(Node* condition, Node* true_value, | 128 Node* CodeStubAssembler::SelectTaggedConstant(Node* condition, Node* true_value, |
129 Node* false_value) { | 129 Node* false_value) { |
130 return SelectConstant(condition, true_value, false_value, | 130 return SelectConstant(condition, true_value, false_value, |
131 MachineRepresentation::kTagged); | 131 MachineRepresentation::kTagged); |
132 } | 132 } |
133 | 133 |
| 134 Node* CodeStubAssembler::SelectSmiConstant(Node* condition, Smi* true_value, |
| 135 Smi* false_value) { |
| 136 return SelectConstant(condition, SmiConstant(true_value), |
| 137 SmiConstant(false_value), |
| 138 MachineRepresentation::kTaggedSigned); |
| 139 } |
| 140 |
134 Node* CodeStubAssembler::NoContextConstant() { return NumberConstant(0); } | 141 Node* CodeStubAssembler::NoContextConstant() { return NumberConstant(0); } |
135 | 142 |
136 #define HEAP_CONSTANT_ACCESSOR(rootName, name) \ | 143 #define HEAP_CONSTANT_ACCESSOR(rootName, name) \ |
137 Node* CodeStubAssembler::name##Constant() { \ | 144 Node* CodeStubAssembler::name##Constant() { \ |
138 return LoadRoot(Heap::k##rootName##RootIndex); \ | 145 return LoadRoot(Heap::k##rootName##RootIndex); \ |
139 } | 146 } |
140 HEAP_CONSTANT_LIST(HEAP_CONSTANT_ACCESSOR); | 147 HEAP_CONSTANT_LIST(HEAP_CONSTANT_ACCESSOR); |
141 #undef HEAP_CONSTANT_ACCESSOR | 148 #undef HEAP_CONSTANT_ACCESSOR |
142 | 149 |
143 #define HEAP_CONSTANT_TEST(rootName, name) \ | 150 #define HEAP_CONSTANT_TEST(rootName, name) \ |
(...skipping 5312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5456 Node* literals = LoadObjectField(function, JSFunction::kLiteralsOffset); | 5463 Node* literals = LoadObjectField(function, JSFunction::kLiteralsOffset); |
5457 return LoadObjectField(literals, LiteralsArray::kFeedbackVectorOffset); | 5464 return LoadObjectField(literals, LiteralsArray::kFeedbackVectorOffset); |
5458 } | 5465 } |
5459 | 5466 |
5460 void CodeStubAssembler::UpdateFeedback(Node* feedback, | 5467 void CodeStubAssembler::UpdateFeedback(Node* feedback, |
5461 Node* type_feedback_vector, | 5468 Node* type_feedback_vector, |
5462 Node* slot_id) { | 5469 Node* slot_id) { |
5463 // This method is used for binary op and compare feedback. These | 5470 // This method is used for binary op and compare feedback. These |
5464 // vector nodes are initialized with a smi 0, so we can simply OR | 5471 // vector nodes are initialized with a smi 0, so we can simply OR |
5465 // our new feedback in place. | 5472 // our new feedback in place. |
5466 // TODO(interpreter): Consider passing the feedback as Smi already to avoid | |
5467 // the tagging completely. | |
5468 Node* previous_feedback = | 5473 Node* previous_feedback = |
5469 LoadFixedArrayElement(type_feedback_vector, slot_id); | 5474 LoadFixedArrayElement(type_feedback_vector, slot_id); |
5470 Node* combined_feedback = SmiOr(previous_feedback, SmiFromWord32(feedback)); | 5475 Node* combined_feedback = SmiOr(previous_feedback, feedback); |
5471 StoreFixedArrayElement(type_feedback_vector, slot_id, combined_feedback, | 5476 StoreFixedArrayElement(type_feedback_vector, slot_id, combined_feedback, |
5472 SKIP_WRITE_BARRIER); | 5477 SKIP_WRITE_BARRIER); |
5473 } | 5478 } |
5474 | 5479 |
5475 Node* CodeStubAssembler::LoadReceiverMap(Node* receiver) { | 5480 Node* CodeStubAssembler::LoadReceiverMap(Node* receiver) { |
5476 Variable var_receiver_map(this, MachineRepresentation::kTagged); | 5481 Variable var_receiver_map(this, MachineRepresentation::kTagged); |
5477 Label load_smi_map(this, Label::kDeferred), load_receiver_map(this), | 5482 Label load_smi_map(this, Label::kDeferred), load_receiver_map(this), |
5478 if_result(this); | 5483 if_result(this); |
5479 | 5484 |
5480 Branch(TaggedIsSmi(receiver), &load_smi_map, &load_receiver_map); | 5485 Branch(TaggedIsSmi(receiver), &load_smi_map, &load_receiver_map); |
(...skipping 2863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8344 StoreObjectFieldNoWriteBarrier(result, | 8349 StoreObjectFieldNoWriteBarrier(result, |
8345 PromiseReactionJobInfo::kDebugNameOffset, | 8350 PromiseReactionJobInfo::kDebugNameOffset, |
8346 SmiConstant(kDebugNotActive)); | 8351 SmiConstant(kDebugNotActive)); |
8347 StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kContextOffset, | 8352 StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kContextOffset, |
8348 context); | 8353 context); |
8349 return result; | 8354 return result; |
8350 } | 8355 } |
8351 | 8356 |
8352 } // namespace internal | 8357 } // namespace internal |
8353 } // namespace v8 | 8358 } // namespace v8 |
OLD | NEW |