| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 static unsigned ReserveIdRange(int n) { | 168 static unsigned ReserveIdRange(int n) { |
| 169 unsigned tmp = current_id_; | 169 unsigned tmp = current_id_; |
| 170 current_id_ += n; | 170 current_id_ += n; |
| 171 return tmp; | 171 return tmp; |
| 172 } | 172 } |
| 173 | 173 |
| 174 private: | 174 private: |
| 175 static unsigned current_id_; | 175 static unsigned current_id_; |
| 176 static unsigned count_; | 176 static unsigned count_; |
| 177 unsigned id_; | 177 unsigned id_; |
| 178 |
| 179 friend class CaseClause; // Generates AST IDs. |
| 178 }; | 180 }; |
| 179 | 181 |
| 180 | 182 |
| 181 class Statement: public AstNode { | 183 class Statement: public AstNode { |
| 182 public: | 184 public: |
| 183 Statement() : statement_pos_(RelocInfo::kNoPosition) {} | 185 Statement() : statement_pos_(RelocInfo::kNoPosition) {} |
| 184 | 186 |
| 185 virtual Statement* AsStatement() { return this; } | 187 virtual Statement* AsStatement() { return this; } |
| 186 | 188 |
| 187 virtual Assignment* StatementAsSimpleAssignment() { return NULL; } | 189 virtual Assignment* StatementAsSimpleAssignment() { return NULL; } |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 Expression* label() const { | 689 Expression* label() const { |
| 688 CHECK(!is_default()); | 690 CHECK(!is_default()); |
| 689 return label_; | 691 return label_; |
| 690 } | 692 } |
| 691 JumpTarget* body_target() { return &body_target_; } | 693 JumpTarget* body_target() { return &body_target_; } |
| 692 ZoneList<Statement*>* statements() const { return statements_; } | 694 ZoneList<Statement*>* statements() const { return statements_; } |
| 693 | 695 |
| 694 int position() { return position_; } | 696 int position() { return position_; } |
| 695 void set_position(int pos) { position_ = pos; } | 697 void set_position(int pos) { position_ = pos; } |
| 696 | 698 |
| 699 int EntryId() { return entry_id_; } |
| 700 |
| 697 // Type feedback information. | 701 // Type feedback information. |
| 698 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 702 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
| 699 bool IsSmiCompare() { return compare_type_ == SMI_ONLY; } | 703 bool IsSmiCompare() { return compare_type_ == SMI_ONLY; } |
| 700 bool IsObjectCompare() { return compare_type_ == OBJECT_ONLY; } | 704 bool IsObjectCompare() { return compare_type_ == OBJECT_ONLY; } |
| 701 | 705 |
| 702 private: | 706 private: |
| 703 Expression* label_; | 707 Expression* label_; |
| 704 JumpTarget body_target_; | 708 JumpTarget body_target_; |
| 705 ZoneList<Statement*>* statements_; | 709 ZoneList<Statement*>* statements_; |
| 706 int position_; | 710 int position_; |
| 707 enum CompareTypeFeedback { NONE, SMI_ONLY, OBJECT_ONLY }; | 711 enum CompareTypeFeedback { NONE, SMI_ONLY, OBJECT_ONLY }; |
| 708 CompareTypeFeedback compare_type_; | 712 CompareTypeFeedback compare_type_; |
| 713 int entry_id_; |
| 709 }; | 714 }; |
| 710 | 715 |
| 711 | 716 |
| 712 class SwitchStatement: public BreakableStatement { | 717 class SwitchStatement: public BreakableStatement { |
| 713 public: | 718 public: |
| 714 explicit inline SwitchStatement(ZoneStringList* labels); | 719 explicit inline SwitchStatement(ZoneStringList* labels); |
| 715 | 720 |
| 716 DECLARE_NODE_TYPE(SwitchStatement) | 721 DECLARE_NODE_TYPE(SwitchStatement) |
| 717 | 722 |
| 718 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { | 723 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { |
| (...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2166 AST_NODE_LIST(DEF_VISIT) | 2171 AST_NODE_LIST(DEF_VISIT) |
| 2167 #undef DEF_VISIT | 2172 #undef DEF_VISIT |
| 2168 | 2173 |
| 2169 private: | 2174 private: |
| 2170 bool stack_overflow_; | 2175 bool stack_overflow_; |
| 2171 }; | 2176 }; |
| 2172 | 2177 |
| 2173 } } // namespace v8::internal | 2178 } } // namespace v8::internal |
| 2174 | 2179 |
| 2175 #endif // V8_AST_H_ | 2180 #endif // V8_AST_H_ |
| OLD | NEW |