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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 } | 192 } |
192 | 193 |
193 | 194 |
194 void AstLabeler::VisitAssignment(Assignment* expr) { | 195 void AstLabeler::VisitAssignment(Assignment* expr) { |
195 Property* prop = expr->target()->AsProperty(); | 196 Property* prop = expr->target()->AsProperty(); |
196 ASSERT(prop != NULL); | 197 ASSERT(prop != NULL); |
197 if (prop != NULL) { | 198 if (prop != NULL) { |
198 ASSERT(prop->key()->IsPropertyName()); | 199 ASSERT(prop->key()->IsPropertyName()); |
199 VariableProxy* proxy = prop->obj()->AsVariableProxy(); | 200 VariableProxy* proxy = prop->obj()->AsVariableProxy(); |
200 if (proxy != NULL && proxy->var()->is_this()) { | 201 if (proxy != NULL && proxy->var()->is_this()) { |
201 has_this_properties_ = true; | 202 info()->set_has_this_properties(true); |
202 } else { | 203 } else { |
203 Visit(prop->obj()); | 204 Visit(prop->obj()); |
204 } | 205 } |
205 } | 206 } |
206 Visit(expr->value()); | 207 Visit(expr->value()); |
207 expr->set_num(next_number_++); | 208 expr->set_num(next_number_++); |
208 } | 209 } |
209 | 210 |
210 | 211 |
211 void AstLabeler::VisitThrow(Throw* expr) { | 212 void AstLabeler::VisitThrow(Throw* expr) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 void AstLabeler::VisitThisFunction(ThisFunction* expr) { | 259 void AstLabeler::VisitThisFunction(ThisFunction* expr) { |
259 UNREACHABLE(); | 260 UNREACHABLE(); |
260 } | 261 } |
261 | 262 |
262 | 263 |
263 void AstLabeler::VisitDeclaration(Declaration* decl) { | 264 void AstLabeler::VisitDeclaration(Declaration* decl) { |
264 UNREACHABLE(); | 265 UNREACHABLE(); |
265 } | 266 } |
266 | 267 |
267 } } // namespace v8::internal | 268 } } // namespace v8::internal |
OLD | NEW |