Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/parsing/parser.cc

Issue 2421493002: Make sure we always temp-zone parse if we preparse toplevel (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2625 matching lines...) Expand 10 before | Expand all | Expand 10 after
2636 // - The function literal shouldn't be hinted to eagerly compile. 2636 // - The function literal shouldn't be hinted to eagerly compile.
2637 // - For asm.js functions the body needs to be available when module 2637 // - For asm.js functions the body needs to be available when module
2638 // validation is active, because we examine the entire module at once. 2638 // validation is active, because we examine the entire module at once.
2639 2639
2640 // Inner functions will be parsed using a temporary Zone. After parsing, we 2640 // Inner functions will be parsed using a temporary Zone. After parsing, we
2641 // will migrate unresolved variable into a Scope in the main Zone. 2641 // will migrate unresolved variable into a Scope in the main Zone.
2642 // TODO(marja): Refactor parsing modes: simplify this. 2642 // TODO(marja): Refactor parsing modes: simplify this.
2643 bool use_temp_zone = 2643 bool use_temp_zone =
2644 (FLAG_lazy_inner_functions 2644 (FLAG_lazy_inner_functions
2645 ? can_preparse 2645 ? can_preparse
2646 : (allow_lazy() && function_type == FunctionLiteral::kDeclaration && 2646 : (is_lazy_top_level_function ||
marja 2016/10/14 08:06:23 Shouldn't this be use_temp_zone = is_lazy_top_lev
2647 eager_compile_hint == FunctionLiteral::kShouldLazyCompile)) && 2647 (allow_lazy() && function_type == FunctionLiteral::kDeclaration &&
2648 eager_compile_hint == FunctionLiteral::kShouldLazyCompile))) &&
2648 !(FLAG_validate_asm && scope()->IsAsmModule()); 2649 !(FLAG_validate_asm && scope()->IsAsmModule());
2649 bool is_lazy_inner_function = 2650 bool is_lazy_inner_function =
2650 use_temp_zone && FLAG_lazy_inner_functions && !is_lazy_top_level_function; 2651 use_temp_zone && FLAG_lazy_inner_functions && !is_lazy_top_level_function;
2651 2652
2652 // This Scope lives in the main zone. We'll migrate data into that zone later. 2653 // This Scope lives in the main zone. We'll migrate data into that zone later.
2653 DeclarationScope* scope = NewFunctionScope(kind); 2654 DeclarationScope* scope = NewFunctionScope(kind);
2654 SetLanguageMode(scope, language_mode); 2655 SetLanguageMode(scope, language_mode);
2655 2656
2656 ZoneList<Statement*>* body = nullptr; 2657 ZoneList<Statement*>* body = nullptr;
2657 int materialized_literal_count = -1; 2658 int materialized_literal_count = -1;
(...skipping 2782 matching lines...) Expand 10 before | Expand all | Expand 10 after
5440 5441
5441 return final_loop; 5442 return final_loop;
5442 } 5443 }
5443 5444
5444 #undef CHECK_OK 5445 #undef CHECK_OK
5445 #undef CHECK_OK_VOID 5446 #undef CHECK_OK_VOID
5446 #undef CHECK_FAILED 5447 #undef CHECK_FAILED
5447 5448
5448 } // namespace internal 5449 } // namespace internal
5449 } // namespace v8 5450 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698