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 4200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4211 function_type == FunctionLiteral::kDeclaration && | 4211 function_type == FunctionLiteral::kDeclaration && |
4212 eager_compile_hint != FunctionLiteral::kShouldEagerCompile; | 4212 eager_compile_hint != FunctionLiteral::kShouldEagerCompile; |
4213 // Open a new BodyScope, which sets our AstNodeFactory to allocate in the | 4213 // Open a new BodyScope, which sets our AstNodeFactory to allocate in the |
4214 // new temporary zone if the preconditions are satisfied, and ensures that | 4214 // new temporary zone if the preconditions are satisfied, and ensures that |
4215 // the previous zone is always restored after parsing the body. | 4215 // the previous zone is always restored after parsing the body. |
4216 // For the purpose of scope analysis, some ZoneObjects allocated by the | 4216 // For the purpose of scope analysis, some ZoneObjects allocated by the |
4217 // factory must persist after the function body is thrown away and | 4217 // factory must persist after the function body is thrown away and |
4218 // temp_zone is deallocated. These objects are instead allocated in a | 4218 // temp_zone is deallocated. These objects are instead allocated in a |
4219 // parser-persistent zone (see parser_zone_ in AstNodeFactory). | 4219 // parser-persistent zone (see parser_zone_ in AstNodeFactory). |
4220 { | 4220 { |
4221 Zone temp_zone; | 4221 Zone temp_zone(zone()->allocator()); |
4222 AstNodeFactory::BodyScope inner(factory(), &temp_zone, use_temp_zone); | 4222 AstNodeFactory::BodyScope inner(factory(), &temp_zone, use_temp_zone); |
4223 | 4223 |
4224 body = ParseEagerFunctionBody(function_name, pos, formals, kind, | 4224 body = ParseEagerFunctionBody(function_name, pos, formals, kind, |
4225 function_type, CHECK_OK); | 4225 function_type, CHECK_OK); |
4226 } | 4226 } |
4227 materialized_literal_count = function_state.materialized_literal_count(); | 4227 materialized_literal_count = function_state.materialized_literal_count(); |
4228 expected_property_count = function_state.expected_property_count(); | 4228 expected_property_count = function_state.expected_property_count(); |
4229 if (use_temp_zone) { | 4229 if (use_temp_zone) { |
4230 // If the preconditions are correct the function body should never be | 4230 // If the preconditions are correct the function body should never be |
4231 // accessed, but do this anyway for better behaviour if they're wrong. | 4231 // accessed, but do this anyway for better behaviour if they're wrong. |
(...skipping 2628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6860 try_block, target); | 6860 try_block, target); |
6861 final_loop = target; | 6861 final_loop = target; |
6862 } | 6862 } |
6863 | 6863 |
6864 return final_loop; | 6864 return final_loop; |
6865 } | 6865 } |
6866 | 6866 |
6867 | 6867 |
6868 } // namespace internal | 6868 } // namespace internal |
6869 } // namespace v8 | 6869 } // namespace v8 |
OLD | NEW |