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

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

Issue 2936813002: Move closing of generators upon final return to the generator-resume builtin. (Closed)
Patch Set: Add TODO Created 3 years, 6 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
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/objects-inl.h" 9 #include "src/objects-inl.h"
10 #include "src/parsing/parse-info.h" 10 #include "src/parsing/parse-info.h"
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 info->ast_value_factory()->dot_result_string()); 379 info->ast_value_factory()->dot_result_string());
380 Processor processor(info->stack_limit(), scope->AsDeclarationScope(), 380 Processor processor(info->stack_limit(), scope->AsDeclarationScope(),
381 result, info->ast_value_factory()); 381 result, info->ast_value_factory());
382 processor.Process(body); 382 processor.Process(body);
383 383
384 DCHECK_IMPLIES(scope->is_module_scope(), processor.result_assigned()); 384 DCHECK_IMPLIES(scope->is_module_scope(), processor.result_assigned());
385 if (processor.result_assigned()) { 385 if (processor.result_assigned()) {
386 int pos = kNoSourcePosition; 386 int pos = kNoSourcePosition;
387 Expression* result_value = 387 Expression* result_value =
388 processor.factory()->NewVariableProxy(result, pos); 388 processor.factory()->NewVariableProxy(result, pos);
389 if (scope->is_module_scope()) {
390 auto args = new (info->zone()) ZoneList<Expression*>(2, info->zone());
391 args->Add(result_value, info->zone());
392 args->Add(processor.factory()->NewBooleanLiteral(true, pos),
393 info->zone());
394 result_value = processor.factory()->NewCallRuntime(
395 Runtime::kInlineCreateIterResultObject, args, pos);
396 }
397 Statement* result_statement = 389 Statement* result_statement =
398 processor.factory()->NewReturnStatement(result_value, pos); 390 processor.factory()->NewReturnStatement(result_value, pos);
399 body->Add(result_statement, info->zone()); 391 body->Add(result_statement, info->zone());
400 } 392 }
401 393
402 // TODO(leszeks): Remove this check and releases once internalization is 394 // TODO(leszeks): Remove this check and releases once internalization is
403 // moved out of parsing/analysis. Also remove the parameter once done. 395 // moved out of parsing/analysis. Also remove the parameter once done.
404 DCHECK(ThreadId::Current().Equals(isolate->thread_id())); 396 DCHECK(ThreadId::Current().Equals(isolate->thread_id()));
405 no_deref.Release(); 397 no_deref.Release();
406 no_handles.Release(); 398 no_handles.Release();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 processor.SetResult(undef), expr->position()); 432 processor.SetResult(undef), expr->position());
441 body->Add(completion, factory->zone()); 433 body->Add(completion, factory->zone());
442 } 434 }
443 } 435 }
444 return true; 436 return true;
445 } 437 }
446 438
447 439
448 } // namespace internal 440 } // namespace internal
449 } // namespace v8 441 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-generator.cc ('k') | test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698