Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Unified Diff: src/crankshaft/x87/lithium-x87.cc

Issue 1606203003: X87: [Crankshaft] ia32/x64: Fix environment handling for LMulI. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/x87/lithium-x87.cc
diff --git a/src/crankshaft/x87/lithium-x87.cc b/src/crankshaft/x87/lithium-x87.cc
index b422e1235b49994728a575736f3bb907b809d476..a2eb343e465ddedc9183d29493159ff75894adba 100644
--- a/src/crankshaft/x87/lithium-x87.cc
+++ b/src/crankshaft/x87/lithium-x87.cc
@@ -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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698