Chromium Code Reviews| Index: src/parsing/parser.cc |
| diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc |
| index 09813ea6a75ba20397156bfcab59e95c0e3c64c1..de17eb5deab0b46a49a94ddf0a31fae9bea44f3b 100644 |
| --- a/src/parsing/parser.cc |
| +++ b/src/parsing/parser.cc |
| @@ -859,6 +859,10 @@ FunctionLiteral* Parser::ParseFunction(Isolate* isolate, ParseInfo* info) { |
| } |
| Handle<SharedFunctionInfo> shared_info = info->shared_info(); |
| DeserializeScopeChain(info, info->maybe_outer_scope_info()); |
| + if (info->asm_function_scope()) { |
| + original_scope_ = info->asm_function_scope(); |
| + factory()->set_zone(info->zone()); |
|
marja
2016/11/29 10:20:04
I was debating with myself whether the set_zone sh
bradn
2016/11/29 10:43:36
Done.
|
| + } |
| // Initialize parser state. |
| source = String::Flatten(source); |
| @@ -908,9 +912,12 @@ FunctionLiteral* Parser::DoParseFunction(ParseInfo* info, |
| fni_ = new (zone()) FuncNameInferrer(ast_value_factory(), zone()); |
| fni_->PushEnclosingName(raw_name); |
| - ResetFunctionLiteralId(); |
| - DCHECK_LT(0, info->function_literal_id()); |
| - SkipFunctionLiterals(info->function_literal_id() - 1); |
| + // Asm functions don't get IDs. |
|
marja
2016/11/29 10:20:04
Why? Is it bad if we assign IDs to them? And what
bradn
2016/11/29 10:43:36
Fair point.
Setting an id for them instead of this
|
| + if (!info->asm_function_scope()) { |
| + ResetFunctionLiteralId(); |
| + DCHECK_LT(0, info->function_literal_id()); |
| + SkipFunctionLiterals(info->function_literal_id() - 1); |
| + } |
| ParsingModeScope parsing_mode(this, PARSE_EAGERLY); |
| @@ -1043,10 +1050,13 @@ FunctionLiteral* Parser::DoParseFunction(ParseInfo* info, |
| DCHECK(ok == (result != nullptr)); |
| } |
| - // Make sure the target stack is empty. |
| - DCHECK_NULL(target_stack_); |
| - DCHECK_IMPLIES(result, |
| - info->function_literal_id() == result->function_literal_id()); |
| + // Asm functions don't get IDs. |
| + if (!info->asm_function_scope()) { |
| + // Make sure the target stack is empty. |
| + DCHECK_NULL(target_stack_); |
| + DCHECK_IMPLIES( |
| + result, info->function_literal_id() == result->function_literal_id()); |
| + } |
| return result; |
| } |
| @@ -2631,8 +2641,6 @@ FunctionLiteral* Parser::ParseFunctionLiteral( |
| // FunctionExpression; even without enclosing parentheses it might be |
| // immediately invoked. |
| // - The function literal shouldn't be hinted to eagerly compile. |
| - // - For asm.js functions the body needs to be available when module |
| - // validation is active, because we examine the entire module at once. |
| // Inner functions will be parsed using a temporary Zone. After parsing, we |
| // will migrate unresolved variable into a Scope in the main Zone. |
| @@ -2642,8 +2650,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral( |
| ? can_preparse |
| : (is_lazy_top_level_function || |
| (allow_lazy_ && function_type == FunctionLiteral::kDeclaration && |
| - eager_compile_hint == FunctionLiteral::kShouldLazyCompile))) && |
| - !(FLAG_validate_asm && scope()->IsAsmModule()); |
| + eager_compile_hint == FunctionLiteral::kShouldLazyCompile))); |
| bool is_lazy_inner_function = |
| use_temp_zone && FLAG_lazy_inner_functions && !is_lazy_top_level_function; |