| 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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 static bool IsArrayIndex(const AstRawString* string, uint32_t* index) { | 411 static bool IsArrayIndex(const AstRawString* string, uint32_t* index) { |
| 412 return string->AsArrayIndex(index); | 412 return string->AsArrayIndex(index); |
| 413 } | 413 } |
| 414 | 414 |
| 415 // Functions for encapsulating the differences between parsing and preparsing; | 415 // Functions for encapsulating the differences between parsing and preparsing; |
| 416 // operations interleaved with the recursive descent. | 416 // operations interleaved with the recursive descent. |
| 417 static void PushLiteralName(FuncNameInferrer* fni, const AstRawString* id) { | 417 static void PushLiteralName(FuncNameInferrer* fni, const AstRawString* id) { |
| 418 fni->PushLiteralName(id); | 418 fni->PushLiteralName(id); |
| 419 } | 419 } |
| 420 void PushPropertyName(FuncNameInferrer* fni, Expression* expression); | 420 void PushPropertyName(FuncNameInferrer* fni, Expression* expression); |
| 421 static void InferFunctionName(FuncNameInferrer* fni, |
| 422 FunctionLiteral* func_to_infer) { |
| 423 fni->AddFunction(func_to_infer); |
| 424 } |
| 421 | 425 |
| 422 static void CheckFunctionLiteralInsideTopLevelObjectLiteral( | 426 static void CheckFunctionLiteralInsideTopLevelObjectLiteral( |
| 423 Scope* scope, Expression* value, bool* has_function) { | 427 Scope* scope, Expression* value, bool* has_function) { |
| 424 if (scope->DeclarationScope()->is_global_scope() && | 428 if (scope->DeclarationScope()->is_global_scope() && |
| 425 value->AsFunctionLiteral() != NULL) { | 429 value->AsFunctionLiteral() != NULL) { |
| 426 *has_function = true; | 430 *has_function = true; |
| 427 value->AsFunctionLiteral()->set_pretenure(); | 431 value->AsFunctionLiteral()->set_pretenure(); |
| 428 } | 432 } |
| 429 } | 433 } |
| 430 | 434 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 | 525 |
| 522 // Odd-ball literal creators. | 526 // Odd-ball literal creators. |
| 523 Literal* GetLiteralTheHole(int position, | 527 Literal* GetLiteralTheHole(int position, |
| 524 AstNodeFactory<AstConstructionVisitor>* factory); | 528 AstNodeFactory<AstConstructionVisitor>* factory); |
| 525 | 529 |
| 526 // Producing data during the recursive descent. | 530 // Producing data during the recursive descent. |
| 527 const AstRawString* GetSymbol(Scanner* scanner); | 531 const AstRawString* GetSymbol(Scanner* scanner); |
| 528 const AstRawString* GetNextSymbol(Scanner* scanner); | 532 const AstRawString* GetNextSymbol(Scanner* scanner); |
| 529 | 533 |
| 530 Expression* ThisExpression(Scope* scope, | 534 Expression* ThisExpression(Scope* scope, |
| 531 AstNodeFactory<AstConstructionVisitor>* factory); | 535 AstNodeFactory<AstConstructionVisitor>* factory, |
| 536 int pos = RelocInfo::kNoPosition); |
| 532 Literal* ExpressionFromLiteral( | 537 Literal* ExpressionFromLiteral( |
| 533 Token::Value token, int pos, Scanner* scanner, | 538 Token::Value token, int pos, Scanner* scanner, |
| 534 AstNodeFactory<AstConstructionVisitor>* factory); | 539 AstNodeFactory<AstConstructionVisitor>* factory); |
| 535 Expression* ExpressionFromIdentifier( | 540 Expression* ExpressionFromIdentifier( |
| 536 const AstRawString* name, int pos, Scope* scope, | 541 const AstRawString* name, int pos, Scope* scope, |
| 537 AstNodeFactory<AstConstructionVisitor>* factory); | 542 AstNodeFactory<AstConstructionVisitor>* factory); |
| 538 Expression* ExpressionFromString( | 543 Expression* ExpressionFromString( |
| 539 int pos, Scanner* scanner, | 544 int pos, Scanner* scanner, |
| 540 AstNodeFactory<AstConstructionVisitor>* factory); | 545 AstNodeFactory<AstConstructionVisitor>* factory); |
| 541 ZoneList<v8::internal::Expression*>* NewExpressionList(int size, Zone* zone) { | 546 ZoneList<v8::internal::Expression*>* NewExpressionList(int size, Zone* zone) { |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 private: | 881 private: |
| 877 static const int kLiteralTypeSlot = 0; | 882 static const int kLiteralTypeSlot = 0; |
| 878 static const int kElementsSlot = 1; | 883 static const int kElementsSlot = 1; |
| 879 | 884 |
| 880 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 885 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
| 881 }; | 886 }; |
| 882 | 887 |
| 883 } } // namespace v8::internal | 888 } } // namespace v8::internal |
| 884 | 889 |
| 885 #endif // V8_PARSER_H_ | 890 #endif // V8_PARSER_H_ |
| OLD | NEW |