Chromium Code Reviews| OLD | NEW | 
|---|---|
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 Statement* body_; | 284 Statement* body_; | 
| 285 BreakTarget continue_target_; | 285 BreakTarget continue_target_; | 
| 286 }; | 286 }; | 
| 287 | 287 | 
| 288 | 288 | 
| 289 class LoopStatement: public IterationStatement { | 289 class LoopStatement: public IterationStatement { | 
| 290 public: | 290 public: | 
| 291 enum Type { DO_LOOP, FOR_LOOP, WHILE_LOOP }; | 291 enum Type { DO_LOOP, FOR_LOOP, WHILE_LOOP }; | 
| 292 | 292 | 
| 293 LoopStatement(ZoneStringList* labels, Type type) | 293 LoopStatement(ZoneStringList* labels, Type type) | 
| 294 : IterationStatement(labels), type_(type), init_(NULL), | 294 : IterationStatement(labels), | 
| 295 cond_(NULL), next_(NULL) { } | 295 type_(type), | 
| 296 init_(NULL), | |
| 297 cond_(NULL), | |
| 298 next_(NULL), | |
| 299 has_function_literal_(false) { | |
| 300 } | |
| 296 | 301 | 
| 297 void Initialize(Statement* init, | 302 void Initialize(Statement* init, | 
| 298 Expression* cond, | 303 Expression* cond, | 
| 299 Statement* next, | 304 Statement* next, | 
| 300 Statement* body) { | 305 Statement* body) { | 
| 301 ASSERT(init == NULL || type_ == FOR_LOOP); | 306 ASSERT(init == NULL || type_ == FOR_LOOP); | 
| 302 ASSERT(next == NULL || type_ == FOR_LOOP); | 307 ASSERT(next == NULL || type_ == FOR_LOOP); | 
| 303 IterationStatement::Initialize(body); | 308 IterationStatement::Initialize(body); | 
| 304 init_ = init; | 309 init_ = init; | 
| 305 cond_ = cond; | 310 cond_ = cond; | 
| 306 next_ = next; | 311 next_ = next; | 
| 307 } | 312 } | 
| 308 | 313 | 
| 309 virtual void Accept(AstVisitor* v); | 314 virtual void Accept(AstVisitor* v); | 
| 310 | 315 | 
| 311 Type type() const { return type_; } | 316 Type type() const { return type_; } | 
| 312 Statement* init() const { return init_; } | 317 Statement* init() const { return init_; } | 
| 313 Expression* cond() const { return cond_; } | 318 Expression* cond() const { return cond_; } | 
| 314 Statement* next() const { return next_; } | 319 Statement* next() const { return next_; } | 
| 320 bool has_function_literal() const { return has_function_literal_; } | |
| 315 | 321 | 
| 316 #ifdef DEBUG | 322 #ifdef DEBUG | 
| 317 const char* OperatorString() const; | 323 const char* OperatorString() const; | 
| 318 #endif | 324 #endif | 
| 319 | 325 | 
| 320 private: | 326 private: | 
| 321 Type type_; | 327 Type type_; | 
| 322 Statement* init_; | 328 Statement* init_; | 
| 323 Expression* cond_; | 329 Expression* cond_; | 
| 324 Statement* next_; | 330 Statement* next_; | 
| 331 bool has_function_literal_; | |
| 
 
Kasper Lund
2009/03/12 15:40:30
Maybe add a comment here that this is a function l
 
Kevin Millikin (Chromium)
2009/03/12 15:42:44
Done.
 
 | |
| 332 | |
| 333 friend class AstOptimizer; | |
| 325 }; | 334 }; | 
| 326 | 335 | 
| 327 | 336 | 
| 328 class ForInStatement: public IterationStatement { | 337 class ForInStatement: public IterationStatement { | 
| 329 public: | 338 public: | 
| 330 explicit ForInStatement(ZoneStringList* labels) | 339 explicit ForInStatement(ZoneStringList* labels) | 
| 331 : IterationStatement(labels), each_(NULL), enumerable_(NULL) { } | 340 : IterationStatement(labels), each_(NULL), enumerable_(NULL) { } | 
| 332 | 341 | 
| 333 void Initialize(Expression* each, Expression* enumerable, Statement* body) { | 342 void Initialize(Expression* each, Expression* enumerable, Statement* body) { | 
| 334 IterationStatement::Initialize(body); | 343 IterationStatement::Initialize(body); | 
| (...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1677 #undef DEF_VISIT | 1686 #undef DEF_VISIT | 
| 1678 | 1687 | 
| 1679 private: | 1688 private: | 
| 1680 bool stack_overflow_; | 1689 bool stack_overflow_; | 
| 1681 }; | 1690 }; | 
| 1682 | 1691 | 
| 1683 | 1692 | 
| 1684 } } // namespace v8::internal | 1693 } } // namespace v8::internal | 
| 1685 | 1694 | 
| 1686 #endif // V8_AST_H_ | 1695 #endif // V8_AST_H_ | 
| OLD | NEW |