[turbofan] Extend LoopVariableOptimizer to speculative ops.

This extends the matching of arithmetic operations against the loop
induction variable to speculative number operations (on top of the
existing JS-level operations). This is needed now that lowering to
speculative operations is done during graph construction.

R=jarin@chromium.org
BUG=chromium:693035

Change-Id: I7c3f71af92b5c059f1d7b3b7f2d3b4a73d7dc43d
Reviewed-on: https://chromium-review.googlesource.com/445196
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43325}
This commit is contained in:
Michael Starzinger 2017-02-20 14:40:40 +01:00 committed by Commit Bot
parent a690aa2994
commit 3d157f7ff6

View File

@ -303,9 +303,11 @@ InductionVariable* LoopVariableOptimizer::TryGetInductionVariable(Node* phi) {
Node* initial = phi->InputAt(0);
Node* arith = phi->InputAt(1);
InductionVariable::ArithmeticType arithmeticType;
if (arith->opcode() == IrOpcode::kJSAdd) {
if (arith->opcode() == IrOpcode::kJSAdd ||
arith->opcode() == IrOpcode::kSpeculativeNumberAdd) {
arithmeticType = InductionVariable::ArithmeticType::kAddition;
} else if (arith->opcode() == IrOpcode::kJSSubtract) {
} else if (arith->opcode() == IrOpcode::kJSSubtract ||
arith->opcode() == IrOpcode::kSpeculativeNumberSubtract) {
arithmeticType = InductionVariable::ArithmeticType::kSubtraction;
} else {
return nullptr;