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

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

Issue 1883443003: [generators] Simplify %CreateJSGeneratorObject (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add back initialization of continuation, just to be on the safe side. Created 4 years, 8 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 | « no previous file | 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/parsing/parser.h" 5 #include "src/parsing/parser.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/ast-expression-rewriter.h" 9 #include "src/ast/ast-expression-rewriter.h"
10 #include "src/ast/ast-expression-visitor.h" 10 #include "src/ast/ast-expression-visitor.h"
(...skipping 4452 matching lines...) Expand 10 before | Expand all | Expand 10 after
4463 // - Any return statement inside the body will have its argument wrapped 4463 // - Any return statement inside the body will have its argument wrapped
4464 // in a "done" iterator result object. 4464 // in a "done" iterator result object.
4465 // - If the generator terminates for whatever reason, we must close it. 4465 // - If the generator terminates for whatever reason, we must close it.
4466 // Hence the finally clause. 4466 // Hence the finally clause.
4467 4467
4468 Block* try_block = 4468 Block* try_block =
4469 factory()->NewBlock(nullptr, 3, false, RelocInfo::kNoPosition); 4469 factory()->NewBlock(nullptr, 3, false, RelocInfo::kNoPosition);
4470 4470
4471 { 4471 {
4472 ZoneList<Expression*>* arguments = 4472 ZoneList<Expression*>* arguments =
4473 new (zone()) ZoneList<Expression*>(0, zone()); 4473 new (zone()) ZoneList<Expression*>(2, zone());
4474 arguments->Add(factory()->NewThisFunction(pos), zone());
4475 arguments->Add(
4476 ThisExpression(scope_, factory(), RelocInfo::kNoPosition), zone());
4474 CallRuntime* allocation = factory()->NewCallRuntime( 4477 CallRuntime* allocation = factory()->NewCallRuntime(
4475 Runtime::kCreateJSGeneratorObject, arguments, pos); 4478 Runtime::kCreateJSGeneratorObject, arguments, pos);
4479
4476 VariableProxy* init_proxy = factory()->NewVariableProxy( 4480 VariableProxy* init_proxy = factory()->NewVariableProxy(
4477 function_state_->generator_object_variable()); 4481 function_state_->generator_object_variable());
4478 Assignment* assignment = factory()->NewAssignment( 4482 Assignment* assignment = factory()->NewAssignment(
4479 Token::INIT, init_proxy, allocation, RelocInfo::kNoPosition); 4483 Token::INIT, init_proxy, allocation, RelocInfo::kNoPosition);
4480 VariableProxy* get_proxy = factory()->NewVariableProxy( 4484 VariableProxy* get_proxy = factory()->NewVariableProxy(
4481 function_state_->generator_object_variable()); 4485 function_state_->generator_object_variable());
4482 Yield* yield = 4486 Yield* yield =
4483 factory()->NewYield(get_proxy, assignment, RelocInfo::kNoPosition); 4487 factory()->NewYield(get_proxy, assignment, RelocInfo::kNoPosition);
4484 try_block->statements()->Add( 4488 try_block->statements()->Add(
4485 factory()->NewExpressionStatement(yield, RelocInfo::kNoPosition), 4489 factory()->NewExpressionStatement(yield, RelocInfo::kNoPosition),
(...skipping 2301 matching lines...) Expand 10 before | Expand all | Expand 10 after
6787 try_block, target); 6791 try_block, target);
6788 final_loop = target; 6792 final_loop = target;
6789 } 6793 }
6790 6794
6791 return final_loop; 6795 return final_loop;
6792 } 6796 }
6793 6797
6794 6798
6795 } // namespace internal 6799 } // namespace internal
6796 } // namespace v8 6800 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698