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

Unified Diff: src/hydrogen.cc

Issue 6880276: Use type info for count operation in Crankshaft. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 8 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 | « src/hydrogen.h ('k') | src/type-info.h » ('j') | src/type-info.cc » ('J')
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 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());
« no previous file with comments | « src/hydrogen.h ('k') | src/type-info.h » ('j') | src/type-info.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698