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

Side by Side Diff: src/parsing/rewriter.cc

Issue 2328593002: [Parser] Don't internalize on-the-fly. (Closed)
Patch Set: Created 4 years, 3 months 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
« no previous file with comments | « src/parsing/parser.cc ('k') | test/cctest/asmjs/test-asm-typer.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 // 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/parsing/rewriter.h" 5 #include "src/parsing/rewriter.h"
6 6
7 #include "src/ast/ast.h" 7 #include "src/ast/ast.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/parsing/parse-info.h" 9 #include "src/parsing/parse-info.h"
10 #include "src/parsing/parser.h" 10 #include "src/parsing/parser.h"
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 Scope* scope = function->scope(); 340 Scope* scope = function->scope();
341 DCHECK_NOT_NULL(scope); 341 DCHECK_NOT_NULL(scope);
342 if (!scope->is_script_scope() && !scope->is_eval_scope()) return true; 342 if (!scope->is_script_scope() && !scope->is_eval_scope()) return true;
343 DeclarationScope* closure_scope = scope->GetClosureScope(); 343 DeclarationScope* closure_scope = scope->GetClosureScope();
344 344
345 ZoneList<Statement*>* body = function->body(); 345 ZoneList<Statement*>* body = function->body();
346 if (!body->is_empty()) { 346 if (!body->is_empty()) {
347 Variable* result = closure_scope->NewTemporary( 347 Variable* result = closure_scope->NewTemporary(
348 info->ast_value_factory()->dot_result_string()); 348 info->ast_value_factory()->dot_result_string());
349 // The name string must be internalized at this point. 349 // The name string must be internalized at this point.
350 info->ast_value_factory()->Internalize(info->isolate());
marja 2016/09/12 07:21:48 Is this needed? Isn't the name internalized at thi
rmcilroy 2016/09/20 08:50:46 Yeah this is needed. The "dot_result_string" needs
350 DCHECK(!result->name().is_null()); 351 DCHECK(!result->name().is_null());
351 Processor processor(info->isolate(), closure_scope, result, 352 Processor processor(info->isolate(), closure_scope, result,
352 info->ast_value_factory()); 353 info->ast_value_factory());
353 processor.Process(body); 354 processor.Process(body);
355 // Internalize any values created during rewriting.
356 info->ast_value_factory()->Internalize(info->isolate());
354 if (processor.HasStackOverflow()) return false; 357 if (processor.HasStackOverflow()) return false;
355 358
356 if (processor.result_assigned()) { 359 if (processor.result_assigned()) {
357 int pos = kNoSourcePosition; 360 int pos = kNoSourcePosition;
358 VariableProxy* result_proxy = 361 VariableProxy* result_proxy =
359 processor.factory()->NewVariableProxy(result, pos); 362 processor.factory()->NewVariableProxy(result, pos);
360 Statement* result_statement = 363 Statement* result_statement =
361 processor.factory()->NewReturnStatement(result_proxy, pos); 364 processor.factory()->NewReturnStatement(result_proxy, pos);
362 body->Add(result_statement, info->zone()); 365 body->Add(result_statement, info->zone());
363 } 366 }
(...skipping 24 matching lines...) Expand all
388 processor.SetResult(undef), expr->position()); 391 processor.SetResult(undef), expr->position());
389 body->Add(completion, factory->zone()); 392 body->Add(completion, factory->zone());
390 } 393 }
391 } 394 }
392 return true; 395 return true;
393 } 396 }
394 397
395 398
396 } // namespace internal 399 } // namespace internal
397 } // namespace v8 400 } // namespace v8
OLDNEW
« no previous file with comments | « src/parsing/parser.cc ('k') | test/cctest/asmjs/test-asm-typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698