| OLD | NEW |
| 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 4458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4469 // - Any return statement inside the body will have its argument wrapped | 4469 // - Any return statement inside the body will have its argument wrapped |
| 4470 // in a "done" iterator result object. | 4470 // in a "done" iterator result object. |
| 4471 // - If the generator terminates for whatever reason, we must close it. | 4471 // - If the generator terminates for whatever reason, we must close it. |
| 4472 // Hence the finally clause. | 4472 // Hence the finally clause. |
| 4473 | 4473 |
| 4474 Block* try_block = | 4474 Block* try_block = |
| 4475 factory()->NewBlock(nullptr, 3, false, RelocInfo::kNoPosition); | 4475 factory()->NewBlock(nullptr, 3, false, RelocInfo::kNoPosition); |
| 4476 | 4476 |
| 4477 { | 4477 { |
| 4478 ZoneList<Expression*>* arguments = | 4478 ZoneList<Expression*>* arguments = |
| 4479 new (zone()) ZoneList<Expression*>(2, zone()); | 4479 new (zone()) ZoneList<Expression*>(1, zone()); |
| 4480 arguments->Add(factory()->NewThisFunction(pos), zone()); | 4480 arguments->Add(factory()->NewThisFunction(pos), zone()); |
| 4481 arguments->Add( | |
| 4482 ThisExpression(scope_, factory(), RelocInfo::kNoPosition), zone()); | |
| 4483 CallRuntime* allocation = factory()->NewCallRuntime( | 4481 CallRuntime* allocation = factory()->NewCallRuntime( |
| 4484 Runtime::kCreateJSGeneratorObject, arguments, pos); | 4482 Runtime::kCreateJSGeneratorObject, arguments, pos); |
| 4485 | 4483 |
| 4486 VariableProxy* init_proxy = factory()->NewVariableProxy( | 4484 VariableProxy* init_proxy = factory()->NewVariableProxy( |
| 4487 function_state_->generator_object_variable()); | 4485 function_state_->generator_object_variable()); |
| 4488 Assignment* assignment = factory()->NewAssignment( | 4486 Assignment* assignment = factory()->NewAssignment( |
| 4489 Token::INIT, init_proxy, allocation, RelocInfo::kNoPosition); | 4487 Token::INIT, init_proxy, allocation, RelocInfo::kNoPosition); |
| 4490 VariableProxy* get_proxy = factory()->NewVariableProxy( | 4488 VariableProxy* get_proxy = factory()->NewVariableProxy( |
| 4491 function_state_->generator_object_variable()); | 4489 function_state_->generator_object_variable()); |
| 4492 Yield* yield = | 4490 Yield* yield = |
| (...skipping 2323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6816 try_block, target); | 6814 try_block, target); |
| 6817 final_loop = target; | 6815 final_loop = target; |
| 6818 } | 6816 } |
| 6819 | 6817 |
| 6820 return final_loop; | 6818 return final_loop; |
| 6821 } | 6819 } |
| 6822 | 6820 |
| 6823 | 6821 |
| 6824 } // namespace internal | 6822 } // namespace internal |
| 6825 } // namespace v8 | 6823 } // namespace v8 |
| OLD | NEW |