Commit 75cf114b authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: [Crankshaft] ia32/x64: Fix environment handling for LMulI.

  port 2dde677f (r33386)

  original commit message:
  This is the ia32/x64 version of https://codereview.chromium.org/873703002,
  which fixed the same problem on arm/arm64.

BUG=

Review URL: https://codereview.chromium.org/1606203003

Cr-Commit-Position: refs/heads/master@{#33424}
parent a2c0aee6
......@@ -1534,14 +1534,22 @@ LInstruction* LChunkBuilder::DoMul(HMul* instr) {
DCHECK(instr->left()->representation().Equals(instr->representation()));
DCHECK(instr->right()->representation().Equals(instr->representation()));
LOperand* left = UseRegisterAtStart(instr->BetterLeftOperand());
LOperand* right = UseOrConstant(instr->BetterRightOperand());
HValue* h_right = instr->BetterRightOperand();
LOperand* right = UseOrConstant(h_right);
LOperand* temp = NULL;
if (instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
temp = TempRegister();
}
LMulI* mul = new(zone()) LMulI(left, right, temp);
if (instr->CheckFlag(HValue::kCanOverflow) ||
instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
int constant_value =
h_right->IsConstant() ? HConstant::cast(h_right)->Integer32Value() : 0;
// |needs_environment| must mirror the cases where LCodeGen::DoMulI calls
// |DeoptimizeIf|.
bool needs_environment =
instr->CheckFlag(HValue::kCanOverflow) ||
(instr->CheckFlag(HValue::kBailoutOnMinusZero) &&
(!right->IsConstantOperand() || constant_value <= 0));
if (needs_environment) {
AssignEnvironment(mul);
}
return DefineSameAsFirst(mul);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment