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

Side by Side Diff: src/parsing/parser-base.h

Issue 2352593002: Preparse inner functions (new try) (Closed)
Patch Set: add comment 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/parsing/parser.cc ('k') | src/parsing/preparser.h » ('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 #ifndef V8_PARSING_PARSER_BASE_H 5 #ifndef V8_PARSING_PARSER_BASE_H
6 #define V8_PARSING_PARSER_BASE_H 6 #define V8_PARSING_PARSER_BASE_H
7 7
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 3897 matching lines...) Expand 10 before | Expand all | Expand 10 after
3908 formal_parameters.materialized_literals_count); 3908 formal_parameters.materialized_literals_count);
3909 3909
3910 impl()->ReindexLiterals(formal_parameters); 3910 impl()->ReindexLiterals(formal_parameters);
3911 3911
3912 Expect(Token::ARROW, CHECK_OK); 3912 Expect(Token::ARROW, CHECK_OK);
3913 3913
3914 if (peek() == Token::LBRACE) { 3914 if (peek() == Token::LBRACE) {
3915 // Multiple statement body 3915 // Multiple statement body
3916 Consume(Token::LBRACE); 3916 Consume(Token::LBRACE);
3917 DCHECK_EQ(scope(), formal_parameters.scope); 3917 DCHECK_EQ(scope(), formal_parameters.scope);
3918 bool is_lazily_parsed = (mode() == PARSE_LAZILY && 3918 bool is_lazily_parsed =
3919 formal_parameters.scope->AllowsLazyParsing()); 3919 (mode() == PARSE_LAZILY &&
3920 formal_parameters.scope
3921 ->AllowsLazyParsingWithoutUnresolvedVariables());
3922 // TODO(marja): consider lazy-parsing inner arrow functions too. is_this
3923 // handling in Scope::ResolveVariable needs to change.
3920 if (is_lazily_parsed) { 3924 if (is_lazily_parsed) {
3921 Scanner::BookmarkScope bookmark(scanner()); 3925 Scanner::BookmarkScope bookmark(scanner());
3922 bookmark.Set(); 3926 bookmark.Set();
3923 LazyParsingResult result = impl()->SkipLazyFunctionBody( 3927 LazyParsingResult result = impl()->SkipLazyFunctionBody(
3924 &materialized_literal_count, &expected_property_count, true, 3928 &materialized_literal_count, &expected_property_count, false, true,
3925 CHECK_OK); 3929 CHECK_OK);
3926 3930
3927 if (formal_parameters.materialized_literals_count > 0) { 3931 if (formal_parameters.materialized_literals_count > 0) {
3928 materialized_literal_count += 3932 materialized_literal_count +=
3929 formal_parameters.materialized_literals_count; 3933 formal_parameters.materialized_literals_count;
3930 } 3934 }
3931 3935
3932 if (result == kLazyParsingAborted) { 3936 if (result == kLazyParsingAborted) {
3933 bookmark.Apply(); 3937 bookmark.Apply();
3934 // Trigger eager (re-)parsing, just below this block. 3938 // Trigger eager (re-)parsing, just below this block.
(...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after
5317 has_seen_constructor_ = true; 5321 has_seen_constructor_ = true;
5318 return; 5322 return;
5319 } 5323 }
5320 } 5324 }
5321 5325
5322 5326
5323 } // namespace internal 5327 } // namespace internal
5324 } // namespace v8 5328 } // namespace v8
5325 5329
5326 #endif // V8_PARSING_PARSER_BASE_H 5330 #endif // V8_PARSING_PARSER_BASE_H
OLDNEW
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698