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

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

Issue 2413213002: Allow lazy parsing of eval-created functions (Closed)
Patch Set: disallow preparsing without scope resolution of strict-mode evaled functions 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 | « src/ast/scopes.cc ('k') | test/mjsunit/preparse-toplevel-strict-eval.js » ('j') | 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 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 DCHECK_NULL(target_stack_); 784 DCHECK_NULL(target_stack_);
785 785
786 Mode parsing_mode = allow_lazy() ? PARSE_LAZILY : PARSE_EAGERLY; 786 Mode parsing_mode = allow_lazy() ? PARSE_LAZILY : PARSE_EAGERLY;
787 787
788 FunctionLiteral* result = NULL; 788 FunctionLiteral* result = NULL;
789 { 789 {
790 Scope* outer = original_scope_; 790 Scope* outer = original_scope_;
791 DCHECK_NOT_NULL(outer); 791 DCHECK_NOT_NULL(outer);
792 parsing_module_ = info->is_module(); 792 parsing_module_ = info->is_module();
793 if (info->is_eval()) { 793 if (info->is_eval()) {
794 if (!outer->is_script_scope() || is_strict(info->language_mode())) {
795 parsing_mode = PARSE_EAGERLY;
796 }
797 outer = NewEvalScope(outer); 794 outer = NewEvalScope(outer);
798 } else if (parsing_module_) { 795 } else if (parsing_module_) {
799 DCHECK_EQ(outer, info->script_scope()); 796 DCHECK_EQ(outer, info->script_scope());
800 outer = NewModuleScope(info->script_scope()); 797 outer = NewModuleScope(info->script_scope());
801 // Never do lazy parsing in modules. If we want to support this in the 798 // Never do lazy parsing in modules. If we want to support this in the
802 // future, we must force context-allocation for all variables that are 799 // future, we must force context-allocation for all variables that are
803 // declared at the module level but not MODULE-allocated. 800 // declared at the module level but not MODULE-allocated.
804 parsing_mode = PARSE_EAGERLY; 801 parsing_mode = PARSE_EAGERLY;
805 } 802 }
806 803
(...skipping 4648 matching lines...) Expand 10 before | Expand all | Expand 10 after
5455 5452
5456 return final_loop; 5453 return final_loop;
5457 } 5454 }
5458 5455
5459 #undef CHECK_OK 5456 #undef CHECK_OK
5460 #undef CHECK_OK_VOID 5457 #undef CHECK_OK_VOID
5461 #undef CHECK_FAILED 5458 #undef CHECK_FAILED
5462 5459
5463 } // namespace internal 5460 } // namespace internal
5464 } // namespace v8 5461 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/scopes.cc ('k') | test/mjsunit/preparse-toplevel-strict-eval.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698