| 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 21 matching lines...) Expand all Loading... |
| 32 #include "ast.h" | 32 #include "ast.h" |
| 33 #include "preparse-data-format.h" | 33 #include "preparse-data-format.h" |
| 34 #include "preparse-data.h" | 34 #include "preparse-data.h" |
| 35 #include "scopes.h" | 35 #include "scopes.h" |
| 36 #include "preparser.h" | 36 #include "preparser.h" |
| 37 | 37 |
| 38 namespace v8 { | 38 namespace v8 { |
| 39 namespace internal { | 39 namespace internal { |
| 40 | 40 |
| 41 class CompilationInfo; | 41 class CompilationInfo; |
| 42 class FuncNameInferrer; | |
| 43 class ParserLog; | 42 class ParserLog; |
| 44 class PositionStack; | 43 class PositionStack; |
| 45 class Target; | 44 class Target; |
| 46 | 45 |
| 47 template <typename T> class ZoneListWrapper; | 46 template <typename T> class ZoneListWrapper; |
| 48 | 47 |
| 49 | 48 |
| 50 class FunctionEntry BASE_EMBEDDED { | 49 class FunctionEntry BASE_EMBEDDED { |
| 51 public: | 50 public: |
| 52 enum { | 51 enum { |
| 53 kStartPositionIndex, | 52 kStartPositionIndex, |
| 54 kEndPositionIndex, | 53 kEndPositionIndex, |
| 55 kLiteralCountIndex, | 54 kLiteralCountIndex, |
| 56 kPropertyCountIndex, | 55 kPropertyCountIndex, |
| 57 kLanguageModeIndex, | 56 kStrictModeIndex, |
| 58 kSize | 57 kSize |
| 59 }; | 58 }; |
| 60 | 59 |
| 61 explicit FunctionEntry(Vector<unsigned> backing) | 60 explicit FunctionEntry(Vector<unsigned> backing) |
| 62 : backing_(backing) { } | 61 : backing_(backing) { } |
| 63 | 62 |
| 64 FunctionEntry() : backing_() { } | 63 FunctionEntry() : backing_() { } |
| 65 | 64 |
| 66 int start_pos() { return backing_[kStartPositionIndex]; } | 65 int start_pos() { return backing_[kStartPositionIndex]; } |
| 67 int end_pos() { return backing_[kEndPositionIndex]; } | 66 int end_pos() { return backing_[kEndPositionIndex]; } |
| 68 int literal_count() { return backing_[kLiteralCountIndex]; } | 67 int literal_count() { return backing_[kLiteralCountIndex]; } |
| 69 int property_count() { return backing_[kPropertyCountIndex]; } | 68 int property_count() { return backing_[kPropertyCountIndex]; } |
| 70 LanguageMode language_mode() { | 69 StrictMode strict_mode() { |
| 71 ASSERT(backing_[kLanguageModeIndex] == CLASSIC_MODE || | 70 ASSERT(backing_[kStrictModeIndex] == SLOPPY || |
| 72 backing_[kLanguageModeIndex] == STRICT_MODE || | 71 backing_[kStrictModeIndex] == STRICT); |
| 73 backing_[kLanguageModeIndex] == EXTENDED_MODE); | 72 return static_cast<StrictMode>(backing_[kStrictModeIndex]); |
| 74 return static_cast<LanguageMode>(backing_[kLanguageModeIndex]); | |
| 75 } | 73 } |
| 76 | 74 |
| 77 bool is_valid() { return !backing_.is_empty(); } | 75 bool is_valid() { return !backing_.is_empty(); } |
| 78 | 76 |
| 79 private: | 77 private: |
| 80 Vector<unsigned> backing_; | 78 Vector<unsigned> backing_; |
| 81 }; | 79 }; |
| 82 | 80 |
| 83 | 81 |
| 84 class ScriptDataImpl : public ScriptData { | 82 class ScriptDataImpl : public ScriptData { |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 | 401 |
| 404 // ---------------------------------------------------------------------------- | 402 // ---------------------------------------------------------------------------- |
| 405 // JAVASCRIPT PARSING | 403 // JAVASCRIPT PARSING |
| 406 | 404 |
| 407 class Parser; | 405 class Parser; |
| 408 class SingletonLogger; | 406 class SingletonLogger; |
| 409 | 407 |
| 410 class ParserTraits { | 408 class ParserTraits { |
| 411 public: | 409 public: |
| 412 struct Type { | 410 struct Type { |
| 411 // TODO(marja): To be removed. The Traits object should contain all the data |
| 412 // it needs. |
| 413 typedef v8::internal::Parser* Parser; | 413 typedef v8::internal::Parser* Parser; |
| 414 | 414 |
| 415 // Types used by FunctionState and BlockState. | 415 // Used by FunctionState and BlockState. |
| 416 typedef v8::internal::Scope Scope; | 416 typedef v8::internal::Scope Scope; |
| 417 typedef AstNodeFactory<AstConstructionVisitor> Factory; | |
| 418 typedef Variable GeneratorVariable; | 417 typedef Variable GeneratorVariable; |
| 419 typedef v8::internal::Zone Zone; | 418 typedef v8::internal::Zone Zone; |
| 420 | 419 |
| 421 // Return types for traversing functions. | 420 // Return types for traversing functions. |
| 422 typedef Handle<String> Identifier; | 421 typedef Handle<String> Identifier; |
| 423 typedef v8::internal::Expression* Expression; | 422 typedef v8::internal::Expression* Expression; |
| 423 typedef Yield* YieldExpression; |
| 424 typedef v8::internal::FunctionLiteral* FunctionLiteral; |
| 425 typedef v8::internal::Literal* Literal; |
| 426 typedef ObjectLiteral::Property* ObjectLiteralProperty; |
| 424 typedef ZoneList<v8::internal::Expression*>* ExpressionList; | 427 typedef ZoneList<v8::internal::Expression*>* ExpressionList; |
| 428 typedef ZoneList<ObjectLiteral::Property*>* PropertyList; |
| 429 |
| 430 // For constructing objects returned by the traversing functions. |
| 431 typedef AstNodeFactory<AstConstructionVisitor> Factory; |
| 425 }; | 432 }; |
| 426 | 433 |
| 427 explicit ParserTraits(Parser* parser) : parser_(parser) {} | 434 explicit ParserTraits(Parser* parser) : parser_(parser) {} |
| 428 | 435 |
| 429 // Custom operations executed when FunctionStates are created and destructed. | 436 // Custom operations executed when FunctionStates are created and destructed. |
| 430 template<typename FunctionState> | 437 template<typename FunctionState> |
| 431 static void SetUpFunctionState(FunctionState* function_state, Zone* zone) { | 438 static void SetUpFunctionState(FunctionState* function_state, Zone* zone) { |
| 432 Isolate* isolate = zone->isolate(); | 439 Isolate* isolate = zone->isolate(); |
| 433 function_state->isolate_ = isolate; | 440 function_state->isolate_ = isolate; |
| 434 function_state->saved_ast_node_id_ = isolate->ast_node_id(); | 441 function_state->saved_ast_node_id_ = isolate->ast_node_id(); |
| 435 isolate->set_ast_node_id(BailoutId::FirstUsable().ToInt()); | 442 isolate->set_ast_node_id(BailoutId::FirstUsable().ToInt()); |
| 436 } | 443 } |
| 437 | 444 |
| 438 template<typename FunctionState> | 445 template<typename FunctionState> |
| 439 static void TearDownFunctionState(FunctionState* function_state) { | 446 static void TearDownFunctionState(FunctionState* function_state) { |
| 440 if (function_state->outer_function_state_ != NULL) { | 447 if (function_state->outer_function_state_ != NULL) { |
| 441 function_state->isolate_->set_ast_node_id( | 448 function_state->isolate_->set_ast_node_id( |
| 442 function_state->saved_ast_node_id_); | 449 function_state->saved_ast_node_id_); |
| 443 } | 450 } |
| 444 } | 451 } |
| 445 | 452 |
| 446 // Helper functions for recursive descent. | 453 // Helper functions for recursive descent. |
| 447 bool IsEvalOrArguments(Handle<String> identifier) const; | 454 bool IsEvalOrArguments(Handle<String> identifier) const; |
| 448 | 455 |
| 456 // Returns true if the expression is of type "this.foo". |
| 457 static bool IsThisProperty(Expression* expression); |
| 458 |
| 459 static bool IsBoilerplateProperty(ObjectLiteral::Property* property) { |
| 460 return ObjectLiteral::IsBoilerplateProperty(property); |
| 461 } |
| 462 |
| 463 static bool IsArrayIndex(Handle<String> string, uint32_t* index) { |
| 464 return !string.is_null() && string->AsArrayIndex(index); |
| 465 } |
| 466 |
| 467 // Functions for encapsulating the differences between parsing and preparsing; |
| 468 // operations interleaved with the recursive descent. |
| 469 static void PushLiteralName(FuncNameInferrer* fni, Handle<String> id) { |
| 470 fni->PushLiteralName(id); |
| 471 } |
| 472 |
| 473 static void CheckFunctionLiteralInsideTopLevelObjectLiteral( |
| 474 Scope* scope, Expression* value, bool* has_function) { |
| 475 if (scope->DeclarationScope()->is_global_scope() && |
| 476 value->AsFunctionLiteral() != NULL) { |
| 477 *has_function = true; |
| 478 value->AsFunctionLiteral()->set_pretenure(); |
| 479 } |
| 480 } |
| 481 |
| 482 // If we assign a function literal to a property we pretenure the |
| 483 // literal so it can be added as a constant function property. |
| 484 static void CheckAssigningFunctionLiteralToProperty(Expression* left, |
| 485 Expression* right); |
| 486 |
| 487 // Signal a reference error if the expression is an invalid left-hand side |
| 488 // expression. We could report this as a syntax error but for compatibility |
| 489 // with JSC we choose to report the error at runtime. |
| 490 Expression* ValidateAssignmentLeftHandSide(Expression* expression) const; |
| 491 |
| 492 // Determine if the expression is a variable proxy and mark it as being used |
| 493 // in an assignment or with a increment/decrement operator. This is currently |
| 494 // used on for the statically checking assignments to harmony const bindings. |
| 495 static Expression* MarkExpressionAsLValue(Expression* expression); |
| 496 |
| 497 // Checks LHS expression for assignment and prefix/postfix increment/decrement |
| 498 // in strict mode. |
| 499 void CheckStrictModeLValue(Expression*expression, bool* ok); |
| 500 |
| 449 // Reporting errors. | 501 // Reporting errors. |
| 450 void ReportMessageAt(Scanner::Location source_location, | 502 void ReportMessageAt(Scanner::Location source_location, |
| 451 const char* message, | 503 const char* message, |
| 452 Vector<const char*> args); | 504 Vector<const char*> args); |
| 453 void ReportMessage(const char* message, Vector<Handle<String> > args); | 505 void ReportMessage(const char* message, Vector<Handle<String> > args); |
| 454 void ReportMessageAt(Scanner::Location source_location, | 506 void ReportMessageAt(Scanner::Location source_location, |
| 455 const char* message, | 507 const char* message, |
| 456 Vector<Handle<String> > args); | 508 Vector<Handle<String> > args); |
| 457 | 509 |
| 458 // "null" return type creators. | 510 // "null" return type creators. |
| 459 static Handle<String> EmptyIdentifier() { | 511 static Handle<String> EmptyIdentifier() { |
| 460 return Handle<String>(); | 512 return Handle<String>(); |
| 461 } | 513 } |
| 462 static Expression* EmptyExpression() { | 514 static Expression* EmptyExpression() { |
| 463 return NULL; | 515 return NULL; |
| 464 } | 516 } |
| 517 static Literal* EmptyLiteral() { |
| 518 return NULL; |
| 519 } |
| 520 static ZoneList<Expression*>* NullExpressionList() { |
| 521 return NULL; |
| 522 } |
| 465 | 523 |
| 466 // Odd-ball literal creators. | 524 // Odd-ball literal creators. |
| 467 Literal* GetLiteralTheHole(int position, | 525 Literal* GetLiteralTheHole(int position, |
| 468 AstNodeFactory<AstConstructionVisitor>* factory); | 526 AstNodeFactory<AstConstructionVisitor>* factory); |
| 469 | 527 |
| 470 // Producing data during the recursive descent. | 528 // Producing data during the recursive descent. |
| 471 Handle<String> GetSymbol(Scanner* scanner = NULL); | 529 Handle<String> GetSymbol(Scanner* scanner = NULL); |
| 472 Handle<String> NextLiteralString(Scanner* scanner, | 530 Handle<String> NextLiteralString(Scanner* scanner, |
| 473 PretenureFlag tenured); | 531 PretenureFlag tenured); |
| 474 Expression* ThisExpression(Scope* scope, | 532 Expression* ThisExpression(Scope* scope, |
| 475 AstNodeFactory<AstConstructionVisitor>* factory); | 533 AstNodeFactory<AstConstructionVisitor>* factory); |
| 476 Expression* ExpressionFromLiteral( | 534 Literal* ExpressionFromLiteral( |
| 477 Token::Value token, int pos, Scanner* scanner, | 535 Token::Value token, int pos, Scanner* scanner, |
| 478 AstNodeFactory<AstConstructionVisitor>* factory); | 536 AstNodeFactory<AstConstructionVisitor>* factory); |
| 479 Expression* ExpressionFromIdentifier( | 537 Expression* ExpressionFromIdentifier( |
| 480 Handle<String> name, int pos, Scope* scope, | 538 Handle<String> name, int pos, Scope* scope, |
| 481 AstNodeFactory<AstConstructionVisitor>* factory); | 539 AstNodeFactory<AstConstructionVisitor>* factory); |
| 482 Expression* ExpressionFromString( | 540 Expression* ExpressionFromString( |
| 483 int pos, Scanner* scanner, | 541 int pos, Scanner* scanner, |
| 484 AstNodeFactory<AstConstructionVisitor>* factory); | 542 AstNodeFactory<AstConstructionVisitor>* factory); |
| 485 ZoneList<v8::internal::Expression*>* NewExpressionList(int size, Zone* zone) { | 543 ZoneList<v8::internal::Expression*>* NewExpressionList(int size, Zone* zone) { |
| 486 return new(zone) ZoneList<v8::internal::Expression*>(size, zone); | 544 return new(zone) ZoneList<v8::internal::Expression*>(size, zone); |
| 487 } | 545 } |
| 546 ZoneList<ObjectLiteral::Property*>* NewPropertyList(int size, Zone* zone) { |
| 547 return new(zone) ZoneList<ObjectLiteral::Property*>(size, zone); |
| 548 } |
| 488 | 549 |
| 489 // Temporary glue; these functions will move to ParserBase. | 550 // Temporary glue; these functions will move to ParserBase. |
| 490 Expression* ParseObjectLiteral(bool* ok); | |
| 491 Expression* ParseAssignmentExpression(bool accept_IN, bool* ok); | |
| 492 Expression* ParseV8Intrinsic(bool* ok); | 551 Expression* ParseV8Intrinsic(bool* ok); |
| 552 FunctionLiteral* ParseFunctionLiteral( |
| 553 Handle<String> name, |
| 554 Scanner::Location function_name_location, |
| 555 bool name_is_strict_reserved, |
| 556 bool is_generator, |
| 557 int function_token_position, |
| 558 FunctionLiteral::FunctionType type, |
| 559 bool* ok); |
| 560 Expression* ParseConditionalExpression(bool accept_IN, bool* ok); |
| 493 | 561 |
| 494 private: | 562 private: |
| 495 Parser* parser_; | 563 Parser* parser_; |
| 496 }; | 564 }; |
| 497 | 565 |
| 498 | 566 |
| 499 class Parser : public ParserBase<ParserTraits> { | 567 class Parser : public ParserBase<ParserTraits> { |
| 500 public: | 568 public: |
| 501 explicit Parser(CompilationInfo* info); | 569 explicit Parser(CompilationInfo* info); |
| 502 ~Parser() { | 570 ~Parser() { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 void ReportInvalidPreparseData(Handle<String> name, bool* ok); | 639 void ReportInvalidPreparseData(Handle<String> name, bool* ok); |
| 572 | 640 |
| 573 void set_pre_parse_data(ScriptDataImpl *data) { | 641 void set_pre_parse_data(ScriptDataImpl *data) { |
| 574 pre_parse_data_ = data; | 642 pre_parse_data_ = data; |
| 575 symbol_cache_.Initialize(data ? data->symbol_count() : 0, zone()); | 643 symbol_cache_.Initialize(data ? data->symbol_count() : 0, zone()); |
| 576 } | 644 } |
| 577 | 645 |
| 578 bool inside_with() const { return scope_->inside_with(); } | 646 bool inside_with() const { return scope_->inside_with(); } |
| 579 Mode mode() const { return mode_; } | 647 Mode mode() const { return mode_; } |
| 580 ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; } | 648 ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; } |
| 581 bool is_extended_mode() { | |
| 582 ASSERT(scope_ != NULL); | |
| 583 return scope_->is_extended_mode(); | |
| 584 } | |
| 585 Scope* DeclarationScope(VariableMode mode) { | 649 Scope* DeclarationScope(VariableMode mode) { |
| 586 return IsLexicalVariableMode(mode) | 650 return IsLexicalVariableMode(mode) |
| 587 ? scope_ : scope_->DeclarationScope(); | 651 ? scope_ : scope_->DeclarationScope(); |
| 588 } | 652 } |
| 589 | 653 |
| 590 // All ParseXXX functions take as the last argument an *ok parameter | 654 // All ParseXXX functions take as the last argument an *ok parameter |
| 591 // which is set to false if parsing failed; it is unchanged otherwise. | 655 // which is set to false if parsing failed; it is unchanged otherwise. |
| 592 // By making the 'exception handling' explicit, we are forced to check | 656 // By making the 'exception handling' explicit, we are forced to check |
| 593 // for failure at the call sites. | 657 // for failure at the call sites. |
| 594 void* ParseSourceElements(ZoneList<Statement*>* processor, int end_token, | 658 void* ParseSourceElements(ZoneList<Statement*>* processor, int end_token, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 WhileStatement* ParseWhileStatement(ZoneStringList* labels, bool* ok); | 693 WhileStatement* ParseWhileStatement(ZoneStringList* labels, bool* ok); |
| 630 Statement* ParseForStatement(ZoneStringList* labels, bool* ok); | 694 Statement* ParseForStatement(ZoneStringList* labels, bool* ok); |
| 631 Statement* ParseThrowStatement(bool* ok); | 695 Statement* ParseThrowStatement(bool* ok); |
| 632 Expression* MakeCatchContext(Handle<String> id, VariableProxy* value); | 696 Expression* MakeCatchContext(Handle<String> id, VariableProxy* value); |
| 633 TryStatement* ParseTryStatement(bool* ok); | 697 TryStatement* ParseTryStatement(bool* ok); |
| 634 DebuggerStatement* ParseDebuggerStatement(bool* ok); | 698 DebuggerStatement* ParseDebuggerStatement(bool* ok); |
| 635 | 699 |
| 636 // Support for hamony block scoped bindings. | 700 // Support for hamony block scoped bindings. |
| 637 Block* ParseScopedBlock(ZoneStringList* labels, bool* ok); | 701 Block* ParseScopedBlock(ZoneStringList* labels, bool* ok); |
| 638 | 702 |
| 639 Expression* ParseAssignmentExpression(bool accept_IN, bool* ok); | |
| 640 Expression* ParseYieldExpression(bool* ok); | |
| 641 Expression* ParseConditionalExpression(bool accept_IN, bool* ok); | 703 Expression* ParseConditionalExpression(bool accept_IN, bool* ok); |
| 642 Expression* ParseBinaryExpression(int prec, bool accept_IN, bool* ok); | 704 Expression* ParseBinaryExpression(int prec, bool accept_IN, bool* ok); |
| 643 Expression* ParseUnaryExpression(bool* ok); | 705 Expression* ParseUnaryExpression(bool* ok); |
| 644 Expression* ParsePostfixExpression(bool* ok); | 706 Expression* ParsePostfixExpression(bool* ok); |
| 645 Expression* ParseLeftHandSideExpression(bool* ok); | 707 Expression* ParseLeftHandSideExpression(bool* ok); |
| 646 Expression* ParseMemberWithNewPrefixesExpression(bool* ok); | 708 Expression* ParseMemberWithNewPrefixesExpression(bool* ok); |
| 647 Expression* ParseMemberExpression(bool* ok); | 709 Expression* ParseMemberExpression(bool* ok); |
| 648 Expression* ParseMemberExpressionContinuation(Expression* expression, | 710 Expression* ParseMemberExpressionContinuation(Expression* expression, |
| 649 bool* ok); | 711 bool* ok); |
| 650 Expression* ParseObjectLiteral(bool* ok); | 712 Expression* ParseObjectLiteral(bool* ok); |
| 651 | 713 |
| 652 // Initialize the components of a for-in / for-of statement. | 714 // Initialize the components of a for-in / for-of statement. |
| 653 void InitializeForEachStatement(ForEachStatement* stmt, | 715 void InitializeForEachStatement(ForEachStatement* stmt, |
| 654 Expression* each, | 716 Expression* each, |
| 655 Expression* subject, | 717 Expression* subject, |
| 656 Statement* body); | 718 Statement* body); |
| 657 | 719 |
| 658 ZoneList<Expression*>* ParseArguments(bool* ok); | |
| 659 FunctionLiteral* ParseFunctionLiteral( | 720 FunctionLiteral* ParseFunctionLiteral( |
| 660 Handle<String> name, | 721 Handle<String> name, |
| 661 Scanner::Location function_name_location, | 722 Scanner::Location function_name_location, |
| 662 bool name_is_strict_reserved, | 723 bool name_is_strict_reserved, |
| 663 bool is_generator, | 724 bool is_generator, |
| 664 int function_token_position, | 725 int function_token_position, |
| 665 FunctionLiteral::FunctionType type, | 726 FunctionLiteral::FunctionType type, |
| 666 bool* ok); | 727 bool* ok); |
| 667 | 728 |
| 668 // Magical syntax support. | 729 // Magical syntax support. |
| 669 Expression* ParseV8Intrinsic(bool* ok); | 730 Expression* ParseV8Intrinsic(bool* ok); |
| 670 | 731 |
| 671 bool CheckInOrOf(bool accept_OF, ForEachStatement::VisitMode* visit_mode); | 732 bool CheckInOrOf(bool accept_OF, ForEachStatement::VisitMode* visit_mode); |
| 672 | 733 |
| 673 Handle<String> LiteralString(PretenureFlag tenured) { | |
| 674 if (scanner()->is_literal_ascii()) { | |
| 675 return isolate_->factory()->NewStringFromAscii( | |
| 676 scanner()->literal_ascii_string(), tenured); | |
| 677 } else { | |
| 678 return isolate_->factory()->NewStringFromTwoByte( | |
| 679 scanner()->literal_utf16_string(), tenured); | |
| 680 } | |
| 681 } | |
| 682 | |
| 683 // Get odd-ball literals. | 734 // Get odd-ball literals. |
| 684 Literal* GetLiteralUndefined(int position); | 735 Literal* GetLiteralUndefined(int position); |
| 685 | 736 |
| 686 // Determine if the expression is a variable proxy and mark it as being used | |
| 687 // in an assignment or with a increment/decrement operator. This is currently | |
| 688 // used on for the statically checking assignments to harmony const bindings. | |
| 689 void MarkAsLValue(Expression* expression); | |
| 690 | |
| 691 // Strict mode validation of LValue expressions | |
| 692 void CheckStrictModeLValue(Expression* expression, | |
| 693 bool* ok); | |
| 694 | |
| 695 // For harmony block scoping mode: Check if the scope has conflicting var/let | 737 // For harmony block scoping mode: Check if the scope has conflicting var/let |
| 696 // declarations from different scopes. It covers for example | 738 // declarations from different scopes. It covers for example |
| 697 // | 739 // |
| 698 // function f() { { { var x; } let x; } } | 740 // function f() { { { var x; } let x; } } |
| 699 // function g() { { var x; let x; } } | 741 // function g() { { var x; let x; } } |
| 700 // | 742 // |
| 701 // The var declarations are hoisted to the function scope, but originate from | 743 // The var declarations are hoisted to the function scope, but originate from |
| 702 // a scope where the name has also been let bound or the var declaration is | 744 // a scope where the name has also been let bound or the var declaration is |
| 703 // hoisted over such a scope. | 745 // hoisted over such a scope. |
| 704 void CheckConflictingVarDeclarations(Scope* scope, bool* ok); | 746 void CheckConflictingVarDeclarations(Scope* scope, bool* ok); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 | 789 |
| 748 Isolate* isolate_; | 790 Isolate* isolate_; |
| 749 ZoneList<Handle<String> > symbol_cache_; | 791 ZoneList<Handle<String> > symbol_cache_; |
| 750 | 792 |
| 751 Handle<Script> script_; | 793 Handle<Script> script_; |
| 752 Scanner scanner_; | 794 Scanner scanner_; |
| 753 PreParser* reusable_preparser_; | 795 PreParser* reusable_preparser_; |
| 754 Scope* original_scope_; // for ES5 function declarations in sloppy eval | 796 Scope* original_scope_; // for ES5 function declarations in sloppy eval |
| 755 Target* target_stack_; // for break, continue statements | 797 Target* target_stack_; // for break, continue statements |
| 756 ScriptDataImpl* pre_parse_data_; | 798 ScriptDataImpl* pre_parse_data_; |
| 757 FuncNameInferrer* fni_; | |
| 758 | 799 |
| 759 Mode mode_; | 800 Mode mode_; |
| 760 | 801 |
| 761 CompilationInfo* info_; | 802 CompilationInfo* info_; |
| 762 }; | 803 }; |
| 763 | 804 |
| 764 | 805 |
| 765 // Support for handling complex values (array and object literals) that | 806 // Support for handling complex values (array and object literals) that |
| 766 // can be fully handled at compile time. | 807 // can be fully handled at compile time. |
| 767 class CompileTimeValue: public AllStatic { | 808 class CompileTimeValue: public AllStatic { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 786 private: | 827 private: |
| 787 static const int kLiteralTypeSlot = 0; | 828 static const int kLiteralTypeSlot = 0; |
| 788 static const int kElementsSlot = 1; | 829 static const int kElementsSlot = 1; |
| 789 | 830 |
| 790 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); | 831 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); |
| 791 }; | 832 }; |
| 792 | 833 |
| 793 } } // namespace v8::internal | 834 } } // namespace v8::internal |
| 794 | 835 |
| 795 #endif // V8_PARSER_H_ | 836 #endif // V8_PARSER_H_ |
| OLD | NEW |