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