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

Unified Diff: src/hydrogen.cc

Issue 17028017: Flexible representation for BuildIncrement, but CannotBeTagged. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Let inferrepr figure out the repr of the add Created 7 years, 6 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 | 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 74a573ef8fd91a6b9a112d75969805223640137d..b62d31a0a20b3147ec857ecb0384f93ae178c7fc 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -2953,7 +2953,11 @@ void HInferRepresentation::Analyze() {
current != NULL; current = current->next()) {
if (current->representation().IsNone() &&
current->CheckFlag(HInstruction::kFlexibleRepresentation)) {
- current->ChangeRepresentation(Representation::Tagged());
+ if (current->CheckFlag(HInstruction::kCannotBeTagged)) {
+ current->ChangeRepresentation(Representation::Double());
+ } else {
+ current->ChangeRepresentation(Representation::Tagged());
+ }
}
}
}
@@ -9182,8 +9186,8 @@ HInstruction* HOptimizedGraphBuilder::BuildIncrement(
// The input to the count operation is on top of the expression stack.
TypeInfo info = expr->type();
Representation rep = ToRepresentation(info);
- if (rep.IsTagged()) {
- rep = Representation::Integer32();
+ if (rep.IsNone() || rep.IsTagged()) {
+ rep = Representation::Smi();
}
if (returns_original_input) {
@@ -9192,6 +9196,10 @@ HInstruction* HOptimizedGraphBuilder::BuildIncrement(
// phase, so it is not available now to be used as an input to HAdd and
// as the return value.
HInstruction* number_input = new(zone()) HForceRepresentation(Pop(), rep);
+ if (!rep.IsDouble()) {
+ number_input->SetFlag(HInstruction::kFlexibleRepresentation);
+ number_input->SetFlag(HInstruction::kCannotBeTagged);
+ }
AddInstruction(number_input);
Push(number_input);
}
@@ -9204,10 +9212,7 @@ HInstruction* HOptimizedGraphBuilder::BuildIncrement(
: graph()->GetConstantMinus1();
HValue* context = environment()->LookupContext();
HInstruction* instr = HAdd::New(zone(), context, Top(), delta);
- // We can't insert a simulate here, because it would break deoptimization,
- // so the HAdd must not have side effects, so we must freeze its
- // representation.
- instr->AssumeRepresentation(rep);
+ instr->SetFlag(HInstruction::kCannotBeTagged);
instr->ClearAllSideEffects();
AddInstruction(instr);
return instr;
« no previous file with comments | « no previous file | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698