| 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 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 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 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #include "data-flow.h" | 30 #include "data-flow.h" |
| 31 | 31 |
| 32 namespace v8 { | 32 namespace v8 { |
| 33 namespace internal { | 33 namespace internal { |
| 34 | 34 |
| 35 | 35 |
| 36 void AstLabeler::Label(FunctionLiteral* fun) { | 36 void AstLabeler::Label(CompilationInfo* info) { |
| 37 VisitStatements(fun->body()); | 37 info_ = info; |
| 38 VisitStatements(info_->function()->body()); |
| 38 } | 39 } |
| 39 | 40 |
| 40 | 41 |
| 41 void AstLabeler::VisitStatements(ZoneList<Statement*>* stmts) { | 42 void AstLabeler::VisitStatements(ZoneList<Statement*>* stmts) { |
| 42 for (int i = 0, len = stmts->length(); i < len; i++) { | 43 for (int i = 0, len = stmts->length(); i < len; i++) { |
| 43 Visit(stmts->at(i)); | 44 Visit(stmts->at(i)); |
| 44 } | 45 } |
| 45 } | 46 } |
| 46 | 47 |
| 47 | 48 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 } | 156 } |
| 156 | 157 |
| 157 | 158 |
| 158 void AstLabeler::VisitSlot(Slot* expr) { | 159 void AstLabeler::VisitSlot(Slot* expr) { |
| 159 UNREACHABLE(); | 160 UNREACHABLE(); |
| 160 } | 161 } |
| 161 | 162 |
| 162 | 163 |
| 163 void AstLabeler::VisitVariableProxy(VariableProxy* expr) { | 164 void AstLabeler::VisitVariableProxy(VariableProxy* expr) { |
| 164 expr->set_num(next_number_++); | 165 expr->set_num(next_number_++); |
| 166 Variable* var = expr->var(); |
| 167 if (var->is_global() && !var->is_this()) { |
| 168 info_->set_has_globals(true); |
| 169 } |
| 165 } | 170 } |
| 166 | 171 |
| 167 | 172 |
| 168 void AstLabeler::VisitLiteral(Literal* expr) { | 173 void AstLabeler::VisitLiteral(Literal* expr) { |
| 169 UNREACHABLE(); | 174 UNREACHABLE(); |
| 170 } | 175 } |
| 171 | 176 |
| 172 | 177 |
| 173 void AstLabeler::VisitRegExpLiteral(RegExpLiteral* expr) { | 178 void AstLabeler::VisitRegExpLiteral(RegExpLiteral* expr) { |
| 174 UNREACHABLE(); | 179 UNREACHABLE(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 191 } | 196 } |
| 192 | 197 |
| 193 | 198 |
| 194 void AstLabeler::VisitAssignment(Assignment* expr) { | 199 void AstLabeler::VisitAssignment(Assignment* expr) { |
| 195 Property* prop = expr->target()->AsProperty(); | 200 Property* prop = expr->target()->AsProperty(); |
| 196 ASSERT(prop != NULL); | 201 ASSERT(prop != NULL); |
| 197 if (prop != NULL) { | 202 if (prop != NULL) { |
| 198 ASSERT(prop->key()->IsPropertyName()); | 203 ASSERT(prop->key()->IsPropertyName()); |
| 199 VariableProxy* proxy = prop->obj()->AsVariableProxy(); | 204 VariableProxy* proxy = prop->obj()->AsVariableProxy(); |
| 200 if (proxy != NULL && proxy->var()->is_this()) { | 205 if (proxy != NULL && proxy->var()->is_this()) { |
| 201 has_this_properties_ = true; | 206 info()->set_has_this_properties(true); |
| 202 } else { | 207 } else { |
| 203 Visit(prop->obj()); | 208 Visit(prop->obj()); |
| 204 } | 209 } |
| 205 } | 210 } |
| 206 Visit(expr->value()); | 211 Visit(expr->value()); |
| 207 expr->set_num(next_number_++); | 212 expr->set_num(next_number_++); |
| 208 } | 213 } |
| 209 | 214 |
| 210 | 215 |
| 211 void AstLabeler::VisitThrow(Throw* expr) { | 216 void AstLabeler::VisitThrow(Throw* expr) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 void AstLabeler::VisitThisFunction(ThisFunction* expr) { | 263 void AstLabeler::VisitThisFunction(ThisFunction* expr) { |
| 259 UNREACHABLE(); | 264 UNREACHABLE(); |
| 260 } | 265 } |
| 261 | 266 |
| 262 | 267 |
| 263 void AstLabeler::VisitDeclaration(Declaration* decl) { | 268 void AstLabeler::VisitDeclaration(Declaration* decl) { |
| 264 UNREACHABLE(); | 269 UNREACHABLE(); |
| 265 } | 270 } |
| 266 | 271 |
| 267 } } // namespace v8::internal | 272 } } // namespace v8::internal |
| OLD | NEW |