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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 FunctionLiteral* fun_; | 428 FunctionLiteral* fun_; |
429 }; | 429 }; |
430 | 430 |
431 | 431 |
432 class IterationStatement: public BreakableStatement { | 432 class IterationStatement: public BreakableStatement { |
433 public: | 433 public: |
434 // Type testing & conversion. | 434 // Type testing & conversion. |
435 virtual IterationStatement* AsIterationStatement() { return this; } | 435 virtual IterationStatement* AsIterationStatement() { return this; } |
436 | 436 |
437 Statement* body() const { return body_; } | 437 Statement* body() const { return body_; } |
| 438 void set_body(Statement* stmt) { body_ = stmt; } |
438 | 439 |
439 // Bailout support. | 440 // Bailout support. |
440 int OsrEntryId() const { return osr_entry_id_; } | 441 int OsrEntryId() const { return osr_entry_id_; } |
441 virtual int ContinueId() const = 0; | 442 virtual int ContinueId() const = 0; |
442 | 443 |
443 // Code generation | 444 // Code generation |
444 BreakTarget* continue_target() { return &continue_target_; } | 445 BreakTarget* continue_target() { return &continue_target_; } |
445 | 446 |
446 protected: | 447 protected: |
447 explicit inline IterationStatement(ZoneStringList* labels); | 448 explicit inline IterationStatement(ZoneStringList* labels); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 Expression* cond, | 525 Expression* cond, |
525 Statement* next, | 526 Statement* next, |
526 Statement* body) { | 527 Statement* body) { |
527 IterationStatement::Initialize(body); | 528 IterationStatement::Initialize(body); |
528 init_ = init; | 529 init_ = init; |
529 cond_ = cond; | 530 cond_ = cond; |
530 next_ = next; | 531 next_ = next; |
531 } | 532 } |
532 | 533 |
533 Statement* init() const { return init_; } | 534 Statement* init() const { return init_; } |
| 535 void set_init(Statement* stmt) { init_ = stmt; } |
534 Expression* cond() const { return cond_; } | 536 Expression* cond() const { return cond_; } |
| 537 void set_cond(Expression* expr) { cond_ = expr; } |
535 Statement* next() const { return next_; } | 538 Statement* next() const { return next_; } |
| 539 void set_next(Statement* stmt) { next_ = stmt; } |
536 | 540 |
537 bool may_have_function_literal() const { | 541 bool may_have_function_literal() const { |
538 return may_have_function_literal_; | 542 return may_have_function_literal_; |
539 } | 543 } |
540 void set_may_have_function_literal(bool value) { | 544 void set_may_have_function_literal(bool value) { |
541 may_have_function_literal_ = value; | 545 may_have_function_literal_ = value; |
542 } | 546 } |
543 | 547 |
544 // Bailout support. | 548 // Bailout support. |
545 virtual int ContinueId() const { return next_id_; } | 549 virtual int ContinueId() const { return next_id_; } |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 | 741 |
738 DECLARE_NODE_TYPE(IfStatement) | 742 DECLARE_NODE_TYPE(IfStatement) |
739 | 743 |
740 virtual bool IsInlineable() const; | 744 virtual bool IsInlineable() const; |
741 | 745 |
742 bool HasThenStatement() const { return !then_statement()->IsEmpty(); } | 746 bool HasThenStatement() const { return !then_statement()->IsEmpty(); } |
743 bool HasElseStatement() const { return !else_statement()->IsEmpty(); } | 747 bool HasElseStatement() const { return !else_statement()->IsEmpty(); } |
744 | 748 |
745 Expression* condition() const { return condition_; } | 749 Expression* condition() const { return condition_; } |
746 Statement* then_statement() const { return then_statement_; } | 750 Statement* then_statement() const { return then_statement_; } |
| 751 void set_then_statement(Statement* stmt) { then_statement_ = stmt; } |
747 Statement* else_statement() const { return else_statement_; } | 752 Statement* else_statement() const { return else_statement_; } |
| 753 void set_else_statement(Statement* stmt) { else_statement_ = stmt; } |
748 | 754 |
749 private: | 755 private: |
750 Expression* condition_; | 756 Expression* condition_; |
751 Statement* then_statement_; | 757 Statement* then_statement_; |
752 Statement* else_statement_; | 758 Statement* else_statement_; |
753 }; | 759 }; |
754 | 760 |
755 | 761 |
756 // NOTE: TargetCollectors are represented as nodes to fit in the target | 762 // NOTE: TargetCollectors are represented as nodes to fit in the target |
757 // stack in the compiler; this should probably be reworked. | 763 // stack in the compiler; this should probably be reworked. |
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2119 AST_NODE_LIST(DEF_VISIT) | 2125 AST_NODE_LIST(DEF_VISIT) |
2120 #undef DEF_VISIT | 2126 #undef DEF_VISIT |
2121 | 2127 |
2122 private: | 2128 private: |
2123 bool stack_overflow_; | 2129 bool stack_overflow_; |
2124 }; | 2130 }; |
2125 | 2131 |
2126 } } // namespace v8::internal | 2132 } } // namespace v8::internal |
2127 | 2133 |
2128 #endif // V8_AST_H_ | 2134 #endif // V8_AST_H_ |
OLD | NEW |