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

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

Issue 2410413003: Decide ParseLazy vs ParseProgram based on is_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 3806 matching lines...) Expand 10 before | Expand all | Expand 10 after
3817 3817
3818 3818
3819 bool Parser::Parse(ParseInfo* info) { 3819 bool Parser::Parse(ParseInfo* info) {
3820 DCHECK(info->literal() == NULL); 3820 DCHECK(info->literal() == NULL);
3821 FunctionLiteral* result = NULL; 3821 FunctionLiteral* result = NULL;
3822 // Ok to use Isolate here; this function is only called in the main thread. 3822 // Ok to use Isolate here; this function is only called in the main thread.
3823 DCHECK(parsing_on_main_thread_); 3823 DCHECK(parsing_on_main_thread_);
3824 Isolate* isolate = info->isolate(); 3824 Isolate* isolate = info->isolate();
3825 pre_parse_timer_ = isolate->counters()->pre_parse(); 3825 pre_parse_timer_ = isolate->counters()->pre_parse();
3826 3826
3827 if (!info->shared_info().is_null() && info->shared_info()->is_function()) { 3827 if (info->is_toplevel()) {
3828 result = ParseLazy(isolate, info);
3829 } else {
3830 SetCachedData(info); 3828 SetCachedData(info);
3831 result = ParseProgram(isolate, info); 3829 result = ParseProgram(isolate, info);
3830 } else {
3831 result = ParseLazy(isolate, info);
3832 } 3832 }
3833 info->set_literal(result); 3833 info->set_literal(result);
3834 3834
3835 Internalize(isolate, info->script(), result == NULL); 3835 Internalize(isolate, info->script(), result == NULL);
3836 return (result != NULL); 3836 return (result != NULL);
3837 } 3837 }
3838 3838
3839 3839
3840 void Parser::ParseOnBackground(ParseInfo* info) { 3840 void Parser::ParseOnBackground(ParseInfo* info) {
3841 parsing_on_main_thread_ = false; 3841 parsing_on_main_thread_ = false;
(...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after
5455 5455
5456 return final_loop; 5456 return final_loop;
5457 } 5457 }
5458 5458
5459 #undef CHECK_OK 5459 #undef CHECK_OK
5460 #undef CHECK_OK_VOID 5460 #undef CHECK_OK_VOID
5461 #undef CHECK_FAILED 5461 #undef CHECK_FAILED
5462 5462
5463 } // namespace internal 5463 } // namespace internal
5464 } // namespace v8 5464 } // 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