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

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

Issue 1604913002: [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 | « src/crankshaft/ia32/lithium-ia32.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/x64/lithium-x64.cc
diff --git a/src/crankshaft/x64/lithium-x64.cc b/src/crankshaft/x64/lithium-x64.cc
index 3c932a24abde50fc7fc6115e5dec6cb891b6270b..14f03321fae32dd7dc93faeefa276d4de1459c1e 100644
--- a/src/crankshaft/x64/lithium-x64.cc
+++ b/src/crankshaft/x64/lithium-x64.cc
@@ -1511,10 +1511,18 @@ 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);
LMulI* mul = new(zone()) LMulI(left, right);
- 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 | « src/crankshaft/ia32/lithium-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698