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

Unified Diff: src/crankshaft/hydrogen.cc

Issue 2491333002: [crankshaft] Always force number representation for increment. (Closed)
Patch Set: Remove redundant parameter Created 4 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/crankshaft/hydrogen.h ('k') | test/mjsunit/regress/regress-664087.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/hydrogen.cc
diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc
index aaa1c7160717e0f2e3c81f4c603cff6b681c263c..be15c379d5e4cecd1c2dec686e7b918e1bc53a5b 100644
--- a/src/crankshaft/hydrogen.cc
+++ b/src/crankshaft/hydrogen.cc
@@ -10386,28 +10386,23 @@ static Representation RepresentationFor(AstType* type) {
return Representation::Tagged();
}
-
-HInstruction* HOptimizedGraphBuilder::BuildIncrement(
- bool returns_original_input,
- CountOperation* expr) {
+HInstruction* HOptimizedGraphBuilder::BuildIncrement(CountOperation* expr) {
// The input to the count operation is on top of the expression stack.
Representation rep = RepresentationFor(expr->type());
if (rep.IsNone() || rep.IsTagged()) {
rep = Representation::Smi();
}
- if (returns_original_input) {
- // We need an explicit HValue representing ToNumber(input). The
- // actual HChange instruction we need is (sometimes) added in a later
- // phase, so it is not available now to be used as an input to HAdd and
- // as the return value.
- HInstruction* number_input = AddUncasted<HForceRepresentation>(Pop(), rep);
- if (!rep.IsDouble()) {
- number_input->SetFlag(HInstruction::kFlexibleRepresentation);
- number_input->SetFlag(HInstruction::kCannotBeTagged);
- }
- Push(number_input);
+ // We need an explicit HValue representing ToNumber(input). The
+ // actual HChange instruction we need is (sometimes) added in a later
+ // phase, so it is not available now to be used as an input to HAdd and
+ // as the return value.
+ HInstruction* number_input = AddUncasted<HForceRepresentation>(Pop(), rep);
+ if (!rep.IsDouble()) {
+ number_input->SetFlag(HInstruction::kFlexibleRepresentation);
+ number_input->SetFlag(HInstruction::kCannotBeTagged);
}
+ Push(number_input);
// The addition has no side effects, so we do not need
// to simulate the expression stack after this instruction.
@@ -10466,7 +10461,7 @@ void HOptimizedGraphBuilder::VisitCountOperation(CountOperation* expr) {
DCHECK(prop == NULL);
CHECK_ALIVE(VisitForValue(target));
- after = BuildIncrement(returns_original_input, expr);
+ after = BuildIncrement(expr);
input = returns_original_input ? Top() : Pop();
Push(after);
@@ -10519,7 +10514,7 @@ void HOptimizedGraphBuilder::VisitCountOperation(CountOperation* expr) {
CHECK_ALIVE(PushLoad(prop, object, key));
- after = BuildIncrement(returns_original_input, expr);
+ after = BuildIncrement(expr);
if (returns_original_input) {
input = Pop();
« no previous file with comments | « src/crankshaft/hydrogen.h ('k') | test/mjsunit/regress/regress-664087.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698