OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 void Processor::VisitDebuggerStatement(DebuggerStatement* node) {} | 223 void Processor::VisitDebuggerStatement(DebuggerStatement* node) {} |
224 | 224 |
225 | 225 |
226 // Expressions are never visited yet. | 226 // Expressions are never visited yet. |
227 #define DEF_VISIT(type) \ | 227 #define DEF_VISIT(type) \ |
228 void Processor::Visit##type(type* expr) { UNREACHABLE(); } | 228 void Processor::Visit##type(type* expr) { UNREACHABLE(); } |
229 EXPRESSION_NODE_LIST(DEF_VISIT) | 229 EXPRESSION_NODE_LIST(DEF_VISIT) |
230 #undef DEF_VISIT | 230 #undef DEF_VISIT |
231 | 231 |
232 | 232 |
233 // Assumes code has been parsed and scopes have been analyzed. Mutates the | 233 // Assumes code has been parsed. Mutates the AST, so the AST should not |
234 // AST, so the AST should not continue to be used in the case of failure. | 234 // continue to be used in the case of failure. |
235 bool Rewriter::Rewrite(CompilationInfo* info) { | 235 bool Rewriter::Rewrite(CompilationInfo* info) { |
236 FunctionLiteral* function = info->function(); | 236 FunctionLiteral* function = info->function(); |
237 ASSERT(function != NULL); | 237 ASSERT(function != NULL); |
238 Scope* scope = function->scope(); | 238 Scope* scope = function->scope(); |
239 ASSERT(scope != NULL); | 239 ASSERT(scope != NULL); |
240 if (!scope->is_global_scope() && !scope->is_eval_scope()) return true; | 240 if (!scope->is_global_scope() && !scope->is_eval_scope()) return true; |
241 | 241 |
242 ZoneList<Statement*>* body = function->body(); | 242 ZoneList<Statement*>* body = function->body(); |
243 if (!body->is_empty()) { | 243 if (!body->is_empty()) { |
244 Variable* result = scope->NewTemporary( | 244 Variable* result = scope->NewTemporary( |
(...skipping 19 matching lines...) Expand all Loading... |
264 result_statement->set_statement_pos(position); | 264 result_statement->set_statement_pos(position); |
265 body->Add(result_statement, info->zone()); | 265 body->Add(result_statement, info->zone()); |
266 } | 266 } |
267 } | 267 } |
268 | 268 |
269 return true; | 269 return true; |
270 } | 270 } |
271 | 271 |
272 | 272 |
273 } } // namespace v8::internal | 273 } } // namespace v8::internal |
OLD | NEW |