Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: src/rewriter.cc

Issue 716833002: Various clean-ups after top-level lexical declarations are done. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Patch for landing Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/preparser.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/rewriter.h" 7 #include "src/rewriter.h"
8 8
9 #include "src/ast.h" 9 #include "src/ast.h"
10 #include "src/compiler.h" 10 #include "src/compiler.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 #undef DEF_VISIT 222 #undef DEF_VISIT
223 223
224 224
225 // Assumes code has been parsed. Mutates the AST, so the AST should not 225 // Assumes code has been parsed. Mutates the AST, so the AST should not
226 // continue to be used in the case of failure. 226 // continue to be used in the case of failure.
227 bool Rewriter::Rewrite(CompilationInfo* info) { 227 bool Rewriter::Rewrite(CompilationInfo* info) {
228 FunctionLiteral* function = info->function(); 228 FunctionLiteral* function = info->function();
229 DCHECK(function != NULL); 229 DCHECK(function != NULL);
230 Scope* scope = function->scope(); 230 Scope* scope = function->scope();
231 DCHECK(scope != NULL); 231 DCHECK(scope != NULL);
232 if (!scope->is_global_scope() && !scope->is_eval_scope()) return true; 232 if (!scope->is_script_scope() && !scope->is_eval_scope()) return true;
233 233
234 ZoneList<Statement*>* body = function->body(); 234 ZoneList<Statement*>* body = function->body();
235 if (!body->is_empty()) { 235 if (!body->is_empty()) {
236 Variable* result = 236 Variable* result =
237 scope->NewTemporary(info->ast_value_factory()->dot_result_string()); 237 scope->NewTemporary(info->ast_value_factory()->dot_result_string());
238 // The name string must be internalized at this point. 238 // The name string must be internalized at this point.
239 DCHECK(!result->name().is_null()); 239 DCHECK(!result->name().is_null());
240 Processor processor(result, info->ast_value_factory()); 240 Processor processor(result, info->ast_value_factory());
241 processor.Process(body); 241 processor.Process(body);
242 if (processor.HasStackOverflow()) return false; 242 if (processor.HasStackOverflow()) return false;
(...skipping 13 matching lines...) Expand all
256 processor.factory()->NewReturnStatement(result_proxy, pos); 256 processor.factory()->NewReturnStatement(result_proxy, pos);
257 body->Add(result_statement, info->zone()); 257 body->Add(result_statement, info->zone());
258 } 258 }
259 } 259 }
260 260
261 return true; 261 return true;
262 } 262 }
263 263
264 264
265 } } // namespace v8::internal 265 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/preparser.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698