OLD | NEW |
(Empty) | |
| 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 |
| 28 #include "v8.h" |
| 29 |
| 30 #include "data-flow.h" |
| 31 |
| 32 namespace v8 { |
| 33 namespace internal { |
| 34 |
| 35 |
| 36 void AstLabeler::Label(FunctionLiteral* fun) { |
| 37 VisitStatements(fun->body()); |
| 38 } |
| 39 |
| 40 |
| 41 void AstLabeler::VisitStatements(ZoneList<Statement*>* stmts) { |
| 42 for (int i = 0, len = stmts->length(); i < len; i++) { |
| 43 Visit(stmts->at(i)); |
| 44 } |
| 45 } |
| 46 |
| 47 |
| 48 void AstLabeler::VisitDeclarations(ZoneList<Declaration*>* decls) { |
| 49 UNREACHABLE(); |
| 50 } |
| 51 |
| 52 |
| 53 void AstLabeler::VisitBlock(Block* stmt) { |
| 54 VisitStatements(stmt->statements()); |
| 55 } |
| 56 |
| 57 |
| 58 void AstLabeler::VisitExpressionStatement( |
| 59 ExpressionStatement* stmt) { |
| 60 Visit(stmt->expression()); |
| 61 } |
| 62 |
| 63 |
| 64 void AstLabeler::VisitEmptyStatement(EmptyStatement* stmt) { |
| 65 // Do nothing. |
| 66 } |
| 67 |
| 68 |
| 69 void AstLabeler::VisitIfStatement(IfStatement* stmt) { |
| 70 UNREACHABLE(); |
| 71 } |
| 72 |
| 73 |
| 74 void AstLabeler::VisitContinueStatement(ContinueStatement* stmt) { |
| 75 UNREACHABLE(); |
| 76 } |
| 77 |
| 78 |
| 79 void AstLabeler::VisitBreakStatement(BreakStatement* stmt) { |
| 80 UNREACHABLE(); |
| 81 } |
| 82 |
| 83 |
| 84 void AstLabeler::VisitReturnStatement(ReturnStatement* stmt) { |
| 85 UNREACHABLE(); |
| 86 } |
| 87 |
| 88 |
| 89 void AstLabeler::VisitWithEnterStatement( |
| 90 WithEnterStatement* stmt) { |
| 91 UNREACHABLE(); |
| 92 } |
| 93 |
| 94 |
| 95 void AstLabeler::VisitWithExitStatement(WithExitStatement* stmt) { |
| 96 UNREACHABLE(); |
| 97 } |
| 98 |
| 99 |
| 100 void AstLabeler::VisitSwitchStatement(SwitchStatement* stmt) { |
| 101 UNREACHABLE(); |
| 102 } |
| 103 |
| 104 |
| 105 void AstLabeler::VisitDoWhileStatement(DoWhileStatement* stmt) { |
| 106 UNREACHABLE(); |
| 107 } |
| 108 |
| 109 |
| 110 void AstLabeler::VisitWhileStatement(WhileStatement* stmt) { |
| 111 UNREACHABLE(); |
| 112 } |
| 113 |
| 114 |
| 115 void AstLabeler::VisitForStatement(ForStatement* stmt) { |
| 116 UNREACHABLE(); |
| 117 } |
| 118 |
| 119 |
| 120 void AstLabeler::VisitForInStatement(ForInStatement* stmt) { |
| 121 UNREACHABLE(); |
| 122 } |
| 123 |
| 124 |
| 125 void AstLabeler::VisitTryCatchStatement(TryCatchStatement* stmt) { |
| 126 UNREACHABLE(); |
| 127 } |
| 128 |
| 129 |
| 130 void AstLabeler::VisitTryFinallyStatement( |
| 131 TryFinallyStatement* stmt) { |
| 132 UNREACHABLE(); |
| 133 } |
| 134 |
| 135 |
| 136 void AstLabeler::VisitDebuggerStatement( |
| 137 DebuggerStatement* stmt) { |
| 138 UNREACHABLE(); |
| 139 } |
| 140 |
| 141 |
| 142 void AstLabeler::VisitFunctionLiteral(FunctionLiteral* expr) { |
| 143 UNREACHABLE(); |
| 144 } |
| 145 |
| 146 |
| 147 void AstLabeler::VisitFunctionBoilerplateLiteral( |
| 148 FunctionBoilerplateLiteral* expr) { |
| 149 UNREACHABLE(); |
| 150 } |
| 151 |
| 152 |
| 153 void AstLabeler::VisitConditional(Conditional* expr) { |
| 154 UNREACHABLE(); |
| 155 } |
| 156 |
| 157 |
| 158 void AstLabeler::VisitSlot(Slot* expr) { |
| 159 UNREACHABLE(); |
| 160 } |
| 161 |
| 162 |
| 163 void AstLabeler::VisitVariableProxy(VariableProxy* expr) { |
| 164 expr->set_num(next_number_++); |
| 165 } |
| 166 |
| 167 |
| 168 void AstLabeler::VisitLiteral(Literal* expr) { |
| 169 UNREACHABLE(); |
| 170 } |
| 171 |
| 172 |
| 173 void AstLabeler::VisitRegExpLiteral(RegExpLiteral* expr) { |
| 174 UNREACHABLE(); |
| 175 } |
| 176 |
| 177 |
| 178 void AstLabeler::VisitObjectLiteral(ObjectLiteral* expr) { |
| 179 UNREACHABLE(); |
| 180 } |
| 181 |
| 182 |
| 183 void AstLabeler::VisitArrayLiteral(ArrayLiteral* expr) { |
| 184 UNREACHABLE(); |
| 185 } |
| 186 |
| 187 |
| 188 void AstLabeler::VisitCatchExtensionObject( |
| 189 CatchExtensionObject* expr) { |
| 190 UNREACHABLE(); |
| 191 } |
| 192 |
| 193 |
| 194 void AstLabeler::VisitAssignment(Assignment* expr) { |
| 195 Property* prop = expr->target()->AsProperty(); |
| 196 ASSERT(prop != NULL); |
| 197 if (prop != NULL) { |
| 198 ASSERT(prop->key()->IsPropertyName()); |
| 199 if (prop->obj()->AsVariableProxy() == NULL || |
| 200 !prop->obj()->AsVariableProxy()->var()->is_this()) |
| 201 Visit(prop->obj()); |
| 202 } |
| 203 Visit(expr->value()); |
| 204 expr->set_num(next_number_++); |
| 205 } |
| 206 |
| 207 |
| 208 void AstLabeler::VisitThrow(Throw* expr) { |
| 209 UNREACHABLE(); |
| 210 } |
| 211 |
| 212 |
| 213 void AstLabeler::VisitProperty(Property* expr) { |
| 214 UNREACHABLE(); |
| 215 } |
| 216 |
| 217 |
| 218 void AstLabeler::VisitCall(Call* expr) { |
| 219 UNREACHABLE(); |
| 220 } |
| 221 |
| 222 |
| 223 void AstLabeler::VisitCallNew(CallNew* expr) { |
| 224 UNREACHABLE(); |
| 225 } |
| 226 |
| 227 |
| 228 void AstLabeler::VisitCallRuntime(CallRuntime* expr) { |
| 229 UNREACHABLE(); |
| 230 } |
| 231 |
| 232 |
| 233 void AstLabeler::VisitUnaryOperation(UnaryOperation* expr) { |
| 234 UNREACHABLE(); |
| 235 } |
| 236 |
| 237 |
| 238 void AstLabeler::VisitCountOperation(CountOperation* expr) { |
| 239 UNREACHABLE(); |
| 240 } |
| 241 |
| 242 |
| 243 void AstLabeler::VisitBinaryOperation(BinaryOperation* expr) { |
| 244 Visit(expr->left()); |
| 245 Visit(expr->right()); |
| 246 expr->set_num(next_number_++); |
| 247 } |
| 248 |
| 249 |
| 250 void AstLabeler::VisitCompareOperation(CompareOperation* expr) { |
| 251 UNREACHABLE(); |
| 252 } |
| 253 |
| 254 |
| 255 void AstLabeler::VisitThisFunction(ThisFunction* expr) { |
| 256 UNREACHABLE(); |
| 257 } |
| 258 |
| 259 |
| 260 void AstLabeler::VisitDeclaration(Declaration* decl) { |
| 261 UNREACHABLE(); |
| 262 } |
| 263 |
| 264 } } // namespace v8::internal |
OLD | NEW |