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