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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/ast/ast-expression-rewriter.h" | 10 #include "src/ast/ast-expression-rewriter.h" |
(...skipping 2470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2481 for (const auto p : parameters.params) { | 2481 for (const auto p : parameters.params) { |
2482 if (p.pattern != nullptr) reindexer.Reindex(p.pattern); | 2482 if (p.pattern != nullptr) reindexer.Reindex(p.pattern); |
2483 if (p.initializer != nullptr) reindexer.Reindex(p.initializer); | 2483 if (p.initializer != nullptr) reindexer.Reindex(p.initializer); |
2484 } | 2484 } |
2485 | 2485 |
2486 DCHECK(reindexer.count() <= function_state_->materialized_literal_count()); | 2486 DCHECK(reindexer.count() <= function_state_->materialized_literal_count()); |
2487 } | 2487 } |
2488 } | 2488 } |
2489 | 2489 |
2490 void Parser::PrepareGeneratorVariables(FunctionState* function_state) { | 2490 void Parser::PrepareGeneratorVariables(FunctionState* function_state) { |
2491 // For generators, allocating variables in contexts is currently a win | 2491 // For generators, allocating variables in contexts is currently a win because |
2492 // because it minimizes the work needed to suspend and resume an | 2492 // it minimizes the work needed to suspend and resume an activation. The |
2493 // activation. The machine code produced for generators (by full-codegen) | 2493 // machine code produced for generators relies on this forced context |
Michael Starzinger
2016/11/21 15:56:16
nit: s/machine code/code/ here because it is techn
neis
2016/11/22 13:18:53
Done.
| |
2494 // relies on this forced context allocation, but not in an essential way. | 2494 // allocation, but not in an essential way. |
2495 scope()->ForceContextAllocation(); | 2495 scope()->ForceContextAllocation(); |
2496 | 2496 |
2497 // Calling a generator returns a generator object. That object is stored | 2497 // Calling a generator returns a generator object. That object is stored |
2498 // in a temporary variable, a definition that is used by "yield" | 2498 // in a temporary variable, a definition that is used by "yield" |
2499 // expressions. | 2499 // expressions. |
2500 Variable* temp = | 2500 Variable* temp = |
2501 NewTemporary(ast_value_factory()->dot_generator_object_string()); | 2501 NewTemporary(ast_value_factory()->dot_generator_object_string()); |
2502 function_state->set_generator_object_variable(temp); | 2502 function_state->set_generator_object_variable(temp); |
2503 } | 2503 } |
2504 | 2504 |
(...skipping 2932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5437 | 5437 |
5438 return final_loop; | 5438 return final_loop; |
5439 } | 5439 } |
5440 | 5440 |
5441 #undef CHECK_OK | 5441 #undef CHECK_OK |
5442 #undef CHECK_OK_VOID | 5442 #undef CHECK_OK_VOID |
5443 #undef CHECK_FAILED | 5443 #undef CHECK_FAILED |
5444 | 5444 |
5445 } // namespace internal | 5445 } // namespace internal |
5446 } // namespace v8 | 5446 } // namespace v8 |
OLD | NEW |