Chromium Code Reviews| Index: src/parsing/parser-base.h |
| diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h |
| index 4fe27e2e5a364a79c103051da3159938b991e21a..6775dfefec7ebc2bae3af4073484c79d3ccf3e48 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_; |
| @@ -3889,8 +3892,13 @@ ParserBase<Impl>::ParseArrowFunctionLiteral( |
| bool accept_IN, const FormalParametersT& formal_parameters, bool* ok) { |
| RuntimeCallTimerScope runtime_timer( |
| runtime_call_stats_, |
| - Impl::IsPreParser() ? &RuntimeCallStats::ParseArrowFunctionLiteral |
| - : &RuntimeCallStats::PreParseArrowFunctionLiteral); |
| + Impl::IsPreParser() |
|
vogelheim
2016/11/16 17:23:15
style: These two-level ternary operator expression
Camillo Bruni
2016/11/16 18:21:24
You're right :)
Went with the helper array which m
|
| + ? parsing_on_main_thread_ |
| + ? &RuntimeCallStats::ParseArrowFunctionLiteral |
| + : &RuntimeCallStats::ParseBackgroundArrowFunctionLiteral |
| + : parsing_on_main_thread_ |
| + ? &RuntimeCallStats::PreParseArrowFunctionLiteral |
| + : &RuntimeCallStats::PreParseBackgroundArrowFunctionLiteral); |
| if (peek() == Token::ARROW && scanner_->HasAnyLineTerminatorBeforeNext()) { |
| // ASI inserts `;` after arrow parameters if a line terminator is found. |