| 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" |
| 11 #include "ast-string-table.h" |
| 11 #include "factory.h" | 12 #include "factory.h" |
| 12 #include "feedback-slots.h" | 13 #include "feedback-slots.h" |
| 13 #include "isolate.h" | 14 #include "isolate.h" |
| 14 #include "jsregexp.h" | 15 #include "jsregexp.h" |
| 15 #include "list-inl.h" | 16 #include "list-inl.h" |
| 16 #include "runtime.h" | 17 #include "runtime.h" |
| 17 #include "small-pointer-list.h" | 18 #include "small-pointer-list.h" |
| 18 #include "smart-pointers.h" | 19 #include "smart-pointers.h" |
| 19 #include "token.h" | 20 #include "token.h" |
| 20 #include "types.h" | 21 #include "types.h" |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 // TODO(rossberg): this should move to its own AST node eventually. | 361 // TODO(rossberg): this should move to its own AST node eventually. |
| 361 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); | 362 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); |
| 362 byte to_boolean_types() const { return to_boolean_types_; } | 363 byte to_boolean_types() const { return to_boolean_types_; } |
| 363 | 364 |
| 364 BailoutId id() const { return id_; } | 365 BailoutId id() const { return id_; } |
| 365 TypeFeedbackId test_id() const { return test_id_; } | 366 TypeFeedbackId test_id() const { return test_id_; } |
| 366 | 367 |
| 367 protected: | 368 protected: |
| 368 Expression(Zone* zone, int pos) | 369 Expression(Zone* zone, int pos) |
| 369 : AstNode(pos), | 370 : AstNode(pos), |
| 371 zone_(zone), |
| 370 bounds_(Bounds::Unbounded(zone)), | 372 bounds_(Bounds::Unbounded(zone)), |
| 371 id_(GetNextId(zone)), | 373 id_(GetNextId(zone)), |
| 372 test_id_(GetNextId(zone)) {} | 374 test_id_(GetNextId(zone)) {} |
| 373 void set_to_boolean_types(byte types) { to_boolean_types_ = types; } | 375 void set_to_boolean_types(byte types) { to_boolean_types_ = types; } |
| 374 | 376 |
| 377 Zone* zone_; |
| 378 |
| 375 private: | 379 private: |
| 376 Bounds bounds_; | 380 Bounds bounds_; |
| 377 byte to_boolean_types_; | 381 byte to_boolean_types_; |
| 378 | 382 |
| 379 const BailoutId id_; | 383 const BailoutId id_; |
| 380 const TypeFeedbackId test_id_; | 384 const TypeFeedbackId test_id_; |
| 381 }; | 385 }; |
| 382 | 386 |
| 383 | 387 |
| 384 class BreakableStatement : public Statement { | 388 class BreakableStatement : public Statement { |
| 385 public: | 389 public: |
| 386 enum BreakableType { | 390 enum BreakableType { |
| 387 TARGET_FOR_ANONYMOUS, | 391 TARGET_FOR_ANONYMOUS, |
| 388 TARGET_FOR_NAMED_ONLY | 392 TARGET_FOR_NAMED_ONLY |
| 389 }; | 393 }; |
| 390 | 394 |
| 391 // The labels associated with this statement. May be NULL; | 395 // The labels associated with this statement. May be NULL; |
| 392 // if it is != NULL, guaranteed to contain at least one entry. | 396 // if it is != NULL, guaranteed to contain at least one entry. |
| 393 ZoneStringList* labels() const { return labels_; } | 397 ZoneList<const AstString*>* labels() const { return labels_; } |
| 394 | 398 |
| 395 // Type testing & conversion. | 399 // Type testing & conversion. |
| 396 virtual BreakableStatement* AsBreakableStatement() V8_FINAL V8_OVERRIDE { | 400 virtual BreakableStatement* AsBreakableStatement() V8_FINAL V8_OVERRIDE { |
| 397 return this; | 401 return this; |
| 398 } | 402 } |
| 399 | 403 |
| 400 // Code generation | 404 // Code generation |
| 401 Label* break_target() { return &break_target_; } | 405 Label* break_target() { return &break_target_; } |
| 402 | 406 |
| 403 // Testers. | 407 // Testers. |
| 404 bool is_target_for_anonymous() const { | 408 bool is_target_for_anonymous() const { |
| 405 return breakable_type_ == TARGET_FOR_ANONYMOUS; | 409 return breakable_type_ == TARGET_FOR_ANONYMOUS; |
| 406 } | 410 } |
| 407 | 411 |
| 408 BailoutId EntryId() const { return entry_id_; } | 412 BailoutId EntryId() const { return entry_id_; } |
| 409 BailoutId ExitId() const { return exit_id_; } | 413 BailoutId ExitId() const { return exit_id_; } |
| 410 | 414 |
| 411 protected: | 415 protected: |
| 412 BreakableStatement( | 416 BreakableStatement( |
| 413 Zone* zone, ZoneStringList* labels, | 417 Zone* zone, ZoneList<const AstString*>* labels, |
| 414 BreakableType breakable_type, int position) | 418 BreakableType breakable_type, int position) |
| 415 : Statement(zone, position), | 419 : Statement(zone, position), |
| 416 labels_(labels), | 420 labels_(labels), |
| 417 breakable_type_(breakable_type), | 421 breakable_type_(breakable_type), |
| 418 entry_id_(GetNextId(zone)), | 422 entry_id_(GetNextId(zone)), |
| 419 exit_id_(GetNextId(zone)) { | 423 exit_id_(GetNextId(zone)) { |
| 420 ASSERT(labels == NULL || labels->length() > 0); | 424 ASSERT(labels == NULL || labels->length() > 0); |
| 421 } | 425 } |
| 422 | 426 |
| 423 | 427 |
| 424 private: | 428 private: |
| 425 ZoneStringList* labels_; | 429 ZoneList<const AstString*>* labels_; |
| 426 BreakableType breakable_type_; | 430 BreakableType breakable_type_; |
| 427 Label break_target_; | 431 Label break_target_; |
| 428 const BailoutId entry_id_; | 432 const BailoutId entry_id_; |
| 429 const BailoutId exit_id_; | 433 const BailoutId exit_id_; |
| 430 }; | 434 }; |
| 431 | 435 |
| 432 | 436 |
| 433 class Block V8_FINAL : public BreakableStatement { | 437 class Block V8_FINAL : public BreakableStatement { |
| 434 public: | 438 public: |
| 435 DECLARE_NODE_TYPE(Block) | 439 DECLARE_NODE_TYPE(Block) |
| 436 | 440 |
| 437 void AddStatement(Statement* statement, Zone* zone) { | 441 void AddStatement(Statement* statement, Zone* zone) { |
| 438 statements_.Add(statement, zone); | 442 statements_.Add(statement, zone); |
| 439 } | 443 } |
| 440 | 444 |
| 441 ZoneList<Statement*>* statements() { return &statements_; } | 445 ZoneList<Statement*>* statements() { return &statements_; } |
| 442 bool is_initializer_block() const { return is_initializer_block_; } | 446 bool is_initializer_block() const { return is_initializer_block_; } |
| 443 | 447 |
| 444 virtual bool IsJump() const V8_OVERRIDE { | 448 virtual bool IsJump() const V8_OVERRIDE { |
| 445 return !statements_.is_empty() && statements_.last()->IsJump() | 449 return !statements_.is_empty() && statements_.last()->IsJump() |
| 446 && labels() == NULL; // Good enough as an approximation... | 450 && labels() == NULL; // Good enough as an approximation... |
| 447 } | 451 } |
| 448 | 452 |
| 449 Scope* scope() const { return scope_; } | 453 Scope* scope() const { return scope_; } |
| 450 void set_scope(Scope* scope) { scope_ = scope; } | 454 void set_scope(Scope* scope) { scope_ = scope; } |
| 451 | 455 |
| 452 protected: | 456 protected: |
| 453 Block(Zone* zone, | 457 Block(Zone* zone, |
| 454 ZoneStringList* labels, | 458 ZoneList<const AstString*>* labels, |
| 455 int capacity, | 459 int capacity, |
| 456 bool is_initializer_block, | 460 bool is_initializer_block, |
| 457 int pos) | 461 int pos) |
| 458 : BreakableStatement(zone, labels, TARGET_FOR_NAMED_ONLY, pos), | 462 : BreakableStatement(zone, labels, TARGET_FOR_NAMED_ONLY, pos), |
| 459 statements_(capacity, zone), | 463 statements_(capacity, zone), |
| 460 is_initializer_block_(is_initializer_block), | 464 is_initializer_block_(is_initializer_block), |
| 461 scope_(NULL) { | 465 scope_(NULL) { |
| 462 } | 466 } |
| 463 | 467 |
| 464 private: | 468 private: |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 private: | 655 private: |
| 652 VariableProxy* proxy_; | 656 VariableProxy* proxy_; |
| 653 }; | 657 }; |
| 654 | 658 |
| 655 | 659 |
| 656 class ModulePath V8_FINAL : public Module { | 660 class ModulePath V8_FINAL : public Module { |
| 657 public: | 661 public: |
| 658 DECLARE_NODE_TYPE(ModulePath) | 662 DECLARE_NODE_TYPE(ModulePath) |
| 659 | 663 |
| 660 Module* module() const { return module_; } | 664 Module* module() const { return module_; } |
| 661 Handle<String> name() const { return name_; } | 665 Handle<String> name() const { return name_->string(); } |
| 662 | 666 |
| 663 protected: | 667 protected: |
| 664 ModulePath(Zone* zone, Module* module, Handle<String> name, int pos) | 668 ModulePath(Zone* zone, Module* module, const AstString* name, |
| 665 : Module(zone, pos), | 669 int pos) |
| 666 module_(module), | 670 : Module(zone, pos), module_(module), name_(name) {} |
| 667 name_(name) { | |
| 668 } | |
| 669 | 671 |
| 670 private: | 672 private: |
| 671 Module* module_; | 673 Module* module_; |
| 672 Handle<String> name_; | 674 const AstString* name_; |
| 673 }; | 675 }; |
| 674 | 676 |
| 675 | 677 |
| 676 class ModuleUrl V8_FINAL : public Module { | 678 class ModuleUrl V8_FINAL : public Module { |
| 677 public: | 679 public: |
| 678 DECLARE_NODE_TYPE(ModuleUrl) | 680 DECLARE_NODE_TYPE(ModuleUrl) |
| 679 | 681 |
| 680 Handle<String> url() const { return url_; } | 682 Handle<String> url() const { return url_; } |
| 681 | 683 |
| 682 protected: | 684 protected: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 Statement* body() const { return body_; } | 721 Statement* body() const { return body_; } |
| 720 | 722 |
| 721 BailoutId OsrEntryId() const { return osr_entry_id_; } | 723 BailoutId OsrEntryId() const { return osr_entry_id_; } |
| 722 virtual BailoutId ContinueId() const = 0; | 724 virtual BailoutId ContinueId() const = 0; |
| 723 virtual BailoutId StackCheckId() const = 0; | 725 virtual BailoutId StackCheckId() const = 0; |
| 724 | 726 |
| 725 // Code generation | 727 // Code generation |
| 726 Label* continue_target() { return &continue_target_; } | 728 Label* continue_target() { return &continue_target_; } |
| 727 | 729 |
| 728 protected: | 730 protected: |
| 729 IterationStatement(Zone* zone, ZoneStringList* labels, int pos) | 731 IterationStatement(Zone* zone, ZoneList<const AstString*>* labels, 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 } | 735 } |
| 734 | 736 |
| 735 void Initialize(Statement* body) { | 737 void Initialize(Statement* body) { |
| 736 body_ = body; | 738 body_ = body; |
| 737 } | 739 } |
| 738 | 740 |
| 739 private: | 741 private: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 753 cond_ = cond; | 755 cond_ = cond; |
| 754 } | 756 } |
| 755 | 757 |
| 756 Expression* cond() const { return cond_; } | 758 Expression* cond() const { return cond_; } |
| 757 | 759 |
| 758 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; } | 760 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; } |
| 759 virtual BailoutId StackCheckId() const V8_OVERRIDE { return back_edge_id_; } | 761 virtual BailoutId StackCheckId() const V8_OVERRIDE { return back_edge_id_; } |
| 760 BailoutId BackEdgeId() const { return back_edge_id_; } | 762 BailoutId BackEdgeId() const { return back_edge_id_; } |
| 761 | 763 |
| 762 protected: | 764 protected: |
| 763 DoWhileStatement(Zone* zone, ZoneStringList* labels, int pos) | 765 DoWhileStatement(Zone* zone, ZoneList<const AstString*>* labels, 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 } | 770 } |
| 769 | 771 |
| 770 private: | 772 private: |
| 771 Expression* cond_; | 773 Expression* cond_; |
| 772 | 774 |
| 773 const BailoutId continue_id_; | 775 const BailoutId continue_id_; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 790 } | 792 } |
| 791 void set_may_have_function_literal(bool value) { | 793 void set_may_have_function_literal(bool value) { |
| 792 may_have_function_literal_ = value; | 794 may_have_function_literal_ = value; |
| 793 } | 795 } |
| 794 | 796 |
| 795 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } | 797 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } |
| 796 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } | 798 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } |
| 797 BailoutId BodyId() const { return body_id_; } | 799 BailoutId BodyId() const { return body_id_; } |
| 798 | 800 |
| 799 protected: | 801 protected: |
| 800 WhileStatement(Zone* zone, ZoneStringList* labels, int pos) | 802 WhileStatement(Zone* zone, ZoneList<const AstString*>* labels, 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 } | 807 } |
| 806 | 808 |
| 807 private: | 809 private: |
| 808 Expression* cond_; | 810 Expression* cond_; |
| 809 | 811 |
| 810 // True if there is a function literal subexpression in the condition. | 812 // True if there is a function literal subexpression in the condition. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 841 | 843 |
| 842 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; } | 844 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; } |
| 843 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } | 845 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } |
| 844 BailoutId BodyId() const { return body_id_; } | 846 BailoutId BodyId() const { return body_id_; } |
| 845 | 847 |
| 846 bool is_fast_smi_loop() { return loop_variable_ != NULL; } | 848 bool is_fast_smi_loop() { return loop_variable_ != NULL; } |
| 847 Variable* loop_variable() { return loop_variable_; } | 849 Variable* loop_variable() { return loop_variable_; } |
| 848 void set_loop_variable(Variable* var) { loop_variable_ = var; } | 850 void set_loop_variable(Variable* var) { loop_variable_ = var; } |
| 849 | 851 |
| 850 protected: | 852 protected: |
| 851 ForStatement(Zone* zone, ZoneStringList* labels, int pos) | 853 ForStatement(Zone* zone, ZoneList<const AstString*>* labels, int pos) |
| 852 : IterationStatement(zone, labels, pos), | 854 : IterationStatement(zone, labels, pos), |
| 853 init_(NULL), | 855 init_(NULL), |
| 854 cond_(NULL), | 856 cond_(NULL), |
| 855 next_(NULL), | 857 next_(NULL), |
| 856 may_have_function_literal_(true), | 858 may_have_function_literal_(true), |
| 857 loop_variable_(NULL), | 859 loop_variable_(NULL), |
| 858 continue_id_(GetNextId(zone)), | 860 continue_id_(GetNextId(zone)), |
| 859 body_id_(GetNextId(zone)) { | 861 body_id_(GetNextId(zone)) { |
| 860 } | 862 } |
| 861 | 863 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 883 void Initialize(Expression* each, Expression* subject, Statement* body) { | 885 void Initialize(Expression* each, Expression* subject, Statement* body) { |
| 884 IterationStatement::Initialize(body); | 886 IterationStatement::Initialize(body); |
| 885 each_ = each; | 887 each_ = each; |
| 886 subject_ = subject; | 888 subject_ = subject; |
| 887 } | 889 } |
| 888 | 890 |
| 889 Expression* each() const { return each_; } | 891 Expression* each() const { return each_; } |
| 890 Expression* subject() const { return subject_; } | 892 Expression* subject() const { return subject_; } |
| 891 | 893 |
| 892 protected: | 894 protected: |
| 893 ForEachStatement(Zone* zone, ZoneStringList* labels, int pos) | 895 ForEachStatement(Zone* zone, ZoneList<const AstString*>* labels, int pos) |
| 894 : IterationStatement(zone, labels, pos), | 896 : IterationStatement(zone, labels, pos), each_(NULL), subject_(NULL) {} |
| 895 each_(NULL), | |
| 896 subject_(NULL) { | |
| 897 } | |
| 898 | 897 |
| 899 private: | 898 private: |
| 900 Expression* each_; | 899 Expression* each_; |
| 901 Expression* subject_; | 900 Expression* subject_; |
| 902 }; | 901 }; |
| 903 | 902 |
| 904 | 903 |
| 905 class ForInStatement V8_FINAL : public ForEachStatement, | 904 class ForInStatement V8_FINAL : public ForEachStatement, |
| 906 public FeedbackSlotInterface { | 905 public FeedbackSlotInterface { |
| 907 public: | 906 public: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 923 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; | 922 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; |
| 924 ForInType for_in_type() const { return for_in_type_; } | 923 ForInType for_in_type() const { return for_in_type_; } |
| 925 void set_for_in_type(ForInType type) { for_in_type_ = type; } | 924 void set_for_in_type(ForInType type) { for_in_type_ = type; } |
| 926 | 925 |
| 927 BailoutId BodyId() const { return body_id_; } | 926 BailoutId BodyId() const { return body_id_; } |
| 928 BailoutId PrepareId() const { return prepare_id_; } | 927 BailoutId PrepareId() const { return prepare_id_; } |
| 929 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } | 928 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } |
| 930 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } | 929 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } |
| 931 | 930 |
| 932 protected: | 931 protected: |
| 933 ForInStatement(Zone* zone, ZoneStringList* labels, int pos) | 932 ForInStatement(Zone* zone, ZoneList<const AstString*>* labels, int pos) |
| 934 : ForEachStatement(zone, labels, pos), | 933 : ForEachStatement(zone, labels, pos), |
| 935 for_in_type_(SLOW_FOR_IN), | 934 for_in_type_(SLOW_FOR_IN), |
| 936 for_in_feedback_slot_(kInvalidFeedbackSlot), | 935 for_in_feedback_slot_(kInvalidFeedbackSlot), |
| 937 body_id_(GetNextId(zone)), | 936 body_id_(GetNextId(zone)), |
| 938 prepare_id_(GetNextId(zone)) { | 937 prepare_id_(GetNextId(zone)) { |
| 939 } | 938 } |
| 940 | 939 |
| 941 ForInType for_in_type_; | 940 ForInType for_in_type_; |
| 942 int for_in_feedback_slot_; | 941 int for_in_feedback_slot_; |
| 943 const BailoutId body_id_; | 942 const BailoutId body_id_; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 Expression* assign_each() const { | 985 Expression* assign_each() const { |
| 987 return assign_each_; | 986 return assign_each_; |
| 988 } | 987 } |
| 989 | 988 |
| 990 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } | 989 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } |
| 991 virtual BailoutId StackCheckId() const V8_OVERRIDE { return BackEdgeId(); } | 990 virtual BailoutId StackCheckId() const V8_OVERRIDE { return BackEdgeId(); } |
| 992 | 991 |
| 993 BailoutId BackEdgeId() const { return back_edge_id_; } | 992 BailoutId BackEdgeId() const { return back_edge_id_; } |
| 994 | 993 |
| 995 protected: | 994 protected: |
| 996 ForOfStatement(Zone* zone, ZoneStringList* labels, int pos) | 995 ForOfStatement(Zone* zone, ZoneList<const AstString*>* labels, int pos) |
| 997 : ForEachStatement(zone, labels, pos), | 996 : ForEachStatement(zone, labels, pos), |
| 998 assign_iterator_(NULL), | 997 assign_iterator_(NULL), |
| 999 next_result_(NULL), | 998 next_result_(NULL), |
| 1000 result_done_(NULL), | 999 result_done_(NULL), |
| 1001 assign_each_(NULL), | 1000 assign_each_(NULL), |
| 1002 back_edge_id_(GetNextId(zone)) { | 1001 back_edge_id_(GetNextId(zone)) { |
| 1003 } | 1002 } |
| 1004 | 1003 |
| 1005 Expression* assign_iterator_; | 1004 Expression* assign_iterator_; |
| 1006 Expression* next_result_; | 1005 Expression* next_result_; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 | 1145 |
| 1147 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { | 1146 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { |
| 1148 tag_ = tag; | 1147 tag_ = tag; |
| 1149 cases_ = cases; | 1148 cases_ = cases; |
| 1150 } | 1149 } |
| 1151 | 1150 |
| 1152 Expression* tag() const { return tag_; } | 1151 Expression* tag() const { return tag_; } |
| 1153 ZoneList<CaseClause*>* cases() const { return cases_; } | 1152 ZoneList<CaseClause*>* cases() const { return cases_; } |
| 1154 | 1153 |
| 1155 protected: | 1154 protected: |
| 1156 SwitchStatement(Zone* zone, ZoneStringList* labels, int pos) | 1155 SwitchStatement(Zone* zone, ZoneList<const AstString*>* labels, int pos) |
| 1157 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos), | 1156 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos), |
| 1158 tag_(NULL), | 1157 tag_(NULL), |
| 1159 cases_(NULL) { } | 1158 cases_(NULL) { } |
| 1160 | 1159 |
| 1161 private: | 1160 private: |
| 1162 Expression* tag_; | 1161 Expression* tag_; |
| 1163 ZoneList<CaseClause*>* cases_; | 1162 ZoneList<CaseClause*>* cases_; |
| 1164 }; | 1163 }; |
| 1165 | 1164 |
| 1166 | 1165 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1326 protected: | 1325 protected: |
| 1327 explicit EmptyStatement(Zone* zone, int pos): Statement(zone, pos) {} | 1326 explicit EmptyStatement(Zone* zone, int pos): Statement(zone, pos) {} |
| 1328 }; | 1327 }; |
| 1329 | 1328 |
| 1330 | 1329 |
| 1331 class Literal V8_FINAL : public Expression { | 1330 class Literal V8_FINAL : public Expression { |
| 1332 public: | 1331 public: |
| 1333 DECLARE_NODE_TYPE(Literal) | 1332 DECLARE_NODE_TYPE(Literal) |
| 1334 | 1333 |
| 1335 virtual bool IsPropertyName() const V8_OVERRIDE { | 1334 virtual bool IsPropertyName() const V8_OVERRIDE { |
| 1336 if (value_->IsInternalizedString()) { | 1335 return value_->IsPropertyName(); |
| 1337 uint32_t ignored; | |
| 1338 return !String::cast(*value_)->AsArrayIndex(&ignored); | |
| 1339 } | |
| 1340 return false; | |
| 1341 } | 1336 } |
| 1342 | 1337 |
| 1343 Handle<String> AsPropertyName() { | 1338 Handle<String> AsPropertyName() { |
| 1344 ASSERT(IsPropertyName()); | 1339 ASSERT(IsPropertyName()); |
| 1345 return Handle<String>::cast(value_); | 1340 return Handle<String>::cast(value()); |
| 1341 } |
| 1342 |
| 1343 const AstString* AsRawPropertyName() { |
| 1344 ASSERT(IsPropertyName()); |
| 1345 return value_->AsString(); |
| 1346 } | 1346 } |
| 1347 | 1347 |
| 1348 virtual bool ToBooleanIsTrue() const V8_OVERRIDE { | 1348 virtual bool ToBooleanIsTrue() const V8_OVERRIDE { |
| 1349 return value_->BooleanValue(); | 1349 return value()->BooleanValue(); |
| 1350 } | 1350 } |
| 1351 virtual bool ToBooleanIsFalse() const V8_OVERRIDE { | 1351 virtual bool ToBooleanIsFalse() const V8_OVERRIDE { |
| 1352 return !value_->BooleanValue(); | 1352 return !value()->BooleanValue(); |
| 1353 } | 1353 } |
| 1354 | 1354 |
| 1355 Handle<Object> value() const { return value_; } | 1355 Handle<Object> value() const { return value_->value(); } |
| 1356 const AstValue* raw_value() const { return value_; } |
| 1356 | 1357 |
| 1357 // Support for using Literal as a HashMap key. NOTE: Currently, this works | 1358 // Support for using Literal as a HashMap key. NOTE: Currently, this works |
| 1358 // only for string and number literals! | 1359 // only for string and number literals! |
| 1359 uint32_t Hash() { return ToString()->Hash(); } | 1360 uint32_t Hash() { return ToString()->Hash(); } |
| 1360 | 1361 |
| 1361 static bool Match(void* literal1, void* literal2) { | 1362 static bool Match(void* literal1, void* literal2) { |
| 1362 Handle<String> s1 = static_cast<Literal*>(literal1)->ToString(); | 1363 Handle<String> s1 = static_cast<Literal*>(literal1)->ToString(); |
| 1363 Handle<String> s2 = static_cast<Literal*>(literal2)->ToString(); | 1364 Handle<String> s2 = static_cast<Literal*>(literal2)->ToString(); |
| 1364 return String::Equals(s1, s2); | 1365 return String::Equals(s1, s2); |
| 1365 } | 1366 } |
| 1366 | 1367 |
| 1367 TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); } | 1368 TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); } |
| 1368 | 1369 |
| 1369 protected: | 1370 protected: |
| 1370 Literal(Zone* zone, Handle<Object> value, int position) | 1371 Literal(Zone* zone, const AstValue* value, int position) |
| 1371 : Expression(zone, position), | 1372 : Expression(zone, position), |
| 1372 value_(value), | 1373 value_(value), |
| 1373 isolate_(zone->isolate()) { } | 1374 isolate_(zone->isolate()) { } |
| 1374 | 1375 |
| 1375 private: | 1376 private: |
| 1376 Handle<String> ToString(); | 1377 Handle<String> ToString(); |
| 1377 | 1378 |
| 1378 Handle<Object> value_; | 1379 const AstValue* value_; |
| 1379 // TODO(dcarney): remove. this is only needed for Match and Hash. | 1380 // TODO(dcarney): remove. this is only needed for Match and Hash. |
| 1380 Isolate* isolate_; | 1381 Isolate* isolate_; |
| 1381 }; | 1382 }; |
| 1382 | 1383 |
| 1383 | 1384 |
| 1384 // Base class for literals that needs space in the corresponding JSFunction. | 1385 // Base class for literals that needs space in the corresponding JSFunction. |
| 1385 class MaterializedLiteral : public Expression { | 1386 class MaterializedLiteral : public Expression { |
| 1386 public: | 1387 public: |
| 1387 virtual MaterializedLiteral* AsMaterializedLiteral() { return this; } | 1388 virtual MaterializedLiteral* AsMaterializedLiteral() { return this; } |
| 1388 | 1389 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1439 class ObjectLiteralProperty V8_FINAL : public ZoneObject { | 1440 class ObjectLiteralProperty V8_FINAL : public ZoneObject { |
| 1440 public: | 1441 public: |
| 1441 enum Kind { | 1442 enum Kind { |
| 1442 CONSTANT, // Property with constant value (compile time). | 1443 CONSTANT, // Property with constant value (compile time). |
| 1443 COMPUTED, // Property with computed value (execution time). | 1444 COMPUTED, // Property with computed value (execution time). |
| 1444 MATERIALIZED_LITERAL, // Property value is a materialized literal. | 1445 MATERIALIZED_LITERAL, // Property value is a materialized literal. |
| 1445 GETTER, SETTER, // Property is an accessor function. | 1446 GETTER, SETTER, // Property is an accessor function. |
| 1446 PROTOTYPE // Property is __proto__. | 1447 PROTOTYPE // Property is __proto__. |
| 1447 }; | 1448 }; |
| 1448 | 1449 |
| 1449 ObjectLiteralProperty(Zone* zone, Literal* key, Expression* value); | 1450 ObjectLiteralProperty(Zone* zone, AstStringTable* string_table, |
| 1451 Literal* key, Expression* value); |
| 1450 | 1452 |
| 1451 Literal* key() { return key_; } | 1453 Literal* key() { return key_; } |
| 1452 Expression* value() { return value_; } | 1454 Expression* value() { return value_; } |
| 1453 Kind kind() { return kind_; } | 1455 Kind kind() { return kind_; } |
| 1454 | 1456 |
| 1455 // Type feedback information. | 1457 // Type feedback information. |
| 1456 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1458 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| 1457 bool IsMonomorphic() { return !receiver_type_.is_null(); } | 1459 bool IsMonomorphic() { return !receiver_type_.is_null(); } |
| 1458 Handle<Map> GetReceiverType() { return receiver_type_; } | 1460 Handle<Map> GetReceiverType() { return receiver_type_; } |
| 1459 | 1461 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1538 bool may_store_doubles_; | 1540 bool may_store_doubles_; |
| 1539 bool has_function_; | 1541 bool has_function_; |
| 1540 }; | 1542 }; |
| 1541 | 1543 |
| 1542 | 1544 |
| 1543 // Node for capturing a regexp literal. | 1545 // Node for capturing a regexp literal. |
| 1544 class RegExpLiteral V8_FINAL : public MaterializedLiteral { | 1546 class RegExpLiteral V8_FINAL : public MaterializedLiteral { |
| 1545 public: | 1547 public: |
| 1546 DECLARE_NODE_TYPE(RegExpLiteral) | 1548 DECLARE_NODE_TYPE(RegExpLiteral) |
| 1547 | 1549 |
| 1548 Handle<String> pattern() const { return pattern_; } | 1550 Handle<String> pattern() const { return pattern_->string(); } |
| 1549 Handle<String> flags() const { return flags_; } | 1551 Handle<String> flags() const { return flags_->string(); } |
| 1550 | 1552 |
| 1551 protected: | 1553 protected: |
| 1552 RegExpLiteral(Zone* zone, | 1554 RegExpLiteral(Zone* zone, |
| 1553 Handle<String> pattern, | 1555 const AstString* pattern, |
| 1554 Handle<String> flags, | 1556 const AstString* flags, |
| 1555 int literal_index, | 1557 int literal_index, |
| 1556 int pos) | 1558 int pos) |
| 1557 : MaterializedLiteral(zone, literal_index, pos), | 1559 : MaterializedLiteral(zone, literal_index, pos), |
| 1558 pattern_(pattern), | 1560 pattern_(pattern), |
| 1559 flags_(flags) { | 1561 flags_(flags) { |
| 1560 set_depth(1); | 1562 set_depth(1); |
| 1561 } | 1563 } |
| 1562 | 1564 |
| 1563 private: | 1565 private: |
| 1564 Handle<String> pattern_; | 1566 const AstString* pattern_; |
| 1565 Handle<String> flags_; | 1567 const AstString* flags_; |
| 1566 }; | 1568 }; |
| 1567 | 1569 |
| 1568 | 1570 |
| 1569 // An array literal has a literals object that is used | 1571 // An array literal has a literals object that is used |
| 1570 // for minimizing the work when constructing it at runtime. | 1572 // for minimizing the work when constructing it at runtime. |
| 1571 class ArrayLiteral V8_FINAL : public MaterializedLiteral { | 1573 class ArrayLiteral V8_FINAL : public MaterializedLiteral { |
| 1572 public: | 1574 public: |
| 1573 DECLARE_NODE_TYPE(ArrayLiteral) | 1575 DECLARE_NODE_TYPE(ArrayLiteral) |
| 1574 | 1576 |
| 1575 Handle<FixedArray> constant_elements() const { return constant_elements_; } | 1577 Handle<FixedArray> constant_elements() const { return constant_elements_; } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1606 | 1608 |
| 1607 | 1609 |
| 1608 class VariableProxy V8_FINAL : public Expression { | 1610 class VariableProxy V8_FINAL : public Expression { |
| 1609 public: | 1611 public: |
| 1610 DECLARE_NODE_TYPE(VariableProxy) | 1612 DECLARE_NODE_TYPE(VariableProxy) |
| 1611 | 1613 |
| 1612 virtual bool IsValidReferenceExpression() const V8_OVERRIDE { | 1614 virtual bool IsValidReferenceExpression() const V8_OVERRIDE { |
| 1613 return var_ == NULL ? true : var_->IsValidReference(); | 1615 return var_ == NULL ? true : var_->IsValidReference(); |
| 1614 } | 1616 } |
| 1615 | 1617 |
| 1616 bool IsVariable(Handle<String> n) const { | |
| 1617 return !is_this() && name().is_identical_to(n); | |
| 1618 } | |
| 1619 | |
| 1620 bool IsArguments() const { return var_ != NULL && var_->is_arguments(); } | 1618 bool IsArguments() const { return var_ != NULL && var_->is_arguments(); } |
| 1621 | 1619 |
| 1622 bool IsLValue() const { return is_lvalue_; } | 1620 bool IsLValue() const { return is_lvalue_; } |
| 1623 | 1621 |
| 1624 Handle<String> name() const { return name_; } | 1622 Handle<String> name() const { return name_->string(); } |
| 1623 const AstString* raw_name() const { return name_; } |
| 1625 Variable* var() const { return var_; } | 1624 Variable* var() const { return var_; } |
| 1626 bool is_this() const { return is_this_; } | 1625 bool is_this() const { return is_this_; } |
| 1627 Interface* interface() const { return interface_; } | 1626 Interface* interface() const { return interface_; } |
| 1628 | 1627 |
| 1629 | 1628 |
| 1630 void MarkAsTrivial() { is_trivial_ = true; } | 1629 void MarkAsTrivial() { is_trivial_ = true; } |
| 1631 void MarkAsLValue() { is_lvalue_ = true; } | 1630 void MarkAsLValue() { is_lvalue_ = true; } |
| 1632 | 1631 |
| 1633 // Bind this proxy to the variable var. Interfaces must match. | 1632 // Bind this proxy to the variable var. Interfaces must match. |
| 1634 void BindTo(Variable* var); | 1633 void BindTo(Variable* var); |
| 1635 | 1634 |
| 1636 protected: | 1635 protected: |
| 1637 VariableProxy(Zone* zone, Variable* var, int position); | 1636 VariableProxy(Zone* zone, Variable* var, int position); |
| 1638 | 1637 |
| 1639 VariableProxy(Zone* zone, | 1638 VariableProxy(Zone* zone, |
| 1640 Handle<String> name, | 1639 const AstString* name, |
| 1641 bool is_this, | 1640 bool is_this, |
| 1642 Interface* interface, | 1641 Interface* interface, |
| 1643 int position); | 1642 int position); |
| 1644 | 1643 |
| 1645 Handle<String> name_; | 1644 const AstString* name_; |
| 1646 Variable* var_; // resolved variable, or NULL | 1645 Variable* var_; // resolved variable, or NULL |
| 1647 bool is_this_; | 1646 bool is_this_; |
| 1648 bool is_trivial_; | 1647 bool is_trivial_; |
| 1649 // True if this variable proxy is being used in an assignment | 1648 // True if this variable proxy is being used in an assignment |
| 1650 // or with a increment/decrement operator. | 1649 // or with a increment/decrement operator. |
| 1651 bool is_lvalue_; | 1650 bool is_lvalue_; |
| 1652 Interface* interface_; | 1651 Interface* interface_; |
| 1653 }; | 1652 }; |
| 1654 | 1653 |
| 1655 | 1654 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1881 | 1880 |
| 1882 | 1881 |
| 1883 // The CallRuntime class does not represent any official JavaScript | 1882 // The CallRuntime class does not represent any official JavaScript |
| 1884 // language construct. Instead it is used to call a C or JS function | 1883 // language construct. Instead it is used to call a C or JS function |
| 1885 // with a set of arguments. This is used from the builtins that are | 1884 // with a set of arguments. This is used from the builtins that are |
| 1886 // implemented in JavaScript (see "v8natives.js"). | 1885 // implemented in JavaScript (see "v8natives.js"). |
| 1887 class CallRuntime V8_FINAL : public Expression { | 1886 class CallRuntime V8_FINAL : public Expression { |
| 1888 public: | 1887 public: |
| 1889 DECLARE_NODE_TYPE(CallRuntime) | 1888 DECLARE_NODE_TYPE(CallRuntime) |
| 1890 | 1889 |
| 1891 Handle<String> name() const { return name_; } | 1890 Handle<String> name() const { return raw_name_->string(); } |
| 1891 const AstString* raw_name() const { return raw_name_; } |
| 1892 const Runtime::Function* function() const { return function_; } | 1892 const Runtime::Function* function() const { return function_; } |
| 1893 ZoneList<Expression*>* arguments() const { return arguments_; } | 1893 ZoneList<Expression*>* arguments() const { return arguments_; } |
| 1894 bool is_jsruntime() const { return function_ == NULL; } | 1894 bool is_jsruntime() const { return function_ == NULL; } |
| 1895 | 1895 |
| 1896 TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); } | 1896 TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); } |
| 1897 | 1897 |
| 1898 protected: | 1898 protected: |
| 1899 CallRuntime(Zone* zone, | 1899 CallRuntime(Zone* zone, |
| 1900 Handle<String> name, | 1900 const AstString* name, |
| 1901 const Runtime::Function* function, | 1901 const Runtime::Function* function, |
| 1902 ZoneList<Expression*>* arguments, | 1902 ZoneList<Expression*>* arguments, |
| 1903 int pos) | 1903 int pos) |
| 1904 : Expression(zone, pos), | 1904 : Expression(zone, pos), |
| 1905 name_(name), | 1905 raw_name_(name), |
| 1906 function_(function), | 1906 function_(function), |
| 1907 arguments_(arguments) { } | 1907 arguments_(arguments) { } |
| 1908 | 1908 |
| 1909 private: | 1909 private: |
| 1910 Handle<String> name_; | 1910 const AstString* raw_name_; |
| 1911 const Runtime::Function* function_; | 1911 const Runtime::Function* function_; |
| 1912 ZoneList<Expression*>* arguments_; | 1912 ZoneList<Expression*>* arguments_; |
| 1913 }; | 1913 }; |
| 1914 | 1914 |
| 1915 | 1915 |
| 1916 class UnaryOperation V8_FINAL : public Expression { | 1916 class UnaryOperation V8_FINAL : public Expression { |
| 1917 public: | 1917 public: |
| 1918 DECLARE_NODE_TYPE(UnaryOperation) | 1918 DECLARE_NODE_TYPE(UnaryOperation) |
| 1919 | 1919 |
| 1920 Token::Value op() const { return op_; } | 1920 Token::Value op() const { return op_; } |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2288 kNotParenthesized | 2288 kNotParenthesized |
| 2289 }; | 2289 }; |
| 2290 | 2290 |
| 2291 enum IsGeneratorFlag { | 2291 enum IsGeneratorFlag { |
| 2292 kIsGenerator, | 2292 kIsGenerator, |
| 2293 kNotGenerator | 2293 kNotGenerator |
| 2294 }; | 2294 }; |
| 2295 | 2295 |
| 2296 DECLARE_NODE_TYPE(FunctionLiteral) | 2296 DECLARE_NODE_TYPE(FunctionLiteral) |
| 2297 | 2297 |
| 2298 Handle<String> name() const { return name_; } | 2298 Handle<String> name() const { return raw_name_->string(); } |
| 2299 const AstString* raw_name() const { return raw_name_; } |
| 2299 Scope* scope() const { return scope_; } | 2300 Scope* scope() const { return scope_; } |
| 2300 ZoneList<Statement*>* body() const { return body_; } | 2301 ZoneList<Statement*>* body() const { return body_; } |
| 2301 void set_function_token_position(int pos) { function_token_position_ = pos; } | 2302 void set_function_token_position(int pos) { function_token_position_ = pos; } |
| 2302 int function_token_position() const { return function_token_position_; } | 2303 int function_token_position() const { return function_token_position_; } |
| 2303 int start_position() const; | 2304 int start_position() const; |
| 2304 int end_position() const; | 2305 int end_position() const; |
| 2305 int SourceSize() const { return end_position() - start_position(); } | 2306 int SourceSize() const { return end_position() - start_position(); } |
| 2306 bool is_expression() const { return IsExpression::decode(bitfield_); } | 2307 bool is_expression() const { return IsExpression::decode(bitfield_); } |
| 2307 bool is_anonymous() const { return IsAnonymous::decode(bitfield_); } | 2308 bool is_anonymous() const { return IsAnonymous::decode(bitfield_); } |
| 2308 StrictMode strict_mode() const; | 2309 StrictMode strict_mode() const; |
| 2309 | 2310 |
| 2310 int materialized_literal_count() { return materialized_literal_count_; } | 2311 int materialized_literal_count() { return materialized_literal_count_; } |
| 2311 int expected_property_count() { return expected_property_count_; } | 2312 int expected_property_count() { return expected_property_count_; } |
| 2312 int handler_count() { return handler_count_; } | 2313 int handler_count() { return handler_count_; } |
| 2313 int parameter_count() { return parameter_count_; } | 2314 int parameter_count() { return parameter_count_; } |
| 2314 | 2315 |
| 2315 bool AllowsLazyCompilation(); | 2316 bool AllowsLazyCompilation(); |
| 2316 bool AllowsLazyCompilationWithoutContext(); | 2317 bool AllowsLazyCompilationWithoutContext(); |
| 2317 | 2318 |
| 2318 void InitializeSharedInfo(Handle<Code> code); | 2319 void InitializeSharedInfo(Handle<Code> code); |
| 2319 | 2320 |
| 2320 Handle<String> debug_name() const { | 2321 Handle<String> debug_name() const { |
| 2321 if (name_->length() > 0) return name_; | 2322 if (raw_name_ != NULL && raw_name_->length() > 0) { |
| 2323 return raw_name_->string(); |
| 2324 } |
| 2322 return inferred_name(); | 2325 return inferred_name(); |
| 2323 } | 2326 } |
| 2324 | 2327 |
| 2325 Handle<String> inferred_name() const { return inferred_name_; } | 2328 Handle<String> inferred_name() const { |
| 2329 if (!inferred_name_.is_null()) { |
| 2330 ASSERT(raw_inferred_name_ == NULL); |
| 2331 return inferred_name_; |
| 2332 } |
| 2333 if (raw_inferred_name_ != NULL) { |
| 2334 return raw_inferred_name_->string(); |
| 2335 } |
| 2336 UNREACHABLE(); |
| 2337 return Handle<String>(); |
| 2338 } |
| 2339 |
| 2326 void set_inferred_name(Handle<String> inferred_name) { | 2340 void set_inferred_name(Handle<String> inferred_name) { |
| 2327 inferred_name_ = inferred_name; | 2341 inferred_name_ = inferred_name; |
| 2342 raw_inferred_name_ = NULL; |
| 2343 } |
| 2344 |
| 2345 void set_raw_inferred_name(const AstString* raw_inferred_name) { |
| 2346 raw_inferred_name_ = raw_inferred_name; |
| 2347 inferred_name_ = Handle<String>(); |
| 2328 } | 2348 } |
| 2329 | 2349 |
| 2330 // shared_info may be null if it's not cached in full code. | 2350 // shared_info may be null if it's not cached in full code. |
| 2331 Handle<SharedFunctionInfo> shared_info() { return shared_info_; } | 2351 Handle<SharedFunctionInfo> shared_info() { return shared_info_; } |
| 2332 | 2352 |
| 2333 bool pretenure() { return Pretenure::decode(bitfield_); } | 2353 bool pretenure() { return Pretenure::decode(bitfield_); } |
| 2334 void set_pretenure() { bitfield_ |= Pretenure::encode(true); } | 2354 void set_pretenure() { bitfield_ |= Pretenure::encode(true); } |
| 2335 | 2355 |
| 2336 bool has_duplicate_parameters() { | 2356 bool has_duplicate_parameters() { |
| 2337 return HasDuplicateParameters::decode(bitfield_); | 2357 return HasDuplicateParameters::decode(bitfield_); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2364 return ast_properties_.feedback_slots(); | 2384 return ast_properties_.feedback_slots(); |
| 2365 } | 2385 } |
| 2366 bool dont_optimize() { return dont_optimize_reason_ != kNoReason; } | 2386 bool dont_optimize() { return dont_optimize_reason_ != kNoReason; } |
| 2367 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; } | 2387 BailoutReason dont_optimize_reason() { return dont_optimize_reason_; } |
| 2368 void set_dont_optimize_reason(BailoutReason reason) { | 2388 void set_dont_optimize_reason(BailoutReason reason) { |
| 2369 dont_optimize_reason_ = reason; | 2389 dont_optimize_reason_ = reason; |
| 2370 } | 2390 } |
| 2371 | 2391 |
| 2372 protected: | 2392 protected: |
| 2373 FunctionLiteral(Zone* zone, | 2393 FunctionLiteral(Zone* zone, |
| 2374 Handle<String> name, | 2394 const AstString* name, |
| 2395 AstStringTable* string_table, |
| 2375 Scope* scope, | 2396 Scope* scope, |
| 2376 ZoneList<Statement*>* body, | 2397 ZoneList<Statement*>* body, |
| 2377 int materialized_literal_count, | 2398 int materialized_literal_count, |
| 2378 int expected_property_count, | 2399 int expected_property_count, |
| 2379 int handler_count, | 2400 int handler_count, |
| 2380 int parameter_count, | 2401 int parameter_count, |
| 2381 FunctionType function_type, | 2402 FunctionType function_type, |
| 2382 ParameterFlag has_duplicate_parameters, | 2403 ParameterFlag has_duplicate_parameters, |
| 2383 IsFunctionFlag is_function, | 2404 IsFunctionFlag is_function, |
| 2384 IsParenthesizedFlag is_parenthesized, | 2405 IsParenthesizedFlag is_parenthesized, |
| 2385 IsGeneratorFlag is_generator, | 2406 IsGeneratorFlag is_generator, |
| 2386 int position) | 2407 int position) |
| 2387 : Expression(zone, position), | 2408 : Expression(zone, position), |
| 2388 name_(name), | 2409 raw_name_(name), |
| 2389 scope_(scope), | 2410 scope_(scope), |
| 2390 body_(body), | 2411 body_(body), |
| 2391 inferred_name_(zone->isolate()->factory()->empty_string()), | 2412 raw_inferred_name_(string_table->empty_string()), |
| 2392 dont_optimize_reason_(kNoReason), | 2413 dont_optimize_reason_(kNoReason), |
| 2393 materialized_literal_count_(materialized_literal_count), | 2414 materialized_literal_count_(materialized_literal_count), |
| 2394 expected_property_count_(expected_property_count), | 2415 expected_property_count_(expected_property_count), |
| 2395 handler_count_(handler_count), | 2416 handler_count_(handler_count), |
| 2396 parameter_count_(parameter_count), | 2417 parameter_count_(parameter_count), |
| 2397 function_token_position_(RelocInfo::kNoPosition) { | 2418 function_token_position_(RelocInfo::kNoPosition) { |
| 2398 bitfield_ = | 2419 bitfield_ = |
| 2399 IsExpression::encode(function_type != DECLARATION) | | 2420 IsExpression::encode(function_type != DECLARATION) | |
| 2400 IsAnonymous::encode(function_type == ANONYMOUS_EXPRESSION) | | 2421 IsAnonymous::encode(function_type == ANONYMOUS_EXPRESSION) | |
| 2401 Pretenure::encode(false) | | 2422 Pretenure::encode(false) | |
| 2402 HasDuplicateParameters::encode(has_duplicate_parameters) | | 2423 HasDuplicateParameters::encode(has_duplicate_parameters) | |
| 2403 IsFunction::encode(is_function) | | 2424 IsFunction::encode(is_function) | |
| 2404 IsParenthesized::encode(is_parenthesized) | | 2425 IsParenthesized::encode(is_parenthesized) | |
| 2405 IsGenerator::encode(is_generator); | 2426 IsGenerator::encode(is_generator); |
| 2406 } | 2427 } |
| 2407 | 2428 |
| 2408 private: | 2429 private: |
| 2430 const AstString* raw_name_; |
| 2409 Handle<String> name_; | 2431 Handle<String> name_; |
| 2410 Handle<SharedFunctionInfo> shared_info_; | 2432 Handle<SharedFunctionInfo> shared_info_; |
| 2411 Scope* scope_; | 2433 Scope* scope_; |
| 2412 ZoneList<Statement*>* body_; | 2434 ZoneList<Statement*>* body_; |
| 2435 const AstString* raw_inferred_name_; |
| 2413 Handle<String> inferred_name_; | 2436 Handle<String> inferred_name_; |
| 2414 AstProperties ast_properties_; | 2437 AstProperties ast_properties_; |
| 2415 BailoutReason dont_optimize_reason_; | 2438 BailoutReason dont_optimize_reason_; |
| 2416 | 2439 |
| 2417 int materialized_literal_count_; | 2440 int materialized_literal_count_; |
| 2418 int expected_property_count_; | 2441 int expected_property_count_; |
| 2419 int handler_count_; | 2442 int handler_count_; |
| 2420 int parameter_count_; | 2443 int parameter_count_; |
| 2421 int function_token_position_; | 2444 int function_token_position_; |
| 2422 | 2445 |
| 2423 unsigned bitfield_; | 2446 unsigned bitfield_; |
| 2424 class IsExpression: public BitField<bool, 0, 1> {}; | 2447 class IsExpression: public BitField<bool, 0, 1> {}; |
| 2425 class IsAnonymous: public BitField<bool, 1, 1> {}; | 2448 class IsAnonymous: public BitField<bool, 1, 1> {}; |
| 2426 class Pretenure: public BitField<bool, 2, 1> {}; | 2449 class Pretenure: public BitField<bool, 2, 1> {}; |
| 2427 class HasDuplicateParameters: public BitField<ParameterFlag, 3, 1> {}; | 2450 class HasDuplicateParameters: public BitField<ParameterFlag, 3, 1> {}; |
| 2428 class IsFunction: public BitField<IsFunctionFlag, 4, 1> {}; | 2451 class IsFunction: public BitField<IsFunctionFlag, 4, 1> {}; |
| 2429 class IsParenthesized: public BitField<IsParenthesizedFlag, 5, 1> {}; | 2452 class IsParenthesized: public BitField<IsParenthesizedFlag, 5, 1> {}; |
| 2430 class IsGenerator: public BitField<IsGeneratorFlag, 6, 1> {}; | 2453 class IsGenerator: public BitField<IsGeneratorFlag, 6, 1> {}; |
| 2431 }; | 2454 }; |
| 2432 | 2455 |
| 2433 | 2456 |
| 2434 class NativeFunctionLiteral V8_FINAL : public Expression { | 2457 class NativeFunctionLiteral V8_FINAL : public Expression { |
| 2435 public: | 2458 public: |
| 2436 DECLARE_NODE_TYPE(NativeFunctionLiteral) | 2459 DECLARE_NODE_TYPE(NativeFunctionLiteral) |
| 2437 | 2460 |
| 2438 Handle<String> name() const { return name_; } | 2461 Handle<String> name() const { return name_->string(); } |
| 2439 v8::Extension* extension() const { return extension_; } | 2462 v8::Extension* extension() const { return extension_; } |
| 2440 | 2463 |
| 2441 protected: | 2464 protected: |
| 2442 NativeFunctionLiteral( | 2465 NativeFunctionLiteral(Zone* zone, const AstString* name, |
| 2443 Zone* zone, Handle<String> name, v8::Extension* extension, int pos) | 2466 v8::Extension* extension, int pos) |
| 2444 : Expression(zone, pos), name_(name), extension_(extension) {} | 2467 : Expression(zone, pos), name_(name), extension_(extension) {} |
| 2445 | 2468 |
| 2446 private: | 2469 private: |
| 2447 Handle<String> name_; | 2470 const AstString* name_; |
| 2448 v8::Extension* extension_; | 2471 v8::Extension* extension_; |
| 2449 }; | 2472 }; |
| 2450 | 2473 |
| 2451 | 2474 |
| 2452 class ThisFunction V8_FINAL : public Expression { | 2475 class ThisFunction V8_FINAL : public Expression { |
| 2453 public: | 2476 public: |
| 2454 DECLARE_NODE_TYPE(ThisFunction) | 2477 DECLARE_NODE_TYPE(ThisFunction) |
| 2455 | 2478 |
| 2456 protected: | 2479 protected: |
| 2457 explicit ThisFunction(Zone* zone, int pos): Expression(zone, pos) {} | 2480 explicit ThisFunction(Zone* zone, int pos): Expression(zone, pos) {} |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2929 }; | 2952 }; |
| 2930 | 2953 |
| 2931 | 2954 |
| 2932 | 2955 |
| 2933 // ---------------------------------------------------------------------------- | 2956 // ---------------------------------------------------------------------------- |
| 2934 // AstNode factory | 2957 // AstNode factory |
| 2935 | 2958 |
| 2936 template<class Visitor> | 2959 template<class Visitor> |
| 2937 class AstNodeFactory V8_FINAL BASE_EMBEDDED { | 2960 class AstNodeFactory V8_FINAL BASE_EMBEDDED { |
| 2938 public: | 2961 public: |
| 2939 explicit AstNodeFactory(Zone* zone) : zone_(zone) { } | 2962 explicit AstNodeFactory(Zone* zone, AstStringTable* string_table) |
| 2963 : zone_(zone), string_table_(string_table) {} |
| 2940 | 2964 |
| 2941 Visitor* visitor() { return &visitor_; } | 2965 Visitor* visitor() { return &visitor_; } |
| 2942 | 2966 |
| 2943 #define VISIT_AND_RETURN(NodeType, node) \ | 2967 #define VISIT_AND_RETURN(NodeType, node) \ |
| 2944 visitor_.Visit##NodeType((node)); \ | 2968 visitor_.Visit##NodeType((node)); \ |
| 2945 return node; | 2969 return node; |
| 2946 | 2970 |
| 2947 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy, | 2971 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy, |
| 2948 VariableMode mode, | 2972 VariableMode mode, |
| 2949 Scope* scope, | 2973 Scope* scope, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2993 ModuleLiteral* module = | 3017 ModuleLiteral* module = |
| 2994 new(zone_) ModuleLiteral(zone_, body, interface, pos); | 3018 new(zone_) ModuleLiteral(zone_, body, interface, pos); |
| 2995 VISIT_AND_RETURN(ModuleLiteral, module) | 3019 VISIT_AND_RETURN(ModuleLiteral, module) |
| 2996 } | 3020 } |
| 2997 | 3021 |
| 2998 ModuleVariable* NewModuleVariable(VariableProxy* proxy, int pos) { | 3022 ModuleVariable* NewModuleVariable(VariableProxy* proxy, int pos) { |
| 2999 ModuleVariable* module = new(zone_) ModuleVariable(zone_, proxy, pos); | 3023 ModuleVariable* module = new(zone_) ModuleVariable(zone_, proxy, pos); |
| 3000 VISIT_AND_RETURN(ModuleVariable, module) | 3024 VISIT_AND_RETURN(ModuleVariable, module) |
| 3001 } | 3025 } |
| 3002 | 3026 |
| 3003 ModulePath* NewModulePath(Module* origin, Handle<String> name, int pos) { | 3027 ModulePath* NewModulePath(Module* origin, |
| 3004 ModulePath* module = new(zone_) ModulePath(zone_, origin, name, pos); | 3028 const AstString* name, int pos) { |
| 3029 ModulePath* module = new (zone_) ModulePath(zone_, origin, name, pos); |
| 3005 VISIT_AND_RETURN(ModulePath, module) | 3030 VISIT_AND_RETURN(ModulePath, module) |
| 3006 } | 3031 } |
| 3007 | 3032 |
| 3008 ModuleUrl* NewModuleUrl(Handle<String> url, int pos) { | 3033 ModuleUrl* NewModuleUrl(Handle<String> url, int pos) { |
| 3009 ModuleUrl* module = new(zone_) ModuleUrl(zone_, url, pos); | 3034 ModuleUrl* module = new(zone_) ModuleUrl(zone_, url, pos); |
| 3010 VISIT_AND_RETURN(ModuleUrl, module) | 3035 VISIT_AND_RETURN(ModuleUrl, module) |
| 3011 } | 3036 } |
| 3012 | 3037 |
| 3013 Block* NewBlock(ZoneStringList* labels, | 3038 Block* NewBlock(ZoneList<const AstString*>* labels, |
| 3014 int capacity, | 3039 int capacity, |
| 3015 bool is_initializer_block, | 3040 bool is_initializer_block, |
| 3016 int pos) { | 3041 int pos) { |
| 3017 Block* block = new(zone_) Block( | 3042 Block* block = new(zone_) Block( |
| 3018 zone_, labels, capacity, is_initializer_block, pos); | 3043 zone_, labels, capacity, is_initializer_block, pos); |
| 3019 VISIT_AND_RETURN(Block, block) | 3044 VISIT_AND_RETURN(Block, block) |
| 3020 } | 3045 } |
| 3021 | 3046 |
| 3022 #define STATEMENT_WITH_LABELS(NodeType) \ | 3047 #define STATEMENT_WITH_LABELS(NodeType) \ |
| 3023 NodeType* New##NodeType(ZoneStringList* labels, int pos) { \ | 3048 NodeType* New##NodeType(ZoneList<const AstString*>* labels, int pos) { \ |
| 3024 NodeType* stmt = new(zone_) NodeType(zone_, labels, pos); \ | 3049 NodeType* stmt = new(zone_) NodeType(zone_, labels, pos); \ |
| 3025 VISIT_AND_RETURN(NodeType, stmt); \ | 3050 VISIT_AND_RETURN(NodeType, stmt); \ |
| 3026 } | 3051 } |
| 3027 STATEMENT_WITH_LABELS(DoWhileStatement) | 3052 STATEMENT_WITH_LABELS(DoWhileStatement) |
| 3028 STATEMENT_WITH_LABELS(WhileStatement) | 3053 STATEMENT_WITH_LABELS(WhileStatement) |
| 3029 STATEMENT_WITH_LABELS(ForStatement) | 3054 STATEMENT_WITH_LABELS(ForStatement) |
| 3030 STATEMENT_WITH_LABELS(SwitchStatement) | 3055 STATEMENT_WITH_LABELS(SwitchStatement) |
| 3031 #undef STATEMENT_WITH_LABELS | 3056 #undef STATEMENT_WITH_LABELS |
| 3032 | 3057 |
| 3033 ForEachStatement* NewForEachStatement(ForEachStatement::VisitMode visit_mode, | 3058 ForEachStatement* NewForEachStatement(ForEachStatement::VisitMode visit_mode, |
| 3034 ZoneStringList* labels, | 3059 ZoneList<const AstString*>* labels, |
| 3035 int pos) { | 3060 int pos) { |
| 3036 switch (visit_mode) { | 3061 switch (visit_mode) { |
| 3037 case ForEachStatement::ENUMERATE: { | 3062 case ForEachStatement::ENUMERATE: { |
| 3038 ForInStatement* stmt = new(zone_) ForInStatement(zone_, labels, pos); | 3063 ForInStatement* stmt = new(zone_) ForInStatement(zone_, labels, pos); |
| 3039 VISIT_AND_RETURN(ForInStatement, stmt); | 3064 VISIT_AND_RETURN(ForInStatement, stmt); |
| 3040 } | 3065 } |
| 3041 case ForEachStatement::ITERATE: { | 3066 case ForEachStatement::ITERATE: { |
| 3042 ForOfStatement* stmt = new(zone_) ForOfStatement(zone_, labels, pos); | 3067 ForOfStatement* stmt = new(zone_) ForOfStatement(zone_, labels, pos); |
| 3043 VISIT_AND_RETURN(ForOfStatement, stmt); | 3068 VISIT_AND_RETURN(ForOfStatement, stmt); |
| 3044 } | 3069 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3121 return new(zone_) EmptyStatement(zone_, pos); | 3146 return new(zone_) EmptyStatement(zone_, pos); |
| 3122 } | 3147 } |
| 3123 | 3148 |
| 3124 CaseClause* NewCaseClause( | 3149 CaseClause* NewCaseClause( |
| 3125 Expression* label, ZoneList<Statement*>* statements, int pos) { | 3150 Expression* label, ZoneList<Statement*>* statements, int pos) { |
| 3126 CaseClause* clause = | 3151 CaseClause* clause = |
| 3127 new(zone_) CaseClause(zone_, label, statements, pos); | 3152 new(zone_) CaseClause(zone_, label, statements, pos); |
| 3128 VISIT_AND_RETURN(CaseClause, clause) | 3153 VISIT_AND_RETURN(CaseClause, clause) |
| 3129 } | 3154 } |
| 3130 | 3155 |
| 3131 Literal* NewLiteral(Handle<Object> handle, int pos) { | 3156 Literal* NewLiteral(const AstString* string, int pos) { |
| 3132 Literal* lit = new(zone_) Literal(zone_, handle, pos); | 3157 Literal* lit = |
| 3158 new (zone_) Literal(zone_, string_table_->NewValue(string), pos); |
| 3133 VISIT_AND_RETURN(Literal, lit) | 3159 VISIT_AND_RETURN(Literal, lit) |
| 3134 } | 3160 } |
| 3135 | 3161 |
| 3136 Literal* NewNumberLiteral(double number, int pos) { | 3162 Literal* NewNumberLiteral(double number, int pos) { |
| 3137 return NewLiteral( | 3163 Literal* lit = new (zone_) |
| 3138 zone_->isolate()->factory()->NewNumber(number, TENURED), pos); | 3164 Literal(zone_, string_table_->NewNumberValue(number), pos); |
| 3165 VISIT_AND_RETURN(Literal, lit) |
| 3166 } |
| 3167 |
| 3168 Literal* NewSmiLiteral(int number, int pos) { |
| 3169 Literal* lit = |
| 3170 new (zone_) Literal(zone_, string_table_->NewSmiValue(number), pos); |
| 3171 VISIT_AND_RETURN(Literal, lit) |
| 3172 } |
| 3173 |
| 3174 Literal* NewLiteral(bool b, int pos) { |
| 3175 Literal* lit = |
| 3176 new (zone_) Literal(zone_, string_table_->NewValue(b), pos); |
| 3177 VISIT_AND_RETURN(Literal, lit) |
| 3178 } |
| 3179 |
| 3180 Literal* NewLiteral(ZoneList<const AstString*>* strings, |
| 3181 int pos) { |
| 3182 Literal* lit = new (zone_) |
| 3183 Literal(zone_, string_table_->NewValue(strings), pos); |
| 3184 VISIT_AND_RETURN(Literal, lit) |
| 3185 } |
| 3186 |
| 3187 Literal* NewLiteral(const AstValue* literal, int pos) { |
| 3188 Literal* lit = new (zone_) Literal(zone_, literal, pos); |
| 3189 VISIT_AND_RETURN(Literal, lit) |
| 3139 } | 3190 } |
| 3140 | 3191 |
| 3141 ObjectLiteral* NewObjectLiteral( | 3192 ObjectLiteral* NewObjectLiteral( |
| 3142 ZoneList<ObjectLiteral::Property*>* properties, | 3193 ZoneList<ObjectLiteral::Property*>* properties, |
| 3143 int literal_index, | 3194 int literal_index, |
| 3144 int boilerplate_properties, | 3195 int boilerplate_properties, |
| 3145 bool has_function, | 3196 bool has_function, |
| 3146 int pos) { | 3197 int pos) { |
| 3147 ObjectLiteral* lit = new(zone_) ObjectLiteral( | 3198 ObjectLiteral* lit = new(zone_) ObjectLiteral( |
| 3148 zone_, properties, literal_index, boilerplate_properties, | 3199 zone_, properties, literal_index, boilerplate_properties, |
| 3149 has_function, pos); | 3200 has_function, pos); |
| 3150 VISIT_AND_RETURN(ObjectLiteral, lit) | 3201 VISIT_AND_RETURN(ObjectLiteral, lit) |
| 3151 } | 3202 } |
| 3152 | 3203 |
| 3153 ObjectLiteral::Property* NewObjectLiteralProperty(Literal* key, | 3204 ObjectLiteral::Property* NewObjectLiteralProperty(Literal* key, |
| 3154 Expression* value) { | 3205 Expression* value) { |
| 3155 return new(zone_) ObjectLiteral::Property(zone_, key, value); | 3206 return new(zone_) ObjectLiteral::Property(zone_, string_table_, key, value); |
| 3156 } | 3207 } |
| 3157 | 3208 |
| 3158 ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter, | 3209 ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter, |
| 3159 FunctionLiteral* value, | 3210 FunctionLiteral* value, |
| 3160 int pos) { | 3211 int pos) { |
| 3161 ObjectLiteral::Property* prop = | 3212 ObjectLiteral::Property* prop = |
| 3162 new(zone_) ObjectLiteral::Property(zone_, is_getter, value); | 3213 new(zone_) ObjectLiteral::Property(zone_, is_getter, value); |
| 3163 prop->set_key(NewLiteral(value->name(), pos)); | 3214 prop->set_key(NewLiteral(value->raw_name(), pos)); |
| 3164 return prop; // Not an AST node, will not be visited. | 3215 return prop; // Not an AST node, will not be visited. |
| 3165 } | 3216 } |
| 3166 | 3217 |
| 3167 RegExpLiteral* NewRegExpLiteral(Handle<String> pattern, | 3218 RegExpLiteral* NewRegExpLiteral(const AstString* pattern, |
| 3168 Handle<String> flags, | 3219 const AstString* flags, |
| 3169 int literal_index, | 3220 int literal_index, |
| 3170 int pos) { | 3221 int pos) { |
| 3171 RegExpLiteral* lit = | 3222 RegExpLiteral* lit = |
| 3172 new(zone_) RegExpLiteral(zone_, pattern, flags, literal_index, pos); | 3223 new(zone_) RegExpLiteral(zone_, pattern, flags, literal_index, pos); |
| 3173 VISIT_AND_RETURN(RegExpLiteral, lit); | 3224 VISIT_AND_RETURN(RegExpLiteral, lit); |
| 3174 } | 3225 } |
| 3175 | 3226 |
| 3176 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values, | 3227 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values, |
| 3177 int literal_index, | 3228 int literal_index, |
| 3178 int pos) { | 3229 int pos) { |
| 3179 ArrayLiteral* lit = new(zone_) ArrayLiteral( | 3230 ArrayLiteral* lit = new(zone_) ArrayLiteral( |
| 3180 zone_, values, literal_index, pos); | 3231 zone_, values, literal_index, pos); |
| 3181 VISIT_AND_RETURN(ArrayLiteral, lit) | 3232 VISIT_AND_RETURN(ArrayLiteral, lit) |
| 3182 } | 3233 } |
| 3183 | 3234 |
| 3184 VariableProxy* NewVariableProxy(Variable* var, | 3235 VariableProxy* NewVariableProxy(Variable* var, |
| 3185 int pos = RelocInfo::kNoPosition) { | 3236 int pos = RelocInfo::kNoPosition) { |
| 3186 VariableProxy* proxy = new(zone_) VariableProxy(zone_, var, pos); | 3237 VariableProxy* proxy = new(zone_) VariableProxy(zone_, var, pos); |
| 3187 VISIT_AND_RETURN(VariableProxy, proxy) | 3238 VISIT_AND_RETURN(VariableProxy, proxy) |
| 3188 } | 3239 } |
| 3189 | 3240 |
| 3190 VariableProxy* NewVariableProxy(Handle<String> name, | 3241 VariableProxy* NewVariableProxy(const AstString* name, |
| 3191 bool is_this, | 3242 bool is_this, |
| 3192 Interface* interface = Interface::NewValue(), | 3243 Interface* interface = Interface::NewValue(), |
| 3193 int position = RelocInfo::kNoPosition) { | 3244 int position = RelocInfo::kNoPosition) { |
| 3194 VariableProxy* proxy = | 3245 VariableProxy* proxy = |
| 3195 new(zone_) VariableProxy(zone_, name, is_this, interface, position); | 3246 new(zone_) VariableProxy(zone_, name, is_this, interface, position); |
| 3196 VISIT_AND_RETURN(VariableProxy, proxy) | 3247 VISIT_AND_RETURN(VariableProxy, proxy) |
| 3197 } | 3248 } |
| 3198 | 3249 |
| 3199 Property* NewProperty(Expression* obj, Expression* key, int pos) { | 3250 Property* NewProperty(Expression* obj, Expression* key, int pos) { |
| 3200 Property* prop = new(zone_) Property(zone_, obj, key, pos); | 3251 Property* prop = new(zone_) Property(zone_, obj, key, pos); |
| 3201 VISIT_AND_RETURN(Property, prop) | 3252 VISIT_AND_RETURN(Property, prop) |
| 3202 } | 3253 } |
| 3203 | 3254 |
| 3204 Call* NewCall(Expression* expression, | 3255 Call* NewCall(Expression* expression, |
| 3205 ZoneList<Expression*>* arguments, | 3256 ZoneList<Expression*>* arguments, |
| 3206 int pos) { | 3257 int pos) { |
| 3207 Call* call = new(zone_) Call(zone_, expression, arguments, pos); | 3258 Call* call = new(zone_) Call(zone_, expression, arguments, pos); |
| 3208 VISIT_AND_RETURN(Call, call) | 3259 VISIT_AND_RETURN(Call, call) |
| 3209 } | 3260 } |
| 3210 | 3261 |
| 3211 CallNew* NewCallNew(Expression* expression, | 3262 CallNew* NewCallNew(Expression* expression, |
| 3212 ZoneList<Expression*>* arguments, | 3263 ZoneList<Expression*>* arguments, |
| 3213 int pos) { | 3264 int pos) { |
| 3214 CallNew* call = new(zone_) CallNew(zone_, expression, arguments, pos); | 3265 CallNew* call = new(zone_) CallNew(zone_, expression, arguments, pos); |
| 3215 VISIT_AND_RETURN(CallNew, call) | 3266 VISIT_AND_RETURN(CallNew, call) |
| 3216 } | 3267 } |
| 3217 | 3268 |
| 3218 CallRuntime* NewCallRuntime(Handle<String> name, | 3269 CallRuntime* NewCallRuntime(const AstString* name, |
| 3219 const Runtime::Function* function, | 3270 const Runtime::Function* function, |
| 3220 ZoneList<Expression*>* arguments, | 3271 ZoneList<Expression*>* arguments, |
| 3221 int pos) { | 3272 int pos) { |
| 3222 CallRuntime* call = | 3273 CallRuntime* call = |
| 3223 new(zone_) CallRuntime(zone_, name, function, arguments, pos); | 3274 new(zone_) CallRuntime(zone_, name, function, arguments, pos); |
| 3224 VISIT_AND_RETURN(CallRuntime, call) | 3275 VISIT_AND_RETURN(CallRuntime, call) |
| 3225 } | 3276 } |
| 3226 | 3277 |
| 3227 UnaryOperation* NewUnaryOperation(Token::Value op, | 3278 UnaryOperation* NewUnaryOperation(Token::Value op, |
| 3228 Expression* expression, | 3279 Expression* expression, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3286 zone_, generator_object, expression, yield_kind, pos); | 3337 zone_, generator_object, expression, yield_kind, pos); |
| 3287 VISIT_AND_RETURN(Yield, yield) | 3338 VISIT_AND_RETURN(Yield, yield) |
| 3288 } | 3339 } |
| 3289 | 3340 |
| 3290 Throw* NewThrow(Expression* exception, int pos) { | 3341 Throw* NewThrow(Expression* exception, int pos) { |
| 3291 Throw* t = new(zone_) Throw(zone_, exception, pos); | 3342 Throw* t = new(zone_) Throw(zone_, exception, pos); |
| 3292 VISIT_AND_RETURN(Throw, t) | 3343 VISIT_AND_RETURN(Throw, t) |
| 3293 } | 3344 } |
| 3294 | 3345 |
| 3295 FunctionLiteral* NewFunctionLiteral( | 3346 FunctionLiteral* NewFunctionLiteral( |
| 3296 Handle<String> name, | 3347 const AstString* name, |
| 3348 AstStringTable* string_table, |
| 3297 Scope* scope, | 3349 Scope* scope, |
| 3298 ZoneList<Statement*>* body, | 3350 ZoneList<Statement*>* body, |
| 3299 int materialized_literal_count, | 3351 int materialized_literal_count, |
| 3300 int expected_property_count, | 3352 int expected_property_count, |
| 3301 int handler_count, | 3353 int handler_count, |
| 3302 int parameter_count, | 3354 int parameter_count, |
| 3303 FunctionLiteral::ParameterFlag has_duplicate_parameters, | 3355 FunctionLiteral::ParameterFlag has_duplicate_parameters, |
| 3304 FunctionLiteral::FunctionType function_type, | 3356 FunctionLiteral::FunctionType function_type, |
| 3305 FunctionLiteral::IsFunctionFlag is_function, | 3357 FunctionLiteral::IsFunctionFlag is_function, |
| 3306 FunctionLiteral::IsParenthesizedFlag is_parenthesized, | 3358 FunctionLiteral::IsParenthesizedFlag is_parenthesized, |
| 3307 FunctionLiteral::IsGeneratorFlag is_generator, | 3359 FunctionLiteral::IsGeneratorFlag is_generator, |
| 3308 int position) { | 3360 int position) { |
| 3309 FunctionLiteral* lit = new(zone_) FunctionLiteral( | 3361 FunctionLiteral* lit = new(zone_) FunctionLiteral( |
| 3310 zone_, name, scope, body, | 3362 zone_, name, string_table, scope, body, |
| 3311 materialized_literal_count, expected_property_count, handler_count, | 3363 materialized_literal_count, expected_property_count, handler_count, |
| 3312 parameter_count, function_type, has_duplicate_parameters, is_function, | 3364 parameter_count, function_type, has_duplicate_parameters, is_function, |
| 3313 is_parenthesized, is_generator, position); | 3365 is_parenthesized, is_generator, position); |
| 3314 // Top-level literal doesn't count for the AST's properties. | 3366 // Top-level literal doesn't count for the AST's properties. |
| 3315 if (is_function == FunctionLiteral::kIsFunction) { | 3367 if (is_function == FunctionLiteral::kIsFunction) { |
| 3316 visitor_.VisitFunctionLiteral(lit); | 3368 visitor_.VisitFunctionLiteral(lit); |
| 3317 } | 3369 } |
| 3318 return lit; | 3370 return lit; |
| 3319 } | 3371 } |
| 3320 | 3372 |
| 3321 NativeFunctionLiteral* NewNativeFunctionLiteral( | 3373 NativeFunctionLiteral* NewNativeFunctionLiteral( |
| 3322 Handle<String> name, v8::Extension* extension, int pos) { | 3374 const AstString* name, v8::Extension* extension, |
| 3375 int pos) { |
| 3323 NativeFunctionLiteral* lit = | 3376 NativeFunctionLiteral* lit = |
| 3324 new(zone_) NativeFunctionLiteral(zone_, name, extension, pos); | 3377 new(zone_) NativeFunctionLiteral(zone_, name, extension, pos); |
| 3325 VISIT_AND_RETURN(NativeFunctionLiteral, lit) | 3378 VISIT_AND_RETURN(NativeFunctionLiteral, lit) |
| 3326 } | 3379 } |
| 3327 | 3380 |
| 3328 ThisFunction* NewThisFunction(int pos) { | 3381 ThisFunction* NewThisFunction(int pos) { |
| 3329 ThisFunction* fun = new(zone_) ThisFunction(zone_, pos); | 3382 ThisFunction* fun = new(zone_) ThisFunction(zone_, pos); |
| 3330 VISIT_AND_RETURN(ThisFunction, fun) | 3383 VISIT_AND_RETURN(ThisFunction, fun) |
| 3331 } | 3384 } |
| 3332 | 3385 |
| 3333 #undef VISIT_AND_RETURN | 3386 #undef VISIT_AND_RETURN |
| 3334 | 3387 |
| 3335 private: | 3388 private: |
| 3336 Zone* zone_; | 3389 Zone* zone_; |
| 3337 Visitor visitor_; | 3390 Visitor visitor_; |
| 3391 AstStringTable* string_table_; |
| 3338 }; | 3392 }; |
| 3339 | 3393 |
| 3340 | 3394 |
| 3341 } } // namespace v8::internal | 3395 } } // namespace v8::internal |
| 3342 | 3396 |
| 3343 #endif // V8_AST_H_ | 3397 #endif // V8_AST_H_ |
| OLD | NEW |