OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_PARSING_PARSER_H_ | 5 #ifndef V8_PARSING_PARSER_H_ |
6 #define V8_PARSING_PARSER_H_ | 6 #define V8_PARSING_PARSER_H_ |
7 | 7 |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/base/compiler-specific.h" | 10 #include "src/base/compiler-specific.h" |
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 V8_INLINE static void CheckAssigningFunctionLiteralToProperty( | 822 V8_INLINE static void CheckAssigningFunctionLiteralToProperty( |
823 Expression* left, Expression* right) { | 823 Expression* left, Expression* right) { |
824 DCHECK(left != NULL); | 824 DCHECK(left != NULL); |
825 if (left->IsProperty() && right->IsFunctionLiteral()) { | 825 if (left->IsProperty() && right->IsFunctionLiteral()) { |
826 right->AsFunctionLiteral()->set_pretenure(); | 826 right->AsFunctionLiteral()->set_pretenure(); |
827 } | 827 } |
828 } | 828 } |
829 | 829 |
830 // Determine if the expression is a variable proxy and mark it as being used | 830 // Determine if the expression is a variable proxy and mark it as being used |
831 // in an assignment or with a increment/decrement operator. | 831 // in an assignment or with a increment/decrement operator. |
832 V8_INLINE static Expression* MarkExpressionAsAssigned( | 832 V8_INLINE static void MarkExpressionAsAssigned(Expression* expression) { |
833 Expression* expression) { | 833 DCHECK_NOT_NULL(expression); |
834 VariableProxy* proxy = | 834 if (expression->IsVariableProxy()) { |
835 expression != NULL ? expression->AsVariableProxy() : NULL; | 835 expression->AsVariableProxy()->set_is_assigned(); |
836 if (proxy != NULL) proxy->set_is_assigned(); | 836 } |
837 return expression; | |
838 } | 837 } |
839 | 838 |
840 // Returns true if we have a binary expression between two numeric | 839 // Returns true if we have a binary expression between two numeric |
841 // literals. In that case, *x will be changed to an expression which is the | 840 // literals. In that case, *x will be changed to an expression which is the |
842 // computed value. | 841 // computed value. |
843 bool ShortcutNumericLiteralBinaryExpression(Expression** x, Expression* y, | 842 bool ShortcutNumericLiteralBinaryExpression(Expression** x, Expression* y, |
844 Token::Value op, int pos); | 843 Token::Value op, int pos); |
845 | 844 |
846 // Rewrites the following types of unary expressions: | 845 // Rewrites the following types of unary expressions: |
847 // not <literal> -> true / false | 846 // not <literal> -> true / false |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 | 1192 |
1194 private: | 1193 private: |
1195 ParserTarget** variable_; | 1194 ParserTarget** variable_; |
1196 ParserTarget* previous_; | 1195 ParserTarget* previous_; |
1197 }; | 1196 }; |
1198 | 1197 |
1199 } // namespace internal | 1198 } // namespace internal |
1200 } // namespace v8 | 1199 } // namespace v8 |
1201 | 1200 |
1202 #endif // V8_PARSING_PARSER_H_ | 1201 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |