Index: src/parser.cc |
diff --git a/src/parser.cc b/src/parser.cc |
index b4ab623829b9657382ab58bcbe347ce4b31d3dff..06dcced8ff1b669cfc5aefacc46ca50447f318a1 100644 |
--- a/src/parser.cc |
+++ b/src/parser.cc |
@@ -3286,6 +3286,16 @@ Expression* Parser::ParseUnaryExpression(bool* ok) { |
} |
} |
+ // Desugar '+foo' into 'foo*1', this enables the collection of type feedback |
+ // without any special stub and the multiplication is removed later in |
+ // Crankshaft's canonicalization pass. |
+ if (op == Token::ADD) { |
+ return factory()->NewBinaryOperation(Token::MUL, |
+ expression, |
+ factory()->NewNumberLiteral(1), |
+ position); |
+ } |
+ |
return factory()->NewUnaryOperation(op, expression, position); |
} else if (Token::IsCountOp(op)) { |