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 4262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4273 // - Neither V8 natives nor native function declarations can be allowed, | 4273 // - Neither V8 natives nor native function declarations can be allowed, |
4274 // since parsing one would retroactively force the function to be | 4274 // since parsing one would retroactively force the function to be |
4275 // eagerly compiled. | 4275 // eagerly compiled. |
4276 // - The invoker of this parser can't depend on the AST being eagerly | 4276 // - The invoker of this parser can't depend on the AST being eagerly |
4277 // built (either because the function is about to be compiled, or | 4277 // built (either because the function is about to be compiled, or |
4278 // because the AST is going to be inspected for some reason). | 4278 // because the AST is going to be inspected for some reason). |
4279 // - Because of the above, we can't be attempting to parse a | 4279 // - Because of the above, we can't be attempting to parse a |
4280 // FunctionExpression; even without enclosing parentheses it might be | 4280 // FunctionExpression; even without enclosing parentheses it might be |
4281 // immediately invoked. | 4281 // immediately invoked. |
4282 // - The function literal shouldn't be hinted to eagerly compile. | 4282 // - The function literal shouldn't be hinted to eagerly compile. |
| 4283 // - For asm.js functions the body needs to be available when module |
| 4284 // validation is active, because we examine the entire module at once. |
4283 bool use_temp_zone = | 4285 bool use_temp_zone = |
4284 FLAG_lazy && !allow_natives() && extension_ == NULL && allow_lazy() && | 4286 FLAG_lazy && !allow_natives() && extension_ == NULL && allow_lazy() && |
4285 function_type == FunctionLiteral::kDeclaration && | 4287 function_type == FunctionLiteral::kDeclaration && |
4286 eager_compile_hint != FunctionLiteral::kShouldEagerCompile; | 4288 eager_compile_hint != FunctionLiteral::kShouldEagerCompile && |
| 4289 !(FLAG_validate_asm && scope->asm_function()); |
4287 // Open a new BodyScope, which sets our AstNodeFactory to allocate in the | 4290 // Open a new BodyScope, which sets our AstNodeFactory to allocate in the |
4288 // new temporary zone if the preconditions are satisfied, and ensures that | 4291 // new temporary zone if the preconditions are satisfied, and ensures that |
4289 // the previous zone is always restored after parsing the body. | 4292 // the previous zone is always restored after parsing the body. |
4290 // For the purpose of scope analysis, some ZoneObjects allocated by the | 4293 // For the purpose of scope analysis, some ZoneObjects allocated by the |
4291 // factory must persist after the function body is thrown away and | 4294 // factory must persist after the function body is thrown away and |
4292 // temp_zone is deallocated. These objects are instead allocated in a | 4295 // temp_zone is deallocated. These objects are instead allocated in a |
4293 // parser-persistent zone (see parser_zone_ in AstNodeFactory). | 4296 // parser-persistent zone (see parser_zone_ in AstNodeFactory). |
4294 { | 4297 { |
4295 Zone temp_zone(zone()->allocator()); | 4298 Zone temp_zone(zone()->allocator()); |
4296 AstNodeFactory::BodyScope inner(factory(), &temp_zone, use_temp_zone); | 4299 AstNodeFactory::BodyScope inner(factory(), &temp_zone, use_temp_zone); |
(...skipping 2612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6909 try_block, target); | 6912 try_block, target); |
6910 final_loop = target; | 6913 final_loop = target; |
6911 } | 6914 } |
6912 | 6915 |
6913 return final_loop; | 6916 return final_loop; |
6914 } | 6917 } |
6915 | 6918 |
6916 | 6919 |
6917 } // namespace internal | 6920 } // namespace internal |
6918 } // namespace v8 | 6921 } // namespace v8 |
OLD | NEW |