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. |
| 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 DCHECK(feedback->IsSmi()); |
| 1151 BinaryOperationHints::Hint hint = |
| 1152 BinaryOperationHintFromFeedback((Smi::cast(feedback))->value()); |
| 1153 BinaryOperationHints hints(hint, hint, hint); |
1145 BuildBinaryOp(javascript()->Subtract(hints)); | 1154 BuildBinaryOp(javascript()->Subtract(hints)); |
1146 } | 1155 } |
1147 | 1156 |
1148 void BytecodeGraphBuilder::VisitMul() { | 1157 void BytecodeGraphBuilder::VisitMul() { |
1149 BinaryOperationHints hints = BinaryOperationHints::Any(); | 1158 BinaryOperationHints hints = BinaryOperationHints::Any(); |
1150 BuildBinaryOp(javascript()->Multiply(hints)); | 1159 BuildBinaryOp(javascript()->Multiply(hints)); |
1151 } | 1160 } |
1152 | 1161 |
1153 void BytecodeGraphBuilder::VisitDiv() { | 1162 void BytecodeGraphBuilder::VisitDiv() { |
1154 BinaryOperationHints hints = BinaryOperationHints::Any(); | 1163 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. | 1832 // Phi does not exist yet, introduce one. |
1824 value = NewPhi(inputs, value, control); | 1833 value = NewPhi(inputs, value, control); |
1825 value->ReplaceInput(inputs - 1, other); | 1834 value->ReplaceInput(inputs - 1, other); |
1826 } | 1835 } |
1827 return value; | 1836 return value; |
1828 } | 1837 } |
1829 | 1838 |
1830 } // namespace compiler | 1839 } // namespace compiler |
1831 } // namespace internal | 1840 } // namespace internal |
1832 } // namespace v8 | 1841 } // namespace v8 |
OLD | NEW |