| 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| 12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
| 13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
| 14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
| 15 // | 15 // |
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_AST_INL_H_ |
| 29 #define V8_AST_INL_H_ |
| 30 |
| 28 #include "v8.h" | 31 #include "v8.h" |
| 29 | 32 |
| 30 #include "ast.h" | 33 #include "ast.h" |
| 34 #include "jump-target-inl.h" |
| 31 | 35 |
| 32 namespace v8 { | 36 namespace v8 { |
| 33 namespace internal { | 37 namespace internal { |
| 34 | 38 |
| 35 BreakableStatement::BreakableStatement(ZoneStringList* labels, Type type) | |
| 36 : labels_(labels), type_(type) { | |
| 37 ASSERT(labels == NULL || labels->length() > 0); | |
| 38 } | |
| 39 | |
| 40 | 39 |
| 41 SwitchStatement::SwitchStatement(ZoneStringList* labels) | 40 SwitchStatement::SwitchStatement(ZoneStringList* labels) |
| 42 : BreakableStatement(labels, TARGET_FOR_ANONYMOUS), | 41 : BreakableStatement(labels, TARGET_FOR_ANONYMOUS), |
| 43 tag_(NULL), cases_(NULL) { | 42 tag_(NULL), cases_(NULL) { |
| 44 } | 43 } |
| 45 | 44 |
| 46 | 45 |
| 47 IterationStatement::IterationStatement(ZoneStringList* labels) | |
| 48 : BreakableStatement(labels, TARGET_FOR_ANONYMOUS), | |
| 49 body_(NULL), | |
| 50 continue_target_(JumpTarget::BIDIRECTIONAL) { | |
| 51 } | |
| 52 | |
| 53 | |
| 54 Block::Block(ZoneStringList* labels, int capacity, bool is_initializer_block) | 46 Block::Block(ZoneStringList* labels, int capacity, bool is_initializer_block) |
| 55 : BreakableStatement(labels, TARGET_FOR_NAMED_ONLY), | 47 : BreakableStatement(labels, TARGET_FOR_NAMED_ONLY), |
| 56 statements_(capacity), | 48 statements_(capacity), |
| 57 is_initializer_block_(is_initializer_block) { | 49 is_initializer_block_(is_initializer_block) { |
| 58 } | 50 } |
| 59 | 51 |
| 60 | 52 |
| 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), |
| 74 next_id_(GetNextId()) { |
| 75 } |
| 76 |
| 77 |
| 78 WhileStatement::WhileStatement(ZoneStringList* labels) |
| 79 : IterationStatement(labels), |
| 80 cond_(NULL), |
| 81 may_have_function_literal_(true) { |
| 82 } |
| 83 |
| 84 |
| 61 ForStatement::ForStatement(ZoneStringList* labels) | 85 ForStatement::ForStatement(ZoneStringList* labels) |
| 62 : IterationStatement(labels), | 86 : IterationStatement(labels), |
| 63 init_(NULL), | 87 init_(NULL), |
| 64 cond_(NULL), | 88 cond_(NULL), |
| 65 next_(NULL), | 89 next_(NULL), |
| 66 may_have_function_literal_(true), | 90 may_have_function_literal_(true), |
| 67 loop_variable_(NULL) { | 91 loop_variable_(NULL), |
| 92 next_id_(GetNextId()) { |
| 68 } | 93 } |
| 69 | 94 |
| 70 | 95 |
| 71 ForInStatement::ForInStatement(ZoneStringList* labels) | 96 ForInStatement::ForInStatement(ZoneStringList* labels) |
| 72 : IterationStatement(labels), each_(NULL), enumerable_(NULL) { | 97 : IterationStatement(labels), each_(NULL), enumerable_(NULL) { |
| 73 } | 98 } |
| 74 | 99 |
| 75 | 100 |
| 76 DoWhileStatement::DoWhileStatement(ZoneStringList* labels) | 101 } } // namespace v8::internal |
| 77 : IterationStatement(labels), cond_(NULL), condition_position_(-1) { | |
| 78 } | |
| 79 | 102 |
| 80 } } // namespace v8::internal | 103 #endif // V8_AST_INL_H_ |
| OLD | NEW |