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 2632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2643 // Temporary zones can nest. When we migrate free variables (see below), we | 2643 // Temporary zones can nest. When we migrate free variables (see below), we |
2644 // need to recreate them in the previous Zone. | 2644 // need to recreate them in the previous Zone. |
2645 AstNodeFactory previous_zone_ast_node_factory(ast_value_factory()); | 2645 AstNodeFactory previous_zone_ast_node_factory(ast_value_factory()); |
2646 previous_zone_ast_node_factory.set_zone(zone()); | 2646 previous_zone_ast_node_factory.set_zone(zone()); |
2647 | 2647 |
2648 // Open a new zone scope, which sets our AstNodeFactory to allocate in the | 2648 // Open a new zone scope, which sets our AstNodeFactory to allocate in the |
2649 // new temporary zone if the preconditions are satisfied, and ensures that | 2649 // new temporary zone if the preconditions are satisfied, and ensures that |
2650 // the previous zone is always restored after parsing the body. To be able | 2650 // the previous zone is always restored after parsing the body. To be able |
2651 // to do scope analysis correctly after full parsing, we migrate needed | 2651 // to do scope analysis correctly after full parsing, we migrate needed |
2652 // information when the function is parsed. | 2652 // information when the function is parsed. |
2653 Zone temp_zone(zone()->allocator()); | 2653 Zone temp_zone(zone()->allocator(), ZONE_NAME); |
2654 DiscardableZoneScope zone_scope(this, &temp_zone, use_temp_zone); | 2654 DiscardableZoneScope zone_scope(this, &temp_zone, use_temp_zone); |
2655 #ifdef DEBUG | 2655 #ifdef DEBUG |
2656 if (use_temp_zone) scope->set_needs_migration(); | 2656 if (use_temp_zone) scope->set_needs_migration(); |
2657 #endif | 2657 #endif |
2658 | 2658 |
2659 // Eager or lazy parse? If is_lazy_top_level_function, we'll parse | 2659 // Eager or lazy parse? If is_lazy_top_level_function, we'll parse |
2660 // lazily. We'll call SkipLazyFunctionBody, which may decide to abort lazy | 2660 // lazily. We'll call SkipLazyFunctionBody, which may decide to abort lazy |
2661 // parsing if it suspects that wasn't a good idea. If so (in which case the | 2661 // parsing if it suspects that wasn't a good idea. If so (in which case the |
2662 // parser is expected to have backtracked), or if we didn't try to lazy | 2662 // parser is expected to have backtracked), or if we didn't try to lazy |
2663 // parse in the first place, we'll have to parse eagerly. | 2663 // parse in the first place, we'll have to parse eagerly. |
(...skipping 2734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5398 | 5398 |
5399 return final_loop; | 5399 return final_loop; |
5400 } | 5400 } |
5401 | 5401 |
5402 #undef CHECK_OK | 5402 #undef CHECK_OK |
5403 #undef CHECK_OK_VOID | 5403 #undef CHECK_OK_VOID |
5404 #undef CHECK_FAILED | 5404 #undef CHECK_FAILED |
5405 | 5405 |
5406 } // namespace internal | 5406 } // namespace internal |
5407 } // namespace v8 | 5407 } // namespace v8 |
OLD | NEW |