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

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

Issue 2490643002: [counters] Implement off-isolate RuntimeCallStats for the Preparser (Closed)
Patch Set: fixing declaration 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 const AstRawString* result = scanner()->CurrentSymbol(ast_value_factory()); 79 const AstRawString* result = scanner()->CurrentSymbol(ast_value_factory());
80 DCHECK_NOT_NULL(result); 80 DCHECK_NOT_NULL(result);
81 symbol.string_ = result; 81 symbol.string_ = result;
82 } 82 }
83 return symbol; 83 return symbol;
84 } 84 }
85 85
86 PreParser::PreParseResult PreParser::PreParseFunction( 86 PreParser::PreParseResult PreParser::PreParseFunction(
87 FunctionKind kind, DeclarationScope* function_scope, bool parsing_module, 87 FunctionKind kind, DeclarationScope* function_scope, bool parsing_module,
88 bool is_inner_function, bool may_abort, int* use_counts) { 88 bool is_inner_function, bool may_abort, int* use_counts) {
89 RuntimeCallTimerScope runtime_timer(
90 runtime_call_stats_,
91 track_unresolved_variables_
92 ? &RuntimeCallStats::PreParseWithVariableResolution
93 : &RuntimeCallStats::PreParseNoVariableResolution);
89 DCHECK_EQ(FUNCTION_SCOPE, function_scope->scope_type()); 94 DCHECK_EQ(FUNCTION_SCOPE, function_scope->scope_type());
90 parsing_module_ = parsing_module; 95 parsing_module_ = parsing_module;
91 use_counts_ = use_counts; 96 use_counts_ = use_counts;
92 DCHECK(!track_unresolved_variables_); 97 DCHECK(!track_unresolved_variables_);
93 track_unresolved_variables_ = is_inner_function; 98 track_unresolved_variables_ = is_inner_function;
94 99
95 // The caller passes the function_scope which is not yet inserted into the 100 // The caller passes the function_scope which is not yet inserted into the
96 // scope_state_. All scopes above the function_scope are ignored by the 101 // scope_state_. All scopes above the function_scope are ignored by the
97 // PreParser. 102 // PreParser.
98 DCHECK_NULL(scope_state_); 103 DCHECK_NULL(scope_state_);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // That means that contextual checks (like a label being declared where 177 // That means that contextual checks (like a label being declared where
173 // it is used) are generally omitted. 178 // it is used) are generally omitted.
174 179
175 PreParser::Expression PreParser::ParseFunctionLiteral( 180 PreParser::Expression PreParser::ParseFunctionLiteral(
176 Identifier function_name, Scanner::Location function_name_location, 181 Identifier function_name, Scanner::Location function_name_location,
177 FunctionNameValidity function_name_validity, FunctionKind kind, 182 FunctionNameValidity function_name_validity, FunctionKind kind,
178 int function_token_pos, FunctionLiteral::FunctionType function_type, 183 int function_token_pos, FunctionLiteral::FunctionType function_type,
179 LanguageMode language_mode, bool* ok) { 184 LanguageMode language_mode, bool* ok) {
180 // Function :: 185 // Function ::
181 // '(' FormalParameterList? ')' '{' FunctionBody '}' 186 // '(' FormalParameterList? ')' '{' FunctionBody '}'
187 RuntimeCallTimerScope runtime_timer(
188 runtime_call_stats_,
189 track_unresolved_variables_
190 ? &RuntimeCallStats::PreParseWithVariableResolution
191 : &RuntimeCallStats::PreParseNoVariableResolution);
182 192
183 // Parse function body. 193 // Parse function body.
184 PreParserStatementList body; 194 PreParserStatementList body;
185 DeclarationScope* function_scope = NewFunctionScope(kind); 195 DeclarationScope* function_scope = NewFunctionScope(kind);
186 function_scope->SetLanguageMode(language_mode); 196 function_scope->SetLanguageMode(language_mode);
187 FunctionState function_state(&function_state_, &scope_state_, function_scope); 197 FunctionState function_state(&function_state_, &scope_state_, function_scope);
188 DuplicateFinder duplicate_finder(scanner()->unicode_cache()); 198 DuplicateFinder duplicate_finder(scanner()->unicode_cache());
189 ExpressionClassifier formals_classifier(this, &duplicate_finder); 199 ExpressionClassifier formals_classifier(this, &duplicate_finder);
190 200
191 Expect(Token::LPAREN, CHECK_OK); 201 Expect(Token::LPAREN, CHECK_OK);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 } 299 }
290 } 300 }
291 } 301 }
292 302
293 #undef CHECK_OK 303 #undef CHECK_OK
294 #undef CHECK_OK_CUSTOM 304 #undef CHECK_OK_CUSTOM
295 305
296 306
297 } // namespace internal 307 } // namespace internal
298 } // namespace v8 308 } // 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