OLD | NEW |
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 PreParser::PreParseResult PreParser::PreParseLazyFunction( | 125 PreParser::PreParseResult PreParser::PreParseLazyFunction( |
126 LanguageMode language_mode, FunctionKind kind, bool has_simple_parameters, | 126 LanguageMode language_mode, FunctionKind kind, bool has_simple_parameters, |
127 bool parsing_module, ParserRecorder* log, Scanner::BookmarkScope* bookmark, | 127 bool parsing_module, ParserRecorder* log, Scanner::BookmarkScope* bookmark, |
128 int* use_counts) { | 128 int* use_counts) { |
129 parsing_module_ = parsing_module; | 129 parsing_module_ = parsing_module; |
130 log_ = log; | 130 log_ = log; |
131 use_counts_ = use_counts; | 131 use_counts_ = use_counts; |
132 // Lazy functions always have trivial outer scopes (no with/catch scopes). | 132 // Lazy functions always have trivial outer scopes (no with/catch scopes). |
133 DCHECK_NULL(scope_state_); | 133 DCHECK_NULL(scope_state_); |
134 Scope* top_scope = NewScope(nullptr, SCRIPT_SCOPE); | 134 Scope* top_scope = NewScriptScope(); |
135 PreParserFactory top_factory(nullptr); | 135 PreParserFactory top_factory(nullptr); |
136 FunctionState top_state(&function_state_, &scope_state_, top_scope, | 136 FunctionState top_state(&function_state_, &scope_state_, top_scope, |
137 kNormalFunction, &top_factory); | 137 kNormalFunction, &top_factory); |
138 scope()->SetLanguageMode(language_mode); | 138 scope()->SetLanguageMode(language_mode); |
139 Scope* function_scope = NewFunctionScope(kind); | 139 Scope* function_scope = NewFunctionScope(kind); |
140 if (!has_simple_parameters) function_scope->SetHasNonSimpleParameters(); | 140 if (!has_simple_parameters) function_scope->SetHasNonSimpleParameters(); |
141 PreParserFactory function_factory(nullptr); | 141 PreParserFactory function_factory(nullptr); |
142 FunctionState function_state(&function_state_, &scope_state_, function_scope, | 142 FunctionState function_state(&function_state_, &scope_state_, function_scope, |
143 kind, &function_factory); | 143 kind, &function_factory); |
144 DCHECK_EQ(Token::LBRACE, scanner()->current_token()); | 144 DCHECK_EQ(Token::LBRACE, scanner()->current_token()); |
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 | 1321 |
1322 body->Add(PreParserStatement::ExpressionStatement(return_value), zone()); | 1322 body->Add(PreParserStatement::ExpressionStatement(return_value), zone()); |
1323 } | 1323 } |
1324 | 1324 |
1325 #undef CHECK_OK | 1325 #undef CHECK_OK |
1326 #undef CHECK_OK_CUSTOM | 1326 #undef CHECK_OK_CUSTOM |
1327 | 1327 |
1328 | 1328 |
1329 } // namespace internal | 1329 } // namespace internal |
1330 } // namespace v8 | 1330 } // namespace v8 |
OLD | NEW |