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

Unified Diff: src/hydrogen.cc

Issue 77053003: Remove the first_right_arg hack for HMod. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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/arm/lithium-codegen-arm.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 8d73c1e51976f7cd4b2e849e1faf5f9c8930f94c..e980ecc5a9116fa1f05fd1447e773e162c6d1ed6 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -8717,9 +8717,24 @@ HValue* HGraphBuilder::BuildBinaryOperation(
case Token::MUL:
instr = AddUncasted<HMul>(left, right);
break;
- case Token::MOD:
- instr = AddUncasted<HMod>(left, right, fixed_right_arg);
+ case Token::MOD: {
+ if (fixed_right_arg.has_value) {
+ if (right->IsConstant()) {
+ ASSERT_EQ(fixed_right_arg.value,
+ HConstant::cast(right)->Integer32Value());
+ } else {
+ HConstant* fixed_right = Add<HConstant>(
+ static_cast<int>(fixed_right_arg.value));
+ IfBuilder if_same(this);
+ if_same.If<HCompareNumericAndBranch>(right, fixed_right, Token::EQ);
+ if_same.Then();
+ if_same.ElseDeopt("Unexpected RHS of binary operation");
+ right = fixed_right;
+ }
+ }
+ instr = AddUncasted<HMod>(left, right);
break;
+ }
case Token::DIV:
instr = AddUncasted<HDiv>(left, right);
break;
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698