| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 158 |
| 159 #define DECLARE_NODE_TYPE(type) \ | 159 #define DECLARE_NODE_TYPE(type) \ |
| 160 virtual void Accept(AstVisitor* v); \ | 160 virtual void Accept(AstVisitor* v); \ |
| 161 virtual AstNode::Type node_type() const { return AstNode::k##type; } \ | 161 virtual AstNode::Type node_type() const { return AstNode::k##type; } \ |
| 162 template<class> friend class AstNodeFactory; | 162 template<class> friend class AstNodeFactory; |
| 163 | 163 |
| 164 | 164 |
| 165 enum AstPropertiesFlag { | 165 enum AstPropertiesFlag { |
| 166 kDontInline, | 166 kDontInline, |
| 167 kDontOptimize, | 167 kDontOptimize, |
| 168 kDontOsr, |
| 168 kDontSelfOptimize, | 169 kDontSelfOptimize, |
| 169 kDontSoftInline, | 170 kDontSoftInline, |
| 170 kDontCache | 171 kDontCache |
| 171 }; | 172 }; |
| 172 | 173 |
| 173 | 174 |
| 174 class AstProperties BASE_EMBEDDED { | 175 class AstProperties BASE_EMBEDDED { |
| 175 public: | 176 public: |
| 176 class Flags : public EnumSet<AstPropertiesFlag, int> {}; | 177 class Flags : public EnumSet<AstPropertiesFlag, int> {}; |
| 177 | 178 |
| (...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 class TryStatement: public Statement { | 1064 class TryStatement: public Statement { |
| 1064 public: | 1065 public: |
| 1065 void set_escaping_targets(ZoneList<Label*>* targets) { | 1066 void set_escaping_targets(ZoneList<Label*>* targets) { |
| 1066 escaping_targets_ = targets; | 1067 escaping_targets_ = targets; |
| 1067 } | 1068 } |
| 1068 | 1069 |
| 1069 int index() const { return index_; } | 1070 int index() const { return index_; } |
| 1070 Block* try_block() const { return try_block_; } | 1071 Block* try_block() const { return try_block_; } |
| 1071 ZoneList<Label*>* escaping_targets() const { return escaping_targets_; } | 1072 ZoneList<Label*>* escaping_targets() const { return escaping_targets_; } |
| 1072 | 1073 |
| 1074 BailoutId TryEntryId() const { return try_entry_id_; } |
| 1075 BailoutId TryExitId() const { return try_exit_id_; } |
| 1076 |
| 1073 protected: | 1077 protected: |
| 1074 TryStatement(int index, Block* try_block) | 1078 TryStatement(Isolate* isolate, int index, Block* try_block) |
| 1075 : index_(index), | 1079 : index_(index), |
| 1080 try_entry_id_(GetNextId(isolate)), |
| 1081 try_exit_id_(GetNextId(isolate)), |
| 1076 try_block_(try_block), | 1082 try_block_(try_block), |
| 1077 escaping_targets_(NULL) { } | 1083 escaping_targets_(NULL) { } |
| 1078 | 1084 |
| 1079 private: | 1085 private: |
| 1080 // Unique (per-function) index of this handler. This is not an AST ID. | 1086 // Unique (per-function) index of this handler. This is not an AST ID. |
| 1081 int index_; | 1087 int index_; |
| 1082 | 1088 |
| 1089 BailoutId try_entry_id_; |
| 1090 BailoutId try_exit_id_; |
| 1091 |
| 1083 Block* try_block_; | 1092 Block* try_block_; |
| 1084 ZoneList<Label*>* escaping_targets_; | 1093 ZoneList<Label*>* escaping_targets_; |
| 1085 }; | 1094 }; |
| 1086 | 1095 |
| 1087 | 1096 |
| 1088 class TryCatchStatement: public TryStatement { | 1097 class TryCatchStatement: public TryStatement { |
| 1089 public: | 1098 public: |
| 1090 DECLARE_NODE_TYPE(TryCatchStatement) | 1099 DECLARE_NODE_TYPE(TryCatchStatement) |
| 1091 | 1100 |
| 1092 Scope* scope() { return scope_; } | 1101 Scope* scope() { return scope_; } |
| 1093 Variable* variable() { return variable_; } | 1102 Variable* variable() { return variable_; } |
| 1094 Block* catch_block() const { return catch_block_; } | 1103 Block* catch_block() const { return catch_block_; } |
| 1095 | 1104 |
| 1096 protected: | 1105 protected: |
| 1097 TryCatchStatement(int index, | 1106 TryCatchStatement(Isolate* isolate, |
| 1107 int index, |
| 1098 Block* try_block, | 1108 Block* try_block, |
| 1099 Scope* scope, | 1109 Scope* scope, |
| 1100 Variable* variable, | 1110 Variable* variable, |
| 1101 Block* catch_block) | 1111 Block* catch_block) |
| 1102 : TryStatement(index, try_block), | 1112 : TryStatement(isolate, index, try_block), |
| 1103 scope_(scope), | 1113 scope_(scope), |
| 1104 variable_(variable), | 1114 variable_(variable), |
| 1105 catch_block_(catch_block) { | 1115 catch_block_(catch_block) { } |
| 1106 } | |
| 1107 | 1116 |
| 1108 private: | 1117 private: |
| 1109 Scope* scope_; | 1118 Scope* scope_; |
| 1110 Variable* variable_; | 1119 Variable* variable_; |
| 1111 Block* catch_block_; | 1120 Block* catch_block_; |
| 1112 }; | 1121 }; |
| 1113 | 1122 |
| 1114 | 1123 |
| 1115 class TryFinallyStatement: public TryStatement { | 1124 class TryFinallyStatement: public TryStatement { |
| 1116 public: | 1125 public: |
| 1117 DECLARE_NODE_TYPE(TryFinallyStatement) | 1126 DECLARE_NODE_TYPE(TryFinallyStatement) |
| 1118 | 1127 |
| 1119 Block* finally_block() const { return finally_block_; } | 1128 Block* finally_block() const { return finally_block_; } |
| 1120 | 1129 |
| 1121 protected: | 1130 protected: |
| 1122 TryFinallyStatement(int index, Block* try_block, Block* finally_block) | 1131 TryFinallyStatement(Isolate* isolate, |
| 1123 : TryStatement(index, try_block), | 1132 int index, |
| 1133 Block* try_block, |
| 1134 Block* finally_block) |
| 1135 : TryStatement(isolate, index, try_block), |
| 1124 finally_block_(finally_block) { } | 1136 finally_block_(finally_block) { } |
| 1125 | 1137 |
| 1126 private: | 1138 private: |
| 1127 Block* finally_block_; | 1139 Block* finally_block_; |
| 1128 }; | 1140 }; |
| 1129 | 1141 |
| 1130 | 1142 |
| 1131 class DebuggerStatement: public Statement { | 1143 class DebuggerStatement: public Statement { |
| 1132 public: | 1144 public: |
| 1133 DECLARE_NODE_TYPE(DebuggerStatement) | 1145 DECLARE_NODE_TYPE(DebuggerStatement) |
| (...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2686 } | 2698 } |
| 2687 | 2699 |
| 2688 IfStatement* NewIfStatement(Expression* condition, | 2700 IfStatement* NewIfStatement(Expression* condition, |
| 2689 Statement* then_statement, | 2701 Statement* then_statement, |
| 2690 Statement* else_statement) { | 2702 Statement* else_statement) { |
| 2691 IfStatement* stmt = new(zone_) IfStatement( | 2703 IfStatement* stmt = new(zone_) IfStatement( |
| 2692 isolate_, condition, then_statement, else_statement); | 2704 isolate_, condition, then_statement, else_statement); |
| 2693 VISIT_AND_RETURN(IfStatement, stmt) | 2705 VISIT_AND_RETURN(IfStatement, stmt) |
| 2694 } | 2706 } |
| 2695 | 2707 |
| 2696 TryCatchStatement* NewTryCatchStatement(int index, | 2708 TryCatchStatement* NewTryCatchStatement(Isolate* isolate, |
| 2709 int index, |
| 2697 Block* try_block, | 2710 Block* try_block, |
| 2698 Scope* scope, | 2711 Scope* scope, |
| 2699 Variable* variable, | 2712 Variable* variable, |
| 2700 Block* catch_block) { | 2713 Block* catch_block) { |
| 2701 TryCatchStatement* stmt = new(zone_) TryCatchStatement( | 2714 TryCatchStatement* stmt = new(zone_) TryCatchStatement( |
| 2702 index, try_block, scope, variable, catch_block); | 2715 isolate, index, try_block, scope, variable, catch_block); |
| 2703 VISIT_AND_RETURN(TryCatchStatement, stmt) | 2716 VISIT_AND_RETURN(TryCatchStatement, stmt) |
| 2704 } | 2717 } |
| 2705 | 2718 |
| 2706 TryFinallyStatement* NewTryFinallyStatement(int index, | 2719 TryFinallyStatement* NewTryFinallyStatement(Isolate* isolate, |
| 2720 int index, |
| 2707 Block* try_block, | 2721 Block* try_block, |
| 2708 Block* finally_block) { | 2722 Block* finally_block) { |
| 2709 TryFinallyStatement* stmt = | 2723 TryFinallyStatement* stmt = |
| 2710 new(zone_) TryFinallyStatement(index, try_block, finally_block); | 2724 new(zone_) TryFinallyStatement(isolate, index, try_block, |
| 2725 finally_block); |
| 2711 VISIT_AND_RETURN(TryFinallyStatement, stmt) | 2726 VISIT_AND_RETURN(TryFinallyStatement, stmt) |
| 2712 } | 2727 } |
| 2713 | 2728 |
| 2714 DebuggerStatement* NewDebuggerStatement() { | 2729 DebuggerStatement* NewDebuggerStatement() { |
| 2715 DebuggerStatement* stmt = new(zone_) DebuggerStatement(); | 2730 DebuggerStatement* stmt = new(zone_) DebuggerStatement(); |
| 2716 VISIT_AND_RETURN(DebuggerStatement, stmt) | 2731 VISIT_AND_RETURN(DebuggerStatement, stmt) |
| 2717 } | 2732 } |
| 2718 | 2733 |
| 2719 EmptyStatement* NewEmptyStatement() { | 2734 EmptyStatement* NewEmptyStatement() { |
| 2720 return new(zone_) EmptyStatement(); | 2735 return new(zone_) EmptyStatement(); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2915 private: | 2930 private: |
| 2916 Isolate* isolate_; | 2931 Isolate* isolate_; |
| 2917 Zone* zone_; | 2932 Zone* zone_; |
| 2918 Visitor visitor_; | 2933 Visitor visitor_; |
| 2919 }; | 2934 }; |
| 2920 | 2935 |
| 2921 | 2936 |
| 2922 } } // namespace v8::internal | 2937 } } // namespace v8::internal |
| 2923 | 2938 |
| 2924 #endif // V8_AST_H_ | 2939 #endif // V8_AST_H_ |
| OLD | NEW |