| 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/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
| 10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 fni->PushLiteralName(id); | 397 fni->PushLiteralName(id); |
| 398 } | 398 } |
| 399 | 399 |
| 400 void PushPropertyName(FuncNameInferrer* fni, Expression* expression); | 400 void PushPropertyName(FuncNameInferrer* fni, Expression* expression); |
| 401 | 401 |
| 402 static void InferFunctionName(FuncNameInferrer* fni, | 402 static void InferFunctionName(FuncNameInferrer* fni, |
| 403 FunctionLiteral* func_to_infer) { | 403 FunctionLiteral* func_to_infer) { |
| 404 fni->AddFunction(func_to_infer); | 404 fni->AddFunction(func_to_infer); |
| 405 } | 405 } |
| 406 | 406 |
| 407 static void CheckFunctionLiteralInsideTopLevelObjectLiteral( | |
| 408 Scope* scope, ObjectLiteralProperty* property, bool* has_function) { | |
| 409 Expression* value = property->value(); | |
| 410 if (scope->DeclarationScope()->is_script_scope() && | |
| 411 value->AsFunctionLiteral() != NULL) { | |
| 412 *has_function = true; | |
| 413 value->AsFunctionLiteral()->set_pretenure(); | |
| 414 } | |
| 415 } | |
| 416 | |
| 417 // If we assign a function literal to a property we pretenure the | 407 // If we assign a function literal to a property we pretenure the |
| 418 // literal so it can be added as a constant function property. | 408 // literal so it can be added as a constant function property. |
| 419 static void CheckAssigningFunctionLiteralToProperty(Expression* left, | 409 static void CheckAssigningFunctionLiteralToProperty(Expression* left, |
| 420 Expression* right); | 410 Expression* right); |
| 421 | 411 |
| 422 // Determine if the expression is a variable proxy and mark it as being used | 412 // Determine if the expression is a variable proxy and mark it as being used |
| 423 // in an assignment or with a increment/decrement operator. | 413 // in an assignment or with a increment/decrement operator. |
| 424 static Expression* MarkExpressionAsAssigned(Expression* expression); | 414 static Expression* MarkExpressionAsAssigned(Expression* expression); |
| 425 | 415 |
| 426 // Returns true if we have a binary expression between two numeric | 416 // Returns true if we have a binary expression between two numeric |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1240 | 1230 |
| 1241 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { | 1231 DoExpression* ParserTraits::ParseDoExpression(bool* ok) { |
| 1242 return parser_->ParseDoExpression(ok); | 1232 return parser_->ParseDoExpression(ok); |
| 1243 } | 1233 } |
| 1244 | 1234 |
| 1245 | 1235 |
| 1246 } // namespace internal | 1236 } // namespace internal |
| 1247 } // namespace v8 | 1237 } // namespace v8 |
| 1248 | 1238 |
| 1249 #endif // V8_PARSING_PARSER_H_ | 1239 #endif // V8_PARSING_PARSER_H_ |
| OLD | NEW |