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

Unified Diff: src/parsing/parser-base.h

Issue 2509683002: [counters] Use separate counters for background parsing (Closed)
Patch Set: fixing cctest 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« 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