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

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

Issue 2509683002: [counters] Use separate counters for background parsing (Closed)
Patch Set: using const arrays instead of two-level ternary syntax. Created 4 years, 1 month 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 typedef typename Types::Block BlockT; 185 typedef typename Types::Block BlockT;
186 typedef typename v8::internal::ExpressionClassifier<Types> 186 typedef typename v8::internal::ExpressionClassifier<Types>
187 ExpressionClassifier; 187 ExpressionClassifier;
188 188
189 // All implementation-specific methods must be called through this. 189 // All implementation-specific methods must be called through this.
190 Impl* impl() { return static_cast<Impl*>(this); } 190 Impl* impl() { return static_cast<Impl*>(this); }
191 const Impl* impl() const { return static_cast<const Impl*>(this); } 191 const Impl* impl() const { return static_cast<const Impl*>(this); }
192 192
193 ParserBase(Zone* zone, Scanner* scanner, uintptr_t stack_limit, 193 ParserBase(Zone* zone, Scanner* scanner, uintptr_t stack_limit,
194 v8::Extension* extension, AstValueFactory* ast_value_factory, 194 v8::Extension* extension, AstValueFactory* ast_value_factory,
195 RuntimeCallStats* runtime_call_stats) 195 RuntimeCallStats* runtime_call_stats,
196 bool parsing_on_main_thread = true)
196 : scope_state_(nullptr), 197 : scope_state_(nullptr),
197 function_state_(nullptr), 198 function_state_(nullptr),
198 extension_(extension), 199 extension_(extension),
199 fni_(nullptr), 200 fni_(nullptr),
200 ast_value_factory_(ast_value_factory), 201 ast_value_factory_(ast_value_factory),
201 ast_node_factory_(ast_value_factory), 202 ast_node_factory_(ast_value_factory),
202 runtime_call_stats_(runtime_call_stats), 203 runtime_call_stats_(runtime_call_stats),
204 parsing_on_main_thread_(parsing_on_main_thread),
203 parsing_module_(false), 205 parsing_module_(false),
204 stack_limit_(stack_limit), 206 stack_limit_(stack_limit),
205 zone_(zone), 207 zone_(zone),
206 classifier_(nullptr), 208 classifier_(nullptr),
207 scanner_(scanner), 209 scanner_(scanner),
208 stack_overflow_(false), 210 stack_overflow_(false),
209 default_eager_compile_hint_(FunctionLiteral::kShouldLazyCompile), 211 default_eager_compile_hint_(FunctionLiteral::kShouldLazyCompile),
210 allow_natives_(false), 212 allow_natives_(false),
211 allow_tailcalls_(false), 213 allow_tailcalls_(false),
212 allow_harmony_do_expressions_(false), 214 allow_harmony_do_expressions_(false),
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 1416
1415 // Parser base's protected field members. 1417 // Parser base's protected field members.
1416 1418
1417 ScopeState* scope_state_; // Scope stack. 1419 ScopeState* scope_state_; // Scope stack.
1418 FunctionState* function_state_; // Function state stack. 1420 FunctionState* function_state_; // Function state stack.
1419 v8::Extension* extension_; 1421 v8::Extension* extension_;
1420 FuncNameInferrer* fni_; 1422 FuncNameInferrer* fni_;
1421 AstValueFactory* ast_value_factory_; // Not owned. 1423 AstValueFactory* ast_value_factory_; // Not owned.
1422 typename Types::Factory ast_node_factory_; 1424 typename Types::Factory ast_node_factory_;
1423 RuntimeCallStats* runtime_call_stats_; 1425 RuntimeCallStats* runtime_call_stats_;
1426 bool parsing_on_main_thread_;
1424 bool parsing_module_; 1427 bool parsing_module_;
1425 uintptr_t stack_limit_; 1428 uintptr_t stack_limit_;
1426 1429
1427 // Parser base's private field members. 1430 // Parser base's private field members.
1428 1431
1429 private: 1432 private:
1430 Zone* zone_; 1433 Zone* zone_;
1431 ExpressionClassifier* classifier_; 1434 ExpressionClassifier* classifier_;
1432 1435
1433 Scanner* scanner_; 1436 Scanner* scanner_;
(...skipping 2446 matching lines...) Expand 10 before | Expand all | Expand 10 after
3880 return true; 3883 return true;
3881 } 3884 }
3882 } 3885 }
3883 return false; 3886 return false;
3884 } 3887 }
3885 3888
3886 template <typename Impl> 3889 template <typename Impl>
3887 typename ParserBase<Impl>::ExpressionT 3890 typename ParserBase<Impl>::ExpressionT
3888 ParserBase<Impl>::ParseArrowFunctionLiteral( 3891 ParserBase<Impl>::ParseArrowFunctionLiteral(
3889 bool accept_IN, const FormalParametersT& formal_parameters, bool* ok) { 3892 bool accept_IN, const FormalParametersT& formal_parameters, bool* ok) {
3893 const RuntimeCallStats::CounterId counters[2][2] = {
3894 {&RuntimeCallStats::ParseArrowFunctionLiteral,
3895 &RuntimeCallStats::ParseBackgroundArrowFunctionLiteral},
3896 {&RuntimeCallStats::PreParseArrowFunctionLiteral,
3897 &RuntimeCallStats::PreParseBackgroundArrowFunctionLiteral}};
3890 RuntimeCallTimerScope runtime_timer( 3898 RuntimeCallTimerScope runtime_timer(
3891 runtime_call_stats_, 3899 runtime_call_stats_,
3892 Impl::IsPreParser() ? &RuntimeCallStats::ParseArrowFunctionLiteral 3900 counters[Impl::IsPreParser()][parsing_on_main_thread_]);
3893 : &RuntimeCallStats::PreParseArrowFunctionLiteral);
3894 3901
3895 if (peek() == Token::ARROW && scanner_->HasAnyLineTerminatorBeforeNext()) { 3902 if (peek() == Token::ARROW && scanner_->HasAnyLineTerminatorBeforeNext()) {
3896 // ASI inserts `;` after arrow parameters if a line terminator is found. 3903 // ASI inserts `;` after arrow parameters if a line terminator is found.
3897 // `=> ...` is never a valid expression, so report as syntax error. 3904 // `=> ...` is never a valid expression, so report as syntax error.
3898 // If next token is not `=>`, it's a syntax error anyways. 3905 // If next token is not `=>`, it's a syntax error anyways.
3899 ReportUnexpectedTokenAt(scanner_->peek_location(), Token::ARROW); 3906 ReportUnexpectedTokenAt(scanner_->peek_location(), Token::ARROW);
3900 *ok = false; 3907 *ok = false;
3901 return impl()->EmptyExpression(); 3908 return impl()->EmptyExpression();
3902 } 3909 }
3903 3910
(...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after
5451 has_seen_constructor_ = true; 5458 has_seen_constructor_ = true;
5452 return; 5459 return;
5453 } 5460 }
5454 } 5461 }
5455 5462
5456 5463
5457 } // namespace internal 5464 } // namespace internal
5458 } // namespace v8 5465 } // namespace v8
5459 5466
5460 #endif // V8_PARSING_PARSER_BASE_H 5467 #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