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