Index: src/parsing/parser-base.h |
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h |
index 4fe27e2e5a364a79c103051da3159938b991e21a..085d4017a1f81640d5f741e064cf0a3943706a23 100644 |
--- a/src/parsing/parser-base.h |
+++ b/src/parsing/parser-base.h |
@@ -192,7 +192,8 @@ class ParserBase { |
ParserBase(Zone* zone, Scanner* scanner, uintptr_t stack_limit, |
v8::Extension* extension, AstValueFactory* ast_value_factory, |
- RuntimeCallStats* runtime_call_stats) |
+ RuntimeCallStats* runtime_call_stats, |
+ bool parsing_on_main_thread = true) |
: scope_state_(nullptr), |
function_state_(nullptr), |
extension_(extension), |
@@ -200,6 +201,7 @@ class ParserBase { |
ast_value_factory_(ast_value_factory), |
ast_node_factory_(ast_value_factory), |
runtime_call_stats_(runtime_call_stats), |
+ parsing_on_main_thread_(parsing_on_main_thread), |
parsing_module_(false), |
stack_limit_(stack_limit), |
zone_(zone), |
@@ -1421,6 +1423,7 @@ class ParserBase { |
AstValueFactory* ast_value_factory_; // Not owned. |
typename Types::Factory ast_node_factory_; |
RuntimeCallStats* runtime_call_stats_; |
+ bool parsing_on_main_thread_; |
bool parsing_module_; |
uintptr_t stack_limit_; |
@@ -3887,10 +3890,14 @@ template <typename Impl> |
typename ParserBase<Impl>::ExpressionT |
ParserBase<Impl>::ParseArrowFunctionLiteral( |
bool accept_IN, const FormalParametersT& formal_parameters, bool* ok) { |
+ const RuntimeCallStats::CounterId counters[2][2] = { |
+ {&RuntimeCallStats::ParseArrowFunctionLiteral, |
+ &RuntimeCallStats::ParseBackgroundArrowFunctionLiteral}, |
+ {&RuntimeCallStats::PreParseArrowFunctionLiteral, |
+ &RuntimeCallStats::PreParseBackgroundArrowFunctionLiteral}}; |
RuntimeCallTimerScope runtime_timer( |
runtime_call_stats_, |
- Impl::IsPreParser() ? &RuntimeCallStats::ParseArrowFunctionLiteral |
- : &RuntimeCallStats::PreParseArrowFunctionLiteral); |
+ counters[Impl::IsPreParser()][parsing_on_main_thread_]); |
if (peek() == Token::ARROW && scanner_->HasAnyLineTerminatorBeforeNext()) { |
// ASI inserts `;` after arrow parameters if a line terminator is found. |