Chromium Code Reviews| Index: src/hydrogen.cc |
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
| index 27b8a2629307be9b036bb4bc7020336ae3873226..4fb96fb3b6699af2b3e04668b971b34df71a4ae4 100644 |
| --- a/src/hydrogen.cc |
| +++ b/src/hydrogen.cc |
| @@ -4653,12 +4653,19 @@ void HGraphBuilder::VisitUnaryOperation(UnaryOperation* expr) { |
| } |
| -HInstruction* HGraphBuilder::BuildIncrement(HValue* value, bool increment) { |
| +HInstruction* HGraphBuilder::BuildIncrement(HValue* value, |
| + bool increment, |
| + CountOperation* expr) { |
| HConstant* delta = increment |
| ? graph_->GetConstant1() |
| : graph_->GetConstantMinus1(); |
| HInstruction* instr = new(zone()) HAdd(value, delta); |
| - AssumeRepresentation(instr, Representation::Integer32()); |
| + Representation rep = ToRepresentation(oracle()->IncrementType(expr)); |
| + if (rep.Equals(Representation::Tagged())) { |
|
fschneider
2011/04/29 08:56:22
you can write
if (rep.IsTagged())
Until we supp
William Hesse
2011/04/29 09:20:34
Done both. We generate the int32 representation.
|
| + Bailout("Count operation with non-number input."); |
| + } else { |
| + AssumeRepresentation(instr, rep); |
| + } |
| return instr; |
| } |
| @@ -4681,7 +4688,7 @@ void HGraphBuilder::VisitCountOperation(CountOperation* expr) { |
| // element for postfix operations in a non-effect context. |
| bool has_extra = expr->is_postfix() && !ast_context()->IsEffect(); |
| HValue* before = has_extra ? Top() : Pop(); |
| - HInstruction* after = BuildIncrement(before, inc); |
| + HInstruction* after = BuildIncrement(before, inc, expr); |
| AddInstruction(after); |
| Push(after); |
| @@ -4733,7 +4740,7 @@ void HGraphBuilder::VisitCountOperation(CountOperation* expr) { |
| HValue* before = Pop(); |
| // There is no deoptimization to after the increment, so we don't need |
| // to simulate the expression stack after this instruction. |
| - HInstruction* after = BuildIncrement(before, inc); |
| + HInstruction* after = BuildIncrement(before, inc, expr); |
| AddInstruction(after); |
| HInstruction* store = BuildStoreNamed(obj, after, prop); |
| @@ -4769,7 +4776,7 @@ void HGraphBuilder::VisitCountOperation(CountOperation* expr) { |
| HValue* before = Pop(); |
| // There is no deoptimization to after the increment, so we don't need |
| // to simulate the expression stack after this instruction. |
| - HInstruction* after = BuildIncrement(before, inc); |
| + HInstruction* after = BuildIncrement(before, inc, expr); |
| AddInstruction(after); |
| expr->RecordTypeFeedback(oracle()); |