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

Unified Diff: src/hydrogen.cc

Issue 198833002: Make translation of modulus operation '--stress-opt'-proof. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added test Created 6 years, 9 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 | test/mjsunit/regress/regress-352059.js » ('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 ce5ad80b11ca44f026650735d637e66effce8d34..6dae101b08c1e41a05304a14b33f12029da793a2 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -9225,21 +9225,15 @@ HValue* HGraphBuilder::BuildBinaryOperation(
instr = AddUncasted<HMul>(left, right);
break;
case Token::MOD: {
- if (fixed_right_arg.has_value) {
- if (right->IsConstant()) {
- HConstant* c_right = HConstant::cast(right);
- if (c_right->HasInteger32Value()) {
- ASSERT_EQ(fixed_right_arg.value, c_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;
- }
+ if (fixed_right_arg.has_value &&
+ !right->EqualsInteger32Constant(fixed_right_arg.value)) {
+ 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;
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-352059.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698