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

Side by Side Diff: src/rewriter.cc

Issue 62143002: Add three string constants from parser to the root-set. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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/parser.cc ('k') | src/scopes.cc » ('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 // 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 bool Rewriter::Rewrite(CompilationInfo* info) { 256 bool Rewriter::Rewrite(CompilationInfo* info) {
257 FunctionLiteral* function = info->function(); 257 FunctionLiteral* function = info->function();
258 ASSERT(function != NULL); 258 ASSERT(function != NULL);
259 Scope* scope = function->scope(); 259 Scope* scope = function->scope();
260 ASSERT(scope != NULL); 260 ASSERT(scope != NULL);
261 if (!scope->is_global_scope() && !scope->is_eval_scope()) return true; 261 if (!scope->is_global_scope() && !scope->is_eval_scope()) return true;
262 262
263 ZoneList<Statement*>* body = function->body(); 263 ZoneList<Statement*>* body = function->body();
264 if (!body->is_empty()) { 264 if (!body->is_empty()) {
265 Variable* result = scope->NewTemporary( 265 Variable* result = scope->NewTemporary(
266 info->isolate()->factory()->result_string()); 266 info->isolate()->factory()->dot_result_string());
267 Processor processor(result, info->zone()); 267 Processor processor(result, info->zone());
268 processor.Process(body); 268 processor.Process(body);
269 if (processor.HasStackOverflow()) return false; 269 if (processor.HasStackOverflow()) return false;
270 270
271 if (processor.result_assigned()) { 271 if (processor.result_assigned()) {
272 ASSERT(function->end_position() != RelocInfo::kNoPosition); 272 ASSERT(function->end_position() != RelocInfo::kNoPosition);
273 // Set the position of the assignment statement one character past the 273 // Set the position of the assignment statement one character past the
274 // source code, such that it definitely is not in the source code range 274 // source code, such that it definitely is not in the source code range
275 // of an immediate inner scope. For example in 275 // of an immediate inner scope. For example in
276 // eval('with ({x:1}) x = 1'); 276 // eval('with ({x:1}) x = 1');
277 // the end position of the function generated for executing the eval code 277 // the end position of the function generated for executing the eval code
278 // coincides with the end of the with scope which is the position of '1'. 278 // coincides with the end of the with scope which is the position of '1'.
279 int pos = function->end_position(); 279 int pos = function->end_position();
280 VariableProxy* result_proxy = processor.factory()->NewVariableProxy( 280 VariableProxy* result_proxy = processor.factory()->NewVariableProxy(
281 result->name(), false, result->interface(), pos); 281 result->name(), false, result->interface(), pos);
282 result_proxy->BindTo(result); 282 result_proxy->BindTo(result);
283 Statement* result_statement = 283 Statement* result_statement =
284 processor.factory()->NewReturnStatement(result_proxy, pos); 284 processor.factory()->NewReturnStatement(result_proxy, pos);
285 body->Add(result_statement, info->zone()); 285 body->Add(result_statement, info->zone());
286 } 286 }
287 } 287 }
288 288
289 return true; 289 return true;
290 } 290 }
291 291
292 292
293 } } // namespace v8::internal 293 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698