26PreParserIdentifier GetIdentifierHelper(Scanner* scanner,
27 const AstRawString*
string,
28 AstValueFactory* avf) {
33 switch (scanner->current_token()) {
36 case Token::kPrivateName:
41 if (
string == avf->constructor_string()) {
44 if (scanner->literal_contains_escapes()) {
47 if (
string == avf->eval_string()) {
50 if (
string == avf->arguments_string()) {
71 scope->set_is_being_lazily_parsed(
true);
108 function_scope->set_is_being_lazily_parsed(
true);
132 preparse_data_builder_scope.
Start(function_scope);
145 Expect(Token::kRightParen);
150 formals_end_position);
153 Expect(Token::kLeftBrace);
162 BlockState block_state(&
scope_, inner_scope);
166 bool allow_duplicate_parameters =
false;
175 allow_duplicate_parameters =
187 if (conflict !=
nullptr)
208 allow_duplicate_parameters);
227 *produced_preparse_data =
265 FunctionParsingScope function_parsing_scope(
this);
272 RuntimeCallCounterId::kPreParseWithVariableResolution,
273 RuntimeCallStats::kThreadSpecific);
281 bool skippable_function =
false;
287 skippable_function = !
function_state_->next_function_is_likely_called() &&
289 if (skippable_function) {
290 preparse_data_builder_scope.
Start(function_scope);
295 Expect(Token::kLeftParen);
304 Expect(Token::kRightParen);
308 start_position, formals_end_position);
310 Expect(Token::kLeftBrace);
315 : function_token_pos;
316 AcceptINScope
scope(
this,
true);
318 function_syntax_kind, FunctionBodyType::kBlock);
326 function_name_location);
331 if (skippable_function) {
338 double ms = timer.Elapsed().InMillisecondsF();
339 const char* event_name =
"preparse-resolution";
342 const char* name =
"";
343 size_t name_byte_length = 0;
344 bool is_one_byte =
true;
346 if (
string !=
nullptr) {
347 name =
reinterpret_cast<const char*
>(
string->raw_data());
348 name_byte_length =
string->byte_length();
349 is_one_byte =
string->is_one_byte();
353 function_scope->
end_position(), name, name_byte_length, is_one_byte);
376 if (
scope()->AsDeclarationScope()->sloppy_eval_can_extend_vars() &&
void HoistSloppyBlockFunctions(AstNodeFactory *factory)
void DeclareArguments(AstValueFactory *ast_value_factory)
bool has_simple_parameters() const
Scanner * scanner() const
V8_INLINE void ParseStatementList(StatementListT *body, Token::Value end_token)
RuntimeCallStats * runtime_call_stats_
void ParseFormalParameterList(FormalParametersT *parameters)
void CheckConflictingVarDeclarations(DeclarationScope *scope)
bool stack_overflow() const
void ValidateFormalParameters(LanguageMode language_mode, const FormalParametersT ¶meters, bool allow_duplicates)
void CheckStrictOctalLiteral(int beg_pos, int end_pos)
FunctionState * function_state_
DeclarationScope * NewFunctionScope(FunctionKind kind, Zone *parse_zone=nullptr) const
void CheckFunctionName(LanguageMode language_mode, IdentifierT function_name, FunctionNameValidity function_name_validity, const Scanner::Location &function_name_loc)
void Expect(Token::Value token)
DeclarationScope * NewScriptScope(REPLMode repl_mode) const
internal::V8FileLogger * v8_file_logger_
V8_INLINE Token::Value peek()
void CheckArityRestrictions(int param_count, FunctionKind function_type, bool has_rest, int formals_start_pos, int formals_end_pos)
const UnoptimizedCompileFlags & flags() const
int peek_position() const
AstValueFactory * ast_value_factory() const
void ParseFunctionBody(StatementListT *body, IdentifierT function_name, int pos, const FormalParametersT ¶meters, FunctionKind kind, FunctionSyntaxKind function_syntax_kind, FunctionBodyType body_type)
int GetLastInfoId() const
V8_INLINE bool has_error() const
DeclarationScope * NewVarblockScope() const
ModuleScope * NewModuleScope(DeclarationScope *parent) const
std::vector< void * > * pointer_buffer()
typename v8::internal::ParameterDeclarationParsingScope< Types > ParameterDeclarationParsingScope
LanguageMode language_mode()
static PreParserBlock Default()
static PreParserExpression Default()
static PreParserIdentifier Eval()
static PreParserIdentifier Arguments()
static PreParserIdentifier Async()
const AstRawString * string_
static PreParserIdentifier PrivateName()
static PreParserIdentifier Default()
static PreParserIdentifier Constructor()
void LogFunction(int end, int num_parameters, int function_length, int num_inner_infos)
V8_INLINE void ReportVarRedeclarationIn(const AstRawString *name, Scope *scope)
V8_INLINE void DeclareFunctionNameVar(const AstRawString *function_name, FunctionSyntaxKind function_syntax_kind, DeclarationScope *function_scope)
PreParserIdentifier GetIdentifier() const
PreParserBlock BuildParameterInitializationBlock(const PreParserFormalParameters ¶meters)
bool IdentifierEquals(const PreParserIdentifier &identifier, const AstRawString *other)
V8_EXPORT_PRIVATE PreParseResult PreParseProgram()
PreParseResult PreParseFunction(const AstRawString *function_name, FunctionKind kind, FunctionSyntaxKind function_syntax_kind, DeclarationScope *function_scope, int *use_counts, ProducedPreparseData **produced_preparser_scope_data)
PreparseDataBuilder * preparse_data_builder_
V8_INLINE void ReportUnidentifiableError()
V8_INLINE void SetLanguageMode(Scope *scope, LanguageMode mode)
Expression ParseFunctionLiteral(Identifier name, Scanner::Location function_name_location, FunctionNameValidity function_name_validity, FunctionKind kind, int function_token_pos, FunctionSyntaxKind function_syntax_kind, LanguageMode language_mode, ZonePtrList< const AstRawString > *arguments_for_wrapped_function)
@ kPreParseNotIdentifiableError
void ParseStatementListAndLogFunction(PreParserFormalParameters *formals)
PendingCompilationErrorHandler * pending_error_handler()
void SetSkippableFunction(DeclarationScope *function_scope, int function_length, int num_inner_functions)
void Start(DeclarationScope *function_scope)
PreparseDataBuilder * parent() const
static ProducedPreparseData * For(PreparseDataBuilder *builder, Zone *zone)
const AstRawString * CurrentSymbol(AstValueFactory *ast_value_factory) const
const Location & location() const
const Location & peek_location() const
void SetLanguageMode(LanguageMode language_mode)
void set_end_position(int statement_pos)
ScopeType scope_type() const
const AstRawString * FindVariableDeclaredIn(Scope *scope, VariableMode mode_limit)
void set_start_position(int statement_pos)
Scope * FinalizeBlockScope()
LanguageMode language_mode() const
int start_position() const
void FunctionEvent(const char *reason, int script_id, double time_delta_ms, int start_position, int end_position, Tagged< String > function_name)
ZoneVector< RpoNumber > & result
bool IsArrowFunction(FunctionKind kind)
bool is_sloppy(LanguageMode language_mode)
constexpr int kNoSourcePosition
@ kLastLexicalVariableMode
bool IsConciseMethod(FunctionKind kind)
bool is_strict(LanguageMode language_mode)
V8_EXPORT_PRIVATE FlagValues v8_flags
#define DCHECK_NOT_NULL(val)
#define DCHECK_IMPLIES(v1, v2)
#define DCHECK_NE(v1, v2)
#define DCHECK(condition)
#define DCHECK_EQ(v1, v2)
#define V8_UNLIKELY(condition)