OLD | NEW |
---|---|
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/compiler/bytecode-graph-builder.h" | 5 #include "src/compiler/bytecode-graph-builder.h" |
6 | 6 |
7 #include "src/compiler/bytecode-branch-analysis.h" | 7 #include "src/compiler/bytecode-branch-analysis.h" |
8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
9 #include "src/compiler/operator-properties.h" | 9 #include "src/compiler/operator-properties.h" |
10 #include "src/interpreter/bytecodes.h" | 10 #include "src/interpreter/bytecodes.h" |
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1134 Node* node = NewNode(js_op, left, right); | 1134 Node* node = NewNode(js_op, left, right); |
1135 environment()->BindAccumulator(node, &states); | 1135 environment()->BindAccumulator(node, &states); |
1136 } | 1136 } |
1137 | 1137 |
1138 void BytecodeGraphBuilder::VisitAdd() { | 1138 void BytecodeGraphBuilder::VisitAdd() { |
1139 BinaryOperationHints hints = BinaryOperationHints::Any(); | 1139 BinaryOperationHints hints = BinaryOperationHints::Any(); |
1140 BuildBinaryOp(javascript()->Add(hints)); | 1140 BuildBinaryOp(javascript()->Add(hints)); |
1141 } | 1141 } |
1142 | 1142 |
1143 void BytecodeGraphBuilder::VisitSub() { | 1143 void BytecodeGraphBuilder::VisitSub() { |
1144 BinaryOperationHints hints = BinaryOperationHints::Any(); | 1144 // TODO(mythria): Move this to a helper function, once more binary operations |
1145 // record type feedback. | |
rmcilroy
2016/08/08 08:27:31
Could you just do this now so that it's reused whe
mythria
2016/08/09 00:51:59
Done.
| |
1146 FeedbackVectorSlot slot = | |
1147 feedback_vector()->ToSlot(bytecode_iterator().GetIndexOperand(1)); | |
1148 DCHECK_EQ(FeedbackVectorSlotKind::GENERAL, feedback_vector()->GetKind(slot)); | |
1149 Object* feedback = feedback_vector()->Get(slot); | |
1150 BinaryOperationHints::Hint hint = BinaryOperationHints::Hint::kAny; | |
1151 if (feedback->IsSmi()) { | |
1152 hint = BinaryOperationHintFromFeedback((Smi::cast(feedback))->value()); | |
1153 } | |
1154 BinaryOperationHints hints(hint, hint, hint); | |
1145 BuildBinaryOp(javascript()->Subtract(hints)); | 1155 BuildBinaryOp(javascript()->Subtract(hints)); |
1146 } | 1156 } |
1147 | 1157 |
1148 void BytecodeGraphBuilder::VisitMul() { | 1158 void BytecodeGraphBuilder::VisitMul() { |
1149 BinaryOperationHints hints = BinaryOperationHints::Any(); | 1159 BinaryOperationHints hints = BinaryOperationHints::Any(); |
1150 BuildBinaryOp(javascript()->Multiply(hints)); | 1160 BuildBinaryOp(javascript()->Multiply(hints)); |
1151 } | 1161 } |
1152 | 1162 |
1153 void BytecodeGraphBuilder::VisitDiv() { | 1163 void BytecodeGraphBuilder::VisitDiv() { |
1154 BinaryOperationHints hints = BinaryOperationHints::Any(); | 1164 BinaryOperationHints hints = BinaryOperationHints::Any(); |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1823 // Phi does not exist yet, introduce one. | 1833 // Phi does not exist yet, introduce one. |
1824 value = NewPhi(inputs, value, control); | 1834 value = NewPhi(inputs, value, control); |
1825 value->ReplaceInput(inputs - 1, other); | 1835 value->ReplaceInput(inputs - 1, other); |
1826 } | 1836 } |
1827 return value; | 1837 return value; |
1828 } | 1838 } |
1829 | 1839 |
1830 } // namespace compiler | 1840 } // namespace compiler |
1831 } // namespace internal | 1841 } // namespace internal |
1832 } // namespace v8 | 1842 } // namespace v8 |
OLD | NEW |