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_PARSER_H_ | 5 #ifndef V8_PARSER_H_ |
6 #define V8_PARSER_H_ | 6 #define V8_PARSER_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/ast.h" | 9 #include "src/ast.h" |
10 #include "src/compiler.h" // For CachedDataMode | 10 #include "src/compiler.h" // For CachedDataMode |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 static void PushLiteralName(FuncNameInferrer* fni, const AstRawString* id) { | 432 static void PushLiteralName(FuncNameInferrer* fni, const AstRawString* id) { |
433 fni->PushLiteralName(id); | 433 fni->PushLiteralName(id); |
434 } | 434 } |
435 void PushPropertyName(FuncNameInferrer* fni, Expression* expression); | 435 void PushPropertyName(FuncNameInferrer* fni, Expression* expression); |
436 static void InferFunctionName(FuncNameInferrer* fni, | 436 static void InferFunctionName(FuncNameInferrer* fni, |
437 FunctionLiteral* func_to_infer) { | 437 FunctionLiteral* func_to_infer) { |
438 fni->AddFunction(func_to_infer); | 438 fni->AddFunction(func_to_infer); |
439 } | 439 } |
440 | 440 |
441 static void CheckFunctionLiteralInsideTopLevelObjectLiteral( | 441 static void CheckFunctionLiteralInsideTopLevelObjectLiteral( |
442 Scope* scope, Expression* value, bool* has_function) { | 442 Scope* scope, ObjectLiteralProperty* property, bool* has_function) { |
| 443 Expression* value = property->value(); |
443 if (scope->DeclarationScope()->is_global_scope() && | 444 if (scope->DeclarationScope()->is_global_scope() && |
444 value->AsFunctionLiteral() != NULL) { | 445 value->AsFunctionLiteral() != NULL) { |
445 *has_function = true; | 446 *has_function = true; |
446 value->AsFunctionLiteral()->set_pretenure(); | 447 value->AsFunctionLiteral()->set_pretenure(); |
447 } | 448 } |
448 } | 449 } |
449 | 450 |
450 // If we assign a function literal to a property we pretenure the | 451 // If we assign a function literal to a property we pretenure the |
451 // literal so it can be added as a constant function property. | 452 // literal so it can be added as a constant function property. |
452 static void CheckAssigningFunctionLiteralToProperty(Expression* left, | 453 static void CheckAssigningFunctionLiteralToProperty(Expression* left, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 static const AstRawString* EmptyIdentifier() { | 523 static const AstRawString* EmptyIdentifier() { |
523 return NULL; | 524 return NULL; |
524 } | 525 } |
525 static Expression* EmptyExpression() { | 526 static Expression* EmptyExpression() { |
526 return NULL; | 527 return NULL; |
527 } | 528 } |
528 static Expression* EmptyArrowParamList() { return NULL; } | 529 static Expression* EmptyArrowParamList() { return NULL; } |
529 static Literal* EmptyLiteral() { | 530 static Literal* EmptyLiteral() { |
530 return NULL; | 531 return NULL; |
531 } | 532 } |
| 533 static ObjectLiteralProperty* EmptyObjectLiteralProperty() { return NULL; } |
532 | 534 |
533 // Used in error return values. | 535 // Used in error return values. |
534 static ZoneList<Expression*>* NullExpressionList() { | 536 static ZoneList<Expression*>* NullExpressionList() { |
535 return NULL; | 537 return NULL; |
536 } | 538 } |
537 | 539 |
538 // Non-NULL empty string. | 540 // Non-NULL empty string. |
539 V8_INLINE const AstRawString* EmptyIdentifierString(); | 541 V8_INLINE const AstRawString* EmptyIdentifierString(); |
540 | 542 |
541 // Odd-ball literal creators. | 543 // Odd-ball literal creators. |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 private: | 900 private: |
899 static const int kLiteralTypeSlot = 0; | 901 static const int kLiteralTypeSlot = 0; |
900 static const int kElementsSlot = 1; | 902 static const int kElementsSlot = 1; |
901 | 903 |
902 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 904 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
903 }; | 905 }; |
904 | 906 |
905 } } // namespace v8::internal | 907 } } // namespace v8::internal |
906 | 908 |
907 #endif // V8_PARSER_H_ | 909 #endif // V8_PARSER_H_ |
OLD | NEW |