Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: src/parser.h

Issue 181453002: Reset trunk to 3.24.35.4 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects-visiting-inl.h ('k') | src/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 bool multiline_; 397 bool multiline_;
398 bool simple_; 398 bool simple_;
399 bool contains_anchor_; 399 bool contains_anchor_;
400 bool is_scanned_for_captures_; 400 bool is_scanned_for_captures_;
401 bool failed_; 401 bool failed_;
402 }; 402 };
403 403
404 // ---------------------------------------------------------------------------- 404 // ----------------------------------------------------------------------------
405 // JAVASCRIPT PARSING 405 // JAVASCRIPT PARSING
406 406
407 class Parser; 407 // Forward declaration.
408 class SingletonLogger; 408 class SingletonLogger;
409 409
410 class ParserTraits { 410 class Parser : public ParserBase {
411 public:
412 struct Type {
413 typedef v8::internal::Parser* Parser;
414
415 // Types used by FunctionState and BlockState.
416 typedef v8::internal::Scope Scope;
417 typedef AstNodeFactory<AstConstructionVisitor> Factory;
418 typedef Variable GeneratorVariable;
419 typedef v8::internal::Zone Zone;
420
421 // Return types for traversing functions.
422 typedef Handle<String> Identifier;
423 typedef v8::internal::Expression* Expression;
424 typedef ZoneList<v8::internal::Expression*>* ExpressionList;
425 };
426
427 explicit ParserTraits(Parser* parser) : parser_(parser) {}
428
429 // Custom operations executed when FunctionStates are created and destructed.
430 template<typename FS>
431 static void SetUpFunctionState(FS* function_state, Zone* zone) {
432 Isolate* isolate = zone->isolate();
433 function_state->isolate_ = isolate;
434 function_state->saved_ast_node_id_ = isolate->ast_node_id();
435 isolate->set_ast_node_id(BailoutId::FirstUsable().ToInt());
436 }
437
438 template<typename FS>
439 static void TearDownFunctionState(FS* function_state) {
440 if (function_state->outer_function_state_ != NULL) {
441 function_state->isolate_->set_ast_node_id(
442 function_state->saved_ast_node_id_);
443 }
444 }
445
446 // Helper functions for recursive descent.
447 bool IsEvalOrArguments(Handle<String> identifier) const;
448
449 // Reporting errors.
450 void ReportMessageAt(Scanner::Location source_location,
451 const char* message,
452 Vector<const char*> args);
453 void ReportMessage(const char* message, Vector<Handle<String> > args);
454 void ReportMessageAt(Scanner::Location source_location,
455 const char* message,
456 Vector<Handle<String> > args);
457
458 // "null" return type creators.
459 static Handle<String> EmptyIdentifier() {
460 return Handle<String>();
461 }
462 static Expression* EmptyExpression() {
463 return NULL;
464 }
465
466 // Odd-ball literal creators.
467 Literal* GetLiteralTheHole(int position,
468 AstNodeFactory<AstConstructionVisitor>* factory);
469
470 // Producing data during the recursive descent.
471 Handle<String> GetSymbol(Scanner* scanner = NULL);
472 Handle<String> NextLiteralString(Scanner* scanner,
473 PretenureFlag tenured);
474 Expression* ThisExpression(Scope* scope,
475 AstNodeFactory<AstConstructionVisitor>* factory);
476 Expression* ExpressionFromLiteral(
477 Token::Value token, int pos, Scanner* scanner,
478 AstNodeFactory<AstConstructionVisitor>* factory);
479 Expression* ExpressionFromIdentifier(
480 Handle<String> name, int pos, Scope* scope,
481 AstNodeFactory<AstConstructionVisitor>* factory);
482 Expression* ExpressionFromString(
483 int pos, Scanner* scanner,
484 AstNodeFactory<AstConstructionVisitor>* factory);
485 ZoneList<v8::internal::Expression*>* NewExpressionList(int size, Zone* zone) {
486 return new(zone) ZoneList<v8::internal::Expression*>(size, zone);
487 }
488
489 // 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);
493
494 private:
495 Parser* parser_;
496 };
497
498
499 class Parser : public ParserBase<ParserTraits> {
500 public: 411 public:
501 explicit Parser(CompilationInfo* info); 412 explicit Parser(CompilationInfo* info);
502 ~Parser() { 413 ~Parser() {
503 delete reusable_preparser_; 414 delete reusable_preparser_;
504 reusable_preparser_ = NULL; 415 reusable_preparser_ = NULL;
505 } 416 }
506 417
507 // Parses the source code represented by the compilation info and sets its 418 // Parses the source code represented by the compilation info and sets its
508 // function literal. Returns false (and deallocates any allocated AST 419 // function literal. Returns false (and deallocates any allocated AST
509 // nodes) if parsing failed. 420 // nodes) if parsing failed.
510 static bool Parse(CompilationInfo* info, 421 static bool Parse(CompilationInfo* info,
511 bool allow_lazy = false) { 422 bool allow_lazy = false) {
512 Parser parser(info); 423 Parser parser(info);
513 parser.set_allow_lazy(allow_lazy); 424 parser.set_allow_lazy(allow_lazy);
514 return parser.Parse(); 425 return parser.Parse();
515 } 426 }
516 bool Parse(); 427 bool Parse();
517 428
518 private: 429 private:
519 friend class ParserTraits;
520
521 static const int kMaxNumFunctionLocals = 131071; // 2^17-1 430 static const int kMaxNumFunctionLocals = 131071; // 2^17-1
522 431
523 enum Mode { 432 enum Mode {
524 PARSE_LAZILY, 433 PARSE_LAZILY,
525 PARSE_EAGERLY 434 PARSE_EAGERLY
526 }; 435 };
527 436
528 enum VariableDeclarationContext { 437 enum VariableDeclarationContext {
529 kModuleElement, 438 kModuleElement,
530 kBlockElement, 439 kBlockElement,
531 kStatement, 440 kStatement,
532 kForStatement 441 kForStatement
533 }; 442 };
534 443
535 // If a list of variable declarations includes any initializers. 444 // If a list of variable declarations includes any initializers.
536 enum VariableDeclarationProperties { 445 enum VariableDeclarationProperties {
537 kHasInitializers, 446 kHasInitializers,
538 kHasNoInitializers 447 kHasNoInitializers
539 }; 448 };
540 449
450 class BlockState;
451
452 class FunctionState BASE_EMBEDDED {
453 public:
454 FunctionState(Parser* parser, Scope* scope);
455 ~FunctionState();
456
457 int NextMaterializedLiteralIndex() {
458 return next_materialized_literal_index_++;
459 }
460 int materialized_literal_count() {
461 return next_materialized_literal_index_ - JSFunction::kLiteralsPrefixSize;
462 }
463
464 int NextHandlerIndex() { return next_handler_index_++; }
465 int handler_count() { return next_handler_index_; }
466
467 void AddProperty() { expected_property_count_++; }
468 int expected_property_count() { return expected_property_count_; }
469
470 void set_generator_object_variable(Variable *variable) {
471 ASSERT(variable != NULL);
472 ASSERT(!is_generator());
473 generator_object_variable_ = variable;
474 }
475 Variable* generator_object_variable() const {
476 return generator_object_variable_;
477 }
478 bool is_generator() const {
479 return generator_object_variable_ != NULL;
480 }
481
482 AstNodeFactory<AstConstructionVisitor>* factory() { return &factory_; }
483
484 private:
485 // Used to assign an index to each literal that needs materialization in
486 // the function. Includes regexp literals, and boilerplate for object and
487 // array literals.
488 int next_materialized_literal_index_;
489
490 // Used to assign a per-function index to try and catch handlers.
491 int next_handler_index_;
492
493 // Properties count estimation.
494 int expected_property_count_;
495
496 // For generators, the variable that holds the generator object. This
497 // variable is used by yield expressions and return statements. NULL
498 // indicates that this function is not a generator.
499 Variable* generator_object_variable_;
500
501 Parser* parser_;
502 FunctionState* outer_function_state_;
503 Scope* outer_scope_;
504 int saved_ast_node_id_;
505 AstNodeFactory<AstConstructionVisitor> factory_;
506 };
507
541 class ParsingModeScope BASE_EMBEDDED { 508 class ParsingModeScope BASE_EMBEDDED {
542 public: 509 public:
543 ParsingModeScope(Parser* parser, Mode mode) 510 ParsingModeScope(Parser* parser, Mode mode)
544 : parser_(parser), 511 : parser_(parser),
545 old_mode_(parser->mode()) { 512 old_mode_(parser->mode()) {
546 parser_->mode_ = mode; 513 parser_->mode_ = mode;
547 } 514 }
548 ~ParsingModeScope() { 515 ~ParsingModeScope() {
549 parser_->mode_ = old_mode_; 516 parser_->mode_ = old_mode_;
550 } 517 }
551 518
552 private: 519 private:
553 Parser* parser_; 520 Parser* parser_;
554 Mode old_mode_; 521 Mode old_mode_;
555 }; 522 };
556 523
524 virtual bool is_classic_mode() {
525 return top_scope_->is_classic_mode();
526 }
527
557 // Returns NULL if parsing failed. 528 // Returns NULL if parsing failed.
558 FunctionLiteral* ParseProgram(); 529 FunctionLiteral* ParseProgram();
559 530
560 FunctionLiteral* ParseLazy(); 531 FunctionLiteral* ParseLazy();
561 FunctionLiteral* ParseLazy(Utf16CharacterStream* source); 532 FunctionLiteral* ParseLazy(Utf16CharacterStream* source);
562 533
563 Isolate* isolate() { return isolate_; } 534 Isolate* isolate() { return isolate_; }
535 Zone* zone() const { return zone_; }
564 CompilationInfo* info() const { return info_; } 536 CompilationInfo* info() const { return info_; }
565 537
566 // Called by ParseProgram after setting up the scanner. 538 // Called by ParseProgram after setting up the scanner.
567 FunctionLiteral* DoParseProgram(CompilationInfo* info, 539 FunctionLiteral* DoParseProgram(CompilationInfo* info,
568 Handle<String> source); 540 Handle<String> source);
569 541
570 // Report syntax error 542 // Report syntax error
571 void ReportInvalidPreparseData(Handle<String> name, bool* ok); 543 void ReportInvalidPreparseData(Handle<String> name, bool* ok);
544 void ReportMessage(const char* message, Vector<const char*> args);
545 void ReportMessage(const char* message, Vector<Handle<String> > args);
546 void ReportMessageAt(Scanner::Location location, const char* type) {
547 ReportMessageAt(location, type, Vector<const char*>::empty());
548 }
549 void ReportMessageAt(Scanner::Location loc,
550 const char* message,
551 Vector<const char*> args);
552 void ReportMessageAt(Scanner::Location loc,
553 const char* message,
554 Vector<Handle<String> > args);
572 555
573 void set_pre_parse_data(ScriptDataImpl *data) { 556 void set_pre_parse_data(ScriptDataImpl *data) {
574 pre_parse_data_ = data; 557 pre_parse_data_ = data;
575 symbol_cache_.Initialize(data ? data->symbol_count() : 0, zone()); 558 symbol_cache_.Initialize(data ? data->symbol_count() : 0, zone());
576 } 559 }
577 560
578 bool inside_with() const { return scope_->inside_with(); } 561 bool inside_with() const { return top_scope_->inside_with(); }
562 Scanner& scanner() { return scanner_; }
579 Mode mode() const { return mode_; } 563 Mode mode() const { return mode_; }
580 ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; } 564 ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; }
581 bool is_extended_mode() { 565 bool is_extended_mode() {
582 ASSERT(scope_ != NULL); 566 ASSERT(top_scope_ != NULL);
583 return scope_->is_extended_mode(); 567 return top_scope_->is_extended_mode();
584 } 568 }
585 Scope* DeclarationScope(VariableMode mode) { 569 Scope* DeclarationScope(VariableMode mode) {
586 return IsLexicalVariableMode(mode) 570 return IsLexicalVariableMode(mode)
587 ? scope_ : scope_->DeclarationScope(); 571 ? top_scope_ : top_scope_->DeclarationScope();
588 } 572 }
589 573
574 // Check if the given string is 'eval' or 'arguments'.
575 bool IsEvalOrArguments(Handle<String> string);
576
590 // All ParseXXX functions take as the last argument an *ok parameter 577 // All ParseXXX functions take as the last argument an *ok parameter
591 // which is set to false if parsing failed; it is unchanged otherwise. 578 // which is set to false if parsing failed; it is unchanged otherwise.
592 // By making the 'exception handling' explicit, we are forced to check 579 // By making the 'exception handling' explicit, we are forced to check
593 // for failure at the call sites. 580 // for failure at the call sites.
594 void* ParseSourceElements(ZoneList<Statement*>* processor, int end_token, 581 void* ParseSourceElements(ZoneList<Statement*>* processor, int end_token,
595 bool is_eval, bool is_global, bool* ok); 582 bool is_eval, bool is_global, bool* ok);
596 Statement* ParseModuleElement(ZoneStringList* labels, bool* ok); 583 Statement* ParseModuleElement(ZoneStringList* labels, bool* ok);
597 Statement* ParseModuleDeclaration(ZoneStringList* names, bool* ok); 584 Statement* ParseModuleDeclaration(ZoneStringList* names, bool* ok);
598 Module* ParseModule(bool* ok); 585 Module* ParseModule(bool* ok);
599 Module* ParseModuleLiteral(bool* ok); 586 Module* ParseModuleLiteral(bool* ok);
(...skipping 29 matching lines...) Expand all
629 WhileStatement* ParseWhileStatement(ZoneStringList* labels, bool* ok); 616 WhileStatement* ParseWhileStatement(ZoneStringList* labels, bool* ok);
630 Statement* ParseForStatement(ZoneStringList* labels, bool* ok); 617 Statement* ParseForStatement(ZoneStringList* labels, bool* ok);
631 Statement* ParseThrowStatement(bool* ok); 618 Statement* ParseThrowStatement(bool* ok);
632 Expression* MakeCatchContext(Handle<String> id, VariableProxy* value); 619 Expression* MakeCatchContext(Handle<String> id, VariableProxy* value);
633 TryStatement* ParseTryStatement(bool* ok); 620 TryStatement* ParseTryStatement(bool* ok);
634 DebuggerStatement* ParseDebuggerStatement(bool* ok); 621 DebuggerStatement* ParseDebuggerStatement(bool* ok);
635 622
636 // Support for hamony block scoped bindings. 623 // Support for hamony block scoped bindings.
637 Block* ParseScopedBlock(ZoneStringList* labels, bool* ok); 624 Block* ParseScopedBlock(ZoneStringList* labels, bool* ok);
638 625
626 Expression* ParseExpression(bool accept_IN, bool* ok);
639 Expression* ParseAssignmentExpression(bool accept_IN, bool* ok); 627 Expression* ParseAssignmentExpression(bool accept_IN, bool* ok);
640 Expression* ParseYieldExpression(bool* ok); 628 Expression* ParseYieldExpression(bool* ok);
641 Expression* ParseConditionalExpression(bool accept_IN, bool* ok); 629 Expression* ParseConditionalExpression(bool accept_IN, bool* ok);
642 Expression* ParseBinaryExpression(int prec, bool accept_IN, bool* ok); 630 Expression* ParseBinaryExpression(int prec, bool accept_IN, bool* ok);
643 Expression* ParseUnaryExpression(bool* ok); 631 Expression* ParseUnaryExpression(bool* ok);
644 Expression* ParsePostfixExpression(bool* ok); 632 Expression* ParsePostfixExpression(bool* ok);
645 Expression* ParseLeftHandSideExpression(bool* ok); 633 Expression* ParseLeftHandSideExpression(bool* ok);
646 Expression* ParseMemberWithNewPrefixesExpression(bool* ok); 634 Expression* ParseNewExpression(bool* ok);
647 Expression* ParseMemberExpression(bool* ok); 635 Expression* ParseMemberExpression(bool* ok);
648 Expression* ParseMemberExpressionContinuation(Expression* expression, 636 Expression* ParseNewPrefix(PositionStack* stack, bool* ok);
649 bool* ok); 637 Expression* ParseMemberWithNewPrefixesExpression(PositionStack* stack,
638 bool* ok);
639 Expression* ParsePrimaryExpression(bool* ok);
640 Expression* ParseArrayLiteral(bool* ok);
650 Expression* ParseObjectLiteral(bool* ok); 641 Expression* ParseObjectLiteral(bool* ok);
642 Expression* ParseRegExpLiteral(bool seen_equal, bool* ok);
651 643
652 // Initialize the components of a for-in / for-of statement. 644 // Initialize the components of a for-in / for-of statement.
653 void InitializeForEachStatement(ForEachStatement* stmt, 645 void InitializeForEachStatement(ForEachStatement* stmt,
654 Expression* each, 646 Expression* each,
655 Expression* subject, 647 Expression* subject,
656 Statement* body); 648 Statement* body);
657 649
658 ZoneList<Expression*>* ParseArguments(bool* ok); 650 ZoneList<Expression*>* ParseArguments(bool* ok);
659 FunctionLiteral* ParseFunctionLiteral( 651 FunctionLiteral* ParseFunctionLiteral(
660 Handle<String> name, 652 Handle<String> name,
661 Scanner::Location function_name_location, 653 Scanner::Location function_name_location,
662 bool name_is_strict_reserved, 654 bool name_is_strict_reserved,
663 bool is_generator, 655 bool is_generator,
664 int function_token_position, 656 int function_token_position,
665 FunctionLiteral::FunctionType type, 657 FunctionLiteral::FunctionType type,
666 bool* ok); 658 bool* ok);
667 659
668 // Magical syntax support. 660 // Magical syntax support.
669 Expression* ParseV8Intrinsic(bool* ok); 661 Expression* ParseV8Intrinsic(bool* ok);
670 662
663 bool is_generator() const { return current_function_state_->is_generator(); }
664
671 bool CheckInOrOf(bool accept_OF, ForEachStatement::VisitMode* visit_mode); 665 bool CheckInOrOf(bool accept_OF, ForEachStatement::VisitMode* visit_mode);
672 666
673 Handle<String> LiteralString(PretenureFlag tenured) { 667 Handle<String> LiteralString(PretenureFlag tenured) {
674 if (scanner()->is_literal_ascii()) { 668 if (scanner().is_literal_ascii()) {
675 return isolate_->factory()->NewStringFromAscii( 669 return isolate_->factory()->NewStringFromAscii(
676 scanner()->literal_ascii_string(), tenured); 670 scanner().literal_ascii_string(), tenured);
677 } else { 671 } else {
678 return isolate_->factory()->NewStringFromTwoByte( 672 return isolate_->factory()->NewStringFromTwoByte(
679 scanner()->literal_utf16_string(), tenured); 673 scanner().literal_utf16_string(), tenured);
680 } 674 }
681 } 675 }
682 676
677 Handle<String> NextLiteralString(PretenureFlag tenured) {
678 if (scanner().is_next_literal_ascii()) {
679 return isolate_->factory()->NewStringFromAscii(
680 scanner().next_literal_ascii_string(), tenured);
681 } else {
682 return isolate_->factory()->NewStringFromTwoByte(
683 scanner().next_literal_utf16_string(), tenured);
684 }
685 }
686
687 Handle<String> GetSymbol();
688
683 // Get odd-ball literals. 689 // Get odd-ball literals.
684 Literal* GetLiteralUndefined(int position); 690 Literal* GetLiteralUndefined(int position);
691 Literal* GetLiteralTheHole(int position);
692
693 Handle<String> ParseIdentifier(AllowEvalOrArgumentsAsIdentifier, bool* ok);
694 Handle<String> ParseIdentifierOrStrictReservedWord(
695 bool* is_strict_reserved, bool* ok);
696 Handle<String> ParseIdentifierName(bool* ok);
697 Handle<String> ParseIdentifierNameOrGetOrSet(bool* is_get,
698 bool* is_set,
699 bool* ok);
685 700
686 // Determine if the expression is a variable proxy and mark it as being used 701 // 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 702 // in an assignment or with a increment/decrement operator. This is currently
688 // used on for the statically checking assignments to harmony const bindings. 703 // used on for the statically checking assignments to harmony const bindings.
689 void MarkAsLValue(Expression* expression); 704 void MarkAsLValue(Expression* expression);
690 705
691 // Strict mode validation of LValue expressions 706 // Strict mode validation of LValue expressions
692 void CheckStrictModeLValue(Expression* expression, 707 void CheckStrictModeLValue(Expression* expression,
693 bool* ok); 708 bool* ok);
694 709
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 Handle<Object> second); 753 Handle<Object> second);
739 754
740 // Generic AST generator for throwing errors from compiled code. 755 // Generic AST generator for throwing errors from compiled code.
741 Expression* NewThrowError(Handle<String> constructor, 756 Expression* NewThrowError(Handle<String> constructor,
742 Handle<String> type, 757 Handle<String> type,
743 Vector< Handle<Object> > arguments); 758 Vector< Handle<Object> > arguments);
744 759
745 PreParser::PreParseResult LazyParseFunctionLiteral( 760 PreParser::PreParseResult LazyParseFunctionLiteral(
746 SingletonLogger* logger); 761 SingletonLogger* logger);
747 762
763 AstNodeFactory<AstConstructionVisitor>* factory() {
764 return current_function_state_->factory();
765 }
766
748 Isolate* isolate_; 767 Isolate* isolate_;
749 ZoneList<Handle<String> > symbol_cache_; 768 ZoneList<Handle<String> > symbol_cache_;
750 769
751 Handle<Script> script_; 770 Handle<Script> script_;
752 Scanner scanner_; 771 Scanner scanner_;
753 PreParser* reusable_preparser_; 772 PreParser* reusable_preparser_;
773 Scope* top_scope_;
754 Scope* original_scope_; // for ES5 function declarations in sloppy eval 774 Scope* original_scope_; // for ES5 function declarations in sloppy eval
775 FunctionState* current_function_state_;
755 Target* target_stack_; // for break, continue statements 776 Target* target_stack_; // for break, continue statements
777 v8::Extension* extension_;
756 ScriptDataImpl* pre_parse_data_; 778 ScriptDataImpl* pre_parse_data_;
757 FuncNameInferrer* fni_; 779 FuncNameInferrer* fni_;
758 780
759 Mode mode_; 781 Mode mode_;
782 // If true, the next (and immediately following) function literal is
783 // preceded by a parenthesis.
784 // Heuristically that means that the function will be called immediately,
785 // so never lazily compile it.
786 bool parenthesized_function_;
760 787
788 Zone* zone_;
761 CompilationInfo* info_; 789 CompilationInfo* info_;
790 friend class BlockState;
791 friend class FunctionState;
762 }; 792 };
763 793
764 794
765 // Support for handling complex values (array and object literals) that 795 // Support for handling complex values (array and object literals) that
766 // can be fully handled at compile time. 796 // can be fully handled at compile time.
767 class CompileTimeValue: public AllStatic { 797 class CompileTimeValue: public AllStatic {
768 public: 798 public:
769 enum LiteralType { 799 enum LiteralType {
770 OBJECT_LITERAL_FAST_ELEMENTS, 800 OBJECT_LITERAL_FAST_ELEMENTS,
771 OBJECT_LITERAL_SLOW_ELEMENTS, 801 OBJECT_LITERAL_SLOW_ELEMENTS,
(...skipping 14 matching lines...) Expand all
786 private: 816 private:
787 static const int kLiteralTypeSlot = 0; 817 static const int kLiteralTypeSlot = 0;
788 static const int kElementsSlot = 1; 818 static const int kElementsSlot = 1;
789 819
790 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); 820 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue);
791 }; 821 };
792 822
793 } } // namespace v8::internal 823 } } // namespace v8::internal
794 824
795 #endif // V8_PARSER_H_ 825 #endif // V8_PARSER_H_
OLDNEW
« no previous file with comments | « src/objects-visiting-inl.h ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698