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/compiler/loop-variable-optimizer.h" | 5 #include "src/compiler/loop-variable-optimizer.h" |
6 | 6 |
7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
8 #include "src/compiler/graph.h" | 8 #include "src/compiler/graph.h" |
9 #include "src/compiler/node-marker.h" | 9 #include "src/compiler/node-marker.h" |
10 #include "src/compiler/node-properties.h" | 10 #include "src/compiler/node-properties.h" |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 arithmeticType = InductionVariable::ArithmeticType::kAddition; | 310 arithmeticType = InductionVariable::ArithmeticType::kAddition; |
311 } else if (arith->opcode() == IrOpcode::kJSSubtract || | 311 } else if (arith->opcode() == IrOpcode::kJSSubtract || |
312 arith->opcode() == IrOpcode::kSpeculativeNumberSubtract) { | 312 arith->opcode() == IrOpcode::kSpeculativeNumberSubtract) { |
313 arithmeticType = InductionVariable::ArithmeticType::kSubtraction; | 313 arithmeticType = InductionVariable::ArithmeticType::kSubtraction; |
314 } else { | 314 } else { |
315 return nullptr; | 315 return nullptr; |
316 } | 316 } |
317 | 317 |
318 // TODO(jarin) Support both sides. | 318 // TODO(jarin) Support both sides. |
319 if (arith->InputAt(0) != phi) { | 319 if (arith->InputAt(0) != phi) { |
320 if (arith->InputAt(0)->opcode() != IrOpcode::kJSToNumber || | 320 if ((arith->InputAt(0)->opcode() != IrOpcode::kJSToNumber && |
| 321 arith->InputAt(0)->opcode() != IrOpcode::kSpeculativeToNumber) || |
321 arith->InputAt(0)->InputAt(0) != phi) { | 322 arith->InputAt(0)->InputAt(0) != phi) { |
322 return nullptr; | 323 return nullptr; |
323 } | 324 } |
324 } | 325 } |
325 Node* incr = arith->InputAt(1); | 326 Node* incr = arith->InputAt(1); |
326 return new (zone()) | 327 return new (zone()) |
327 InductionVariable(phi, arith, incr, initial, zone(), arithmeticType); | 328 InductionVariable(phi, arith, incr, initial, zone(), arithmeticType); |
328 } | 329 } |
329 | 330 |
330 void LoopVariableOptimizer::DetectInductionVariables(Node* loop) { | 331 void LoopVariableOptimizer::DetectInductionVariables(Node* loop) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 backedge_value, backedge_control); | 401 backedge_value, backedge_control); |
401 induction_var->phi()->ReplaceInput(1, rename); | 402 induction_var->phi()->ReplaceInput(1, rename); |
402 } | 403 } |
403 } | 404 } |
404 } | 405 } |
405 } | 406 } |
406 | 407 |
407 } // namespace compiler | 408 } // namespace compiler |
408 } // namespace internal | 409 } // namespace internal |
409 } // namespace v8 | 410 } // namespace v8 |
OLD | NEW |