OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/simplified-operator-reducer.h" | 5 #include "src/compiler/simplified-operator-reducer.h" |
6 | 6 |
7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
8 #include "src/compiler/machine-operator.h" | 8 #include "src/compiler/machine-operator.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/compiler/operator-properties.h" | 10 #include "src/compiler/operator-properties.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 switch (DecideObjectIsSmi(input)) { | 150 switch (DecideObjectIsSmi(input)) { |
151 case Decision::kTrue: | 151 case Decision::kTrue: |
152 return ReplaceBoolean(true); | 152 return ReplaceBoolean(true); |
153 case Decision::kFalse: | 153 case Decision::kFalse: |
154 return ReplaceBoolean(false); | 154 return ReplaceBoolean(false); |
155 case Decision::kUnknown: | 155 case Decision::kUnknown: |
156 break; | 156 break; |
157 } | 157 } |
158 break; | 158 break; |
159 } | 159 } |
| 160 case IrOpcode::kNumberAbs: { |
| 161 NumberMatcher m(node->InputAt(0)); |
| 162 if (m.HasValue()) return ReplaceNumber(std::fabs(m.Value())); |
| 163 break; |
| 164 } |
160 case IrOpcode::kNumberCeil: | 165 case IrOpcode::kNumberCeil: |
161 case IrOpcode::kNumberFloor: | 166 case IrOpcode::kNumberFloor: |
162 case IrOpcode::kNumberRound: | 167 case IrOpcode::kNumberRound: |
163 case IrOpcode::kNumberTrunc: { | 168 case IrOpcode::kNumberTrunc: { |
164 Node* const input = NodeProperties::GetValueInput(node, 0); | 169 Node* const input = NodeProperties::GetValueInput(node, 0); |
165 Type* const input_type = NodeProperties::GetType(input); | 170 Type* const input_type = NodeProperties::GetType(input); |
166 if (input_type->Is(type_cache_.kIntegerOrMinusZeroOrNaN)) { | 171 if (input_type->Is(type_cache_.kIntegerOrMinusZeroOrNaN)) { |
167 return Replace(input); | 172 return Replace(input); |
168 } | 173 } |
169 break; | 174 break; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 Graph* SimplifiedOperatorReducer::graph() const { return jsgraph()->graph(); } | 244 Graph* SimplifiedOperatorReducer::graph() const { return jsgraph()->graph(); } |
240 | 245 |
241 | 246 |
242 MachineOperatorBuilder* SimplifiedOperatorReducer::machine() const { | 247 MachineOperatorBuilder* SimplifiedOperatorReducer::machine() const { |
243 return jsgraph()->machine(); | 248 return jsgraph()->machine(); |
244 } | 249 } |
245 | 250 |
246 } // namespace compiler | 251 } // namespace compiler |
247 } // namespace internal | 252 } // namespace internal |
248 } // namespace v8 | 253 } // namespace v8 |
OLD | NEW |