Chromium Code Reviews| 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 "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 210 } | 210 } |
| 211 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 211 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
| 212 #undef DECLARE_NODE_FUNCTIONS | 212 #undef DECLARE_NODE_FUNCTIONS |
| 213 | 213 |
| 214 virtual TargetCollector* AsTargetCollector() { return NULL; } | 214 virtual TargetCollector* AsTargetCollector() { return NULL; } |
| 215 virtual BreakableStatement* AsBreakableStatement() { return NULL; } | 215 virtual BreakableStatement* AsBreakableStatement() { return NULL; } |
| 216 virtual IterationStatement* AsIterationStatement() { return NULL; } | 216 virtual IterationStatement* AsIterationStatement() { return NULL; } |
| 217 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; } | 217 virtual MaterializedLiteral* AsMaterializedLiteral() { return NULL; } |
| 218 | 218 |
| 219 protected: | 219 protected: |
| 220 static int GetNextId(Zone* zone) { | 220 static int GetNextId(int* id) { return ReserveIdRange(id, 1); } |
|
rossberg
2014/08/21 11:32:01
Instead of passing raw int pointers around everywh
marja
2014/08/21 11:58:52
Done.
| |
| 221 return ReserveIdRange(zone, 1); | |
| 222 } | |
| 223 | 221 |
| 224 static int ReserveIdRange(Zone* zone, int n) { | 222 static int ReserveIdRange(int* id, int n) { |
| 225 int tmp = zone->isolate()->ast_node_id(); | 223 int tmp = *id; |
| 226 zone->isolate()->set_ast_node_id(tmp + n); | 224 *id = tmp + n; |
| 227 return tmp; | 225 return tmp; |
| 228 } | 226 } |
| 229 | 227 |
| 230 // Some nodes re-use bailout IDs for type feedback. | 228 // Some nodes re-use bailout IDs for type feedback. |
| 231 static TypeFeedbackId reuse(BailoutId id) { | 229 static TypeFeedbackId reuse(BailoutId id) { |
| 232 return TypeFeedbackId(id.ToInt()); | 230 return TypeFeedbackId(id.ToInt()); |
| 233 } | 231 } |
| 234 | 232 |
| 235 | 233 |
| 236 private: | 234 private: |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 365 } | 363 } |
| 366 | 364 |
| 367 // TODO(rossberg): this should move to its own AST node eventually. | 365 // TODO(rossberg): this should move to its own AST node eventually. |
| 368 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); | 366 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle); |
| 369 byte to_boolean_types() const { return to_boolean_types_; } | 367 byte to_boolean_types() const { return to_boolean_types_; } |
| 370 | 368 |
| 371 BailoutId id() const { return id_; } | 369 BailoutId id() const { return id_; } |
| 372 TypeFeedbackId test_id() const { return test_id_; } | 370 TypeFeedbackId test_id() const { return test_id_; } |
| 373 | 371 |
| 374 protected: | 372 protected: |
| 375 Expression(Zone* zone, int pos) | 373 Expression(Zone* zone, int pos, int* id_counter) |
| 376 : AstNode(pos), | 374 : AstNode(pos), |
| 377 zone_(zone), | |
| 378 bounds_(Bounds::Unbounded(zone)), | 375 bounds_(Bounds::Unbounded(zone)), |
| 379 parenthesization_level_(0), | 376 parenthesization_level_(0), |
| 380 id_(GetNextId(zone)), | 377 id_(GetNextId(id_counter)), |
| 381 test_id_(GetNextId(zone)) {} | 378 test_id_(GetNextId(id_counter)) {} |
| 382 void set_to_boolean_types(byte types) { to_boolean_types_ = types; } | 379 void set_to_boolean_types(byte types) { to_boolean_types_ = types; } |
| 383 | 380 |
| 384 Zone* zone_; | |
| 385 | |
| 386 private: | 381 private: |
| 387 Bounds bounds_; | 382 Bounds bounds_; |
| 388 byte to_boolean_types_; | 383 byte to_boolean_types_; |
| 389 unsigned parenthesization_level_; | 384 unsigned parenthesization_level_; |
| 390 | 385 |
| 391 const BailoutId id_; | 386 const BailoutId id_; |
| 392 const TypeFeedbackId test_id_; | 387 const TypeFeedbackId test_id_; |
| 393 }; | 388 }; |
| 394 | 389 |
| 395 | 390 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 414 | 409 |
| 415 // Testers. | 410 // Testers. |
| 416 bool is_target_for_anonymous() const { | 411 bool is_target_for_anonymous() const { |
| 417 return breakable_type_ == TARGET_FOR_ANONYMOUS; | 412 return breakable_type_ == TARGET_FOR_ANONYMOUS; |
| 418 } | 413 } |
| 419 | 414 |
| 420 BailoutId EntryId() const { return entry_id_; } | 415 BailoutId EntryId() const { return entry_id_; } |
| 421 BailoutId ExitId() const { return exit_id_; } | 416 BailoutId ExitId() const { return exit_id_; } |
| 422 | 417 |
| 423 protected: | 418 protected: |
| 424 BreakableStatement( | 419 BreakableStatement(Zone* zone, ZoneList<const AstRawString*>* labels, |
| 425 Zone* zone, ZoneList<const AstRawString*>* labels, | 420 BreakableType breakable_type, int position, |
| 426 BreakableType breakable_type, int position) | 421 int* id_counter) |
| 427 : Statement(zone, position), | 422 : Statement(zone, position), |
| 428 labels_(labels), | 423 labels_(labels), |
| 429 breakable_type_(breakable_type), | 424 breakable_type_(breakable_type), |
| 430 entry_id_(GetNextId(zone)), | 425 entry_id_(GetNextId(id_counter)), |
| 431 exit_id_(GetNextId(zone)) { | 426 exit_id_(GetNextId(id_counter)) { |
| 432 DCHECK(labels == NULL || labels->length() > 0); | 427 DCHECK(labels == NULL || labels->length() > 0); |
| 433 } | 428 } |
| 434 | 429 |
| 435 | 430 |
| 436 private: | 431 private: |
| 437 ZoneList<const AstRawString*>* labels_; | 432 ZoneList<const AstRawString*>* labels_; |
| 438 BreakableType breakable_type_; | 433 BreakableType breakable_type_; |
| 439 Label break_target_; | 434 Label break_target_; |
| 440 const BailoutId entry_id_; | 435 const BailoutId entry_id_; |
| 441 const BailoutId exit_id_; | 436 const BailoutId exit_id_; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 457 | 452 |
| 458 virtual bool IsJump() const V8_OVERRIDE { | 453 virtual bool IsJump() const V8_OVERRIDE { |
| 459 return !statements_.is_empty() && statements_.last()->IsJump() | 454 return !statements_.is_empty() && statements_.last()->IsJump() |
| 460 && labels() == NULL; // Good enough as an approximation... | 455 && labels() == NULL; // Good enough as an approximation... |
| 461 } | 456 } |
| 462 | 457 |
| 463 Scope* scope() const { return scope_; } | 458 Scope* scope() const { return scope_; } |
| 464 void set_scope(Scope* scope) { scope_ = scope; } | 459 void set_scope(Scope* scope) { scope_ = scope; } |
| 465 | 460 |
| 466 protected: | 461 protected: |
| 467 Block(Zone* zone, | 462 Block(Zone* zone, ZoneList<const AstRawString*>* labels, int capacity, |
| 468 ZoneList<const AstRawString*>* labels, | 463 bool is_initializer_block, int pos, int* id_counter) |
| 469 int capacity, | 464 : BreakableStatement(zone, labels, TARGET_FOR_NAMED_ONLY, pos, |
| 470 bool is_initializer_block, | 465 id_counter), |
| 471 int pos) | |
| 472 : BreakableStatement(zone, labels, TARGET_FOR_NAMED_ONLY, pos), | |
| 473 statements_(capacity, zone), | 466 statements_(capacity, zone), |
| 474 is_initializer_block_(is_initializer_block), | 467 is_initializer_block_(is_initializer_block), |
| 475 decls_id_(GetNextId(zone)), | 468 decls_id_(GetNextId(id_counter)), |
| 476 scope_(NULL) { | 469 scope_(NULL) {} |
| 477 } | |
| 478 | 470 |
| 479 private: | 471 private: |
| 480 ZoneList<Statement*> statements_; | 472 ZoneList<Statement*> statements_; |
| 481 bool is_initializer_block_; | 473 bool is_initializer_block_; |
| 482 const BailoutId decls_id_; | 474 const BailoutId decls_id_; |
| 483 Scope* scope_; | 475 Scope* scope_; |
| 484 }; | 476 }; |
| 485 | 477 |
| 486 | 478 |
| 487 class Declaration : public AstNode { | 479 class Declaration : public AstNode { |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 732 Statement* body() const { return body_; } | 724 Statement* body() const { return body_; } |
| 733 | 725 |
| 734 BailoutId OsrEntryId() const { return osr_entry_id_; } | 726 BailoutId OsrEntryId() const { return osr_entry_id_; } |
| 735 virtual BailoutId ContinueId() const = 0; | 727 virtual BailoutId ContinueId() const = 0; |
| 736 virtual BailoutId StackCheckId() const = 0; | 728 virtual BailoutId StackCheckId() const = 0; |
| 737 | 729 |
| 738 // Code generation | 730 // Code generation |
| 739 Label* continue_target() { return &continue_target_; } | 731 Label* continue_target() { return &continue_target_; } |
| 740 | 732 |
| 741 protected: | 733 protected: |
| 742 IterationStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) | 734 IterationStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos, |
| 743 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos), | 735 int* id_counter) |
| 736 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos, id_counter), | |
| 744 body_(NULL), | 737 body_(NULL), |
| 745 osr_entry_id_(GetNextId(zone)) { | 738 osr_entry_id_(GetNextId(id_counter)) {} |
| 746 } | |
| 747 | 739 |
| 748 void Initialize(Statement* body) { | 740 void Initialize(Statement* body) { |
| 749 body_ = body; | 741 body_ = body; |
| 750 } | 742 } |
| 751 | 743 |
| 752 private: | 744 private: |
| 753 Statement* body_; | 745 Statement* body_; |
| 754 Label continue_target_; | 746 Label continue_target_; |
| 755 | 747 |
| 756 const BailoutId osr_entry_id_; | 748 const BailoutId osr_entry_id_; |
| 757 }; | 749 }; |
| 758 | 750 |
| 759 | 751 |
| 760 class DoWhileStatement V8_FINAL : public IterationStatement { | 752 class DoWhileStatement V8_FINAL : public IterationStatement { |
| 761 public: | 753 public: |
| 762 DECLARE_NODE_TYPE(DoWhileStatement) | 754 DECLARE_NODE_TYPE(DoWhileStatement) |
| 763 | 755 |
| 764 void Initialize(Expression* cond, Statement* body) { | 756 void Initialize(Expression* cond, Statement* body) { |
| 765 IterationStatement::Initialize(body); | 757 IterationStatement::Initialize(body); |
| 766 cond_ = cond; | 758 cond_ = cond; |
| 767 } | 759 } |
| 768 | 760 |
| 769 Expression* cond() const { return cond_; } | 761 Expression* cond() const { return cond_; } |
| 770 | 762 |
| 771 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; } | 763 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; } |
| 772 virtual BailoutId StackCheckId() const V8_OVERRIDE { return back_edge_id_; } | 764 virtual BailoutId StackCheckId() const V8_OVERRIDE { return back_edge_id_; } |
| 773 BailoutId BackEdgeId() const { return back_edge_id_; } | 765 BailoutId BackEdgeId() const { return back_edge_id_; } |
| 774 | 766 |
| 775 protected: | 767 protected: |
| 776 DoWhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) | 768 DoWhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos, |
| 777 : IterationStatement(zone, labels, pos), | 769 int* id_counter) |
| 770 : IterationStatement(zone, labels, pos, id_counter), | |
| 778 cond_(NULL), | 771 cond_(NULL), |
| 779 continue_id_(GetNextId(zone)), | 772 continue_id_(GetNextId(id_counter)), |
| 780 back_edge_id_(GetNextId(zone)) { | 773 back_edge_id_(GetNextId(id_counter)) {} |
| 781 } | |
| 782 | 774 |
| 783 private: | 775 private: |
| 784 Expression* cond_; | 776 Expression* cond_; |
| 785 | 777 |
| 786 const BailoutId continue_id_; | 778 const BailoutId continue_id_; |
| 787 const BailoutId back_edge_id_; | 779 const BailoutId back_edge_id_; |
| 788 }; | 780 }; |
| 789 | 781 |
| 790 | 782 |
| 791 class WhileStatement V8_FINAL : public IterationStatement { | 783 class WhileStatement V8_FINAL : public IterationStatement { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 803 } | 795 } |
| 804 void set_may_have_function_literal(bool value) { | 796 void set_may_have_function_literal(bool value) { |
| 805 may_have_function_literal_ = value; | 797 may_have_function_literal_ = value; |
| 806 } | 798 } |
| 807 | 799 |
| 808 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } | 800 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } |
| 809 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } | 801 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } |
| 810 BailoutId BodyId() const { return body_id_; } | 802 BailoutId BodyId() const { return body_id_; } |
| 811 | 803 |
| 812 protected: | 804 protected: |
| 813 WhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) | 805 WhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos, |
| 814 : IterationStatement(zone, labels, pos), | 806 int* id_counter) |
| 807 : IterationStatement(zone, labels, pos, id_counter), | |
| 815 cond_(NULL), | 808 cond_(NULL), |
| 816 may_have_function_literal_(true), | 809 may_have_function_literal_(true), |
| 817 body_id_(GetNextId(zone)) { | 810 body_id_(GetNextId(id_counter)) {} |
| 818 } | |
| 819 | 811 |
| 820 private: | 812 private: |
| 821 Expression* cond_; | 813 Expression* cond_; |
| 822 | 814 |
| 823 // True if there is a function literal subexpression in the condition. | 815 // True if there is a function literal subexpression in the condition. |
| 824 bool may_have_function_literal_; | 816 bool may_have_function_literal_; |
| 825 | 817 |
| 826 const BailoutId body_id_; | 818 const BailoutId body_id_; |
| 827 }; | 819 }; |
| 828 | 820 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 854 | 846 |
| 855 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; } | 847 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; } |
| 856 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } | 848 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } |
| 857 BailoutId BodyId() const { return body_id_; } | 849 BailoutId BodyId() const { return body_id_; } |
| 858 | 850 |
| 859 bool is_fast_smi_loop() { return loop_variable_ != NULL; } | 851 bool is_fast_smi_loop() { return loop_variable_ != NULL; } |
| 860 Variable* loop_variable() { return loop_variable_; } | 852 Variable* loop_variable() { return loop_variable_; } |
| 861 void set_loop_variable(Variable* var) { loop_variable_ = var; } | 853 void set_loop_variable(Variable* var) { loop_variable_ = var; } |
| 862 | 854 |
| 863 protected: | 855 protected: |
| 864 ForStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) | 856 ForStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos, |
| 865 : IterationStatement(zone, labels, pos), | 857 int* id_counter) |
| 858 : IterationStatement(zone, labels, pos, id_counter), | |
| 866 init_(NULL), | 859 init_(NULL), |
| 867 cond_(NULL), | 860 cond_(NULL), |
| 868 next_(NULL), | 861 next_(NULL), |
| 869 may_have_function_literal_(true), | 862 may_have_function_literal_(true), |
| 870 loop_variable_(NULL), | 863 loop_variable_(NULL), |
| 871 continue_id_(GetNextId(zone)), | 864 continue_id_(GetNextId(id_counter)), |
| 872 body_id_(GetNextId(zone)) { | 865 body_id_(GetNextId(id_counter)) {} |
| 873 } | |
| 874 | 866 |
| 875 private: | 867 private: |
| 876 Statement* init_; | 868 Statement* init_; |
| 877 Expression* cond_; | 869 Expression* cond_; |
| 878 Statement* next_; | 870 Statement* next_; |
| 879 | 871 |
| 880 // True if there is a function literal subexpression in the condition. | 872 // True if there is a function literal subexpression in the condition. |
| 881 bool may_have_function_literal_; | 873 bool may_have_function_literal_; |
| 882 Variable* loop_variable_; | 874 Variable* loop_variable_; |
| 883 | 875 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 896 void Initialize(Expression* each, Expression* subject, Statement* body) { | 888 void Initialize(Expression* each, Expression* subject, Statement* body) { |
| 897 IterationStatement::Initialize(body); | 889 IterationStatement::Initialize(body); |
| 898 each_ = each; | 890 each_ = each; |
| 899 subject_ = subject; | 891 subject_ = subject; |
| 900 } | 892 } |
| 901 | 893 |
| 902 Expression* each() const { return each_; } | 894 Expression* each() const { return each_; } |
| 903 Expression* subject() const { return subject_; } | 895 Expression* subject() const { return subject_; } |
| 904 | 896 |
| 905 protected: | 897 protected: |
| 906 ForEachStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) | 898 ForEachStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos, |
| 907 : IterationStatement(zone, labels, pos), each_(NULL), subject_(NULL) {} | 899 int* id_counter) |
| 900 : IterationStatement(zone, labels, pos, id_counter), | |
| 901 each_(NULL), | |
| 902 subject_(NULL) {} | |
| 908 | 903 |
| 909 private: | 904 private: |
| 910 Expression* each_; | 905 Expression* each_; |
| 911 Expression* subject_; | 906 Expression* subject_; |
| 912 }; | 907 }; |
| 913 | 908 |
| 914 | 909 |
| 915 class ForInStatement V8_FINAL : public ForEachStatement, | 910 class ForInStatement V8_FINAL : public ForEachStatement, |
| 916 public FeedbackSlotInterface { | 911 public FeedbackSlotInterface { |
| 917 public: | 912 public: |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 933 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; | 928 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; |
| 934 ForInType for_in_type() const { return for_in_type_; } | 929 ForInType for_in_type() const { return for_in_type_; } |
| 935 void set_for_in_type(ForInType type) { for_in_type_ = type; } | 930 void set_for_in_type(ForInType type) { for_in_type_ = type; } |
| 936 | 931 |
| 937 BailoutId BodyId() const { return body_id_; } | 932 BailoutId BodyId() const { return body_id_; } |
| 938 BailoutId PrepareId() const { return prepare_id_; } | 933 BailoutId PrepareId() const { return prepare_id_; } |
| 939 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } | 934 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } |
| 940 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } | 935 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } |
| 941 | 936 |
| 942 protected: | 937 protected: |
| 943 ForInStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) | 938 ForInStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos, |
| 944 : ForEachStatement(zone, labels, pos), | 939 int* id_counter) |
| 940 : ForEachStatement(zone, labels, pos, id_counter), | |
| 945 for_in_type_(SLOW_FOR_IN), | 941 for_in_type_(SLOW_FOR_IN), |
| 946 for_in_feedback_slot_(kInvalidFeedbackSlot), | 942 for_in_feedback_slot_(kInvalidFeedbackSlot), |
| 947 body_id_(GetNextId(zone)), | 943 body_id_(GetNextId(id_counter)), |
| 948 prepare_id_(GetNextId(zone)) { | 944 prepare_id_(GetNextId(id_counter)) {} |
| 949 } | |
| 950 | 945 |
| 951 ForInType for_in_type_; | 946 ForInType for_in_type_; |
| 952 int for_in_feedback_slot_; | 947 int for_in_feedback_slot_; |
| 953 const BailoutId body_id_; | 948 const BailoutId body_id_; |
| 954 const BailoutId prepare_id_; | 949 const BailoutId prepare_id_; |
| 955 }; | 950 }; |
| 956 | 951 |
| 957 | 952 |
| 958 class ForOfStatement V8_FINAL : public ForEachStatement { | 953 class ForOfStatement V8_FINAL : public ForEachStatement { |
| 959 public: | 954 public: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 996 Expression* assign_each() const { | 991 Expression* assign_each() const { |
| 997 return assign_each_; | 992 return assign_each_; |
| 998 } | 993 } |
| 999 | 994 |
| 1000 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } | 995 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } |
| 1001 virtual BailoutId StackCheckId() const V8_OVERRIDE { return BackEdgeId(); } | 996 virtual BailoutId StackCheckId() const V8_OVERRIDE { return BackEdgeId(); } |
| 1002 | 997 |
| 1003 BailoutId BackEdgeId() const { return back_edge_id_; } | 998 BailoutId BackEdgeId() const { return back_edge_id_; } |
| 1004 | 999 |
| 1005 protected: | 1000 protected: |
| 1006 ForOfStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) | 1001 ForOfStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos, |
| 1007 : ForEachStatement(zone, labels, pos), | 1002 int* id_counter) |
| 1003 : ForEachStatement(zone, labels, pos, id_counter), | |
| 1008 assign_iterator_(NULL), | 1004 assign_iterator_(NULL), |
| 1009 next_result_(NULL), | 1005 next_result_(NULL), |
| 1010 result_done_(NULL), | 1006 result_done_(NULL), |
| 1011 assign_each_(NULL), | 1007 assign_each_(NULL), |
| 1012 back_edge_id_(GetNextId(zone)) { | 1008 back_edge_id_(GetNextId(id_counter)) {} |
| 1013 } | |
| 1014 | 1009 |
| 1015 Expression* assign_iterator_; | 1010 Expression* assign_iterator_; |
| 1016 Expression* next_result_; | 1011 Expression* next_result_; |
| 1017 Expression* result_done_; | 1012 Expression* result_done_; |
| 1018 Expression* assign_each_; | 1013 Expression* assign_each_; |
| 1019 const BailoutId back_edge_id_; | 1014 const BailoutId back_edge_id_; |
| 1020 }; | 1015 }; |
| 1021 | 1016 |
| 1022 | 1017 |
| 1023 class ExpressionStatement V8_FINAL : public Statement { | 1018 class ExpressionStatement V8_FINAL : public Statement { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1128 ZoneList<Statement*>* statements() const { return statements_; } | 1123 ZoneList<Statement*>* statements() const { return statements_; } |
| 1129 | 1124 |
| 1130 BailoutId EntryId() const { return entry_id_; } | 1125 BailoutId EntryId() const { return entry_id_; } |
| 1131 | 1126 |
| 1132 // Type feedback information. | 1127 // Type feedback information. |
| 1133 TypeFeedbackId CompareId() { return compare_id_; } | 1128 TypeFeedbackId CompareId() { return compare_id_; } |
| 1134 Type* compare_type() { return compare_type_; } | 1129 Type* compare_type() { return compare_type_; } |
| 1135 void set_compare_type(Type* type) { compare_type_ = type; } | 1130 void set_compare_type(Type* type) { compare_type_ = type; } |
| 1136 | 1131 |
| 1137 private: | 1132 private: |
| 1138 CaseClause(Zone* zone, | 1133 CaseClause(Zone* zone, Expression* label, ZoneList<Statement*>* statements, |
| 1139 Expression* label, | 1134 int pos, int* id_counter); |
| 1140 ZoneList<Statement*>* statements, | |
| 1141 int pos); | |
| 1142 | 1135 |
| 1143 Expression* label_; | 1136 Expression* label_; |
| 1144 Label body_target_; | 1137 Label body_target_; |
| 1145 ZoneList<Statement*>* statements_; | 1138 ZoneList<Statement*>* statements_; |
| 1146 Type* compare_type_; | 1139 Type* compare_type_; |
| 1147 | 1140 |
| 1148 const TypeFeedbackId compare_id_; | 1141 const TypeFeedbackId compare_id_; |
| 1149 const BailoutId entry_id_; | 1142 const BailoutId entry_id_; |
| 1150 }; | 1143 }; |
| 1151 | 1144 |
| 1152 | 1145 |
| 1153 class SwitchStatement V8_FINAL : public BreakableStatement { | 1146 class SwitchStatement V8_FINAL : public BreakableStatement { |
| 1154 public: | 1147 public: |
| 1155 DECLARE_NODE_TYPE(SwitchStatement) | 1148 DECLARE_NODE_TYPE(SwitchStatement) |
| 1156 | 1149 |
| 1157 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { | 1150 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { |
| 1158 tag_ = tag; | 1151 tag_ = tag; |
| 1159 cases_ = cases; | 1152 cases_ = cases; |
| 1160 } | 1153 } |
| 1161 | 1154 |
| 1162 Expression* tag() const { return tag_; } | 1155 Expression* tag() const { return tag_; } |
| 1163 ZoneList<CaseClause*>* cases() const { return cases_; } | 1156 ZoneList<CaseClause*>* cases() const { return cases_; } |
| 1164 | 1157 |
| 1165 protected: | 1158 protected: |
| 1166 SwitchStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) | 1159 SwitchStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos, |
| 1167 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos), | 1160 int* id_counter) |
| 1161 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos, id_counter), | |
| 1168 tag_(NULL), | 1162 tag_(NULL), |
| 1169 cases_(NULL) { } | 1163 cases_(NULL) {} |
| 1170 | 1164 |
| 1171 private: | 1165 private: |
| 1172 Expression* tag_; | 1166 Expression* tag_; |
| 1173 ZoneList<CaseClause*>* cases_; | 1167 ZoneList<CaseClause*>* cases_; |
| 1174 }; | 1168 }; |
| 1175 | 1169 |
| 1176 | 1170 |
| 1177 // If-statements always have non-null references to their then- and | 1171 // If-statements always have non-null references to their then- and |
| 1178 // else-parts. When parsing if-statements with no explicit else-part, | 1172 // else-parts. When parsing if-statements with no explicit else-part, |
| 1179 // the parser implicitly creates an empty statement. Use the | 1173 // the parser implicitly creates an empty statement. Use the |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1193 virtual bool IsJump() const V8_OVERRIDE { | 1187 virtual bool IsJump() const V8_OVERRIDE { |
| 1194 return HasThenStatement() && then_statement()->IsJump() | 1188 return HasThenStatement() && then_statement()->IsJump() |
| 1195 && HasElseStatement() && else_statement()->IsJump(); | 1189 && HasElseStatement() && else_statement()->IsJump(); |
| 1196 } | 1190 } |
| 1197 | 1191 |
| 1198 BailoutId IfId() const { return if_id_; } | 1192 BailoutId IfId() const { return if_id_; } |
| 1199 BailoutId ThenId() const { return then_id_; } | 1193 BailoutId ThenId() const { return then_id_; } |
| 1200 BailoutId ElseId() const { return else_id_; } | 1194 BailoutId ElseId() const { return else_id_; } |
| 1201 | 1195 |
| 1202 protected: | 1196 protected: |
| 1203 IfStatement(Zone* zone, | 1197 IfStatement(Zone* zone, Expression* condition, Statement* then_statement, |
| 1204 Expression* condition, | 1198 Statement* else_statement, int pos, int* id_counter) |
| 1205 Statement* then_statement, | |
| 1206 Statement* else_statement, | |
| 1207 int pos) | |
| 1208 : Statement(zone, pos), | 1199 : Statement(zone, pos), |
| 1209 condition_(condition), | 1200 condition_(condition), |
| 1210 then_statement_(then_statement), | 1201 then_statement_(then_statement), |
| 1211 else_statement_(else_statement), | 1202 else_statement_(else_statement), |
| 1212 if_id_(GetNextId(zone)), | 1203 if_id_(GetNextId(id_counter)), |
| 1213 then_id_(GetNextId(zone)), | 1204 then_id_(GetNextId(id_counter)), |
| 1214 else_id_(GetNextId(zone)) { | 1205 else_id_(GetNextId(id_counter)) {} |
| 1215 } | |
| 1216 | 1206 |
| 1217 private: | 1207 private: |
| 1218 Expression* condition_; | 1208 Expression* condition_; |
| 1219 Statement* then_statement_; | 1209 Statement* then_statement_; |
| 1220 Statement* else_statement_; | 1210 Statement* else_statement_; |
| 1221 const BailoutId if_id_; | 1211 const BailoutId if_id_; |
| 1222 const BailoutId then_id_; | 1212 const BailoutId then_id_; |
| 1223 const BailoutId else_id_; | 1213 const BailoutId else_id_; |
| 1224 }; | 1214 }; |
| 1225 | 1215 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1372 | 1362 |
| 1373 static bool Match(void* literal1, void* literal2) { | 1363 static bool Match(void* literal1, void* literal2) { |
| 1374 Handle<String> s1 = static_cast<Literal*>(literal1)->ToString(); | 1364 Handle<String> s1 = static_cast<Literal*>(literal1)->ToString(); |
| 1375 Handle<String> s2 = static_cast<Literal*>(literal2)->ToString(); | 1365 Handle<String> s2 = static_cast<Literal*>(literal2)->ToString(); |
| 1376 return String::Equals(s1, s2); | 1366 return String::Equals(s1, s2); |
| 1377 } | 1367 } |
| 1378 | 1368 |
| 1379 TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); } | 1369 TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); } |
| 1380 | 1370 |
| 1381 protected: | 1371 protected: |
| 1382 Literal(Zone* zone, const AstValue* value, int position) | 1372 Literal(Zone* zone, const AstValue* value, int position, int* id_counter) |
| 1383 : Expression(zone, position), | 1373 : Expression(zone, position, id_counter), |
| 1384 value_(value), | 1374 value_(value), |
| 1385 isolate_(zone->isolate()) { } | 1375 isolate_(zone->isolate()) {} |
| 1386 | 1376 |
| 1387 private: | 1377 private: |
| 1388 Handle<String> ToString(); | 1378 Handle<String> ToString(); |
| 1389 | 1379 |
| 1390 const AstValue* value_; | 1380 const AstValue* value_; |
| 1391 // TODO(dcarney): remove. this is only needed for Match and Hash. | 1381 // TODO(dcarney): remove. this is only needed for Match and Hash. |
| 1392 Isolate* isolate_; | 1382 Isolate* isolate_; |
| 1393 }; | 1383 }; |
| 1394 | 1384 |
| 1395 | 1385 |
| 1396 // Base class for literals that needs space in the corresponding JSFunction. | 1386 // Base class for literals that needs space in the corresponding JSFunction. |
| 1397 class MaterializedLiteral : public Expression { | 1387 class MaterializedLiteral : public Expression { |
| 1398 public: | 1388 public: |
| 1399 virtual MaterializedLiteral* AsMaterializedLiteral() { return this; } | 1389 virtual MaterializedLiteral* AsMaterializedLiteral() { return this; } |
| 1400 | 1390 |
| 1401 int literal_index() { return literal_index_; } | 1391 int literal_index() { return literal_index_; } |
| 1402 | 1392 |
| 1403 int depth() const { | 1393 int depth() const { |
| 1404 // only callable after initialization. | 1394 // only callable after initialization. |
| 1405 DCHECK(depth_ >= 1); | 1395 DCHECK(depth_ >= 1); |
| 1406 return depth_; | 1396 return depth_; |
| 1407 } | 1397 } |
| 1408 | 1398 |
| 1409 protected: | 1399 protected: |
| 1410 MaterializedLiteral(Zone* zone, | 1400 MaterializedLiteral(Zone* zone, int literal_index, int pos, int* id_counter) |
| 1411 int literal_index, | 1401 : Expression(zone, pos, id_counter), |
| 1412 int pos) | |
| 1413 : Expression(zone, pos), | |
| 1414 literal_index_(literal_index), | 1402 literal_index_(literal_index), |
| 1415 is_simple_(false), | 1403 is_simple_(false), |
| 1416 depth_(0) {} | 1404 depth_(0) {} |
| 1417 | 1405 |
| 1418 // A materialized literal is simple if the values consist of only | 1406 // A materialized literal is simple if the values consist of only |
| 1419 // constants and simple object and array literals. | 1407 // constants and simple object and array literals. |
| 1420 bool is_simple() const { return is_simple_; } | 1408 bool is_simple() const { return is_simple_; } |
| 1421 void set_is_simple(bool is_simple) { is_simple_ = is_simple; } | 1409 void set_is_simple(bool is_simple) { is_simple_ = is_simple; } |
| 1422 friend class CompileTimeValue; | 1410 friend class CompileTimeValue; |
| 1423 | 1411 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1530 kHasFunction = 1 << 1 | 1518 kHasFunction = 1 << 1 |
| 1531 }; | 1519 }; |
| 1532 | 1520 |
| 1533 struct Accessors: public ZoneObject { | 1521 struct Accessors: public ZoneObject { |
| 1534 Accessors() : getter(NULL), setter(NULL) { } | 1522 Accessors() : getter(NULL), setter(NULL) { } |
| 1535 Expression* getter; | 1523 Expression* getter; |
| 1536 Expression* setter; | 1524 Expression* setter; |
| 1537 }; | 1525 }; |
| 1538 | 1526 |
| 1539 protected: | 1527 protected: |
| 1540 ObjectLiteral(Zone* zone, | 1528 ObjectLiteral(Zone* zone, ZoneList<Property*>* properties, int literal_index, |
| 1541 ZoneList<Property*>* properties, | 1529 int boilerplate_properties, bool has_function, int pos, |
| 1542 int literal_index, | 1530 int* id_counter) |
| 1543 int boilerplate_properties, | 1531 : MaterializedLiteral(zone, literal_index, pos, id_counter), |
| 1544 bool has_function, | |
| 1545 int pos) | |
| 1546 : MaterializedLiteral(zone, literal_index, pos), | |
| 1547 properties_(properties), | 1532 properties_(properties), |
| 1548 boilerplate_properties_(boilerplate_properties), | 1533 boilerplate_properties_(boilerplate_properties), |
| 1549 fast_elements_(false), | 1534 fast_elements_(false), |
| 1550 may_store_doubles_(false), | 1535 may_store_doubles_(false), |
| 1551 has_function_(has_function) {} | 1536 has_function_(has_function) {} |
| 1552 | 1537 |
| 1553 private: | 1538 private: |
| 1554 Handle<FixedArray> constant_properties_; | 1539 Handle<FixedArray> constant_properties_; |
| 1555 ZoneList<Property*>* properties_; | 1540 ZoneList<Property*>* properties_; |
| 1556 int boilerplate_properties_; | 1541 int boilerplate_properties_; |
| 1557 bool fast_elements_; | 1542 bool fast_elements_; |
| 1558 bool may_store_doubles_; | 1543 bool may_store_doubles_; |
| 1559 bool has_function_; | 1544 bool has_function_; |
| 1560 }; | 1545 }; |
| 1561 | 1546 |
| 1562 | 1547 |
| 1563 // Node for capturing a regexp literal. | 1548 // Node for capturing a regexp literal. |
| 1564 class RegExpLiteral V8_FINAL : public MaterializedLiteral { | 1549 class RegExpLiteral V8_FINAL : public MaterializedLiteral { |
| 1565 public: | 1550 public: |
| 1566 DECLARE_NODE_TYPE(RegExpLiteral) | 1551 DECLARE_NODE_TYPE(RegExpLiteral) |
| 1567 | 1552 |
| 1568 Handle<String> pattern() const { return pattern_->string(); } | 1553 Handle<String> pattern() const { return pattern_->string(); } |
| 1569 Handle<String> flags() const { return flags_->string(); } | 1554 Handle<String> flags() const { return flags_->string(); } |
| 1570 | 1555 |
| 1571 protected: | 1556 protected: |
| 1572 RegExpLiteral(Zone* zone, | 1557 RegExpLiteral(Zone* zone, const AstRawString* pattern, |
| 1573 const AstRawString* pattern, | 1558 const AstRawString* flags, int literal_index, int pos, |
| 1574 const AstRawString* flags, | 1559 int* id_counter) |
| 1575 int literal_index, | 1560 : MaterializedLiteral(zone, literal_index, pos, id_counter), |
| 1576 int pos) | |
| 1577 : MaterializedLiteral(zone, literal_index, pos), | |
| 1578 pattern_(pattern), | 1561 pattern_(pattern), |
| 1579 flags_(flags) { | 1562 flags_(flags) { |
| 1580 set_depth(1); | 1563 set_depth(1); |
| 1581 } | 1564 } |
| 1582 | 1565 |
| 1583 private: | 1566 private: |
| 1584 const AstRawString* pattern_; | 1567 const AstRawString* pattern_; |
| 1585 const AstRawString* flags_; | 1568 const AstRawString* flags_; |
| 1586 }; | 1569 }; |
| 1587 | 1570 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 1610 return flags; | 1593 return flags; |
| 1611 } | 1594 } |
| 1612 | 1595 |
| 1613 enum Flags { | 1596 enum Flags { |
| 1614 kNoFlags = 0, | 1597 kNoFlags = 0, |
| 1615 kShallowElements = 1, | 1598 kShallowElements = 1, |
| 1616 kDisableMementos = 1 << 1 | 1599 kDisableMementos = 1 << 1 |
| 1617 }; | 1600 }; |
| 1618 | 1601 |
| 1619 protected: | 1602 protected: |
| 1620 ArrayLiteral(Zone* zone, | 1603 ArrayLiteral(Zone* zone, ZoneList<Expression*>* values, int literal_index, |
| 1621 ZoneList<Expression*>* values, | 1604 int pos, int* id_counter) |
| 1622 int literal_index, | 1605 : MaterializedLiteral(zone, literal_index, pos, id_counter), |
| 1623 int pos) | |
| 1624 : MaterializedLiteral(zone, literal_index, pos), | |
| 1625 values_(values), | 1606 values_(values), |
| 1626 first_element_id_(ReserveIdRange(zone, values->length())) {} | 1607 first_element_id_(ReserveIdRange(id_counter, values->length())) {} |
| 1627 | 1608 |
| 1628 private: | 1609 private: |
| 1629 Handle<FixedArray> constant_elements_; | 1610 Handle<FixedArray> constant_elements_; |
| 1630 ZoneList<Expression*>* values_; | 1611 ZoneList<Expression*>* values_; |
| 1631 const BailoutId first_element_id_; | 1612 const BailoutId first_element_id_; |
| 1632 }; | 1613 }; |
| 1633 | 1614 |
| 1634 | 1615 |
| 1635 class VariableProxy V8_FINAL : public Expression, public FeedbackSlotInterface { | 1616 class VariableProxy V8_FINAL : public Expression, public FeedbackSlotInterface { |
| 1636 public: | 1617 public: |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1655 void BindTo(Variable* var); | 1636 void BindTo(Variable* var); |
| 1656 | 1637 |
| 1657 virtual int ComputeFeedbackSlotCount() { return FLAG_vector_ics ? 1 : 0; } | 1638 virtual int ComputeFeedbackSlotCount() { return FLAG_vector_ics ? 1 : 0; } |
| 1658 virtual void SetFirstFeedbackSlot(int slot) { | 1639 virtual void SetFirstFeedbackSlot(int slot) { |
| 1659 variable_feedback_slot_ = slot; | 1640 variable_feedback_slot_ = slot; |
| 1660 } | 1641 } |
| 1661 | 1642 |
| 1662 int VariableFeedbackSlot() { return variable_feedback_slot_; } | 1643 int VariableFeedbackSlot() { return variable_feedback_slot_; } |
| 1663 | 1644 |
| 1664 protected: | 1645 protected: |
| 1665 VariableProxy(Zone* zone, Variable* var, int position); | 1646 VariableProxy(Zone* zone, Variable* var, int position, int* id_counter); |
| 1666 | 1647 |
| 1667 VariableProxy(Zone* zone, | 1648 VariableProxy(Zone* zone, const AstRawString* name, bool is_this, |
| 1668 const AstRawString* name, | 1649 Interface* interface, int position, int* id_counter); |
| 1669 bool is_this, | |
| 1670 Interface* interface, | |
| 1671 int position); | |
| 1672 | 1650 |
| 1673 const AstRawString* name_; | 1651 const AstRawString* name_; |
| 1674 Variable* var_; // resolved variable, or NULL | 1652 Variable* var_; // resolved variable, or NULL |
| 1675 bool is_this_; | 1653 bool is_this_; |
| 1676 bool is_assigned_; | 1654 bool is_assigned_; |
| 1677 Interface* interface_; | 1655 Interface* interface_; |
| 1678 int variable_feedback_slot_; | 1656 int variable_feedback_slot_; |
| 1679 }; | 1657 }; |
| 1680 | 1658 |
| 1681 | 1659 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1718 TypeFeedbackId PropertyFeedbackId() { return reuse(id()); } | 1696 TypeFeedbackId PropertyFeedbackId() { return reuse(id()); } |
| 1719 | 1697 |
| 1720 virtual int ComputeFeedbackSlotCount() { return FLAG_vector_ics ? 1 : 0; } | 1698 virtual int ComputeFeedbackSlotCount() { return FLAG_vector_ics ? 1 : 0; } |
| 1721 virtual void SetFirstFeedbackSlot(int slot) { | 1699 virtual void SetFirstFeedbackSlot(int slot) { |
| 1722 property_feedback_slot_ = slot; | 1700 property_feedback_slot_ = slot; |
| 1723 } | 1701 } |
| 1724 | 1702 |
| 1725 int PropertyFeedbackSlot() const { return property_feedback_slot_; } | 1703 int PropertyFeedbackSlot() const { return property_feedback_slot_; } |
| 1726 | 1704 |
| 1727 protected: | 1705 protected: |
| 1728 Property(Zone* zone, Expression* obj, Expression* key, int pos) | 1706 Property(Zone* zone, Expression* obj, Expression* key, int pos, |
| 1729 : Expression(zone, pos), | 1707 int* id_counter) |
| 1708 : Expression(zone, pos, id_counter), | |
| 1730 obj_(obj), | 1709 obj_(obj), |
| 1731 key_(key), | 1710 key_(key), |
| 1732 load_id_(GetNextId(zone)), | 1711 load_id_(GetNextId(id_counter)), |
| 1733 property_feedback_slot_(kInvalidFeedbackSlot), | 1712 property_feedback_slot_(kInvalidFeedbackSlot), |
| 1734 is_for_call_(false), | 1713 is_for_call_(false), |
| 1735 is_uninitialized_(false), | 1714 is_uninitialized_(false), |
| 1736 is_string_access_(false) {} | 1715 is_string_access_(false) {} |
| 1737 | 1716 |
| 1738 private: | 1717 private: |
| 1739 Expression* obj_; | 1718 Expression* obj_; |
| 1740 Expression* key_; | 1719 Expression* key_; |
| 1741 const BailoutId load_id_; | 1720 const BailoutId load_id_; |
| 1742 int property_feedback_slot_; | 1721 int property_feedback_slot_; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1814 // Helpers to determine how to handle the call. | 1793 // Helpers to determine how to handle the call. |
| 1815 CallType GetCallType(Isolate* isolate) const; | 1794 CallType GetCallType(Isolate* isolate) const; |
| 1816 bool IsUsingCallFeedbackSlot(Isolate* isolate) const; | 1795 bool IsUsingCallFeedbackSlot(Isolate* isolate) const; |
| 1817 | 1796 |
| 1818 #ifdef DEBUG | 1797 #ifdef DEBUG |
| 1819 // Used to assert that the FullCodeGenerator records the return site. | 1798 // Used to assert that the FullCodeGenerator records the return site. |
| 1820 bool return_is_recorded_; | 1799 bool return_is_recorded_; |
| 1821 #endif | 1800 #endif |
| 1822 | 1801 |
| 1823 protected: | 1802 protected: |
| 1824 Call(Zone* zone, | 1803 Call(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments, |
| 1825 Expression* expression, | 1804 int pos, int* id_counter) |
| 1826 ZoneList<Expression*>* arguments, | 1805 : Expression(zone, pos, id_counter), |
| 1827 int pos) | |
| 1828 : Expression(zone, pos), | |
| 1829 expression_(expression), | 1806 expression_(expression), |
| 1830 arguments_(arguments), | 1807 arguments_(arguments), |
| 1831 call_feedback_slot_(kInvalidFeedbackSlot), | 1808 call_feedback_slot_(kInvalidFeedbackSlot), |
| 1832 return_id_(GetNextId(zone)) { | 1809 return_id_(GetNextId(id_counter)) { |
| 1833 if (expression->IsProperty()) { | 1810 if (expression->IsProperty()) { |
| 1834 expression->AsProperty()->mark_for_call(); | 1811 expression->AsProperty()->mark_for_call(); |
| 1835 } | 1812 } |
| 1836 } | 1813 } |
| 1837 | 1814 |
| 1838 private: | 1815 private: |
| 1839 Expression* expression_; | 1816 Expression* expression_; |
| 1840 ZoneList<Expression*>* arguments_; | 1817 ZoneList<Expression*>* arguments_; |
| 1841 | 1818 |
| 1842 Handle<JSFunction> target_; | 1819 Handle<JSFunction> target_; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1879 ElementsKind elements_kind() const { return elements_kind_; } | 1856 ElementsKind elements_kind() const { return elements_kind_; } |
| 1880 Handle<AllocationSite> allocation_site() const { | 1857 Handle<AllocationSite> allocation_site() const { |
| 1881 return allocation_site_; | 1858 return allocation_site_; |
| 1882 } | 1859 } |
| 1883 | 1860 |
| 1884 static int feedback_slots() { return 1; } | 1861 static int feedback_slots() { return 1; } |
| 1885 | 1862 |
| 1886 BailoutId ReturnId() const { return return_id_; } | 1863 BailoutId ReturnId() const { return return_id_; } |
| 1887 | 1864 |
| 1888 protected: | 1865 protected: |
| 1889 CallNew(Zone* zone, | 1866 CallNew(Zone* zone, Expression* expression, ZoneList<Expression*>* arguments, |
| 1890 Expression* expression, | 1867 int pos, int* id_counter) |
| 1891 ZoneList<Expression*>* arguments, | 1868 : Expression(zone, pos, id_counter), |
| 1892 int pos) | |
| 1893 : Expression(zone, pos), | |
| 1894 expression_(expression), | 1869 expression_(expression), |
| 1895 arguments_(arguments), | 1870 arguments_(arguments), |
| 1896 is_monomorphic_(false), | 1871 is_monomorphic_(false), |
| 1897 elements_kind_(GetInitialFastElementsKind()), | 1872 elements_kind_(GetInitialFastElementsKind()), |
| 1898 callnew_feedback_slot_(kInvalidFeedbackSlot), | 1873 callnew_feedback_slot_(kInvalidFeedbackSlot), |
| 1899 return_id_(GetNextId(zone)) { } | 1874 return_id_(GetNextId(id_counter)) {} |
| 1900 | 1875 |
| 1901 private: | 1876 private: |
| 1902 Expression* expression_; | 1877 Expression* expression_; |
| 1903 ZoneList<Expression*>* arguments_; | 1878 ZoneList<Expression*>* arguments_; |
| 1904 | 1879 |
| 1905 bool is_monomorphic_; | 1880 bool is_monomorphic_; |
| 1906 Handle<JSFunction> target_; | 1881 Handle<JSFunction> target_; |
| 1907 ElementsKind elements_kind_; | 1882 ElementsKind elements_kind_; |
| 1908 Handle<AllocationSite> allocation_site_; | 1883 Handle<AllocationSite> allocation_site_; |
| 1909 int callnew_feedback_slot_; | 1884 int callnew_feedback_slot_; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 1936 | 1911 |
| 1937 int CallRuntimeFeedbackSlot() { | 1912 int CallRuntimeFeedbackSlot() { |
| 1938 DCHECK(!is_jsruntime() || | 1913 DCHECK(!is_jsruntime() || |
| 1939 callruntime_feedback_slot_ != kInvalidFeedbackSlot); | 1914 callruntime_feedback_slot_ != kInvalidFeedbackSlot); |
| 1940 return callruntime_feedback_slot_; | 1915 return callruntime_feedback_slot_; |
| 1941 } | 1916 } |
| 1942 | 1917 |
| 1943 TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); } | 1918 TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); } |
| 1944 | 1919 |
| 1945 protected: | 1920 protected: |
| 1946 CallRuntime(Zone* zone, | 1921 CallRuntime(Zone* zone, const AstRawString* name, |
| 1947 const AstRawString* name, | |
| 1948 const Runtime::Function* function, | 1922 const Runtime::Function* function, |
| 1949 ZoneList<Expression*>* arguments, | 1923 ZoneList<Expression*>* arguments, int pos, int* id_counter) |
| 1950 int pos) | 1924 : Expression(zone, pos, id_counter), |
| 1951 : Expression(zone, pos), | |
| 1952 raw_name_(name), | 1925 raw_name_(name), |
| 1953 function_(function), | 1926 function_(function), |
| 1954 arguments_(arguments) { } | 1927 arguments_(arguments) {} |
| 1955 | 1928 |
| 1956 private: | 1929 private: |
| 1957 const AstRawString* raw_name_; | 1930 const AstRawString* raw_name_; |
| 1958 const Runtime::Function* function_; | 1931 const Runtime::Function* function_; |
| 1959 ZoneList<Expression*>* arguments_; | 1932 ZoneList<Expression*>* arguments_; |
| 1960 int callruntime_feedback_slot_; | 1933 int callruntime_feedback_slot_; |
| 1961 }; | 1934 }; |
| 1962 | 1935 |
| 1963 | 1936 |
| 1964 class UnaryOperation V8_FINAL : public Expression { | 1937 class UnaryOperation V8_FINAL : public Expression { |
| 1965 public: | 1938 public: |
| 1966 DECLARE_NODE_TYPE(UnaryOperation) | 1939 DECLARE_NODE_TYPE(UnaryOperation) |
| 1967 | 1940 |
| 1968 Token::Value op() const { return op_; } | 1941 Token::Value op() const { return op_; } |
| 1969 Expression* expression() const { return expression_; } | 1942 Expression* expression() const { return expression_; } |
| 1970 | 1943 |
| 1971 BailoutId MaterializeTrueId() { return materialize_true_id_; } | 1944 BailoutId MaterializeTrueId() { return materialize_true_id_; } |
| 1972 BailoutId MaterializeFalseId() { return materialize_false_id_; } | 1945 BailoutId MaterializeFalseId() { return materialize_false_id_; } |
| 1973 | 1946 |
| 1974 virtual void RecordToBooleanTypeFeedback( | 1947 virtual void RecordToBooleanTypeFeedback( |
| 1975 TypeFeedbackOracle* oracle) V8_OVERRIDE; | 1948 TypeFeedbackOracle* oracle) V8_OVERRIDE; |
| 1976 | 1949 |
| 1977 protected: | 1950 protected: |
| 1978 UnaryOperation(Zone* zone, | 1951 UnaryOperation(Zone* zone, Token::Value op, Expression* expression, int pos, |
| 1979 Token::Value op, | 1952 int* id_counter) |
| 1980 Expression* expression, | 1953 : Expression(zone, pos, id_counter), |
| 1981 int pos) | |
| 1982 : Expression(zone, pos), | |
| 1983 op_(op), | 1954 op_(op), |
| 1984 expression_(expression), | 1955 expression_(expression), |
| 1985 materialize_true_id_(GetNextId(zone)), | 1956 materialize_true_id_(GetNextId(id_counter)), |
| 1986 materialize_false_id_(GetNextId(zone)) { | 1957 materialize_false_id_(GetNextId(id_counter)) { |
| 1987 DCHECK(Token::IsUnaryOp(op)); | 1958 DCHECK(Token::IsUnaryOp(op)); |
| 1988 } | 1959 } |
| 1989 | 1960 |
| 1990 private: | 1961 private: |
| 1991 Token::Value op_; | 1962 Token::Value op_; |
| 1992 Expression* expression_; | 1963 Expression* expression_; |
| 1993 | 1964 |
| 1994 // For unary not (Token::NOT), the AST ids where true and false will | 1965 // For unary not (Token::NOT), the AST ids where true and false will |
| 1995 // actually be materialized, respectively. | 1966 // actually be materialized, respectively. |
| 1996 const BailoutId materialize_true_id_; | 1967 const BailoutId materialize_true_id_; |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 2015 BailoutId RightId() const { return right_id_; } | 1986 BailoutId RightId() const { return right_id_; } |
| 2016 | 1987 |
| 2017 TypeFeedbackId BinaryOperationFeedbackId() const { return reuse(id()); } | 1988 TypeFeedbackId BinaryOperationFeedbackId() const { return reuse(id()); } |
| 2018 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } | 1989 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } |
| 2019 void set_fixed_right_arg(Maybe<int> arg) { fixed_right_arg_ = arg; } | 1990 void set_fixed_right_arg(Maybe<int> arg) { fixed_right_arg_ = arg; } |
| 2020 | 1991 |
| 2021 virtual void RecordToBooleanTypeFeedback( | 1992 virtual void RecordToBooleanTypeFeedback( |
| 2022 TypeFeedbackOracle* oracle) V8_OVERRIDE; | 1993 TypeFeedbackOracle* oracle) V8_OVERRIDE; |
| 2023 | 1994 |
| 2024 protected: | 1995 protected: |
| 2025 BinaryOperation(Zone* zone, | 1996 BinaryOperation(Zone* zone, Token::Value op, Expression* left, |
| 2026 Token::Value op, | 1997 Expression* right, int pos, int* id_counter) |
| 2027 Expression* left, | 1998 : Expression(zone, pos, id_counter), |
| 2028 Expression* right, | |
| 2029 int pos) | |
| 2030 : Expression(zone, pos), | |
| 2031 op_(op), | 1999 op_(op), |
| 2032 left_(left), | 2000 left_(left), |
| 2033 right_(right), | 2001 right_(right), |
| 2034 right_id_(GetNextId(zone)) { | 2002 right_id_(GetNextId(id_counter)) { |
| 2035 DCHECK(Token::IsBinaryOp(op)); | 2003 DCHECK(Token::IsBinaryOp(op)); |
| 2036 } | 2004 } |
| 2037 | 2005 |
| 2038 private: | 2006 private: |
| 2039 Token::Value op_; | 2007 Token::Value op_; |
| 2040 Expression* left_; | 2008 Expression* left_; |
| 2041 Expression* right_; | 2009 Expression* right_; |
| 2042 Handle<AllocationSite> allocation_site_; | 2010 Handle<AllocationSite> allocation_site_; |
| 2043 | 2011 |
| 2044 // TODO(rossberg): the fixed arg should probably be represented as a Constant | 2012 // TODO(rossberg): the fixed arg should probably be represented as a Constant |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2077 Type* type() const { return type_; } | 2045 Type* type() const { return type_; } |
| 2078 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } | 2046 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } |
| 2079 void set_type(Type* type) { type_ = type; } | 2047 void set_type(Type* type) { type_ = type; } |
| 2080 | 2048 |
| 2081 BailoutId AssignmentId() const { return assignment_id_; } | 2049 BailoutId AssignmentId() const { return assignment_id_; } |
| 2082 | 2050 |
| 2083 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; } | 2051 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; } |
| 2084 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); } | 2052 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); } |
| 2085 | 2053 |
| 2086 protected: | 2054 protected: |
| 2087 CountOperation(Zone* zone, | 2055 CountOperation(Zone* zone, Token::Value op, bool is_prefix, Expression* expr, |
| 2088 Token::Value op, | 2056 int pos, int* id_counter) |
| 2089 bool is_prefix, | 2057 : Expression(zone, pos, id_counter), |
| 2090 Expression* expr, | |
| 2091 int pos) | |
| 2092 : Expression(zone, pos), | |
| 2093 op_(op), | 2058 op_(op), |
| 2094 is_prefix_(is_prefix), | 2059 is_prefix_(is_prefix), |
| 2095 store_mode_(STANDARD_STORE), | 2060 store_mode_(STANDARD_STORE), |
| 2096 expression_(expr), | 2061 expression_(expr), |
| 2097 assignment_id_(GetNextId(zone)), | 2062 assignment_id_(GetNextId(id_counter)), |
| 2098 count_id_(GetNextId(zone)) {} | 2063 count_id_(GetNextId(id_counter)) {} |
| 2099 | 2064 |
| 2100 private: | 2065 private: |
| 2101 Token::Value op_; | 2066 Token::Value op_; |
| 2102 bool is_prefix_ : 1; | 2067 bool is_prefix_ : 1; |
| 2103 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed, | 2068 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed, |
| 2104 // must have extra bit. | 2069 // must have extra bit. |
| 2105 Type* type_; | 2070 Type* type_; |
| 2106 | 2071 |
| 2107 Expression* expression_; | 2072 Expression* expression_; |
| 2108 const BailoutId assignment_id_; | 2073 const BailoutId assignment_id_; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 2123 TypeFeedbackId CompareOperationFeedbackId() const { return reuse(id()); } | 2088 TypeFeedbackId CompareOperationFeedbackId() const { return reuse(id()); } |
| 2124 Type* combined_type() const { return combined_type_; } | 2089 Type* combined_type() const { return combined_type_; } |
| 2125 void set_combined_type(Type* type) { combined_type_ = type; } | 2090 void set_combined_type(Type* type) { combined_type_ = type; } |
| 2126 | 2091 |
| 2127 // Match special cases. | 2092 // Match special cases. |
| 2128 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check); | 2093 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check); |
| 2129 bool IsLiteralCompareUndefined(Expression** expr, Isolate* isolate); | 2094 bool IsLiteralCompareUndefined(Expression** expr, Isolate* isolate); |
| 2130 bool IsLiteralCompareNull(Expression** expr); | 2095 bool IsLiteralCompareNull(Expression** expr); |
| 2131 | 2096 |
| 2132 protected: | 2097 protected: |
| 2133 CompareOperation(Zone* zone, | 2098 CompareOperation(Zone* zone, Token::Value op, Expression* left, |
| 2134 Token::Value op, | 2099 Expression* right, int pos, int* id_counter) |
| 2135 Expression* left, | 2100 : Expression(zone, pos, id_counter), |
| 2136 Expression* right, | |
| 2137 int pos) | |
| 2138 : Expression(zone, pos), | |
| 2139 op_(op), | 2101 op_(op), |
| 2140 left_(left), | 2102 left_(left), |
| 2141 right_(right), | 2103 right_(right), |
| 2142 combined_type_(Type::None(zone)) { | 2104 combined_type_(Type::None(zone)) { |
| 2143 DCHECK(Token::IsCompareOp(op)); | 2105 DCHECK(Token::IsCompareOp(op)); |
| 2144 } | 2106 } |
| 2145 | 2107 |
| 2146 private: | 2108 private: |
| 2147 Token::Value op_; | 2109 Token::Value op_; |
| 2148 Expression* left_; | 2110 Expression* left_; |
| 2149 Expression* right_; | 2111 Expression* right_; |
| 2150 | 2112 |
| 2151 Type* combined_type_; | 2113 Type* combined_type_; |
| 2152 }; | 2114 }; |
| 2153 | 2115 |
| 2154 | 2116 |
| 2155 class Conditional V8_FINAL : public Expression { | 2117 class Conditional V8_FINAL : public Expression { |
| 2156 public: | 2118 public: |
| 2157 DECLARE_NODE_TYPE(Conditional) | 2119 DECLARE_NODE_TYPE(Conditional) |
| 2158 | 2120 |
| 2159 Expression* condition() const { return condition_; } | 2121 Expression* condition() const { return condition_; } |
| 2160 Expression* then_expression() const { return then_expression_; } | 2122 Expression* then_expression() const { return then_expression_; } |
| 2161 Expression* else_expression() const { return else_expression_; } | 2123 Expression* else_expression() const { return else_expression_; } |
| 2162 | 2124 |
| 2163 BailoutId ThenId() const { return then_id_; } | 2125 BailoutId ThenId() const { return then_id_; } |
| 2164 BailoutId ElseId() const { return else_id_; } | 2126 BailoutId ElseId() const { return else_id_; } |
| 2165 | 2127 |
| 2166 protected: | 2128 protected: |
| 2167 Conditional(Zone* zone, | 2129 Conditional(Zone* zone, Expression* condition, Expression* then_expression, |
| 2168 Expression* condition, | 2130 Expression* else_expression, int position, int* id_counter) |
| 2169 Expression* then_expression, | 2131 : Expression(zone, position, id_counter), |
| 2170 Expression* else_expression, | |
| 2171 int position) | |
| 2172 : Expression(zone, position), | |
| 2173 condition_(condition), | 2132 condition_(condition), |
| 2174 then_expression_(then_expression), | 2133 then_expression_(then_expression), |
| 2175 else_expression_(else_expression), | 2134 else_expression_(else_expression), |
| 2176 then_id_(GetNextId(zone)), | 2135 then_id_(GetNextId(id_counter)), |
| 2177 else_id_(GetNextId(zone)) { } | 2136 else_id_(GetNextId(id_counter)) {} |
| 2178 | 2137 |
| 2179 private: | 2138 private: |
| 2180 Expression* condition_; | 2139 Expression* condition_; |
| 2181 Expression* then_expression_; | 2140 Expression* then_expression_; |
| 2182 Expression* else_expression_; | 2141 Expression* else_expression_; |
| 2183 const BailoutId then_id_; | 2142 const BailoutId then_id_; |
| 2184 const BailoutId else_id_; | 2143 const BailoutId else_id_; |
| 2185 }; | 2144 }; |
| 2186 | 2145 |
| 2187 | 2146 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 2215 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { | 2174 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { |
| 2216 return &receiver_types_; | 2175 return &receiver_types_; |
| 2217 } | 2176 } |
| 2218 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { | 2177 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { |
| 2219 return store_mode_; | 2178 return store_mode_; |
| 2220 } | 2179 } |
| 2221 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } | 2180 void set_is_uninitialized(bool b) { is_uninitialized_ = b; } |
| 2222 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } | 2181 void set_store_mode(KeyedAccessStoreMode mode) { store_mode_ = mode; } |
| 2223 | 2182 |
| 2224 protected: | 2183 protected: |
| 2225 Assignment(Zone* zone, | 2184 Assignment(Zone* zone, Token::Value op, Expression* target, Expression* value, |
| 2226 Token::Value op, | 2185 int pos, int* id_counter); |
| 2227 Expression* target, | |
| 2228 Expression* value, | |
| 2229 int pos); | |
| 2230 | 2186 |
| 2231 template<class Visitor> | 2187 template<class Visitor> |
| 2232 void Init(Zone* zone, AstNodeFactory<Visitor>* factory) { | 2188 void Init(Zone* zone, AstNodeFactory<Visitor>* factory) { |
| 2233 DCHECK(Token::IsAssignmentOp(op_)); | 2189 DCHECK(Token::IsAssignmentOp(op_)); |
| 2234 if (is_compound()) { | 2190 if (is_compound()) { |
| 2235 binary_operation_ = factory->NewBinaryOperation( | 2191 binary_operation_ = factory->NewBinaryOperation( |
| 2236 binary_op(), target_, value_, position() + 1); | 2192 binary_op(), target_, value_, position() + 1); |
| 2237 } | 2193 } |
| 2238 } | 2194 } |
| 2239 | 2195 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2295 DCHECK(yield_first_feedback_slot_ != kInvalidFeedbackSlot); | 2251 DCHECK(yield_first_feedback_slot_ != kInvalidFeedbackSlot); |
| 2296 return yield_first_feedback_slot_ + 1; | 2252 return yield_first_feedback_slot_ + 1; |
| 2297 } | 2253 } |
| 2298 | 2254 |
| 2299 int ValueFeedbackSlot() { | 2255 int ValueFeedbackSlot() { |
| 2300 DCHECK(yield_first_feedback_slot_ != kInvalidFeedbackSlot); | 2256 DCHECK(yield_first_feedback_slot_ != kInvalidFeedbackSlot); |
| 2301 return yield_first_feedback_slot_ + 2; | 2257 return yield_first_feedback_slot_ + 2; |
| 2302 } | 2258 } |
| 2303 | 2259 |
| 2304 protected: | 2260 protected: |
| 2305 Yield(Zone* zone, | 2261 Yield(Zone* zone, Expression* generator_object, Expression* expression, |
| 2306 Expression* generator_object, | 2262 Kind yield_kind, int pos, int* id_counter) |
| 2307 Expression* expression, | 2263 : Expression(zone, pos, id_counter), |
| 2308 Kind yield_kind, | |
| 2309 int pos) | |
| 2310 : Expression(zone, pos), | |
| 2311 generator_object_(generator_object), | 2264 generator_object_(generator_object), |
| 2312 expression_(expression), | 2265 expression_(expression), |
| 2313 yield_kind_(yield_kind), | 2266 yield_kind_(yield_kind), |
| 2314 index_(-1), | 2267 index_(-1), |
| 2315 yield_first_feedback_slot_(kInvalidFeedbackSlot) { } | 2268 yield_first_feedback_slot_(kInvalidFeedbackSlot) {} |
| 2316 | 2269 |
| 2317 private: | 2270 private: |
| 2318 Expression* generator_object_; | 2271 Expression* generator_object_; |
| 2319 Expression* expression_; | 2272 Expression* expression_; |
| 2320 Kind yield_kind_; | 2273 Kind yield_kind_; |
| 2321 int index_; | 2274 int index_; |
| 2322 int yield_first_feedback_slot_; | 2275 int yield_first_feedback_slot_; |
| 2323 }; | 2276 }; |
| 2324 | 2277 |
| 2325 | 2278 |
| 2326 class Throw V8_FINAL : public Expression { | 2279 class Throw V8_FINAL : public Expression { |
| 2327 public: | 2280 public: |
| 2328 DECLARE_NODE_TYPE(Throw) | 2281 DECLARE_NODE_TYPE(Throw) |
| 2329 | 2282 |
| 2330 Expression* exception() const { return exception_; } | 2283 Expression* exception() const { return exception_; } |
| 2331 | 2284 |
| 2332 protected: | 2285 protected: |
| 2333 Throw(Zone* zone, Expression* exception, int pos) | 2286 Throw(Zone* zone, Expression* exception, int pos, int* id_counter) |
| 2334 : Expression(zone, pos), exception_(exception) {} | 2287 : Expression(zone, pos, id_counter), exception_(exception) {} |
| 2335 | 2288 |
| 2336 private: | 2289 private: |
| 2337 Expression* exception_; | 2290 Expression* exception_; |
| 2338 }; | 2291 }; |
| 2339 | 2292 |
| 2340 | 2293 |
| 2341 class FunctionLiteral V8_FINAL : public Expression { | 2294 class FunctionLiteral V8_FINAL : public Expression { |
| 2342 public: | 2295 public: |
| 2343 enum FunctionType { | 2296 enum FunctionType { |
| 2344 ANONYMOUS_EXPRESSION, | 2297 ANONYMOUS_EXPRESSION, |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2475 | 2428 |
| 2476 protected: | 2429 protected: |
| 2477 FunctionLiteral(Zone* zone, const AstRawString* name, | 2430 FunctionLiteral(Zone* zone, const AstRawString* name, |
| 2478 AstValueFactory* ast_value_factory, Scope* scope, | 2431 AstValueFactory* ast_value_factory, Scope* scope, |
| 2479 ZoneList<Statement*>* body, int materialized_literal_count, | 2432 ZoneList<Statement*>* body, int materialized_literal_count, |
| 2480 int expected_property_count, int handler_count, | 2433 int expected_property_count, int handler_count, |
| 2481 int parameter_count, FunctionType function_type, | 2434 int parameter_count, FunctionType function_type, |
| 2482 ParameterFlag has_duplicate_parameters, | 2435 ParameterFlag has_duplicate_parameters, |
| 2483 IsFunctionFlag is_function, | 2436 IsFunctionFlag is_function, |
| 2484 IsParenthesizedFlag is_parenthesized, KindFlag kind, | 2437 IsParenthesizedFlag is_parenthesized, KindFlag kind, |
| 2485 int position) | 2438 int position, int* id_counter) |
| 2486 : Expression(zone, position), | 2439 : Expression(zone, position, id_counter), |
| 2487 raw_name_(name), | 2440 raw_name_(name), |
| 2488 scope_(scope), | 2441 scope_(scope), |
| 2489 body_(body), | 2442 body_(body), |
| 2490 raw_inferred_name_(ast_value_factory->empty_string()), | 2443 raw_inferred_name_(ast_value_factory->empty_string()), |
| 2491 dont_optimize_reason_(kNoReason), | 2444 dont_optimize_reason_(kNoReason), |
| 2492 materialized_literal_count_(materialized_literal_count), | 2445 materialized_literal_count_(materialized_literal_count), |
| 2493 expected_property_count_(expected_property_count), | 2446 expected_property_count_(expected_property_count), |
| 2494 handler_count_(handler_count), | 2447 handler_count_(handler_count), |
| 2495 parameter_count_(parameter_count), | 2448 parameter_count_(parameter_count), |
| 2496 function_token_position_(RelocInfo::kNoPosition) { | 2449 function_token_position_(RelocInfo::kNoPosition) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2535 | 2488 |
| 2536 class NativeFunctionLiteral V8_FINAL : public Expression { | 2489 class NativeFunctionLiteral V8_FINAL : public Expression { |
| 2537 public: | 2490 public: |
| 2538 DECLARE_NODE_TYPE(NativeFunctionLiteral) | 2491 DECLARE_NODE_TYPE(NativeFunctionLiteral) |
| 2539 | 2492 |
| 2540 Handle<String> name() const { return name_->string(); } | 2493 Handle<String> name() const { return name_->string(); } |
| 2541 v8::Extension* extension() const { return extension_; } | 2494 v8::Extension* extension() const { return extension_; } |
| 2542 | 2495 |
| 2543 protected: | 2496 protected: |
| 2544 NativeFunctionLiteral(Zone* zone, const AstRawString* name, | 2497 NativeFunctionLiteral(Zone* zone, const AstRawString* name, |
| 2545 v8::Extension* extension, int pos) | 2498 v8::Extension* extension, int pos, int* id_counter) |
| 2546 : Expression(zone, pos), name_(name), extension_(extension) {} | 2499 : Expression(zone, pos, id_counter), name_(name), extension_(extension) {} |
| 2547 | 2500 |
| 2548 private: | 2501 private: |
| 2549 const AstRawString* name_; | 2502 const AstRawString* name_; |
| 2550 v8::Extension* extension_; | 2503 v8::Extension* extension_; |
| 2551 }; | 2504 }; |
| 2552 | 2505 |
| 2553 | 2506 |
| 2554 class ThisFunction V8_FINAL : public Expression { | 2507 class ThisFunction V8_FINAL : public Expression { |
| 2555 public: | 2508 public: |
| 2556 DECLARE_NODE_TYPE(ThisFunction) | 2509 DECLARE_NODE_TYPE(ThisFunction) |
| 2557 | 2510 |
| 2558 protected: | 2511 protected: |
| 2559 explicit ThisFunction(Zone* zone, int pos): Expression(zone, pos) {} | 2512 ThisFunction(Zone* zone, int pos, int* id_counter) |
| 2513 : Expression(zone, pos, id_counter) {} | |
| 2560 }; | 2514 }; |
| 2561 | 2515 |
| 2562 | 2516 |
| 2563 class SuperReference V8_FINAL : public Expression { | 2517 class SuperReference V8_FINAL : public Expression { |
| 2564 public: | 2518 public: |
| 2565 DECLARE_NODE_TYPE(SuperReference) | 2519 DECLARE_NODE_TYPE(SuperReference) |
| 2566 | 2520 |
| 2567 VariableProxy* this_var() const { return this_var_; } | 2521 VariableProxy* this_var() const { return this_var_; } |
| 2568 | 2522 |
| 2569 TypeFeedbackId HomeObjectFeedbackId() { return reuse(id()); } | 2523 TypeFeedbackId HomeObjectFeedbackId() { return reuse(id()); } |
| 2570 | 2524 |
| 2571 protected: | 2525 protected: |
| 2572 explicit SuperReference(Zone* zone, VariableProxy* this_var, int pos) | 2526 SuperReference(Zone* zone, VariableProxy* this_var, int pos, int* id_counter) |
| 2573 : Expression(zone, pos), this_var_(this_var) { | 2527 : Expression(zone, pos, id_counter), this_var_(this_var) { |
| 2574 DCHECK(this_var->is_this()); | 2528 DCHECK(this_var->is_this()); |
| 2575 } | 2529 } |
| 2576 | 2530 |
| 2577 VariableProxy* this_var_; | 2531 VariableProxy* this_var_; |
| 2578 }; | 2532 }; |
| 2579 | 2533 |
| 2580 | 2534 |
| 2581 #undef DECLARE_NODE_TYPE | 2535 #undef DECLARE_NODE_TYPE |
| 2582 | 2536 |
| 2583 | 2537 |
| 2584 // ---------------------------------------------------------------------------- | 2538 // ---------------------------------------------------------------------------- |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3050 }; | 3004 }; |
| 3051 | 3005 |
| 3052 | 3006 |
| 3053 | 3007 |
| 3054 // ---------------------------------------------------------------------------- | 3008 // ---------------------------------------------------------------------------- |
| 3055 // AstNode factory | 3009 // AstNode factory |
| 3056 | 3010 |
| 3057 template<class Visitor> | 3011 template<class Visitor> |
| 3058 class AstNodeFactory V8_FINAL BASE_EMBEDDED { | 3012 class AstNodeFactory V8_FINAL BASE_EMBEDDED { |
| 3059 public: | 3013 public: |
| 3060 explicit AstNodeFactory(Zone* zone, AstValueFactory* ast_value_factory) | 3014 AstNodeFactory(Zone* zone, AstValueFactory* ast_value_factory, |
| 3061 : zone_(zone), ast_value_factory_(ast_value_factory) {} | 3015 int* id_counter) |
| 3016 : zone_(zone), | |
| 3017 ast_value_factory_(ast_value_factory), | |
| 3018 id_counter_(id_counter) {} | |
| 3062 | 3019 |
| 3063 Visitor* visitor() { return &visitor_; } | 3020 Visitor* visitor() { return &visitor_; } |
| 3064 | 3021 |
| 3065 #define VISIT_AND_RETURN(NodeType, node) \ | 3022 #define VISIT_AND_RETURN(NodeType, node) \ |
| 3066 visitor_.Visit##NodeType((node)); \ | 3023 visitor_.Visit##NodeType((node)); \ |
| 3067 return node; | 3024 return node; |
| 3068 | 3025 |
| 3069 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy, | 3026 VariableDeclaration* NewVariableDeclaration(VariableProxy* proxy, |
| 3070 VariableMode mode, | 3027 VariableMode mode, |
| 3071 Scope* scope, | 3028 Scope* scope, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3129 | 3086 |
| 3130 ModuleUrl* NewModuleUrl(Handle<String> url, int pos) { | 3087 ModuleUrl* NewModuleUrl(Handle<String> url, int pos) { |
| 3131 ModuleUrl* module = new(zone_) ModuleUrl(zone_, url, pos); | 3088 ModuleUrl* module = new(zone_) ModuleUrl(zone_, url, pos); |
| 3132 VISIT_AND_RETURN(ModuleUrl, module) | 3089 VISIT_AND_RETURN(ModuleUrl, module) |
| 3133 } | 3090 } |
| 3134 | 3091 |
| 3135 Block* NewBlock(ZoneList<const AstRawString*>* labels, | 3092 Block* NewBlock(ZoneList<const AstRawString*>* labels, |
| 3136 int capacity, | 3093 int capacity, |
| 3137 bool is_initializer_block, | 3094 bool is_initializer_block, |
| 3138 int pos) { | 3095 int pos) { |
| 3139 Block* block = new(zone_) Block( | 3096 Block* block = new (zone_) |
| 3140 zone_, labels, capacity, is_initializer_block, pos); | 3097 Block(zone_, labels, capacity, is_initializer_block, pos, id_counter_); |
| 3141 VISIT_AND_RETURN(Block, block) | 3098 VISIT_AND_RETURN(Block, block) |
| 3142 } | 3099 } |
| 3143 | 3100 |
| 3144 #define STATEMENT_WITH_LABELS(NodeType) \ | 3101 #define STATEMENT_WITH_LABELS(NodeType) \ |
| 3145 NodeType* New##NodeType(ZoneList<const AstRawString*>* labels, int pos) { \ | 3102 NodeType* New##NodeType(ZoneList<const AstRawString*>* labels, int pos) { \ |
| 3146 NodeType* stmt = new(zone_) NodeType(zone_, labels, pos); \ | 3103 NodeType* stmt = new (zone_) NodeType(zone_, labels, pos, id_counter_); \ |
| 3147 VISIT_AND_RETURN(NodeType, stmt); \ | 3104 VISIT_AND_RETURN(NodeType, stmt); \ |
| 3148 } | 3105 } |
| 3149 STATEMENT_WITH_LABELS(DoWhileStatement) | 3106 STATEMENT_WITH_LABELS(DoWhileStatement) |
| 3150 STATEMENT_WITH_LABELS(WhileStatement) | 3107 STATEMENT_WITH_LABELS(WhileStatement) |
| 3151 STATEMENT_WITH_LABELS(ForStatement) | 3108 STATEMENT_WITH_LABELS(ForStatement) |
| 3152 STATEMENT_WITH_LABELS(SwitchStatement) | 3109 STATEMENT_WITH_LABELS(SwitchStatement) |
| 3153 #undef STATEMENT_WITH_LABELS | 3110 #undef STATEMENT_WITH_LABELS |
| 3154 | 3111 |
| 3155 ForEachStatement* NewForEachStatement(ForEachStatement::VisitMode visit_mode, | 3112 ForEachStatement* NewForEachStatement(ForEachStatement::VisitMode visit_mode, |
| 3156 ZoneList<const AstRawString*>* labels, | 3113 ZoneList<const AstRawString*>* labels, |
| 3157 int pos) { | 3114 int pos) { |
| 3158 switch (visit_mode) { | 3115 switch (visit_mode) { |
| 3159 case ForEachStatement::ENUMERATE: { | 3116 case ForEachStatement::ENUMERATE: { |
| 3160 ForInStatement* stmt = new(zone_) ForInStatement(zone_, labels, pos); | 3117 ForInStatement* stmt = |
| 3118 new (zone_) ForInStatement(zone_, labels, pos, id_counter_); | |
| 3161 VISIT_AND_RETURN(ForInStatement, stmt); | 3119 VISIT_AND_RETURN(ForInStatement, stmt); |
| 3162 } | 3120 } |
| 3163 case ForEachStatement::ITERATE: { | 3121 case ForEachStatement::ITERATE: { |
| 3164 ForOfStatement* stmt = new(zone_) ForOfStatement(zone_, labels, pos); | 3122 ForOfStatement* stmt = |
| 3123 new (zone_) ForOfStatement(zone_, labels, pos, id_counter_); | |
| 3165 VISIT_AND_RETURN(ForOfStatement, stmt); | 3124 VISIT_AND_RETURN(ForOfStatement, stmt); |
| 3166 } | 3125 } |
| 3167 } | 3126 } |
| 3168 UNREACHABLE(); | 3127 UNREACHABLE(); |
| 3169 return NULL; | 3128 return NULL; |
| 3170 } | 3129 } |
| 3171 | 3130 |
| 3172 ModuleStatement* NewModuleStatement( | 3131 ModuleStatement* NewModuleStatement( |
| 3173 VariableProxy* proxy, Block* body, int pos) { | 3132 VariableProxy* proxy, Block* body, int pos) { |
| 3174 ModuleStatement* stmt = new(zone_) ModuleStatement(zone_, proxy, body, pos); | 3133 ModuleStatement* stmt = new(zone_) ModuleStatement(zone_, proxy, body, pos); |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 3202 int pos) { | 3161 int pos) { |
| 3203 WithStatement* stmt = new(zone_) WithStatement( | 3162 WithStatement* stmt = new(zone_) WithStatement( |
| 3204 zone_, scope, expression, statement, pos); | 3163 zone_, scope, expression, statement, pos); |
| 3205 VISIT_AND_RETURN(WithStatement, stmt) | 3164 VISIT_AND_RETURN(WithStatement, stmt) |
| 3206 } | 3165 } |
| 3207 | 3166 |
| 3208 IfStatement* NewIfStatement(Expression* condition, | 3167 IfStatement* NewIfStatement(Expression* condition, |
| 3209 Statement* then_statement, | 3168 Statement* then_statement, |
| 3210 Statement* else_statement, | 3169 Statement* else_statement, |
| 3211 int pos) { | 3170 int pos) { |
| 3212 IfStatement* stmt = new(zone_) IfStatement( | 3171 IfStatement* stmt = new (zone_) IfStatement( |
| 3213 zone_, condition, then_statement, else_statement, pos); | 3172 zone_, condition, then_statement, else_statement, pos, id_counter_); |
| 3214 VISIT_AND_RETURN(IfStatement, stmt) | 3173 VISIT_AND_RETURN(IfStatement, stmt) |
| 3215 } | 3174 } |
| 3216 | 3175 |
| 3217 TryCatchStatement* NewTryCatchStatement(int index, | 3176 TryCatchStatement* NewTryCatchStatement(int index, |
| 3218 Block* try_block, | 3177 Block* try_block, |
| 3219 Scope* scope, | 3178 Scope* scope, |
| 3220 Variable* variable, | 3179 Variable* variable, |
| 3221 Block* catch_block, | 3180 Block* catch_block, |
| 3222 int pos) { | 3181 int pos) { |
| 3223 TryCatchStatement* stmt = new(zone_) TryCatchStatement( | 3182 TryCatchStatement* stmt = new(zone_) TryCatchStatement( |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 3239 VISIT_AND_RETURN(DebuggerStatement, stmt) | 3198 VISIT_AND_RETURN(DebuggerStatement, stmt) |
| 3240 } | 3199 } |
| 3241 | 3200 |
| 3242 EmptyStatement* NewEmptyStatement(int pos) { | 3201 EmptyStatement* NewEmptyStatement(int pos) { |
| 3243 return new(zone_) EmptyStatement(zone_, pos); | 3202 return new(zone_) EmptyStatement(zone_, pos); |
| 3244 } | 3203 } |
| 3245 | 3204 |
| 3246 CaseClause* NewCaseClause( | 3205 CaseClause* NewCaseClause( |
| 3247 Expression* label, ZoneList<Statement*>* statements, int pos) { | 3206 Expression* label, ZoneList<Statement*>* statements, int pos) { |
| 3248 CaseClause* clause = | 3207 CaseClause* clause = |
| 3249 new(zone_) CaseClause(zone_, label, statements, pos); | 3208 new (zone_) CaseClause(zone_, label, statements, pos, id_counter_); |
| 3250 VISIT_AND_RETURN(CaseClause, clause) | 3209 VISIT_AND_RETURN(CaseClause, clause) |
| 3251 } | 3210 } |
| 3252 | 3211 |
| 3253 Literal* NewStringLiteral(const AstRawString* string, int pos) { | 3212 Literal* NewStringLiteral(const AstRawString* string, int pos) { |
| 3254 Literal* lit = | 3213 Literal* lit = new (zone_) |
| 3255 new (zone_) Literal(zone_, ast_value_factory_->NewString(string), pos); | 3214 Literal(zone_, ast_value_factory_->NewString(string), pos, id_counter_); |
| 3256 VISIT_AND_RETURN(Literal, lit) | 3215 VISIT_AND_RETURN(Literal, lit) |
| 3257 } | 3216 } |
| 3258 | 3217 |
| 3259 // A JavaScript symbol (ECMA-262 edition 6). | 3218 // A JavaScript symbol (ECMA-262 edition 6). |
| 3260 Literal* NewSymbolLiteral(const char* name, int pos) { | 3219 Literal* NewSymbolLiteral(const char* name, int pos) { |
| 3261 Literal* lit = | 3220 Literal* lit = new (zone_) |
| 3262 new (zone_) Literal(zone_, ast_value_factory_->NewSymbol(name), pos); | 3221 Literal(zone_, ast_value_factory_->NewSymbol(name), pos, id_counter_); |
| 3263 VISIT_AND_RETURN(Literal, lit) | 3222 VISIT_AND_RETURN(Literal, lit) |
| 3264 } | 3223 } |
| 3265 | 3224 |
| 3266 Literal* NewNumberLiteral(double number, int pos) { | 3225 Literal* NewNumberLiteral(double number, int pos) { |
| 3267 Literal* lit = new (zone_) | 3226 Literal* lit = new (zone_) |
| 3268 Literal(zone_, ast_value_factory_->NewNumber(number), pos); | 3227 Literal(zone_, ast_value_factory_->NewNumber(number), pos, id_counter_); |
| 3269 VISIT_AND_RETURN(Literal, lit) | 3228 VISIT_AND_RETURN(Literal, lit) |
| 3270 } | 3229 } |
| 3271 | 3230 |
| 3272 Literal* NewSmiLiteral(int number, int pos) { | 3231 Literal* NewSmiLiteral(int number, int pos) { |
| 3273 Literal* lit = | 3232 Literal* lit = new (zone_) |
| 3274 new (zone_) Literal(zone_, ast_value_factory_->NewSmi(number), pos); | 3233 Literal(zone_, ast_value_factory_->NewSmi(number), pos, id_counter_); |
| 3275 VISIT_AND_RETURN(Literal, lit) | 3234 VISIT_AND_RETURN(Literal, lit) |
| 3276 } | 3235 } |
| 3277 | 3236 |
| 3278 Literal* NewBooleanLiteral(bool b, int pos) { | 3237 Literal* NewBooleanLiteral(bool b, int pos) { |
| 3279 Literal* lit = | 3238 Literal* lit = new (zone_) |
| 3280 new (zone_) Literal(zone_, ast_value_factory_->NewBoolean(b), pos); | 3239 Literal(zone_, ast_value_factory_->NewBoolean(b), pos, id_counter_); |
| 3281 VISIT_AND_RETURN(Literal, lit) | 3240 VISIT_AND_RETURN(Literal, lit) |
| 3282 } | 3241 } |
| 3283 | 3242 |
| 3284 Literal* NewStringListLiteral(ZoneList<const AstRawString*>* strings, | 3243 Literal* NewStringListLiteral(ZoneList<const AstRawString*>* strings, |
| 3285 int pos) { | 3244 int pos) { |
| 3286 Literal* lit = new (zone_) | 3245 Literal* lit = new (zone_) Literal( |
| 3287 Literal(zone_, ast_value_factory_->NewStringList(strings), pos); | 3246 zone_, ast_value_factory_->NewStringList(strings), pos, id_counter_); |
| 3288 VISIT_AND_RETURN(Literal, lit) | 3247 VISIT_AND_RETURN(Literal, lit) |
| 3289 } | 3248 } |
| 3290 | 3249 |
| 3291 Literal* NewNullLiteral(int pos) { | 3250 Literal* NewNullLiteral(int pos) { |
| 3292 Literal* lit = | 3251 Literal* lit = new (zone_) |
| 3293 new (zone_) Literal(zone_, ast_value_factory_->NewNull(), pos); | 3252 Literal(zone_, ast_value_factory_->NewNull(), pos, id_counter_); |
| 3294 VISIT_AND_RETURN(Literal, lit) | 3253 VISIT_AND_RETURN(Literal, lit) |
| 3295 } | 3254 } |
| 3296 | 3255 |
| 3297 Literal* NewUndefinedLiteral(int pos) { | 3256 Literal* NewUndefinedLiteral(int pos) { |
| 3298 Literal* lit = | 3257 Literal* lit = new (zone_) |
| 3299 new (zone_) Literal(zone_, ast_value_factory_->NewUndefined(), pos); | 3258 Literal(zone_, ast_value_factory_->NewUndefined(), pos, id_counter_); |
| 3300 VISIT_AND_RETURN(Literal, lit) | 3259 VISIT_AND_RETURN(Literal, lit) |
| 3301 } | 3260 } |
| 3302 | 3261 |
| 3303 Literal* NewTheHoleLiteral(int pos) { | 3262 Literal* NewTheHoleLiteral(int pos) { |
| 3304 Literal* lit = | 3263 Literal* lit = new (zone_) |
| 3305 new (zone_) Literal(zone_, ast_value_factory_->NewTheHole(), pos); | 3264 Literal(zone_, ast_value_factory_->NewTheHole(), pos, id_counter_); |
| 3306 VISIT_AND_RETURN(Literal, lit) | 3265 VISIT_AND_RETURN(Literal, lit) |
| 3307 } | 3266 } |
| 3308 | 3267 |
| 3309 ObjectLiteral* NewObjectLiteral( | 3268 ObjectLiteral* NewObjectLiteral( |
| 3310 ZoneList<ObjectLiteral::Property*>* properties, | 3269 ZoneList<ObjectLiteral::Property*>* properties, |
| 3311 int literal_index, | 3270 int literal_index, |
| 3312 int boilerplate_properties, | 3271 int boilerplate_properties, |
| 3313 bool has_function, | 3272 bool has_function, |
| 3314 int pos) { | 3273 int pos) { |
| 3315 ObjectLiteral* lit = new(zone_) ObjectLiteral( | 3274 ObjectLiteral* lit = new (zone_) |
| 3316 zone_, properties, literal_index, boilerplate_properties, | 3275 ObjectLiteral(zone_, properties, literal_index, boilerplate_properties, |
| 3317 has_function, pos); | 3276 has_function, pos, id_counter_); |
| 3318 VISIT_AND_RETURN(ObjectLiteral, lit) | 3277 VISIT_AND_RETURN(ObjectLiteral, lit) |
| 3319 } | 3278 } |
| 3320 | 3279 |
| 3321 ObjectLiteral::Property* NewObjectLiteralProperty(Literal* key, | 3280 ObjectLiteral::Property* NewObjectLiteralProperty(Literal* key, |
| 3322 Expression* value) { | 3281 Expression* value) { |
| 3323 return new (zone_) | 3282 return new (zone_) |
| 3324 ObjectLiteral::Property(zone_, ast_value_factory_, key, value); | 3283 ObjectLiteral::Property(zone_, ast_value_factory_, key, value); |
| 3325 } | 3284 } |
| 3326 | 3285 |
| 3327 ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter, | 3286 ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter, |
| 3328 FunctionLiteral* value, | 3287 FunctionLiteral* value, |
| 3329 int pos) { | 3288 int pos) { |
| 3330 ObjectLiteral::Property* prop = | 3289 ObjectLiteral::Property* prop = |
| 3331 new(zone_) ObjectLiteral::Property(zone_, is_getter, value); | 3290 new(zone_) ObjectLiteral::Property(zone_, is_getter, value); |
| 3332 prop->set_key(NewStringLiteral(value->raw_name(), pos)); | 3291 prop->set_key(NewStringLiteral(value->raw_name(), pos)); |
| 3333 return prop; // Not an AST node, will not be visited. | 3292 return prop; // Not an AST node, will not be visited. |
| 3334 } | 3293 } |
| 3335 | 3294 |
| 3336 RegExpLiteral* NewRegExpLiteral(const AstRawString* pattern, | 3295 RegExpLiteral* NewRegExpLiteral(const AstRawString* pattern, |
| 3337 const AstRawString* flags, | 3296 const AstRawString* flags, |
| 3338 int literal_index, | 3297 int literal_index, |
| 3339 int pos) { | 3298 int pos) { |
| 3340 RegExpLiteral* lit = | 3299 RegExpLiteral* lit = new (zone_) |
| 3341 new(zone_) RegExpLiteral(zone_, pattern, flags, literal_index, pos); | 3300 RegExpLiteral(zone_, pattern, flags, literal_index, pos, id_counter_); |
| 3342 VISIT_AND_RETURN(RegExpLiteral, lit); | 3301 VISIT_AND_RETURN(RegExpLiteral, lit); |
| 3343 } | 3302 } |
| 3344 | 3303 |
| 3345 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values, | 3304 ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values, |
| 3346 int literal_index, | 3305 int literal_index, |
| 3347 int pos) { | 3306 int pos) { |
| 3348 ArrayLiteral* lit = new(zone_) ArrayLiteral( | 3307 ArrayLiteral* lit = new (zone_) |
| 3349 zone_, values, literal_index, pos); | 3308 ArrayLiteral(zone_, values, literal_index, pos, id_counter_); |
| 3350 VISIT_AND_RETURN(ArrayLiteral, lit) | 3309 VISIT_AND_RETURN(ArrayLiteral, lit) |
| 3351 } | 3310 } |
| 3352 | 3311 |
| 3353 VariableProxy* NewVariableProxy(Variable* var, | 3312 VariableProxy* NewVariableProxy(Variable* var, |
| 3354 int pos = RelocInfo::kNoPosition) { | 3313 int pos = RelocInfo::kNoPosition) { |
| 3355 VariableProxy* proxy = new(zone_) VariableProxy(zone_, var, pos); | 3314 VariableProxy* proxy = |
| 3315 new (zone_) VariableProxy(zone_, var, pos, id_counter_); | |
| 3356 VISIT_AND_RETURN(VariableProxy, proxy) | 3316 VISIT_AND_RETURN(VariableProxy, proxy) |
| 3357 } | 3317 } |
| 3358 | 3318 |
| 3359 VariableProxy* NewVariableProxy(const AstRawString* name, | 3319 VariableProxy* NewVariableProxy(const AstRawString* name, |
| 3360 bool is_this, | 3320 bool is_this, |
| 3361 Interface* interface = Interface::NewValue(), | 3321 Interface* interface = Interface::NewValue(), |
| 3362 int position = RelocInfo::kNoPosition) { | 3322 int position = RelocInfo::kNoPosition) { |
| 3363 VariableProxy* proxy = | 3323 VariableProxy* proxy = new (zone_) |
| 3364 new(zone_) VariableProxy(zone_, name, is_this, interface, position); | 3324 VariableProxy(zone_, name, is_this, interface, position, id_counter_); |
| 3365 VISIT_AND_RETURN(VariableProxy, proxy) | 3325 VISIT_AND_RETURN(VariableProxy, proxy) |
| 3366 } | 3326 } |
| 3367 | 3327 |
| 3368 Property* NewProperty(Expression* obj, Expression* key, int pos) { | 3328 Property* NewProperty(Expression* obj, Expression* key, int pos) { |
| 3369 Property* prop = new(zone_) Property(zone_, obj, key, pos); | 3329 Property* prop = new (zone_) Property(zone_, obj, key, pos, id_counter_); |
| 3370 VISIT_AND_RETURN(Property, prop) | 3330 VISIT_AND_RETURN(Property, prop) |
| 3371 } | 3331 } |
| 3372 | 3332 |
| 3373 Call* NewCall(Expression* expression, | 3333 Call* NewCall(Expression* expression, |
| 3374 ZoneList<Expression*>* arguments, | 3334 ZoneList<Expression*>* arguments, |
| 3375 int pos) { | 3335 int pos) { |
| 3376 Call* call = new(zone_) Call(zone_, expression, arguments, pos); | 3336 Call* call = |
| 3337 new (zone_) Call(zone_, expression, arguments, pos, id_counter_); | |
| 3377 VISIT_AND_RETURN(Call, call) | 3338 VISIT_AND_RETURN(Call, call) |
| 3378 } | 3339 } |
| 3379 | 3340 |
| 3380 CallNew* NewCallNew(Expression* expression, | 3341 CallNew* NewCallNew(Expression* expression, |
| 3381 ZoneList<Expression*>* arguments, | 3342 ZoneList<Expression*>* arguments, |
| 3382 int pos) { | 3343 int pos) { |
| 3383 CallNew* call = new(zone_) CallNew(zone_, expression, arguments, pos); | 3344 CallNew* call = |
| 3345 new (zone_) CallNew(zone_, expression, arguments, pos, id_counter_); | |
| 3384 VISIT_AND_RETURN(CallNew, call) | 3346 VISIT_AND_RETURN(CallNew, call) |
| 3385 } | 3347 } |
| 3386 | 3348 |
| 3387 CallRuntime* NewCallRuntime(const AstRawString* name, | 3349 CallRuntime* NewCallRuntime(const AstRawString* name, |
| 3388 const Runtime::Function* function, | 3350 const Runtime::Function* function, |
| 3389 ZoneList<Expression*>* arguments, | 3351 ZoneList<Expression*>* arguments, |
| 3390 int pos) { | 3352 int pos) { |
| 3391 CallRuntime* call = | 3353 CallRuntime* call = new (zone_) |
| 3392 new(zone_) CallRuntime(zone_, name, function, arguments, pos); | 3354 CallRuntime(zone_, name, function, arguments, pos, id_counter_); |
| 3393 VISIT_AND_RETURN(CallRuntime, call) | 3355 VISIT_AND_RETURN(CallRuntime, call) |
| 3394 } | 3356 } |
| 3395 | 3357 |
| 3396 UnaryOperation* NewUnaryOperation(Token::Value op, | 3358 UnaryOperation* NewUnaryOperation(Token::Value op, |
| 3397 Expression* expression, | 3359 Expression* expression, |
| 3398 int pos) { | 3360 int pos) { |
| 3399 UnaryOperation* node = | 3361 UnaryOperation* node = |
| 3400 new(zone_) UnaryOperation(zone_, op, expression, pos); | 3362 new (zone_) UnaryOperation(zone_, op, expression, pos, id_counter_); |
| 3401 VISIT_AND_RETURN(UnaryOperation, node) | 3363 VISIT_AND_RETURN(UnaryOperation, node) |
| 3402 } | 3364 } |
| 3403 | 3365 |
| 3404 BinaryOperation* NewBinaryOperation(Token::Value op, | 3366 BinaryOperation* NewBinaryOperation(Token::Value op, |
| 3405 Expression* left, | 3367 Expression* left, |
| 3406 Expression* right, | 3368 Expression* right, |
| 3407 int pos) { | 3369 int pos) { |
| 3408 BinaryOperation* node = | 3370 BinaryOperation* node = |
| 3409 new(zone_) BinaryOperation(zone_, op, left, right, pos); | 3371 new (zone_) BinaryOperation(zone_, op, left, right, pos, id_counter_); |
| 3410 VISIT_AND_RETURN(BinaryOperation, node) | 3372 VISIT_AND_RETURN(BinaryOperation, node) |
| 3411 } | 3373 } |
| 3412 | 3374 |
| 3413 CountOperation* NewCountOperation(Token::Value op, | 3375 CountOperation* NewCountOperation(Token::Value op, |
| 3414 bool is_prefix, | 3376 bool is_prefix, |
| 3415 Expression* expr, | 3377 Expression* expr, |
| 3416 int pos) { | 3378 int pos) { |
| 3417 CountOperation* node = | 3379 CountOperation* node = new (zone_) |
| 3418 new(zone_) CountOperation(zone_, op, is_prefix, expr, pos); | 3380 CountOperation(zone_, op, is_prefix, expr, pos, id_counter_); |
| 3419 VISIT_AND_RETURN(CountOperation, node) | 3381 VISIT_AND_RETURN(CountOperation, node) |
| 3420 } | 3382 } |
| 3421 | 3383 |
| 3422 CompareOperation* NewCompareOperation(Token::Value op, | 3384 CompareOperation* NewCompareOperation(Token::Value op, |
| 3423 Expression* left, | 3385 Expression* left, |
| 3424 Expression* right, | 3386 Expression* right, |
| 3425 int pos) { | 3387 int pos) { |
| 3426 CompareOperation* node = | 3388 CompareOperation* node = |
| 3427 new(zone_) CompareOperation(zone_, op, left, right, pos); | 3389 new (zone_) CompareOperation(zone_, op, left, right, pos, id_counter_); |
| 3428 VISIT_AND_RETURN(CompareOperation, node) | 3390 VISIT_AND_RETURN(CompareOperation, node) |
| 3429 } | 3391 } |
| 3430 | 3392 |
| 3431 Conditional* NewConditional(Expression* condition, | 3393 Conditional* NewConditional(Expression* condition, |
| 3432 Expression* then_expression, | 3394 Expression* then_expression, |
| 3433 Expression* else_expression, | 3395 Expression* else_expression, |
| 3434 int position) { | 3396 int position) { |
| 3435 Conditional* cond = new(zone_) Conditional( | 3397 Conditional* cond = |
| 3436 zone_, condition, then_expression, else_expression, position); | 3398 new (zone_) Conditional(zone_, condition, then_expression, |
| 3399 else_expression, position, id_counter_); | |
| 3437 VISIT_AND_RETURN(Conditional, cond) | 3400 VISIT_AND_RETURN(Conditional, cond) |
| 3438 } | 3401 } |
| 3439 | 3402 |
| 3440 Assignment* NewAssignment(Token::Value op, | 3403 Assignment* NewAssignment(Token::Value op, |
| 3441 Expression* target, | 3404 Expression* target, |
| 3442 Expression* value, | 3405 Expression* value, |
| 3443 int pos) { | 3406 int pos) { |
| 3444 Assignment* assign = | 3407 Assignment* assign = |
| 3445 new(zone_) Assignment(zone_, op, target, value, pos); | 3408 new (zone_) Assignment(zone_, op, target, value, pos, id_counter_); |
| 3446 assign->Init(zone_, this); | 3409 assign->Init(zone_, this); |
| 3447 VISIT_AND_RETURN(Assignment, assign) | 3410 VISIT_AND_RETURN(Assignment, assign) |
| 3448 } | 3411 } |
| 3449 | 3412 |
| 3450 Yield* NewYield(Expression *generator_object, | 3413 Yield* NewYield(Expression *generator_object, |
| 3451 Expression* expression, | 3414 Expression* expression, |
| 3452 Yield::Kind yield_kind, | 3415 Yield::Kind yield_kind, |
| 3453 int pos) { | 3416 int pos) { |
| 3454 if (!expression) expression = NewUndefinedLiteral(pos); | 3417 if (!expression) expression = NewUndefinedLiteral(pos); |
| 3455 Yield* yield = new(zone_) Yield( | 3418 Yield* yield = new (zone_) Yield(zone_, generator_object, expression, |
| 3456 zone_, generator_object, expression, yield_kind, pos); | 3419 yield_kind, pos, id_counter_); |
| 3457 VISIT_AND_RETURN(Yield, yield) | 3420 VISIT_AND_RETURN(Yield, yield) |
| 3458 } | 3421 } |
| 3459 | 3422 |
| 3460 Throw* NewThrow(Expression* exception, int pos) { | 3423 Throw* NewThrow(Expression* exception, int pos) { |
| 3461 Throw* t = new(zone_) Throw(zone_, exception, pos); | 3424 Throw* t = new (zone_) Throw(zone_, exception, pos, id_counter_); |
| 3462 VISIT_AND_RETURN(Throw, t) | 3425 VISIT_AND_RETURN(Throw, t) |
| 3463 } | 3426 } |
| 3464 | 3427 |
| 3465 FunctionLiteral* NewFunctionLiteral( | 3428 FunctionLiteral* NewFunctionLiteral( |
| 3466 const AstRawString* name, AstValueFactory* ast_value_factory, | 3429 const AstRawString* name, AstValueFactory* ast_value_factory, |
| 3467 Scope* scope, ZoneList<Statement*>* body, int materialized_literal_count, | 3430 Scope* scope, ZoneList<Statement*>* body, int materialized_literal_count, |
| 3468 int expected_property_count, int handler_count, int parameter_count, | 3431 int expected_property_count, int handler_count, int parameter_count, |
| 3469 FunctionLiteral::ParameterFlag has_duplicate_parameters, | 3432 FunctionLiteral::ParameterFlag has_duplicate_parameters, |
| 3470 FunctionLiteral::FunctionType function_type, | 3433 FunctionLiteral::FunctionType function_type, |
| 3471 FunctionLiteral::IsFunctionFlag is_function, | 3434 FunctionLiteral::IsFunctionFlag is_function, |
| 3472 FunctionLiteral::IsParenthesizedFlag is_parenthesized, | 3435 FunctionLiteral::IsParenthesizedFlag is_parenthesized, |
| 3473 FunctionLiteral::KindFlag kind, int position) { | 3436 FunctionLiteral::KindFlag kind, int position) { |
| 3474 FunctionLiteral* lit = new (zone_) FunctionLiteral( | 3437 FunctionLiteral* lit = new (zone_) FunctionLiteral( |
| 3475 zone_, name, ast_value_factory, scope, body, materialized_literal_count, | 3438 zone_, name, ast_value_factory, scope, body, materialized_literal_count, |
| 3476 expected_property_count, handler_count, parameter_count, function_type, | 3439 expected_property_count, handler_count, parameter_count, function_type, |
| 3477 has_duplicate_parameters, is_function, is_parenthesized, kind, | 3440 has_duplicate_parameters, is_function, is_parenthesized, kind, position, |
| 3478 position); | 3441 id_counter_); |
| 3479 // Top-level literal doesn't count for the AST's properties. | 3442 // Top-level literal doesn't count for the AST's properties. |
| 3480 if (is_function == FunctionLiteral::kIsFunction) { | 3443 if (is_function == FunctionLiteral::kIsFunction) { |
| 3481 visitor_.VisitFunctionLiteral(lit); | 3444 visitor_.VisitFunctionLiteral(lit); |
| 3482 } | 3445 } |
| 3483 return lit; | 3446 return lit; |
| 3484 } | 3447 } |
| 3485 | 3448 |
| 3486 NativeFunctionLiteral* NewNativeFunctionLiteral( | 3449 NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name, |
| 3487 const AstRawString* name, v8::Extension* extension, | 3450 v8::Extension* extension, |
| 3488 int pos) { | 3451 int pos) { |
| 3489 NativeFunctionLiteral* lit = | 3452 NativeFunctionLiteral* lit = new (zone_) |
| 3490 new(zone_) NativeFunctionLiteral(zone_, name, extension, pos); | 3453 NativeFunctionLiteral(zone_, name, extension, pos, id_counter_); |
| 3491 VISIT_AND_RETURN(NativeFunctionLiteral, lit) | 3454 VISIT_AND_RETURN(NativeFunctionLiteral, lit) |
| 3492 } | 3455 } |
| 3493 | 3456 |
| 3494 ThisFunction* NewThisFunction(int pos) { | 3457 ThisFunction* NewThisFunction(int pos) { |
| 3495 ThisFunction* fun = new(zone_) ThisFunction(zone_, pos); | 3458 ThisFunction* fun = new (zone_) ThisFunction(zone_, pos, id_counter_); |
| 3496 VISIT_AND_RETURN(ThisFunction, fun) | 3459 VISIT_AND_RETURN(ThisFunction, fun) |
| 3497 } | 3460 } |
| 3498 | 3461 |
| 3499 SuperReference* NewSuperReference(VariableProxy* this_var, int pos) { | 3462 SuperReference* NewSuperReference(VariableProxy* this_var, int pos) { |
| 3500 SuperReference* super = new (zone_) SuperReference(zone_, this_var, pos); | 3463 SuperReference* super = |
| 3464 new (zone_) SuperReference(zone_, this_var, pos, id_counter_); | |
| 3501 VISIT_AND_RETURN(SuperReference, super); | 3465 VISIT_AND_RETURN(SuperReference, super); |
| 3502 } | 3466 } |
| 3503 | 3467 |
| 3504 #undef VISIT_AND_RETURN | 3468 #undef VISIT_AND_RETURN |
| 3505 | 3469 |
| 3506 private: | 3470 private: |
| 3507 Zone* zone_; | 3471 Zone* zone_; |
| 3508 Visitor visitor_; | 3472 Visitor visitor_; |
| 3509 AstValueFactory* ast_value_factory_; | 3473 AstValueFactory* ast_value_factory_; |
| 3474 int* id_counter_; | |
| 3510 }; | 3475 }; |
| 3511 | 3476 |
| 3512 | 3477 |
| 3513 } } // namespace v8::internal | 3478 } } // namespace v8::internal |
| 3514 | 3479 |
| 3515 #endif // V8_AST_H_ | 3480 #endif // V8_AST_H_ |
| OLD | NEW |