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_AST_H_ | 5 #ifndef V8_AST_H_ |
6 #define V8_AST_H_ | 6 #define V8_AST_H_ |
7 | 7 |
8 #include "v8.h" | 8 #include "v8.h" |
9 | 9 |
10 #include "assembler.h" | 10 #include "assembler.h" |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
360 // TODO(rossberg): this should move to its own AST node eventually. | 360 // TODO(rossberg): this should move to its own AST node eventually. |
361 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); | 361 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); |
362 byte to_boolean_types() const { return to_boolean_types_; } | 362 byte to_boolean_types() const { return to_boolean_types_; } |
363 | 363 |
364 BailoutId id() const { return id_; } | 364 BailoutId id() const { return id_; } |
365 TypeFeedbackId test_id() const { return test_id_; } | 365 TypeFeedbackId test_id() const { return test_id_; } |
366 | 366 |
367 protected: | 367 protected: |
368 Expression(Zone* zone, int pos) | 368 Expression(Zone* zone, int pos) |
369 : AstNode(pos), | 369 : AstNode(pos), |
370 zone_(zone), | |
370 bounds_(Bounds::Unbounded(zone)), | 371 bounds_(Bounds::Unbounded(zone)), |
371 id_(GetNextId(zone)), | 372 id_(GetNextId(zone)), |
372 test_id_(GetNextId(zone)) {} | 373 test_id_(GetNextId(zone)) {} |
373 void set_to_boolean_types(byte types) { to_boolean_types_ = types; } | 374 void set_to_boolean_types(byte types) { to_boolean_types_ = types; } |
374 | 375 |
376 Zone* zone_; | |
377 | |
375 private: | 378 private: |
376 Bounds bounds_; | 379 Bounds bounds_; |
377 byte to_boolean_types_; | 380 byte to_boolean_types_; |
378 | 381 |
379 const BailoutId id_; | 382 const BailoutId id_; |
380 const TypeFeedbackId test_id_; | 383 const TypeFeedbackId test_id_; |
381 }; | 384 }; |
382 | 385 |
383 | 386 |
384 class BreakableStatement : public Statement { | 387 class BreakableStatement : public Statement { |
385 public: | 388 public: |
386 enum BreakableType { | 389 enum BreakableType { |
387 TARGET_FOR_ANONYMOUS, | 390 TARGET_FOR_ANONYMOUS, |
388 TARGET_FOR_NAMED_ONLY | 391 TARGET_FOR_NAMED_ONLY |
389 }; | 392 }; |
390 | 393 |
391 // The labels associated with this statement. May be NULL; | 394 // The labels associated with this statement. May be NULL; |
392 // if it is != NULL, guaranteed to contain at least one entry. | 395 // if it is != NULL, guaranteed to contain at least one entry. |
393 ZoneStringList* labels() const { return labels_; } | 396 ZoneList<ParserSymbolTable::Symbol*>* labels() const { return labels_; } |
394 | 397 |
395 // Type testing & conversion. | 398 // Type testing & conversion. |
396 virtual BreakableStatement* AsBreakableStatement() V8_FINAL V8_OVERRIDE { | 399 virtual BreakableStatement* AsBreakableStatement() V8_FINAL V8_OVERRIDE { |
397 return this; | 400 return this; |
398 } | 401 } |
399 | 402 |
400 // Code generation | 403 // Code generation |
401 Label* break_target() { return &break_target_; } | 404 Label* break_target() { return &break_target_; } |
402 | 405 |
403 // Testers. | 406 // Testers. |
404 bool is_target_for_anonymous() const { | 407 bool is_target_for_anonymous() const { |
405 return breakable_type_ == TARGET_FOR_ANONYMOUS; | 408 return breakable_type_ == TARGET_FOR_ANONYMOUS; |
406 } | 409 } |
407 | 410 |
408 BailoutId EntryId() const { return entry_id_; } | 411 BailoutId EntryId() const { return entry_id_; } |
409 BailoutId ExitId() const { return exit_id_; } | 412 BailoutId ExitId() const { return exit_id_; } |
410 | 413 |
411 protected: | 414 protected: |
412 BreakableStatement( | 415 BreakableStatement( |
413 Zone* zone, ZoneStringList* labels, | 416 Zone* zone, ZoneList<ParserSymbolTable::Symbol*>* labels, |
414 BreakableType breakable_type, int position) | 417 BreakableType breakable_type, int position) |
415 : Statement(zone, position), | 418 : Statement(zone, position), |
416 labels_(labels), | 419 labels_(labels), |
417 breakable_type_(breakable_type), | 420 breakable_type_(breakable_type), |
418 entry_id_(GetNextId(zone)), | 421 entry_id_(GetNextId(zone)), |
419 exit_id_(GetNextId(zone)) { | 422 exit_id_(GetNextId(zone)) { |
420 ASSERT(labels == NULL || labels->length() > 0); | 423 ASSERT(labels == NULL || labels->length() > 0); |
421 } | 424 } |
422 | 425 |
423 | 426 |
424 private: | 427 private: |
425 ZoneStringList* labels_; | 428 ZoneList<ParserSymbolTable::Symbol*>* labels_; |
426 BreakableType breakable_type_; | 429 BreakableType breakable_type_; |
427 Label break_target_; | 430 Label break_target_; |
428 const BailoutId entry_id_; | 431 const BailoutId entry_id_; |
429 const BailoutId exit_id_; | 432 const BailoutId exit_id_; |
430 }; | 433 }; |
431 | 434 |
432 | 435 |
433 class Block V8_FINAL : public BreakableStatement { | 436 class Block V8_FINAL : public BreakableStatement { |
434 public: | 437 public: |
435 DECLARE_NODE_TYPE(Block) | 438 DECLARE_NODE_TYPE(Block) |
436 | 439 |
437 void AddStatement(Statement* statement, Zone* zone) { | 440 void AddStatement(Statement* statement, Zone* zone) { |
438 statements_.Add(statement, zone); | 441 statements_.Add(statement, zone); |
439 } | 442 } |
440 | 443 |
441 ZoneList<Statement*>* statements() { return &statements_; } | 444 ZoneList<Statement*>* statements() { return &statements_; } |
442 bool is_initializer_block() const { return is_initializer_block_; } | 445 bool is_initializer_block() const { return is_initializer_block_; } |
443 | 446 |
444 virtual bool IsJump() const V8_OVERRIDE { | 447 virtual bool IsJump() const V8_OVERRIDE { |
445 return !statements_.is_empty() && statements_.last()->IsJump() | 448 return !statements_.is_empty() && statements_.last()->IsJump() |
446 && labels() == NULL; // Good enough as an approximation... | 449 && labels() == NULL; // Good enough as an approximation... |
447 } | 450 } |
448 | 451 |
449 Scope* scope() const { return scope_; } | 452 Scope* scope() const { return scope_; } |
450 void set_scope(Scope* scope) { scope_ = scope; } | 453 void set_scope(Scope* scope) { scope_ = scope; } |
451 | 454 |
452 protected: | 455 protected: |
453 Block(Zone* zone, | 456 Block(Zone* zone, |
454 ZoneStringList* labels, | 457 ZoneList<ParserSymbolTable::Symbol*>* labels, |
455 int capacity, | 458 int capacity, |
456 bool is_initializer_block, | 459 bool is_initializer_block, |
457 int pos) | 460 int pos) |
458 : BreakableStatement(zone, labels, TARGET_FOR_NAMED_ONLY, pos), | 461 : BreakableStatement(zone, labels, TARGET_FOR_NAMED_ONLY, pos), |
459 statements_(capacity, zone), | 462 statements_(capacity, zone), |
460 is_initializer_block_(is_initializer_block), | 463 is_initializer_block_(is_initializer_block), |
461 scope_(NULL) { | 464 scope_(NULL) { |
462 } | 465 } |
463 | 466 |
464 private: | 467 private: |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
651 private: | 654 private: |
652 VariableProxy* proxy_; | 655 VariableProxy* proxy_; |
653 }; | 656 }; |
654 | 657 |
655 | 658 |
656 class ModulePath V8_FINAL : public Module { | 659 class ModulePath V8_FINAL : public Module { |
657 public: | 660 public: |
658 DECLARE_NODE_TYPE(ModulePath) | 661 DECLARE_NODE_TYPE(ModulePath) |
659 | 662 |
660 Module* module() const { return module_; } | 663 Module* module() const { return module_; } |
661 Handle<String> name() const { return name_; } | 664 Handle<String> name() const { return name_->string(); } |
662 | 665 |
663 protected: | 666 protected: |
664 ModulePath(Zone* zone, Module* module, Handle<String> name, int pos) | 667 ModulePath(Zone* zone, Module* module, ParserSymbolTable::Symbol* name, |
665 : Module(zone, pos), | 668 int pos) |
666 module_(module), | 669 : Module(zone, pos), module_(module), name_(name) {} |
667 name_(name) { | |
668 } | |
669 | 670 |
670 private: | 671 private: |
671 Module* module_; | 672 Module* module_; |
672 Handle<String> name_; | 673 ParserSymbolTable::Symbol* name_; |
673 }; | 674 }; |
674 | 675 |
675 | 676 |
676 class ModuleUrl V8_FINAL : public Module { | 677 class ModuleUrl V8_FINAL : public Module { |
677 public: | 678 public: |
678 DECLARE_NODE_TYPE(ModuleUrl) | 679 DECLARE_NODE_TYPE(ModuleUrl) |
679 | 680 |
680 Handle<String> url() const { return url_; } | 681 Handle<String> url() const { return url_; } |
681 | 682 |
682 protected: | 683 protected: |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
719 Statement* body() const { return body_; } | 720 Statement* body() const { return body_; } |
720 | 721 |
721 BailoutId OsrEntryId() const { return osr_entry_id_; } | 722 BailoutId OsrEntryId() const { return osr_entry_id_; } |
722 virtual BailoutId ContinueId() const = 0; | 723 virtual BailoutId ContinueId() const = 0; |
723 virtual BailoutId StackCheckId() const = 0; | 724 virtual BailoutId StackCheckId() const = 0; |
724 | 725 |
725 // Code generation | 726 // Code generation |
726 Label* continue_target() { return &continue_target_; } | 727 Label* continue_target() { return &continue_target_; } |
727 | 728 |
728 protected: | 729 protected: |
729 IterationStatement(Zone* zone, ZoneStringList* labels, int pos) | 730 IterationStatement(Zone* zone, ZoneList<ParserSymbolTable::Symbol*>* labels, |
731 int pos) | |
730 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos), | 732 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos), |
731 body_(NULL), | 733 body_(NULL), |
732 osr_entry_id_(GetNextId(zone)) { | 734 osr_entry_id_(GetNextId(zone)) {} |
733 } | |
734 | 735 |
735 void Initialize(Statement* body) { | 736 void Initialize(Statement* body) { |
736 body_ = body; | 737 body_ = body; |
737 } | 738 } |
738 | 739 |
739 private: | 740 private: |
740 Statement* body_; | 741 Statement* body_; |
741 Label continue_target_; | 742 Label continue_target_; |
742 | 743 |
743 const BailoutId osr_entry_id_; | 744 const BailoutId osr_entry_id_; |
744 }; | 745 }; |
745 | 746 |
746 | 747 |
747 class DoWhileStatement V8_FINAL : public IterationStatement { | 748 class DoWhileStatement V8_FINAL : public IterationStatement { |
748 public: | 749 public: |
749 DECLARE_NODE_TYPE(DoWhileStatement) | 750 DECLARE_NODE_TYPE(DoWhileStatement) |
750 | 751 |
751 void Initialize(Expression* cond, Statement* body) { | 752 void Initialize(Expression* cond, Statement* body) { |
752 IterationStatement::Initialize(body); | 753 IterationStatement::Initialize(body); |
753 cond_ = cond; | 754 cond_ = cond; |
754 } | 755 } |
755 | 756 |
756 Expression* cond() const { return cond_; } | 757 Expression* cond() const { return cond_; } |
757 | 758 |
758 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; } | 759 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; } |
759 virtual BailoutId StackCheckId() const V8_OVERRIDE { return back_edge_id_; } | 760 virtual BailoutId StackCheckId() const V8_OVERRIDE { return back_edge_id_; } |
760 BailoutId BackEdgeId() const { return back_edge_id_; } | 761 BailoutId BackEdgeId() const { return back_edge_id_; } |
761 | 762 |
762 protected: | 763 protected: |
763 DoWhileStatement(Zone* zone, ZoneStringList* labels, int pos) | 764 DoWhileStatement(Zone* zone, ZoneList<ParserSymbolTable::Symbol*>* labels, |
765 int pos) | |
764 : IterationStatement(zone, labels, pos), | 766 : IterationStatement(zone, labels, pos), |
765 cond_(NULL), | 767 cond_(NULL), |
766 continue_id_(GetNextId(zone)), | 768 continue_id_(GetNextId(zone)), |
767 back_edge_id_(GetNextId(zone)) { | 769 back_edge_id_(GetNextId(zone)) {} |
768 } | |
769 | 770 |
770 private: | 771 private: |
771 Expression* cond_; | 772 Expression* cond_; |
772 | 773 |
773 const BailoutId continue_id_; | 774 const BailoutId continue_id_; |
774 const BailoutId back_edge_id_; | 775 const BailoutId back_edge_id_; |
775 }; | 776 }; |
776 | 777 |
777 | 778 |
778 class WhileStatement V8_FINAL : public IterationStatement { | 779 class WhileStatement V8_FINAL : public IterationStatement { |
(...skipping 11 matching lines...) Expand all Loading... | |
790 } | 791 } |
791 void set_may_have_function_literal(bool value) { | 792 void set_may_have_function_literal(bool value) { |
792 may_have_function_literal_ = value; | 793 may_have_function_literal_ = value; |
793 } | 794 } |
794 | 795 |
795 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } | 796 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } |
796 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } | 797 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } |
797 BailoutId BodyId() const { return body_id_; } | 798 BailoutId BodyId() const { return body_id_; } |
798 | 799 |
799 protected: | 800 protected: |
800 WhileStatement(Zone* zone, ZoneStringList* labels, int pos) | 801 WhileStatement(Zone* zone, ZoneList<ParserSymbolTable::Symbol*>* labels, |
802 int pos) | |
801 : IterationStatement(zone, labels, pos), | 803 : IterationStatement(zone, labels, pos), |
802 cond_(NULL), | 804 cond_(NULL), |
803 may_have_function_literal_(true), | 805 may_have_function_literal_(true), |
804 body_id_(GetNextId(zone)) { | 806 body_id_(GetNextId(zone)) {} |
805 } | |
806 | 807 |
807 private: | 808 private: |
808 Expression* cond_; | 809 Expression* cond_; |
809 | 810 |
810 // True if there is a function literal subexpression in the condition. | 811 // True if there is a function literal subexpression in the condition. |
811 bool may_have_function_literal_; | 812 bool may_have_function_literal_; |
812 | 813 |
813 const BailoutId body_id_; | 814 const BailoutId body_id_; |
814 }; | 815 }; |
815 | 816 |
(...skipping 25 matching lines...) Expand all Loading... | |
841 | 842 |
842 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; } | 843 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; } |
843 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } | 844 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } |
844 BailoutId BodyId() const { return body_id_; } | 845 BailoutId BodyId() const { return body_id_; } |
845 | 846 |
846 bool is_fast_smi_loop() { return loop_variable_ != NULL; } | 847 bool is_fast_smi_loop() { return loop_variable_ != NULL; } |
847 Variable* loop_variable() { return loop_variable_; } | 848 Variable* loop_variable() { return loop_variable_; } |
848 void set_loop_variable(Variable* var) { loop_variable_ = var; } | 849 void set_loop_variable(Variable* var) { loop_variable_ = var; } |
849 | 850 |
850 protected: | 851 protected: |
851 ForStatement(Zone* zone, ZoneStringList* labels, int pos) | 852 ForStatement(Zone* zone, ZoneList<ParserSymbolTable::Symbol*>* labels, int pos ) |
rossberg
2014/05/08 12:52:08
Nit: line length
marja
2014/06/03 08:48:20
Done.
| |
852 : IterationStatement(zone, labels, pos), | 853 : IterationStatement(zone, labels, pos), |
853 init_(NULL), | 854 init_(NULL), |
854 cond_(NULL), | 855 cond_(NULL), |
855 next_(NULL), | 856 next_(NULL), |
856 may_have_function_literal_(true), | 857 may_have_function_literal_(true), |
857 loop_variable_(NULL), | 858 loop_variable_(NULL), |
858 continue_id_(GetNextId(zone)), | 859 continue_id_(GetNextId(zone)), |
859 body_id_(GetNextId(zone)) { | 860 body_id_(GetNextId(zone)) { |
860 } | 861 } |
861 | 862 |
(...skipping 21 matching lines...) Expand all Loading... | |
883 void Initialize(Expression* each, Expression* subject, Statement* body) { | 884 void Initialize(Expression* each, Expression* subject, Statement* body) { |
884 IterationStatement::Initialize(body); | 885 IterationStatement::Initialize(body); |
885 each_ = each; | 886 each_ = each; |
886 subject_ = subject; | 887 subject_ = subject; |
887 } | 888 } |
888 | 889 |
889 Expression* each() const { return each_; } | 890 Expression* each() const { return each_; } |
890 Expression* subject() const { return subject_; } | 891 Expression* subject() const { return subject_; } |
891 | 892 |
892 protected: | 893 protected: |
893 ForEachStatement(Zone* zone, ZoneStringList* labels, int pos) | 894 ForEachStatement(Zone* zone, ZoneList<ParserSymbolTable::Symbol*>* labels, int pos) |
rossberg
2014/05/08 12:52:08
Nit: line length
marja
2014/06/03 08:48:20
Done.
| |
894 : IterationStatement(zone, labels, pos), | 895 : IterationStatement(zone, labels, pos), |
895 each_(NULL), | 896 each_(NULL), |
896 subject_(NULL) { | 897 subject_(NULL) { |
897 } | 898 } |
898 | 899 |
899 private: | 900 private: |
900 Expression* each_; | 901 Expression* each_; |
901 Expression* subject_; | 902 Expression* subject_; |
902 }; | 903 }; |
903 | 904 |
(...skipping 19 matching lines...) Expand all Loading... | |
923 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; | 924 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; |
924 ForInType for_in_type() const { return for_in_type_; } | 925 ForInType for_in_type() const { return for_in_type_; } |
925 void set_for_in_type(ForInType type) { for_in_type_ = type; } | 926 void set_for_in_type(ForInType type) { for_in_type_ = type; } |
926 | 927 |
927 BailoutId BodyId() const { return body_id_; } | 928 BailoutId BodyId() const { return body_id_; } |
928 BailoutId PrepareId() const { return prepare_id_; } | 929 BailoutId PrepareId() const { return prepare_id_; } |
929 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } | 930 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } |
930 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } | 931 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } |
931 | 932 |
932 protected: | 933 protected: |
933 ForInStatement(Zone* zone, ZoneStringList* labels, int pos) | 934 ForInStatement(Zone* zone, ZoneList<ParserSymbolTable::Symbol*>* labels, int p os) |
rossberg
2014/05/08 12:52:08
Nit: line length
marja
2014/06/03 08:48:20
Done.
| |
934 : ForEachStatement(zone, labels, pos), | 935 : ForEachStatement(zone, labels, pos), |
935 for_in_type_(SLOW_FOR_IN), | 936 for_in_type_(SLOW_FOR_IN), |
936 for_in_feedback_slot_(kInvalidFeedbackSlot), | 937 for_in_feedback_slot_(kInvalidFeedbackSlot), |
937 body_id_(GetNextId(zone)), | 938 body_id_(GetNextId(zone)), |
938 prepare_id_(GetNextId(zone)) { | 939 prepare_id_(GetNextId(zone)) { |
939 } | 940 } |
940 | 941 |
941 ForInType for_in_type_; | 942 ForInType for_in_type_; |
942 int for_in_feedback_slot_; | 943 int for_in_feedback_slot_; |
943 const BailoutId body_id_; | 944 const BailoutId body_id_; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
986 Expression* assign_each() const { | 987 Expression* assign_each() const { |
987 return assign_each_; | 988 return assign_each_; |
988 } | 989 } |
989 | 990 |
990 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } | 991 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } |
991 virtual BailoutId StackCheckId() const V8_OVERRIDE { return BackEdgeId(); } | 992 virtual BailoutId StackCheckId() const V8_OVERRIDE { return BackEdgeId(); } |
992 | 993 |
993 BailoutId BackEdgeId() const { return back_edge_id_; } | 994 BailoutId BackEdgeId() const { return back_edge_id_; } |
994 | 995 |
995 protected: | 996 protected: |
996 ForOfStatement(Zone* zone, ZoneStringList* labels, int pos) | 997 ForOfStatement(Zone* zone, ZoneList<ParserSymbolTable::Symbol*>* labels, int p os) |
rossberg
2014/05/08 12:52:08
Nit: line length
marja
2014/06/03 08:48:20
Done.
| |
997 : ForEachStatement(zone, labels, pos), | 998 : ForEachStatement(zone, labels, pos), |
998 assign_iterator_(NULL), | 999 assign_iterator_(NULL), |
999 next_result_(NULL), | 1000 next_result_(NULL), |
1000 result_done_(NULL), | 1001 result_done_(NULL), |
1001 assign_each_(NULL), | 1002 assign_each_(NULL), |
1002 back_edge_id_(GetNextId(zone)) { | 1003 back_edge_id_(GetNextId(zone)) { |
1003 } | 1004 } |
1004 | 1005 |
1005 Expression* assign_iterator_; | 1006 Expression* assign_iterator_; |
1006 Expression* next_result_; | 1007 Expression* next_result_; |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1146 | 1147 |
1147 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { | 1148 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { |
1148 tag_ = tag; | 1149 tag_ = tag; |
1149 cases_ = cases; | 1150 cases_ = cases; |
1150 } | 1151 } |
1151 | 1152 |
1152 Expression* tag() const { return tag_; } | 1153 Expression* tag() const { return tag_; } |
1153 ZoneList<CaseClause*>* cases() const { return cases_; } | 1154 ZoneList<CaseClause*>* cases() const { return cases_; } |
1154 | 1155 |
1155 protected: | 1156 protected: |
1156 SwitchStatement(Zone* zone, ZoneStringList* labels, int pos) | 1157 SwitchStatement(Zone* zone, ZoneList<ParserSymbolTable::Symbol*>* labels, int pos) |
rossberg
2014/05/08 12:52:08
Nit: line length
marja
2014/06/03 08:48:20
Done.
| |
1157 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos), | 1158 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos), |
1158 tag_(NULL), | 1159 tag_(NULL), |
1159 cases_(NULL) { } | 1160 cases_(NULL) { } |
1160 | 1161 |
1161 private: | 1162 private: |
1162 Expression* tag_; | 1163 Expression* tag_; |
1163 ZoneList<CaseClause*>* cases_; | 1164 ZoneList<CaseClause*>* cases_; |
1164 }; | 1165 }; |
1165 | 1166 |
1166 | 1167 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1326 protected: | 1327 protected: |
1327 explicit EmptyStatement(Zone* zone, int pos): Statement(zone, pos) {} | 1328 explicit EmptyStatement(Zone* zone, int pos): Statement(zone, pos) {} |
1328 }; | 1329 }; |
1329 | 1330 |
1330 | 1331 |
1331 class Literal V8_FINAL : public Expression { | 1332 class Literal V8_FINAL : public Expression { |
1332 public: | 1333 public: |
1333 DECLARE_NODE_TYPE(Literal) | 1334 DECLARE_NODE_TYPE(Literal) |
1334 | 1335 |
1335 virtual bool IsPropertyName() const V8_OVERRIDE { | 1336 virtual bool IsPropertyName() const V8_OVERRIDE { |
1336 if (value_->IsInternalizedString()) { | 1337 if (string_) { |
1337 uint32_t ignored; | 1338 return !ParserSymbolTable::IsArrayIndexSlow(string_); |
1338 return !String::cast(*value_)->AsArrayIndex(&ignored); | |
1339 } | 1339 } |
1340 return false; | 1340 return false; |
1341 } | 1341 } |
1342 | 1342 |
1343 Handle<String> AsPropertyName() { | 1343 Handle<String> AsPropertyName() { |
1344 ASSERT(!value_.is_null()); | |
1344 ASSERT(IsPropertyName()); | 1345 ASSERT(IsPropertyName()); |
1345 return Handle<String>::cast(value_); | 1346 return Handle<String>::cast(value_); |
1346 } | 1347 } |
1347 | 1348 |
1349 ParserSymbolTable::Symbol* AsRawPropertyName() { | |
1350 ASSERT(IsPropertyName()); | |
1351 return string_; | |
1352 } | |
1353 | |
1348 virtual bool ToBooleanIsTrue() const V8_OVERRIDE { | 1354 virtual bool ToBooleanIsTrue() const V8_OVERRIDE { |
1349 return value_->BooleanValue(); | 1355 return value_->BooleanValue(); |
1350 } | 1356 } |
1351 virtual bool ToBooleanIsFalse() const V8_OVERRIDE { | 1357 virtual bool ToBooleanIsFalse() const V8_OVERRIDE { |
1352 return !value_->BooleanValue(); | 1358 return !value_->BooleanValue(); |
1353 } | 1359 } |
1354 | 1360 |
1355 // Identity testers. | 1361 // Identity testers. |
1356 bool IsNull() const { | 1362 bool IsNull() const { |
1357 ASSERT(!value_.is_null()); | 1363 ASSERT(!value_.is_null()); |
1358 return value_->IsNull(); | 1364 return value_->IsNull(); |
1359 } | 1365 } |
1360 bool IsTrue() const { | 1366 bool IsTrue() const { |
1361 ASSERT(!value_.is_null()); | 1367 ASSERT(!value_.is_null()); |
1362 return value_->IsTrue(); | 1368 return value_->IsTrue(); |
1363 } | 1369 } |
1364 bool IsFalse() const { | 1370 bool IsFalse() const { |
1365 ASSERT(!value_.is_null()); | 1371 ASSERT(!value_.is_null()); |
1366 return value_->IsFalse(); | 1372 return value_->IsFalse(); |
1367 } | 1373 } |
1368 | 1374 |
1369 Handle<Object> value() const { return value_; } | 1375 // FIXME: this is temporary |
1376 Handle<Object> valueIfNotString() const { | |
1377 return value_; | |
1378 } | |
1379 // FIXME: this function is called both before and after the internalization | |
1380 // point. Figure out how to. | |
1381 Handle<Object> value() const { | |
1382 if (!value_.is_null()) { | |
rossberg
2014/05/08 12:52:08
Is it an invariant that at least one of value_, st
marja
2014/06/03 08:48:20
This is now refactored so that we have another Lit
| |
1383 return value_; | |
1384 } | |
1385 if (string_ != NULL) { | |
1386 value_ = string_->string(); | |
1387 } else if (strings_ != NULL) { | |
1388 // FIXME: get the isolate from somewhere else | |
1389 Factory* factory = Isolate::Current()->factory(); | |
1390 int len = strings_->length(); | |
1391 Handle<FixedArray> elements = factory->NewFixedArray(len, TENURED); | |
1392 for (int i = 0; i < len; i++) { | |
1393 Handle<Object> element = (*strings_)[i]->string(); | |
1394 elements->set(i, *element); | |
1395 } | |
1396 value_ = | |
1397 factory->NewJSArrayWithElements(elements, FAST_ELEMENTS, TENURED); | |
1398 } | |
1399 return value_; | |
1400 } | |
1401 | |
1402 ParserSymbolTable::Symbol* string() const { return string_; } | |
rossberg
2014/05/08 12:52:08
Maybe call these symbol/symbol_?
marja
2014/06/03 08:48:20
This is also in the other class now, and I think i
| |
1370 | 1403 |
1371 // Support for using Literal as a HashMap key. NOTE: Currently, this works | 1404 // Support for using Literal as a HashMap key. NOTE: Currently, this works |
1372 // only for string and number literals! | 1405 // only for string and number literals! |
1373 uint32_t Hash() { return ToString()->Hash(); } | 1406 uint32_t Hash() { return ToString()->Hash(); } |
1374 | 1407 |
1375 static bool Match(void* literal1, void* literal2) { | 1408 static bool Match(void* literal1, void* literal2) { |
1376 Handle<String> s1 = static_cast<Literal*>(literal1)->ToString(); | 1409 Handle<String> s1 = static_cast<Literal*>(literal1)->ToString(); |
1377 Handle<String> s2 = static_cast<Literal*>(literal2)->ToString(); | 1410 Handle<String> s2 = static_cast<Literal*>(literal2)->ToString(); |
1378 return String::Equals(s1, s2); | 1411 return String::Equals(s1, s2); |
1379 } | 1412 } |
1380 | 1413 |
1381 TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); } | 1414 TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); } |
1382 | 1415 |
1383 protected: | 1416 protected: |
1384 Literal(Zone* zone, Handle<Object> value, int position) | 1417 Literal(Zone* zone, Handle<Object> value, int position) |
1385 : Expression(zone, position), | 1418 : Expression(zone, position), |
1386 value_(value), | 1419 value_(value), |
1420 string_(NULL), | |
1421 strings_(NULL), | |
1387 isolate_(zone->isolate()) { } | 1422 isolate_(zone->isolate()) { } |
1423 Literal(Zone* zone, ParserSymbolTable::Symbol* string, int position) | |
1424 : Expression(zone, position), | |
1425 string_(string), | |
1426 strings_(NULL), | |
1427 isolate_(zone->isolate()) { | |
1428 } | |
1429 Literal(Zone* zone, ZoneList<ParserSymbolTable::Symbol*>* strings, | |
1430 int position) | |
1431 : Expression(zone, position), | |
1432 string_(NULL), | |
1433 strings_(strings), | |
1434 isolate_(zone->isolate()) { | |
1435 } | |
1388 | 1436 |
1389 private: | 1437 private: |
1390 Handle<String> ToString(); | 1438 Handle<String> ToString(); |
1391 | 1439 |
1392 Handle<Object> value_; | 1440 mutable Handle<Object> value_; |
1441 ParserSymbolTable::Symbol* string_; | |
1442 ZoneList<ParserSymbolTable::Symbol*>* strings_; | |
rossberg
2014/05/08 12:52:08
symbols_? Also, add a comment that this is to repr
marja
2014/06/03 08:48:20
Ditto (added comment about this to the literal cla
| |
1393 // TODO(dcarney): remove. this is only needed for Match and Hash. | 1443 // TODO(dcarney): remove. this is only needed for Match and Hash. |
1394 Isolate* isolate_; | 1444 Isolate* isolate_; |
1395 }; | 1445 }; |
1396 | 1446 |
1397 | 1447 |
1398 // Base class for literals that needs space in the corresponding JSFunction. | 1448 // Base class for literals that needs space in the corresponding JSFunction. |
1399 class MaterializedLiteral : public Expression { | 1449 class MaterializedLiteral : public Expression { |
1400 public: | 1450 public: |
1401 virtual MaterializedLiteral* AsMaterializedLiteral() { return this; } | 1451 virtual MaterializedLiteral* AsMaterializedLiteral() { return this; } |
1402 | 1452 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1552 bool may_store_doubles_; | 1602 bool may_store_doubles_; |
1553 bool has_function_; | 1603 bool has_function_; |
1554 }; | 1604 }; |
1555 | 1605 |
1556 | 1606 |
1557 // Node for capturing a regexp literal. | 1607 // Node for capturing a regexp literal. |
1558 class RegExpLiteral V8_FINAL : public MaterializedLiteral { | 1608 class RegExpLiteral V8_FINAL : public MaterializedLiteral { |
1559 public: | 1609 public: |
1560 DECLARE_NODE_TYPE(RegExpLiteral) | 1610 DECLARE_NODE_TYPE(RegExpLiteral) |
1561 | 1611 |
1562 Handle<String> pattern() const { return pattern_; } | 1612 Handle<String> pattern() const { return pattern_->string(); } |
1563 Handle<String> flags() const { return flags_; } | 1613 Handle<String> flags() const { return flags_->string(); } |
1564 | 1614 |
1565 protected: | 1615 protected: |
1566 RegExpLiteral(Zone* zone, | 1616 RegExpLiteral(Zone* zone, |
1567 Handle<String> pattern, | 1617 ParserSymbolTable::Symbol* pattern, |
1568 Handle<String> flags, | 1618 ParserSymbolTable::Symbol* flags, |
1569 int literal_index, | 1619 int literal_index, |
1570 int pos) | 1620 int pos) |
1571 : MaterializedLiteral(zone, literal_index, pos), | 1621 : MaterializedLiteral(zone, literal_index, pos), |
1572 pattern_(pattern), | 1622 pattern_(pattern), |
1573 flags_(flags) { | 1623 flags_(flags) { |
1574 set_depth(1); | 1624 set_depth(1); |
1575 } | 1625 } |
1576 | 1626 |
1577 private: | 1627 private: |
1578 Handle<String> pattern_; | 1628 ParserSymbolTable::Symbol* pattern_; |
1579 Handle<String> flags_; | 1629 ParserSymbolTable::Symbol* flags_; |
1580 }; | 1630 }; |
1581 | 1631 |
1582 | 1632 |
1583 // An array literal has a literals object that is used | 1633 // An array literal has a literals object that is used |
1584 // for minimizing the work when constructing it at runtime. | 1634 // for minimizing the work when constructing it at runtime. |
1585 class ArrayLiteral V8_FINAL : public MaterializedLiteral { | 1635 class ArrayLiteral V8_FINAL : public MaterializedLiteral { |
1586 public: | 1636 public: |
1587 DECLARE_NODE_TYPE(ArrayLiteral) | 1637 DECLARE_NODE_TYPE(ArrayLiteral) |
1588 | 1638 |
1589 Handle<FixedArray> constant_elements() const { return constant_elements_; } | 1639 Handle<FixedArray> constant_elements() const { return constant_elements_; } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1628 } | 1678 } |
1629 | 1679 |
1630 bool IsVariable(Handle<String> n) const { | 1680 bool IsVariable(Handle<String> n) const { |
1631 return !is_this() && name().is_identical_to(n); | 1681 return !is_this() && name().is_identical_to(n); |
1632 } | 1682 } |
1633 | 1683 |
1634 bool IsArguments() const { return var_ != NULL && var_->is_arguments(); } | 1684 bool IsArguments() const { return var_ != NULL && var_->is_arguments(); } |
1635 | 1685 |
1636 bool IsLValue() const { return is_lvalue_; } | 1686 bool IsLValue() const { return is_lvalue_; } |
1637 | 1687 |
1638 Handle<String> name() const { return name_; } | 1688 Handle<String> name() const { return raw_name_->string(); } |
1689 ParserSymbolTable::Symbol* raw_name() const { return raw_name_; } | |
1639 Variable* var() const { return var_; } | 1690 Variable* var() const { return var_; } |
1640 bool is_this() const { return is_this_; } | 1691 bool is_this() const { return is_this_; } |
1641 Interface* interface() const { return interface_; } | 1692 Interface* interface() const { return interface_; } |
1642 | 1693 |
1643 | 1694 |
1644 void MarkAsTrivial() { is_trivial_ = true; } | 1695 void MarkAsTrivial() { is_trivial_ = true; } |
1645 void MarkAsLValue() { is_lvalue_ = true; } | 1696 void MarkAsLValue() { is_lvalue_ = true; } |
1646 | 1697 |
1647 // Bind this proxy to the variable var. Interfaces must match. | 1698 // Bind this proxy to the variable var. Interfaces must match. |
1648 void BindTo(Variable* var); | 1699 void BindTo(Variable* var); |
1649 | 1700 |
1650 protected: | 1701 protected: |
1651 VariableProxy(Zone* zone, Variable* var, int position); | 1702 VariableProxy(Zone* zone, Variable* var, int position); |
1652 | 1703 |
1653 VariableProxy(Zone* zone, | 1704 VariableProxy(Zone* zone, |
1654 Handle<String> name, | 1705 ParserSymbolTable::Symbol* raw_name, |
1655 bool is_this, | 1706 bool is_this, |
1656 Interface* interface, | 1707 Interface* interface, |
1657 int position); | 1708 int position); |
1658 | 1709 |
1659 Handle<String> name_; | 1710 ParserSymbolTable::Symbol* raw_name_; |
1660 Variable* var_; // resolved variable, or NULL | 1711 Variable* var_; // resolved variable, or NULL |
1661 bool is_this_; | 1712 bool is_this_; |
1662 bool is_trivial_; | 1713 bool is_trivial_; |
1663 // True if this variable proxy is being used in an assignment | 1714 // True if this variable proxy is being used in an assignment |
1664 // or with a increment/decrement operator. | 1715 // or with a increment/decrement operator. |
1665 bool is_lvalue_; | 1716 bool is_lvalue_; |
1666 Interface* interface_; | 1717 Interface* interface_; |
1667 }; | 1718 }; |
1668 | 1719 |
1669 | 1720 |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1880 | 1931 |
1881 | 1932 |
1882 // The CallRuntime class does not represent any official JavaScript | 1933 // The CallRuntime class does not represent any official JavaScript |
1883 // language construct. Instead it is used to call a C or JS function | 1934 // language construct. Instead it is used to call a C or JS function |
1884 // with a set of arguments. This is used from the builtins that are | 1935 // with a set of arguments. This is used from the builtins that are |
1885 // implemented in JavaScript (see "v8natives.js"). | 1936 // implemented in JavaScript (see "v8natives.js"). |
1886 class CallRuntime V8_FINAL : public Expression { | 1937 class CallRuntime V8_FINAL : public Expression { |
1887 public: | 1938 public: |
1888 DECLARE_NODE_TYPE(CallRuntime) | 1939 DECLARE_NODE_TYPE(CallRuntime) |
1889 | 1940 |
1890 Handle<String> name() const { return name_; } | 1941 Handle<String> name() const { return raw_name_->string(); } |
1942 ParserSymbolTable::Symbol* raw_name() const { return raw_name_; } | |
1891 const Runtime::Function* function() const { return function_; } | 1943 const Runtime::Function* function() const { return function_; } |
1892 ZoneList<Expression*>* arguments() const { return arguments_; } | 1944 ZoneList<Expression*>* arguments() const { return arguments_; } |
1893 bool is_jsruntime() const { return function_ == NULL; } | 1945 bool is_jsruntime() const { return function_ == NULL; } |
1894 | 1946 |
1895 TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); } | 1947 TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); } |
1896 | 1948 |
1897 protected: | 1949 protected: |
1898 CallRuntime(Zone* zone, | 1950 CallRuntime(Zone* zone, |
1899 Handle<String> name, | 1951 ParserSymbolTable::Symbol* name, |
1900 const Runtime::Function* function, | 1952 const Runtime::Function* function, |
1901 ZoneList<Expression*>* arguments, | 1953 ZoneList<Expression*>* arguments, |
1902 int pos) | 1954 int pos) |
1903 : Expression(zone, pos), | 1955 : Expression(zone, pos), |
1904 name_(name), | 1956 raw_name_(name), |
1905 function_(function), | 1957 function_(function), |
1906 arguments_(arguments) { } | 1958 arguments_(arguments) { } |
1907 | 1959 |
1908 private: | 1960 private: |
1909 Handle<String> name_; | 1961 ParserSymbolTable::Symbol* raw_name_; |
1910 const Runtime::Function* function_; | 1962 const Runtime::Function* function_; |
1911 ZoneList<Expression*>* arguments_; | 1963 ZoneList<Expression*>* arguments_; |
1912 }; | 1964 }; |
1913 | 1965 |
1914 | 1966 |
1915 class UnaryOperation V8_FINAL : public Expression { | 1967 class UnaryOperation V8_FINAL : public Expression { |
1916 public: | 1968 public: |
1917 DECLARE_NODE_TYPE(UnaryOperation) | 1969 DECLARE_NODE_TYPE(UnaryOperation) |
1918 | 1970 |
1919 Token::Value op() const { return op_; } | 1971 Token::Value op() const { return op_; } |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2287 kNotParenthesized | 2339 kNotParenthesized |
2288 }; | 2340 }; |
2289 | 2341 |
2290 enum IsGeneratorFlag { | 2342 enum IsGeneratorFlag { |
2291 kIsGenerator, | 2343 kIsGenerator, |
2292 kNotGenerator | 2344 kNotGenerator |
2293 }; | 2345 }; |
2294 | 2346 |
2295 DECLARE_NODE_TYPE(FunctionLiteral) | 2347 DECLARE_NODE_TYPE(FunctionLiteral) |
2296 | 2348 |
2297 Handle<String> name() const { return name_; } | 2349 Handle<String> name() const { return raw_name_->string(); } |
2350 ParserSymbolTable::Symbol* raw_name() const { return raw_name_; } | |
2298 Scope* scope() const { return scope_; } | 2351 Scope* scope() const { return scope_; } |
2299 ZoneList<Statement*>* body() const { return body_; } | 2352 ZoneList<Statement*>* body() const { return body_; } |
2300 void set_function_token_position(int pos) { function_token_position_ = pos; } | 2353 void set_function_token_position(int pos) { function_token_position_ = pos; } |
2301 int function_token_position() const { return function_token_position_; } | 2354 int function_token_position() const { return function_token_position_; } |
2302 int start_position() const; | 2355 int start_position() const; |
2303 int end_position() const; | 2356 int end_position() const; |
2304 int SourceSize() const { return end_position() - start_position(); } | 2357 int SourceSize() const { return end_position() - start_position(); } |
2305 bool is_expression() const { return IsExpression::decode(bitfield_); } | 2358 bool is_expression() const { return IsExpression::decode(bitfield_); } |
2306 bool is_anonymous() const { return IsAnonymous::decode(bitfield_); } | 2359 bool is_anonymous() const { return IsAnonymous::decode(bitfield_); } |
2307 StrictMode strict_mode() const; | 2360 StrictMode strict_mode() const; |
2308 | 2361 |
2309 int materialized_literal_count() { return materialized_literal_count_; } | 2362 int materialized_literal_count() { return materialized_literal_count_; } |
2310 int expected_property_count() { return expected_property_count_; } | 2363 int expected_property_count() { return expected_property_count_; } |
2311 int handler_count() { return handler_count_; } | 2364 int handler_count() { return handler_count_; } |
2312 int parameter_count() { return parameter_count_; } | 2365 int parameter_count() { return parameter_count_; } |
2313 | 2366 |
2314 bool AllowsLazyCompilation(); | 2367 bool AllowsLazyCompilation(); |
2315 bool AllowsLazyCompilationWithoutContext(); | 2368 bool AllowsLazyCompilationWithoutContext(); |
2316 | 2369 |
2317 void InitializeSharedInfo(Handle<Code> code); | 2370 void InitializeSharedInfo(Handle<Code> code); |
2318 | 2371 |
2319 Handle<String> debug_name() const { | 2372 Handle<String> debug_name() const { |
2320 if (name_->length() > 0) return name_; | 2373 if (raw_name_ != NULL) { |
2374 return raw_name_->string(); | |
2375 } | |
2321 return inferred_name(); | 2376 return inferred_name(); |
2322 } | 2377 } |
2323 | 2378 |
2324 Handle<String> inferred_name() const { return inferred_name_; } | |
2325 void set_inferred_name(Handle<String> inferred_name) { | 2379 void set_inferred_name(Handle<String> inferred_name) { |
2326 inferred_name_ = inferred_name; | 2380 inferred_name_ = inferred_name; |
2327 } | 2381 } |
2382 Handle<String> inferred_name() const { | |
2383 if (raw_inferred_name_ != NULL) { | |
rossberg
2014/05/08 12:52:08
I'm surprised that inferred_name_ does not take pr
marja
2014/06/03 08:48:20
Doesn't matter, because only one of them will be s
| |
2384 return raw_inferred_name_->string(); | |
2385 } | |
2386 if (!inferred_name_.is_null()) { | |
2387 return inferred_name_; | |
2388 } | |
2389 // FIXME: here we'd need an empty string... | |
2390 return Isolate::Current()->factory()->empty_string(); | |
2391 } | |
2392 ParserSymbolTable::Symbol* raw_inferred_name() const { | |
2393 return raw_inferred_name_; | |
2394 } | |
2395 void set_raw_inferred_name(ParserSymbolTable::Symbol* raw_inferred_name) { | |
2396 raw_inferred_name_ = raw_inferred_name; | |
2397 } | |
2328 | 2398 |
2329 // shared_info may be null if it's not cached in full code. | 2399 // shared_info may be null if it's not cached in full code. |
2330 Handle<SharedFunctionInfo> shared_info() { return shared_info_; } | 2400 Handle<SharedFunctionInfo> shared_info() { return shared_info_; } |
2331 | 2401 |
2332 bool pretenure() { return Pretenure::decode(bitfield_); } | 2402 bool pretenure() { return Pretenure::decode(bitfield_); } |
2333 void set_pretenure() { bitfield_ |= Pretenure::encode(true); } | 2403 void set_pretenure() { bitfield_ |= Pretenure::encode(true); } |
2334 | 2404 |
2335 bool has_duplicate_parameters() { | 2405 bool has_duplicate_parameters() { |
2336 return HasDuplicateParameters::decode(bitfield_); | 2406 return HasDuplicateParameters::decode(bitfield_); |
2337 } | 2407 } |
(...skipping 25 matching lines...) Expand all Loading... | |
2363 return ast_properties_.feedback_slots(); | 2433 return ast_properties_.feedback_slots(); |
2364 } | 2434 } |
2365 bool dont_optimize() { return dont_optimize_reason_ != kNoReason; } | 2435 bool dont_optimize() { return dont_optimize_reason_ != kNoReason; } |
2366 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; } | 2436 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; } |
2367 void set_dont_optimize_reason(BailoutReason reason) { | 2437 void set_dont_optimize_reason(BailoutReason reason) { |
2368 dont_optimize_reason_ = reason; | 2438 dont_optimize_reason_ = reason; |
2369 } | 2439 } |
2370 | 2440 |
2371 protected: | 2441 protected: |
2372 FunctionLiteral(Zone* zone, | 2442 FunctionLiteral(Zone* zone, |
2373 Handle<String> name, | 2443 ParserSymbolTable::Symbol* name, |
2374 Scope* scope, | 2444 Scope* scope, |
2375 ZoneList<Statement*>* body, | 2445 ZoneList<Statement*>* body, |
2376 int materialized_literal_count, | 2446 int materialized_literal_count, |
2377 int expected_property_count, | 2447 int expected_property_count, |
2378 int handler_count, | 2448 int handler_count, |
2379 int parameter_count, | 2449 int parameter_count, |
2380 FunctionType function_type, | 2450 FunctionType function_type, |
2381 ParameterFlag has_duplicate_parameters, | 2451 ParameterFlag has_duplicate_parameters, |
2382 IsFunctionFlag is_function, | 2452 IsFunctionFlag is_function, |
2383 IsParenthesizedFlag is_parenthesized, | 2453 IsParenthesizedFlag is_parenthesized, |
2384 IsGeneratorFlag is_generator, | 2454 IsGeneratorFlag is_generator, |
2385 int position) | 2455 int position) |
2386 : Expression(zone, position), | 2456 : Expression(zone, position), |
2387 name_(name), | 2457 raw_name_(name), |
2388 scope_(scope), | 2458 scope_(scope), |
2389 body_(body), | 2459 body_(body), |
2390 inferred_name_(zone->isolate()->factory()->empty_string()), | 2460 raw_inferred_name_(NULL), |
2391 dont_optimize_reason_(kNoReason), | 2461 dont_optimize_reason_(kNoReason), |
2392 materialized_literal_count_(materialized_literal_count), | 2462 materialized_literal_count_(materialized_literal_count), |
2393 expected_property_count_(expected_property_count), | 2463 expected_property_count_(expected_property_count), |
2394 handler_count_(handler_count), | 2464 handler_count_(handler_count), |
2395 parameter_count_(parameter_count), | 2465 parameter_count_(parameter_count), |
2396 function_token_position_(RelocInfo::kNoPosition) { | 2466 function_token_position_(RelocInfo::kNoPosition) { |
2397 bitfield_ = | 2467 bitfield_ = |
2398 IsExpression::encode(function_type != DECLARATION) | | 2468 IsExpression::encode(function_type != DECLARATION) | |
2399 IsAnonymous::encode(function_type == ANONYMOUS_EXPRESSION) | | 2469 IsAnonymous::encode(function_type == ANONYMOUS_EXPRESSION) | |
2400 Pretenure::encode(false) | | 2470 Pretenure::encode(false) | |
2401 HasDuplicateParameters::encode(has_duplicate_parameters) | | 2471 HasDuplicateParameters::encode(has_duplicate_parameters) | |
2402 IsFunction::encode(is_function) | | 2472 IsFunction::encode(is_function) | |
2403 IsParenthesized::encode(is_parenthesized) | | 2473 IsParenthesized::encode(is_parenthesized) | |
2404 IsGenerator::encode(is_generator); | 2474 IsGenerator::encode(is_generator); |
2405 } | 2475 } |
2406 | 2476 |
2407 private: | 2477 private: |
2478 ParserSymbolTable::Symbol* raw_name_; | |
2408 Handle<String> name_; | 2479 Handle<String> name_; |
2409 Handle<SharedFunctionInfo> shared_info_; | 2480 Handle<SharedFunctionInfo> shared_info_; |
2410 Scope* scope_; | 2481 Scope* scope_; |
2411 ZoneList<Statement*>* body_; | 2482 ZoneList<Statement*>* body_; |
2483 ParserSymbolTable::Symbol* raw_inferred_name_; | |
2412 Handle<String> inferred_name_; | 2484 Handle<String> inferred_name_; |
2413 AstProperties ast_properties_; | 2485 AstProperties ast_properties_; |
2414 BailoutReason dont_optimize_reason_; | 2486 BailoutReason dont_optimize_reason_; |
2415 | 2487 |
2416 int materialized_literal_count_; | 2488 int materialized_literal_count_; |
2417 int expected_property_count_; | 2489 int expected_property_count_; |
2418 int handler_count_; | 2490 int handler_count_; |
2419 int parameter_count_; | 2491 int parameter_count_; |
2420 int function_token_position_; | 2492 int function_token_position_; |
2421 | 2493 |
2422 unsigned bitfield_; | 2494 unsigned bitfield_; |
2423 class IsExpression: public BitField<bool, 0, 1> {}; | 2495 class IsExpression: public BitField<bool, 0, 1> {}; |
2424 class IsAnonymous: public BitField<bool, 1, 1> {}; | 2496 class IsAnonymous: public BitField<bool, 1, 1> {}; |
2425 class Pretenure: public BitField<bool, 2, 1> {}; | 2497 class Pretenure: public BitField<bool, 2, 1> {}; |
2426 class HasDuplicateParameters: public BitField<ParameterFlag, 3, 1> {}; | 2498 class HasDuplicateParameters: public BitField<ParameterFlag, 3, 1> {}; |
2427 class IsFunction: public BitField<IsFunctionFlag, 4, 1> {}; | 2499 class IsFunction: public BitField<IsFunctionFlag, 4, 1> {}; |
2428 class IsParenthesized: public BitField<IsParenthesizedFlag, 5, 1> {}; | 2500 class IsParenthesized: public BitField<IsParenthesizedFlag, 5, 1> {}; |
2429 class IsGenerator: public BitField<IsGeneratorFlag, 6, 1> {}; | 2501 class IsGenerator: public BitField<IsGeneratorFlag, 6, 1> {}; |
2430 }; | 2502 }; |
2431 | 2503 |
2432 | 2504 |
2433 class NativeFunctionLiteral V8_FINAL : public Expression { | 2505 class NativeFunctionLiteral V8_FINAL : public Expression { |
2434 public: | 2506 public: |
2435 DECLARE_NODE_TYPE(NativeFunctionLiteral) | 2507 DECLARE_NODE_TYPE(NativeFunctionLiteral) |
2436 | 2508 |
2437 Handle<String> name() const { return name_; } | 2509 Handle<String> name() const { return raw_name_->string(); } |
2438 v8::Extension* extension() const { return extension_; } | 2510 v8::Extension* extension() const { return extension_; } |
2439 | 2511 |
2440 protected: | 2512 protected: |
2441 NativeFunctionLiteral( | 2513 NativeFunctionLiteral(Zone* zone, ParserSymbolTable::Symbol* name, |
2442 Zone* zone, Handle<String> name, v8::Extension* extension, int pos) | 2514 v8::Extension* extension, int pos) |
2443 : Expression(zone, pos), name_(name), extension_(extension) {} | 2515 : Expression(zone, pos), raw_name_(name), extension_(extension) {} |
2444 | 2516 |
2445 private: | 2517 private: |
2446 Handle<String> name_; | 2518 ParserSymbolTable::Symbol* raw_name_; |
2447 v8::Extension* extension_; | 2519 v8::Extension* extension_; |
2448 }; | 2520 }; |
2449 | 2521 |
2450 | 2522 |
2451 class ThisFunction V8_FINAL : public Expression { | 2523 class ThisFunction V8_FINAL : public Expression { |
2452 public: | 2524 public: |
2453 DECLARE_NODE_TYPE(ThisFunction) | 2525 DECLARE_NODE_TYPE(ThisFunction) |
2454 | 2526 |
2455 protected: | 2527 protected: |
2456 explicit ThisFunction(Zone* zone, int pos): Expression(zone, pos) {} | 2528 explicit ThisFunction(Zone* zone, int pos): Expression(zone, pos) {} |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2992 ModuleLiteral* module = | 3064 ModuleLiteral* module = |
2993 new(zone_) ModuleLiteral(zone_, body, interface, pos); | 3065 new(zone_) ModuleLiteral(zone_, body, interface, pos); |
2994 VISIT_AND_RETURN(ModuleLiteral, module) | 3066 VISIT_AND_RETURN(ModuleLiteral, module) |
2995 } | 3067 } |
2996 | 3068 |
2997 ModuleVariable* NewModuleVariable(VariableProxy* proxy, int pos) { | 3069 ModuleVariable* NewModuleVariable(VariableProxy* proxy, int pos) { |
2998 ModuleVariable* module = new(zone_) ModuleVariable(zone_, proxy, pos); | 3070 ModuleVariable* module = new(zone_) ModuleVariable(zone_, proxy, pos); |
2999 VISIT_AND_RETURN(ModuleVariable, module) | 3071 VISIT_AND_RETURN(ModuleVariable, module) |
3000 } | 3072 } |
3001 | 3073 |
3002 ModulePath* NewModulePath(Module* origin, Handle<String> name, int pos) { | 3074 ModulePath* NewModulePath(Module* origin, ParserSymbolTable::Symbol* name, |
3075 int pos) { | |
3003 ModulePath* module = new(zone_) ModulePath(zone_, origin, name, pos); | 3076 ModulePath* module = new(zone_) ModulePath(zone_, origin, name, pos); |
3004 VISIT_AND_RETURN(ModulePath, module) | 3077 VISIT_AND_RETURN(ModulePath, module) |
3005 } | 3078 } |
3006 | 3079 |
3007 ModuleUrl* NewModuleUrl(Handle<String> url, int pos) { | 3080 ModuleUrl* NewModuleUrl(Handle<String> url, int pos) { |
3008 ModuleUrl* module = new(zone_) ModuleUrl(zone_, url, pos); | 3081 ModuleUrl* module = new(zone_) ModuleUrl(zone_, url, pos); |
3009 VISIT_AND_RETURN(ModuleUrl, module) | 3082 VISIT_AND_RETURN(ModuleUrl, module) |
3010 } | 3083 } |
3011 | 3084 |
3012 Block* NewBlock(ZoneStringList* labels, | 3085 Block* NewBlock(ZoneList<ParserSymbolTable::Symbol*>* labels, |
3013 int capacity, | 3086 int capacity, |
3014 bool is_initializer_block, | 3087 bool is_initializer_block, |
3015 int pos) { | 3088 int pos) { |
3016 Block* block = new(zone_) Block( | 3089 Block* block = new(zone_) Block( |
3017 zone_, labels, capacity, is_initializer_block, pos); | 3090 zone_, labels, capacity, is_initializer_block, pos); |
3018 VISIT_AND_RETURN(Block, block) | 3091 VISIT_AND_RETURN(Block, block) |
3019 } | 3092 } |
3020 | 3093 |
3021 #define STATEMENT_WITH_LABELS(NodeType) \ | 3094 #define STATEMENT_WITH_LABELS(NodeType) \ |
3022 NodeType* New##NodeType(ZoneStringList* labels, int pos) { \ | 3095 NodeType* New##NodeType(ZoneList<ParserSymbolTable::Symbol*>* labels,\ |
3096 int pos) { \ | |
3023 NodeType* stmt = new(zone_) NodeType(zone_, labels, pos); \ | 3097 NodeType* stmt = new(zone_) NodeType(zone_, labels, pos); \ |
3024 VISIT_AND_RETURN(NodeType, stmt); \ | 3098 VISIT_AND_RETURN(NodeType, stmt); \ |
3025 } | 3099 } |
3026 STATEMENT_WITH_LABELS(DoWhileStatement) | 3100 STATEMENT_WITH_LABELS(DoWhileStatement) |
3027 STATEMENT_WITH_LABELS(WhileStatement) | 3101 STATEMENT_WITH_LABELS(WhileStatement) |
3028 STATEMENT_WITH_LABELS(ForStatement) | 3102 STATEMENT_WITH_LABELS(ForStatement) |
3029 STATEMENT_WITH_LABELS(SwitchStatement) | 3103 STATEMENT_WITH_LABELS(SwitchStatement) |
3030 #undef STATEMENT_WITH_LABELS | 3104 #undef STATEMENT_WITH_LABELS |
3031 | 3105 |
3032 ForEachStatement* NewForEachStatement(ForEachStatement::VisitMode visit_mode, | 3106 ForEachStatement* NewForEachStatement(ForEachStatement::VisitMode visit_mode, |
3033 ZoneStringList* labels, | 3107 ZoneList<ParserSymbolTable::Symbol*>* la bels, |
3034 int pos) { | 3108 int pos) { |
3035 switch (visit_mode) { | 3109 switch (visit_mode) { |
3036 case ForEachStatement::ENUMERATE: { | 3110 case ForEachStatement::ENUMERATE: { |
3037 ForInStatement* stmt = new(zone_) ForInStatement(zone_, labels, pos); | 3111 ForInStatement* stmt = new(zone_) ForInStatement(zone_, labels, pos); |
3038 VISIT_AND_RETURN(ForInStatement, stmt); | 3112 VISIT_AND_RETURN(ForInStatement, stmt); |
3039 } | 3113 } |
3040 case ForEachStatement::ITERATE: { | 3114 case ForEachStatement::ITERATE: { |
3041 ForOfStatement* stmt = new(zone_) ForOfStatement(zone_, labels, pos); | 3115 ForOfStatement* stmt = new(zone_) ForOfStatement(zone_, labels, pos); |
3042 VISIT_AND_RETURN(ForOfStatement, stmt); | 3116 VISIT_AND_RETURN(ForOfStatement, stmt); |
3043 } | 3117 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3125 CaseClause* clause = | 3199 CaseClause* clause = |
3126 new(zone_) CaseClause(zone_, label, statements, pos); | 3200 new(zone_) CaseClause(zone_, label, statements, pos); |
3127 VISIT_AND_RETURN(CaseClause, clause) | 3201 VISIT_AND_RETURN(CaseClause, clause) |
3128 } | 3202 } |
3129 | 3203 |
3130 Literal* NewLiteral(Handle<Object> handle, int pos) { | 3204 Literal* NewLiteral(Handle<Object> handle, int pos) { |
3131 Literal* lit = new(zone_) Literal(zone_, handle, pos); | 3205 Literal* lit = new(zone_) Literal(zone_, handle, pos); |
3132 VISIT_AND_RETURN(Literal, lit) | 3206 VISIT_AND_RETURN(Literal, lit) |
3133 } | 3207 } |
3134 | 3208 |
3209 Literal* NewLiteral(ParserSymbolTable::Symbol* string, int pos) { | |
3210 Literal* lit = new(zone_) Literal(zone_, string, pos); | |
3211 VISIT_AND_RETURN(Literal, lit) | |
3212 } | |
3213 | |
3214 Literal* NewLiteral(ZoneList<ParserSymbolTable::Symbol*>* strings, int pos) { | |
3215 Literal* lit = new(zone_) Literal(zone_, strings, pos); | |
3216 VISIT_AND_RETURN(Literal, lit) | |
3217 } | |
3218 | |
3135 Literal* NewNumberLiteral(double number, int pos) { | 3219 Literal* NewNumberLiteral(double number, int pos) { |
3136 return NewLiteral( | 3220 return NewLiteral( |
3137 zone_->isolate()->factory()->NewNumber(number, TENURED), pos); | 3221 zone_->isolate()->factory()->NewNumber(number, TENURED), pos); |
3138 } | 3222 } |
3139 | 3223 |
3140 ObjectLiteral* NewObjectLiteral( | 3224 ObjectLiteral* NewObjectLiteral( |
3141 ZoneList<ObjectLiteral::Property*>* properties, | 3225 ZoneList<ObjectLiteral::Property*>* properties, |
3142 int literal_index, | 3226 int literal_index, |
3143 int boilerplate_properties, | 3227 int boilerplate_properties, |
3144 bool has_function, | 3228 bool has_function, |
3145 int pos) { | 3229 int pos) { |
3146 ObjectLiteral* lit = new(zone_) ObjectLiteral( | 3230 ObjectLiteral* lit = new(zone_) ObjectLiteral( |
3147 zone_, properties, literal_index, boilerplate_properties, | 3231 zone_, properties, literal_index, boilerplate_properties, |
3148 has_function, pos); | 3232 has_function, pos); |
3149 VISIT_AND_RETURN(ObjectLiteral, lit) | 3233 VISIT_AND_RETURN(ObjectLiteral, lit) |
3150 } | 3234 } |
3151 | 3235 |
3152 ObjectLiteral::Property* NewObjectLiteralProperty(Literal* key, | 3236 ObjectLiteral::Property* NewObjectLiteralProperty(Literal* key, |
3153 Expression* value) { | 3237 Expression* value) { |
3154 return new(zone_) ObjectLiteral::Property(zone_, key, value); | 3238 return new(zone_) ObjectLiteral::Property(zone_, key, value); |
3155 } | 3239 } |
3156 | 3240 |
3157 ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter, | 3241 ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter, |
3158 FunctionLiteral* value, | 3242 FunctionLiteral* value, |
3159 int pos) { | 3243 int pos) { |
3160 ObjectLiteral::Property* prop = | 3244 ObjectLiteral::Property* prop = |
3161 new(zone_) ObjectLiteral::Property(zone_, is_getter, value); | 3245 new(zone_) ObjectLiteral::Property(zone_, is_getter, value); |
3162 prop->set_key(NewLiteral(value->name(), pos)); | 3246 prop->set_key(NewLiteral(value->raw_name(), pos)); |
3163 return prop; // Not an AST node, will not be visited. | 3247 return prop; // Not an AST node, will not be visited. |
3164 } | 3248 } |
3165 | 3249 |
3166 RegExpLiteral* NewRegExpLiteral(Handle<String> pattern, | 3250 RegExpLiteral* NewRegExpLiteral(ParserSymbolTable::Symbol* pattern, |
3167 Handle<String> flags, | 3251 ParserSymbolTable::Symbol* flags, |
3168 int literal_index, | 3252 int literal_index, |
3169 int pos) { | 3253 int pos) { |
3170 RegExpLiteral* lit = | 3254 RegExpLiteral* lit = |
3171 new(zone_) RegExpLiteral(zone_, pattern, flags, literal_index, pos); | 3255 new(zone_) RegExpLiteral(zone_, pattern, flags, literal_index, pos); |
3172 VISIT_AND_RETURN(RegExpLiteral, lit); | 3256 VISIT_AND_RETURN(RegExpLiteral, lit); |
3173 } | 3257 } |
3174 | 3258 |
3175 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values, | 3259 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values, |
3176 int literal_index, | 3260 int literal_index, |
3177 int pos) { | 3261 int pos) { |
3178 ArrayLiteral* lit = new(zone_) ArrayLiteral( | 3262 ArrayLiteral* lit = new(zone_) ArrayLiteral( |
3179 zone_, values, literal_index, pos); | 3263 zone_, values, literal_index, pos); |
3180 VISIT_AND_RETURN(ArrayLiteral, lit) | 3264 VISIT_AND_RETURN(ArrayLiteral, lit) |
3181 } | 3265 } |
3182 | 3266 |
3183 VariableProxy* NewVariableProxy(Variable* var, | 3267 VariableProxy* NewVariableProxy(Variable* var, |
3184 int pos = RelocInfo::kNoPosition) { | 3268 int pos = RelocInfo::kNoPosition) { |
3185 VariableProxy* proxy = new(zone_) VariableProxy(zone_, var, pos); | 3269 VariableProxy* proxy = new(zone_) VariableProxy(zone_, var, pos); |
3186 VISIT_AND_RETURN(VariableProxy, proxy) | 3270 VISIT_AND_RETURN(VariableProxy, proxy) |
3187 } | 3271 } |
3188 | 3272 |
3189 VariableProxy* NewVariableProxy(Handle<String> name, | 3273 VariableProxy* NewVariableProxy(ParserSymbolTable::Symbol* name, |
3190 bool is_this, | 3274 bool is_this, |
3191 Interface* interface = Interface::NewValue(), | 3275 Interface* interface = Interface::NewValue(), |
3192 int position = RelocInfo::kNoPosition) { | 3276 int position = RelocInfo::kNoPosition) { |
3193 VariableProxy* proxy = | 3277 VariableProxy* proxy = |
3194 new(zone_) VariableProxy(zone_, name, is_this, interface, position); | 3278 new(zone_) VariableProxy(zone_, name, is_this, interface, position); |
3195 VISIT_AND_RETURN(VariableProxy, proxy) | 3279 VISIT_AND_RETURN(VariableProxy, proxy) |
3196 } | 3280 } |
3197 | 3281 |
3198 Property* NewProperty(Expression* obj, Expression* key, int pos) { | 3282 Property* NewProperty(Expression* obj, Expression* key, int pos) { |
3199 Property* prop = new(zone_) Property(zone_, obj, key, pos); | 3283 Property* prop = new(zone_) Property(zone_, obj, key, pos); |
3200 VISIT_AND_RETURN(Property, prop) | 3284 VISIT_AND_RETURN(Property, prop) |
3201 } | 3285 } |
3202 | 3286 |
3203 Call* NewCall(Expression* expression, | 3287 Call* NewCall(Expression* expression, |
3204 ZoneList<Expression*>* arguments, | 3288 ZoneList<Expression*>* arguments, |
3205 int pos) { | 3289 int pos) { |
3206 Call* call = new(zone_) Call(zone_, expression, arguments, pos); | 3290 Call* call = new(zone_) Call(zone_, expression, arguments, pos); |
3207 VISIT_AND_RETURN(Call, call) | 3291 VISIT_AND_RETURN(Call, call) |
3208 } | 3292 } |
3209 | 3293 |
3210 CallNew* NewCallNew(Expression* expression, | 3294 CallNew* NewCallNew(Expression* expression, |
3211 ZoneList<Expression*>* arguments, | 3295 ZoneList<Expression*>* arguments, |
3212 int pos) { | 3296 int pos) { |
3213 CallNew* call = new(zone_) CallNew(zone_, expression, arguments, pos); | 3297 CallNew* call = new(zone_) CallNew(zone_, expression, arguments, pos); |
3214 VISIT_AND_RETURN(CallNew, call) | 3298 VISIT_AND_RETURN(CallNew, call) |
3215 } | 3299 } |
3216 | 3300 |
3217 CallRuntime* NewCallRuntime(Handle<String> name, | 3301 CallRuntime* NewCallRuntime(ParserSymbolTable::Symbol* name, |
3218 const Runtime::Function* function, | 3302 const Runtime::Function* function, |
3219 ZoneList<Expression*>* arguments, | 3303 ZoneList<Expression*>* arguments, |
3220 int pos) { | 3304 int pos) { |
3221 CallRuntime* call = | 3305 CallRuntime* call = |
3222 new(zone_) CallRuntime(zone_, name, function, arguments, pos); | 3306 new(zone_) CallRuntime(zone_, name, function, arguments, pos); |
3223 VISIT_AND_RETURN(CallRuntime, call) | 3307 VISIT_AND_RETURN(CallRuntime, call) |
3224 } | 3308 } |
3225 | 3309 |
3226 UnaryOperation* NewUnaryOperation(Token::Value op, | 3310 UnaryOperation* NewUnaryOperation(Token::Value op, |
3227 Expression* expression, | 3311 Expression* expression, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3285 zone_, generator_object, expression, yield_kind, pos); | 3369 zone_, generator_object, expression, yield_kind, pos); |
3286 VISIT_AND_RETURN(Yield, yield) | 3370 VISIT_AND_RETURN(Yield, yield) |
3287 } | 3371 } |
3288 | 3372 |
3289 Throw* NewThrow(Expression* exception, int pos) { | 3373 Throw* NewThrow(Expression* exception, int pos) { |
3290 Throw* t = new(zone_) Throw(zone_, exception, pos); | 3374 Throw* t = new(zone_) Throw(zone_, exception, pos); |
3291 VISIT_AND_RETURN(Throw, t) | 3375 VISIT_AND_RETURN(Throw, t) |
3292 } | 3376 } |
3293 | 3377 |
3294 FunctionLiteral* NewFunctionLiteral( | 3378 FunctionLiteral* NewFunctionLiteral( |
3295 Handle<String> name, | 3379 ParserSymbolTable::Symbol* name, |
3296 Scope* scope, | 3380 Scope* scope, |
3297 ZoneList<Statement*>* body, | 3381 ZoneList<Statement*>* body, |
3298 int materialized_literal_count, | 3382 int materialized_literal_count, |
3299 int expected_property_count, | 3383 int expected_property_count, |
3300 int handler_count, | 3384 int handler_count, |
3301 int parameter_count, | 3385 int parameter_count, |
3302 FunctionLiteral::ParameterFlag has_duplicate_parameters, | 3386 FunctionLiteral::ParameterFlag has_duplicate_parameters, |
3303 FunctionLiteral::FunctionType function_type, | 3387 FunctionLiteral::FunctionType function_type, |
3304 FunctionLiteral::IsFunctionFlag is_function, | 3388 FunctionLiteral::IsFunctionFlag is_function, |
3305 FunctionLiteral::IsParenthesizedFlag is_parenthesized, | 3389 FunctionLiteral::IsParenthesizedFlag is_parenthesized, |
3306 FunctionLiteral::IsGeneratorFlag is_generator, | 3390 FunctionLiteral::IsGeneratorFlag is_generator, |
3307 int position) { | 3391 int position) { |
3308 FunctionLiteral* lit = new(zone_) FunctionLiteral( | 3392 FunctionLiteral* lit = new(zone_) FunctionLiteral( |
3309 zone_, name, scope, body, | 3393 zone_, name, scope, body, |
3310 materialized_literal_count, expected_property_count, handler_count, | 3394 materialized_literal_count, expected_property_count, handler_count, |
3311 parameter_count, function_type, has_duplicate_parameters, is_function, | 3395 parameter_count, function_type, has_duplicate_parameters, is_function, |
3312 is_parenthesized, is_generator, position); | 3396 is_parenthesized, is_generator, position); |
3313 // Top-level literal doesn't count for the AST's properties. | 3397 // Top-level literal doesn't count for the AST's properties. |
3314 if (is_function == FunctionLiteral::kIsFunction) { | 3398 if (is_function == FunctionLiteral::kIsFunction) { |
3315 visitor_.VisitFunctionLiteral(lit); | 3399 visitor_.VisitFunctionLiteral(lit); |
3316 } | 3400 } |
3317 return lit; | 3401 return lit; |
3318 } | 3402 } |
3319 | 3403 |
3320 NativeFunctionLiteral* NewNativeFunctionLiteral( | 3404 NativeFunctionLiteral* NewNativeFunctionLiteral( |
3321 Handle<String> name, v8::Extension* extension, int pos) { | 3405 ParserSymbolTable::Symbol* name, v8::Extension* extension, int pos) { |
3322 NativeFunctionLiteral* lit = | 3406 NativeFunctionLiteral* lit = |
3323 new(zone_) NativeFunctionLiteral(zone_, name, extension, pos); | 3407 new(zone_) NativeFunctionLiteral(zone_, name, extension, pos); |
3324 VISIT_AND_RETURN(NativeFunctionLiteral, lit) | 3408 VISIT_AND_RETURN(NativeFunctionLiteral, lit) |
3325 } | 3409 } |
3326 | 3410 |
3327 ThisFunction* NewThisFunction(int pos) { | 3411 ThisFunction* NewThisFunction(int pos) { |
3328 ThisFunction* fun = new(zone_) ThisFunction(zone_, pos); | 3412 ThisFunction* fun = new(zone_) ThisFunction(zone_, pos); |
3329 VISIT_AND_RETURN(ThisFunction, fun) | 3413 VISIT_AND_RETURN(ThisFunction, fun) |
3330 } | 3414 } |
3331 | 3415 |
3332 #undef VISIT_AND_RETURN | 3416 #undef VISIT_AND_RETURN |
3333 | 3417 |
3334 private: | 3418 private: |
3335 Zone* zone_; | 3419 Zone* zone_; |
3336 Visitor visitor_; | 3420 Visitor visitor_; |
3337 }; | 3421 }; |
3338 | 3422 |
3339 | 3423 |
3340 } } // namespace v8::internal | 3424 } } // namespace v8::internal |
3341 | 3425 |
3342 #endif // V8_AST_H_ | 3426 #endif // V8_AST_H_ |
OLD | NEW |