karlklose@chromium.org | 44bc708 | 2011-04-11 12:33:05 +0000 | [diff] [blame] | 1 | // Copyright 2011 the V8 project authors. All rights reserved. |
vegorov@chromium.org | dff694e | 2010-05-17 09:10:26 +0000 | [diff] [blame] | 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" |
fschneider@chromium.org | fb144a0 | 2011-05-04 12:43:48 +0000 | [diff] [blame] | 34 | #include "scopes.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 | |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 40 | SwitchStatement::SwitchStatement(Isolate* isolate, |
| 41 | ZoneStringList* labels) |
| 42 | : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS), |
vegorov@chromium.org | dff694e | 2010-05-17 09:10:26 +0000 | [diff] [blame] | 43 | tag_(NULL), cases_(NULL) { |
| 44 | } |
| 45 | |
| 46 | |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 47 | Block::Block(Isolate* isolate, |
| 48 | ZoneStringList* labels, |
| 49 | int capacity, |
| 50 | bool is_initializer_block) |
| 51 | : BreakableStatement(isolate, labels, TARGET_FOR_NAMED_ONLY), |
vegorov@chromium.org | dff694e | 2010-05-17 09:10:26 +0000 | [diff] [blame] | 52 | statements_(capacity), |
| 53 | is_initializer_block_(is_initializer_block) { |
| 54 | } |
| 55 | |
| 56 | |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 57 | BreakableStatement::BreakableStatement(Isolate* isolate, |
| 58 | ZoneStringList* labels, |
| 59 | Type type) |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 60 | : labels_(labels), |
| 61 | type_(type), |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 62 | entry_id_(GetNextId(isolate)), |
| 63 | exit_id_(GetNextId(isolate)) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 64 | ASSERT(labels == NULL || labels->length() > 0); |
| 65 | } |
| 66 | |
| 67 | |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 68 | IterationStatement::IterationStatement(Isolate* isolate, ZoneStringList* labels) |
| 69 | : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS), |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 70 | body_(NULL), |
karlklose@chromium.org | 44bc708 | 2011-04-11 12:33:05 +0000 | [diff] [blame] | 71 | continue_target_(), |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 72 | osr_entry_id_(GetNextId(isolate)) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 73 | } |
| 74 | |
| 75 | |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 76 | DoWhileStatement::DoWhileStatement(Isolate* isolate, ZoneStringList* labels) |
| 77 | : IterationStatement(isolate, labels), |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 78 | cond_(NULL), |
| 79 | condition_position_(-1), |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 80 | continue_id_(GetNextId(isolate)), |
| 81 | back_edge_id_(GetNextId(isolate)) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 82 | } |
| 83 | |
| 84 | |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 85 | WhileStatement::WhileStatement(Isolate* isolate, ZoneStringList* labels) |
| 86 | : IterationStatement(isolate, labels), |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 87 | cond_(NULL), |
ager@chromium.org | 5f0c45f | 2010-12-17 08:51:21 +0000 | [diff] [blame] | 88 | may_have_function_literal_(true), |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 89 | body_id_(GetNextId(isolate)) { |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 90 | } |
| 91 | |
| 92 | |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 93 | ForStatement::ForStatement(Isolate* isolate, ZoneStringList* labels) |
| 94 | : IterationStatement(isolate, labels), |
vegorov@chromium.org | dff694e | 2010-05-17 09:10:26 +0000 | [diff] [blame] | 95 | init_(NULL), |
| 96 | cond_(NULL), |
| 97 | next_(NULL), |
| 98 | may_have_function_literal_(true), |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 99 | loop_variable_(NULL), |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 100 | continue_id_(GetNextId(isolate)), |
| 101 | body_id_(GetNextId(isolate)) { |
vegorov@chromium.org | dff694e | 2010-05-17 09:10:26 +0000 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 105 | ForInStatement::ForInStatement(Isolate* isolate, ZoneStringList* labels) |
| 106 | : IterationStatement(isolate, labels), |
| 107 | each_(NULL), |
| 108 | enumerable_(NULL), |
| 109 | assignment_id_(GetNextId(isolate)) { |
vegorov@chromium.org | dff694e | 2010-05-17 09:10:26 +0000 | [diff] [blame] | 110 | } |
| 111 | |
| 112 | |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 113 | bool FunctionLiteral::strict_mode() const { |
| 114 | return scope()->is_strict_mode(); |
| 115 | } |
| 116 | |
| 117 | |
vegorov@chromium.org | dff694e | 2010-05-17 09:10:26 +0000 | [diff] [blame] | 118 | } } // namespace v8::internal |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 119 | |
| 120 | #endif // V8_AST_INL_H_ |