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