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

Side by Side Diff: src/parsing/preparser.cc

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/preparser.h ('k') | test/cctest/test-parsing.cc » ('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 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // That means that contextual checks (like a label being declared where 172 // That means that contextual checks (like a label being declared where
173 // it is used) are generally omitted. 173 // it is used) are generally omitted.
174 174
175 PreParser::Expression PreParser::ParseFunctionLiteral( 175 PreParser::Expression PreParser::ParseFunctionLiteral(
176 Identifier function_name, Scanner::Location function_name_location, 176 Identifier function_name, Scanner::Location function_name_location,
177 FunctionNameValidity function_name_validity, FunctionKind kind, 177 FunctionNameValidity function_name_validity, FunctionKind kind,
178 int function_token_pos, FunctionLiteral::FunctionType function_type, 178 int function_token_pos, FunctionLiteral::FunctionType function_type,
179 LanguageMode language_mode, bool* ok) { 179 LanguageMode language_mode, bool* ok) {
180 // Function :: 180 // Function ::
181 // '(' FormalParameterList? ')' '{' FunctionBody '}' 181 // '(' FormalParameterList? ')' '{' FunctionBody '}'
182 const RuntimeCallStats::CounterId counters[2][2] = {
183 {&RuntimeCallStats::PreParseWithVariableResolution,
184 &RuntimeCallStats::PreParseBackgroundWithVariableResolution},
185 {&RuntimeCallStats::PreParseNoVariableResolution,
186 &RuntimeCallStats::PreParseBackgroundNoVariableResolution}};
182 RuntimeCallTimerScope runtime_timer( 187 RuntimeCallTimerScope runtime_timer(
183 runtime_call_stats_, 188 runtime_call_stats_,
184 track_unresolved_variables_ 189 counters[track_unresolved_variables_][parsing_on_main_thread_]);
185 ? &RuntimeCallStats::PreParseWithVariableResolution
186 : &RuntimeCallStats::PreParseNoVariableResolution);
187 190
188 // Parse function body. 191 // Parse function body.
189 PreParserStatementList body; 192 PreParserStatementList body;
190 DeclarationScope* function_scope = NewFunctionScope(kind); 193 DeclarationScope* function_scope = NewFunctionScope(kind);
191 function_scope->SetLanguageMode(language_mode); 194 function_scope->SetLanguageMode(language_mode);
192 FunctionState function_state(&function_state_, &scope_state_, function_scope); 195 FunctionState function_state(&function_state_, &scope_state_, function_scope);
193 DuplicateFinder duplicate_finder(scanner()->unicode_cache()); 196 DuplicateFinder duplicate_finder(scanner()->unicode_cache());
194 ExpressionClassifier formals_classifier(this, &duplicate_finder); 197 ExpressionClassifier formals_classifier(this, &duplicate_finder);
195 198
196 Expect(Token::LPAREN, CHECK_OK); 199 Expect(Token::LPAREN, CHECK_OK);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 } 297 }
295 } 298 }
296 } 299 }
297 300
298 #undef CHECK_OK 301 #undef CHECK_OK
299 #undef CHECK_OK_CUSTOM 302 #undef CHECK_OK_CUSTOM
300 303
301 304
302 } // namespace internal 305 } // namespace internal
303 } // namespace v8 306 } // namespace v8
OLDNEW
« no previous file with comments | « src/parsing/preparser.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698