OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 3268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3279 // "delete identifier" is a syntax error in strict mode. | 3279 // "delete identifier" is a syntax error in strict mode. |
3280 if (op == Token::DELETE && !top_scope_->is_classic_mode()) { | 3280 if (op == Token::DELETE && !top_scope_->is_classic_mode()) { |
3281 VariableProxy* operand = expression->AsVariableProxy(); | 3281 VariableProxy* operand = expression->AsVariableProxy(); |
3282 if (operand != NULL && !operand->is_this()) { | 3282 if (operand != NULL && !operand->is_this()) { |
3283 ReportMessage("strict_delete", Vector<const char*>::empty()); | 3283 ReportMessage("strict_delete", Vector<const char*>::empty()); |
3284 *ok = false; | 3284 *ok = false; |
3285 return NULL; | 3285 return NULL; |
3286 } | 3286 } |
3287 } | 3287 } |
3288 | 3288 |
| 3289 // Desugar '+foo' into 'foo*1', this enables the collection of type feedback |
| 3290 // without any special stub and the multiplication is removed later in |
| 3291 // Crankshaft's canonicalization pass. |
| 3292 if (op == Token::ADD) { |
| 3293 return factory()->NewBinaryOperation(Token::MUL, |
| 3294 expression, |
| 3295 factory()->NewNumberLiteral(1), |
| 3296 position); |
| 3297 } |
| 3298 |
3289 return factory()->NewUnaryOperation(op, expression, position); | 3299 return factory()->NewUnaryOperation(op, expression, position); |
3290 | 3300 |
3291 } else if (Token::IsCountOp(op)) { | 3301 } else if (Token::IsCountOp(op)) { |
3292 op = Next(); | 3302 op = Next(); |
3293 Expression* expression = ParseUnaryExpression(CHECK_OK); | 3303 Expression* expression = ParseUnaryExpression(CHECK_OK); |
3294 // Signal a reference error if the expression is an invalid | 3304 // Signal a reference error if the expression is an invalid |
3295 // left-hand side expression. We could report this as a syntax | 3305 // left-hand side expression. We could report this as a syntax |
3296 // error here but for compatibility with JSC we choose to report the | 3306 // error here but for compatibility with JSC we choose to report the |
3297 // error at runtime. | 3307 // error at runtime. |
3298 if (expression == NULL || !expression->IsValidLeftHandSide()) { | 3308 if (expression == NULL || !expression->IsValidLeftHandSide()) { |
(...skipping 2708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6007 ASSERT(info()->isolate()->has_pending_exception()); | 6017 ASSERT(info()->isolate()->has_pending_exception()); |
6008 } else { | 6018 } else { |
6009 result = ParseProgram(); | 6019 result = ParseProgram(); |
6010 } | 6020 } |
6011 } | 6021 } |
6012 info()->SetFunction(result); | 6022 info()->SetFunction(result); |
6013 return (result != NULL); | 6023 return (result != NULL); |
6014 } | 6024 } |
6015 | 6025 |
6016 } } // namespace v8::internal | 6026 } } // namespace v8::internal |
OLD | NEW |