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

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

Issue 1895123002: Prevent un-parsed LiteralFunction reaching the compiler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix test. (eager_compile_hint used function_state_ of parent function.) Created 4 years, 8 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-base.h ('k') | test/mjsunit/regress-604044.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 <cmath> 5 #include <cmath>
6 6
7 #include "src/allocation.h" 7 #include "src/allocation.h"
8 #include "src/base/logging.h" 8 #include "src/base/logging.h"
9 #include "src/conversions-inl.h" 9 #include "src/conversions-inl.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 PreParserFormalParameters formals(function_scope); 977 PreParserFormalParameters formals(function_scope);
978 ParseFormalParameterList(&formals, &formals_classifier, CHECK_OK); 978 ParseFormalParameterList(&formals, &formals_classifier, CHECK_OK);
979 Expect(Token::RPAREN, CHECK_OK); 979 Expect(Token::RPAREN, CHECK_OK);
980 int formals_end_position = scanner()->location().end_pos; 980 int formals_end_position = scanner()->location().end_pos;
981 981
982 CheckArityRestrictions(formals.arity, kind, formals.has_rest, start_position, 982 CheckArityRestrictions(formals.arity, kind, formals.has_rest, start_position,
983 formals_end_position, CHECK_OK); 983 formals_end_position, CHECK_OK);
984 984
985 // See Parser::ParseFunctionLiteral for more information about lazy parsing 985 // See Parser::ParseFunctionLiteral for more information about lazy parsing
986 // and lazy compilation. 986 // and lazy compilation.
987 bool is_lazily_parsed = 987 bool is_lazily_parsed = (outer_is_script_scope && allow_lazy() &&
988 (outer_is_script_scope && allow_lazy() && !parenthesized_function_); 988 !function_state_->this_function_is_parenthesized());
989 parenthesized_function_ = false;
990 989
991 Expect(Token::LBRACE, CHECK_OK); 990 Expect(Token::LBRACE, CHECK_OK);
992 if (is_lazily_parsed) { 991 if (is_lazily_parsed) {
993 ParseLazyFunctionLiteralBody(CHECK_OK); 992 ParseLazyFunctionLiteralBody(CHECK_OK);
994 } else { 993 } else {
995 ParseStatementList(Token::RBRACE, CHECK_OK); 994 ParseStatementList(Token::RBRACE, CHECK_OK);
996 } 995 }
997 Expect(Token::RBRACE, CHECK_OK); 996 Expect(Token::RBRACE, CHECK_OK);
998 997
999 // Parsing the body may change the language mode in our scope. 998 // Parsing the body may change the language mode in our scope.
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 Expect(Token::RBRACE, CHECK_OK); 1123 Expect(Token::RBRACE, CHECK_OK);
1125 return PreParserExpression::Default(); 1124 return PreParserExpression::Default();
1126 } 1125 }
1127 } 1126 }
1128 1127
1129 #undef CHECK_OK 1128 #undef CHECK_OK
1130 1129
1131 1130
1132 } // namespace internal 1131 } // namespace internal
1133 } // namespace v8 1132 } // namespace v8
OLDNEW
« no previous file with comments | « src/parsing/parser-base.h ('k') | test/mjsunit/regress-604044.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698