vegorov@chromium.org | dff694e | 2010-05-17 09:10:26 +0000 | [diff] [blame] | 1 | // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 | // Redistribution and use in source and binary forms, with or without |
| 3 | // modification, are permitted provided that the following conditions are |
| 4 | // met: |
| 5 | // |
| 6 | // * Redistributions of source code must retain the above copyright |
| 7 | // notice, this list of conditions and the following disclaimer. |
| 8 | // * Redistributions in binary form must reproduce the above |
| 9 | // copyright notice, this list of conditions and the following |
| 10 | // disclaimer in the documentation and/or other materials provided |
| 11 | // with the distribution. |
| 12 | // * Neither the name of Google Inc. nor the names of its |
| 13 | // contributors may be used to endorse or promote products derived |
| 14 | // from this software without specific prior written permission. |
| 15 | // |
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 28 | #ifndef V8_AST_INL_H_ |
| 29 | #define V8_AST_INL_H_ |
| 30 | |
vegorov@chromium.org | dff694e | 2010-05-17 09:10:26 +0000 | [diff] [blame] | 31 | #include "v8.h" |
| 32 | |
| 33 | #include "ast.h" |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 34 | #include "jump-target-inl.h" |
vegorov@chromium.org | dff694e | 2010-05-17 09:10:26 +0000 | [diff] [blame] | 35 | |
| 36 | namespace v8 { |
| 37 | namespace internal { |
| 38 | |
vegorov@chromium.org | dff694e | 2010-05-17 09:10:26 +0000 | [diff] [blame] | 39 | |
| 40 | SwitchStatement::SwitchStatement(ZoneStringList* labels) |
| 41 | : BreakableStatement(labels, TARGET_FOR_ANONYMOUS), |
| 42 | tag_(NULL), cases_(NULL) { |
| 43 | } |
| 44 | |
| 45 | |
vegorov@chromium.org | dff694e | 2010-05-17 09:10:26 +0000 | [diff] [blame] | 46 | Block::Block(ZoneStringList* labels, int capacity, bool is_initializer_block) |
| 47 | : BreakableStatement(labels, TARGET_FOR_NAMED_ONLY), |
| 48 | statements_(capacity), |
| 49 | is_initializer_block_(is_initializer_block) { |
| 50 | } |
| 51 | |
| 52 | |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 53 | BreakableStatement::BreakableStatement(ZoneStringList* labels, Type type) |
| 54 | : labels_(labels), |
| 55 | type_(type), |
| 56 | entry_id_(GetNextId()), |
| 57 | exit_id_(GetNextId()) { |
| 58 | ASSERT(labels == NULL || labels->length() > 0); |
| 59 | } |
| 60 | |
| 61 | |
| 62 | IterationStatement::IterationStatement(ZoneStringList* labels) |
| 63 | : BreakableStatement(labels, TARGET_FOR_ANONYMOUS), |
| 64 | body_(NULL), |
| 65 | continue_target_(JumpTarget::BIDIRECTIONAL), |
| 66 | osr_entry_id_(GetNextId()) { |
| 67 | } |
| 68 | |
| 69 | |
| 70 | DoWhileStatement::DoWhileStatement(ZoneStringList* labels) |
| 71 | : IterationStatement(labels), |
| 72 | cond_(NULL), |
| 73 | condition_position_(-1), |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 74 | continue_id_(GetNextId()), |
| 75 | back_edge_id_(GetNextId()) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 76 | } |
| 77 | |
| 78 | |
| 79 | WhileStatement::WhileStatement(ZoneStringList* labels) |
| 80 | : IterationStatement(labels), |
| 81 | cond_(NULL), |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 82 | may_have_function_literal_(true), |
| 83 | body_id_(GetNextId()) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 84 | } |
| 85 | |
| 86 | |
vegorov@chromium.org | dff694e | 2010-05-17 09:10:26 +0000 | [diff] [blame] | 87 | ForStatement::ForStatement(ZoneStringList* labels) |
| 88 | : IterationStatement(labels), |
| 89 | init_(NULL), |
| 90 | cond_(NULL), |
| 91 | next_(NULL), |
| 92 | may_have_function_literal_(true), |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 93 | loop_variable_(NULL), |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 94 | continue_id_(GetNextId()), |
| 95 | body_id_(GetNextId()) { |
vegorov@chromium.org | dff694e | 2010-05-17 09:10:26 +0000 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | |
| 99 | ForInStatement::ForInStatement(ZoneStringList* labels) |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 100 | : IterationStatement(labels), each_(NULL), enumerable_(NULL), |
| 101 | assignment_id_(GetNextId()) { |
vegorov@chromium.org | dff694e | 2010-05-17 09:10:26 +0000 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | |
vegorov@chromium.org | dff694e | 2010-05-17 09:10:26 +0000 | [diff] [blame] | 105 | } } // namespace v8::internal |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 106 | |
| 107 | #endif // V8_AST_INL_H_ |