| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 167 |
| 168 #define DECLARE_NODE_TYPE(type) \ | 168 #define DECLARE_NODE_TYPE(type) \ |
| 169 virtual void Accept(AstVisitor* v); \ | 169 virtual void Accept(AstVisitor* v); \ |
| 170 virtual AstNode::NodeType node_type() const { return AstNode::k##type; } \ | 170 virtual AstNode::NodeType node_type() const { return AstNode::k##type; } \ |
| 171 template<class> friend class AstNodeFactory; | 171 template<class> friend class AstNodeFactory; |
| 172 | 172 |
| 173 | 173 |
| 174 enum AstPropertiesFlag { | 174 enum AstPropertiesFlag { |
| 175 kDontInline, | 175 kDontInline, |
| 176 kDontOptimize, | 176 kDontOptimize, |
| 177 kDontOsr, |
| 177 kDontSelfOptimize, | 178 kDontSelfOptimize, |
| 178 kDontSoftInline, | 179 kDontSoftInline, |
| 179 kDontCache | 180 kDontCache |
| 180 }; | 181 }; |
| 181 | 182 |
| 182 | 183 |
| 183 class AstProperties BASE_EMBEDDED { | 184 class AstProperties BASE_EMBEDDED { |
| 184 public: | 185 public: |
| 185 class Flags : public EnumSet<AstPropertiesFlag, int> {}; | 186 class Flags : public EnumSet<AstPropertiesFlag, int> {}; |
| 186 | 187 |
| (...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1224 class TryStatement: public Statement { | 1225 class TryStatement: public Statement { |
| 1225 public: | 1226 public: |
| 1226 void set_escaping_targets(ZoneList<Label*>* targets) { | 1227 void set_escaping_targets(ZoneList<Label*>* targets) { |
| 1227 escaping_targets_ = targets; | 1228 escaping_targets_ = targets; |
| 1228 } | 1229 } |
| 1229 | 1230 |
| 1230 int index() const { return index_; } | 1231 int index() const { return index_; } |
| 1231 Block* try_block() const { return try_block_; } | 1232 Block* try_block() const { return try_block_; } |
| 1232 ZoneList<Label*>* escaping_targets() const { return escaping_targets_; } | 1233 ZoneList<Label*>* escaping_targets() const { return escaping_targets_; } |
| 1233 | 1234 |
| 1235 BailoutId TryEntryId() const { return try_entry_id_; } |
| 1236 BailoutId TryExitId() const { return try_exit_id_; } |
| 1237 |
| 1234 protected: | 1238 protected: |
| 1235 TryStatement(int index, Block* try_block) | 1239 TryStatement(Isolate* isolate, int index, Block* try_block) |
| 1236 : index_(index), | 1240 : index_(index), |
| 1241 try_entry_id_(GetNextId(isolate)), |
| 1242 try_exit_id_(GetNextId(isolate)), |
| 1237 try_block_(try_block), | 1243 try_block_(try_block), |
| 1238 escaping_targets_(NULL) { } | 1244 escaping_targets_(NULL) { } |
| 1239 | 1245 |
| 1240 private: | 1246 private: |
| 1241 // Unique (per-function) index of this handler. This is not an AST ID. | 1247 // Unique (per-function) index of this handler. This is not an AST ID. |
| 1242 int index_; | 1248 int index_; |
| 1243 | 1249 |
| 1250 BailoutId try_entry_id_; |
| 1251 BailoutId try_exit_id_; |
| 1252 |
| 1244 Block* try_block_; | 1253 Block* try_block_; |
| 1245 ZoneList<Label*>* escaping_targets_; | 1254 ZoneList<Label*>* escaping_targets_; |
| 1246 }; | 1255 }; |
| 1247 | 1256 |
| 1248 | 1257 |
| 1249 class TryCatchStatement: public TryStatement { | 1258 class TryCatchStatement: public TryStatement { |
| 1250 public: | 1259 public: |
| 1251 DECLARE_NODE_TYPE(TryCatchStatement) | 1260 DECLARE_NODE_TYPE(TryCatchStatement) |
| 1252 | 1261 |
| 1253 Scope* scope() { return scope_; } | 1262 Scope* scope() { return scope_; } |
| 1254 Variable* variable() { return variable_; } | 1263 Variable* variable() { return variable_; } |
| 1255 Block* catch_block() const { return catch_block_; } | 1264 Block* catch_block() const { return catch_block_; } |
| 1256 | 1265 |
| 1257 protected: | 1266 protected: |
| 1258 TryCatchStatement(int index, | 1267 TryCatchStatement(Isolate* isolate, |
| 1268 int index, |
| 1259 Block* try_block, | 1269 Block* try_block, |
| 1260 Scope* scope, | 1270 Scope* scope, |
| 1261 Variable* variable, | 1271 Variable* variable, |
| 1262 Block* catch_block) | 1272 Block* catch_block) |
| 1263 : TryStatement(index, try_block), | 1273 : TryStatement(isolate, index, try_block), |
| 1264 scope_(scope), | 1274 scope_(scope), |
| 1265 variable_(variable), | 1275 variable_(variable), |
| 1266 catch_block_(catch_block) { | 1276 catch_block_(catch_block) { } |
| 1267 } | |
| 1268 | 1277 |
| 1269 private: | 1278 private: |
| 1270 Scope* scope_; | 1279 Scope* scope_; |
| 1271 Variable* variable_; | 1280 Variable* variable_; |
| 1272 Block* catch_block_; | 1281 Block* catch_block_; |
| 1273 }; | 1282 }; |
| 1274 | 1283 |
| 1275 | 1284 |
| 1276 class TryFinallyStatement: public TryStatement { | 1285 class TryFinallyStatement: public TryStatement { |
| 1277 public: | 1286 public: |
| 1278 DECLARE_NODE_TYPE(TryFinallyStatement) | 1287 DECLARE_NODE_TYPE(TryFinallyStatement) |
| 1279 | 1288 |
| 1280 Block* finally_block() const { return finally_block_; } | 1289 Block* finally_block() const { return finally_block_; } |
| 1281 | 1290 |
| 1282 protected: | 1291 protected: |
| 1283 TryFinallyStatement(int index, Block* try_block, Block* finally_block) | 1292 TryFinallyStatement(Isolate* isolate, |
| 1284 : TryStatement(index, try_block), | 1293 int index, |
| 1294 Block* try_block, |
| 1295 Block* finally_block) |
| 1296 : TryStatement(isolate, index, try_block), |
| 1285 finally_block_(finally_block) { } | 1297 finally_block_(finally_block) { } |
| 1286 | 1298 |
| 1287 private: | 1299 private: |
| 1288 Block* finally_block_; | 1300 Block* finally_block_; |
| 1289 }; | 1301 }; |
| 1290 | 1302 |
| 1291 | 1303 |
| 1292 class DebuggerStatement: public Statement { | 1304 class DebuggerStatement: public Statement { |
| 1293 public: | 1305 public: |
| 1294 DECLARE_NODE_TYPE(DebuggerStatement) | 1306 DECLARE_NODE_TYPE(DebuggerStatement) |
| (...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2971 } | 2983 } |
| 2972 | 2984 |
| 2973 IfStatement* NewIfStatement(Expression* condition, | 2985 IfStatement* NewIfStatement(Expression* condition, |
| 2974 Statement* then_statement, | 2986 Statement* then_statement, |
| 2975 Statement* else_statement) { | 2987 Statement* else_statement) { |
| 2976 IfStatement* stmt = new(zone_) IfStatement( | 2988 IfStatement* stmt = new(zone_) IfStatement( |
| 2977 isolate_, condition, then_statement, else_statement); | 2989 isolate_, condition, then_statement, else_statement); |
| 2978 VISIT_AND_RETURN(IfStatement, stmt) | 2990 VISIT_AND_RETURN(IfStatement, stmt) |
| 2979 } | 2991 } |
| 2980 | 2992 |
| 2981 TryCatchStatement* NewTryCatchStatement(int index, | 2993 TryCatchStatement* NewTryCatchStatement(Isolate* isolate, |
| 2994 int index, |
| 2982 Block* try_block, | 2995 Block* try_block, |
| 2983 Scope* scope, | 2996 Scope* scope, |
| 2984 Variable* variable, | 2997 Variable* variable, |
| 2985 Block* catch_block) { | 2998 Block* catch_block) { |
| 2986 TryCatchStatement* stmt = new(zone_) TryCatchStatement( | 2999 TryCatchStatement* stmt = new(zone_) TryCatchStatement( |
| 2987 index, try_block, scope, variable, catch_block); | 3000 isolate, index, try_block, scope, variable, catch_block); |
| 2988 VISIT_AND_RETURN(TryCatchStatement, stmt) | 3001 VISIT_AND_RETURN(TryCatchStatement, stmt) |
| 2989 } | 3002 } |
| 2990 | 3003 |
| 2991 TryFinallyStatement* NewTryFinallyStatement(int index, | 3004 TryFinallyStatement* NewTryFinallyStatement(Isolate* isolate, |
| 3005 int index, |
| 2992 Block* try_block, | 3006 Block* try_block, |
| 2993 Block* finally_block) { | 3007 Block* finally_block) { |
| 2994 TryFinallyStatement* stmt = | 3008 TryFinallyStatement* stmt = |
| 2995 new(zone_) TryFinallyStatement(index, try_block, finally_block); | 3009 new(zone_) TryFinallyStatement(isolate, index, try_block, |
| 3010 finally_block); |
| 2996 VISIT_AND_RETURN(TryFinallyStatement, stmt) | 3011 VISIT_AND_RETURN(TryFinallyStatement, stmt) |
| 2997 } | 3012 } |
| 2998 | 3013 |
| 2999 DebuggerStatement* NewDebuggerStatement() { | 3014 DebuggerStatement* NewDebuggerStatement() { |
| 3000 DebuggerStatement* stmt = new(zone_) DebuggerStatement(); | 3015 DebuggerStatement* stmt = new(zone_) DebuggerStatement(); |
| 3001 VISIT_AND_RETURN(DebuggerStatement, stmt) | 3016 VISIT_AND_RETURN(DebuggerStatement, stmt) |
| 3002 } | 3017 } |
| 3003 | 3018 |
| 3004 EmptyStatement* NewEmptyStatement() { | 3019 EmptyStatement* NewEmptyStatement() { |
| 3005 return new(zone_) EmptyStatement(); | 3020 return new(zone_) EmptyStatement(); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3208 private: | 3223 private: |
| 3209 Isolate* isolate_; | 3224 Isolate* isolate_; |
| 3210 Zone* zone_; | 3225 Zone* zone_; |
| 3211 Visitor visitor_; | 3226 Visitor visitor_; |
| 3212 }; | 3227 }; |
| 3213 | 3228 |
| 3214 | 3229 |
| 3215 } } // namespace v8::internal | 3230 } } // namespace v8::internal |
| 3216 | 3231 |
| 3217 #endif // V8_AST_H_ | 3232 #endif // V8_AST_H_ |
| OLD | NEW |