diff options
Diffstat (limited to 'deps/v8/src/parsing/parser.h')
-rw-r--r-- | deps/v8/src/parsing/parser.h | 124 |
1 files changed, 66 insertions, 58 deletions
diff --git a/deps/v8/src/parsing/parser.h b/deps/v8/src/parsing/parser.h index 2da4490906..2dec83b274 100644 --- a/deps/v8/src/parsing/parser.h +++ b/deps/v8/src/parsing/parser.h @@ -125,12 +125,12 @@ struct ParserTypes<Parser> { typedef ClassLiteral::Property* ClassLiteralProperty; typedef v8::internal::Suspend* Suspend; typedef v8::internal::RewritableExpression* RewritableExpression; - typedef ZoneList<v8::internal::Expression*>* ExpressionList; - typedef ZoneList<ObjectLiteral::Property*>* ObjectPropertyList; - typedef ZoneList<ClassLiteral::Property*>* ClassPropertyList; + typedef ZonePtrList<v8::internal::Expression>* ExpressionList; + typedef ZonePtrList<ObjectLiteral::Property>* ObjectPropertyList; + typedef ZonePtrList<ClassLiteral::Property>* ClassPropertyList; typedef ParserFormalParameters FormalParameters; typedef v8::internal::Statement* Statement; - typedef ZoneList<v8::internal::Statement*>* StatementList; + typedef ZonePtrList<v8::internal::Statement>* StatementList; typedef v8::internal::Block* Block; typedef v8::internal::BreakableStatement* BreakableStatement; typedef v8::internal::ForStatement* ForStatement; @@ -163,7 +163,7 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { // This only deserializes the scope chain, but doesn't connect the scopes to // their corresponding scope infos. Therefore, looking up variables in the // deserialized scopes is not possible. - void DeserializeScopeChain(ParseInfo* info, + void DeserializeScopeChain(Isolate* isolate, ParseInfo* info, MaybeHandle<ScopeInfo> maybe_outer_scope_info); // Move statistics to Isolate @@ -216,20 +216,22 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { FunctionLiteral* ParseFunction(Isolate* isolate, ParseInfo* info, Handle<SharedFunctionInfo> shared_info); - FunctionLiteral* DoParseFunction(ParseInfo* info, + FunctionLiteral* DoParseFunction(Isolate* isolate, ParseInfo* info, const AstRawString* raw_name); // Called by ParseProgram after setting up the scanner. - FunctionLiteral* DoParseProgram(ParseInfo* info); + FunctionLiteral* DoParseProgram(Isolate* isolate, ParseInfo* info); // Parse with the script as if the source is implicitly wrapped in a function. // We manually construct the AST and scopes for a top-level function and the // function wrapper. - void ParseWrapped(ParseInfo* info, ZoneList<Statement*>* body, - DeclarationScope* scope, Zone* zone, bool* ok); + void ParseWrapped(Isolate* isolate, ParseInfo* info, + ZonePtrList<Statement>* body, DeclarationScope* scope, + Zone* zone, bool* ok); - ZoneList<const AstRawString*>* PrepareWrappedArguments(ParseInfo* info, - Zone* zone); + ZonePtrList<const AstRawString>* PrepareWrappedArguments(Isolate* isolate, + ParseInfo* info, + Zone* zone); void StitchAst(ParseInfo* top_level_parse_info, Isolate* isolate); @@ -247,7 +249,6 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { SET_ALLOW(harmony_dynamic_import); SET_ALLOW(harmony_import_meta); SET_ALLOW(harmony_bigint); - SET_ALLOW(harmony_optional_catch_binding); SET_ALLOW(harmony_private_fields); SET_ALLOW(eval_cache); #undef SET_ALLOW @@ -255,15 +256,15 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { return reusable_preparser_; } - void ParseModuleItemList(ZoneList<Statement*>* body, bool* ok); + void ParseModuleItemList(ZonePtrList<Statement>* body, bool* ok); Statement* ParseModuleItem(bool* ok); const AstRawString* ParseModuleSpecifier(bool* ok); void ParseImportDeclaration(bool* ok); Statement* ParseExportDeclaration(bool* ok); Statement* ParseExportDefault(bool* ok); - void ParseExportClause(ZoneList<const AstRawString*>* export_names, + void ParseExportClause(ZonePtrList<const AstRawString>* export_names, ZoneList<Scanner::Location>* export_locations, - ZoneList<const AstRawString*>* local_names, + ZonePtrList<const AstRawString>* local_names, Scanner::Location* reserved_loc, bool* ok); struct NamedImport : public ZoneObject { const AstRawString* import_name; @@ -275,13 +276,13 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { local_name(local_name), location(location) {} }; - ZoneList<const NamedImport*>* ParseNamedImports(int pos, bool* ok); + ZonePtrList<const NamedImport>* ParseNamedImports(int pos, bool* ok); Block* BuildInitializationBlock(DeclarationParsingResult* parsing_result, - ZoneList<const AstRawString*>* names, + ZonePtrList<const AstRawString>* names, bool* ok); - ZoneList<const AstRawString*>* DeclareLabel( - ZoneList<const AstRawString*>* labels, VariableProxy* expr, bool* ok); - bool ContainsLabel(ZoneList<const AstRawString*>* labels, + ZonePtrList<const AstRawString>* DeclareLabel( + ZonePtrList<const AstRawString>* labels, VariableProxy* expr, bool* ok); + bool ContainsLabel(ZonePtrList<const AstRawString>* labels, const AstRawString* label); Expression* RewriteReturn(Expression* return_value, int pos); Statement* RewriteSwitchStatement(SwitchStatement* switch_statement, @@ -294,10 +295,10 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { const SourceRange& finally_range, const CatchInfo& catch_info, int pos); void ParseAndRewriteGeneratorFunctionBody(int pos, FunctionKind kind, - ZoneList<Statement*>* body, + ZonePtrList<Statement>* body, bool* ok); void ParseAndRewriteAsyncGeneratorFunctionBody(int pos, FunctionKind kind, - ZoneList<Statement*>* body, + ZonePtrList<Statement>* body, bool* ok); void DeclareFunctionNameVar(const AstRawString* function_name, FunctionLiteral::FunctionType function_type, @@ -306,14 +307,14 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { Statement* DeclareFunction(const AstRawString* variable_name, FunctionLiteral* function, VariableMode mode, int pos, bool is_sloppy_block_function, - ZoneList<const AstRawString*>* names, bool* ok); + ZonePtrList<const AstRawString>* names, bool* ok); Variable* CreateSyntheticContextVariable(const AstRawString* synthetic_name, bool* ok); FunctionLiteral* CreateInitializerFunction( - DeclarationScope* scope, ZoneList<ClassLiteral::Property*>* fields); + DeclarationScope* scope, ZonePtrList<ClassLiteral::Property>* fields); V8_INLINE Statement* DeclareClass(const AstRawString* variable_name, Expression* value, - ZoneList<const AstRawString*>* names, + ZonePtrList<const AstRawString>* names, int class_token_pos, int end_pos, bool* ok); V8_INLINE void DeclareClassVariable(const AstRawString* name, ClassInfo* class_info, @@ -341,7 +342,7 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { void DeclareAndInitializeVariables( Block* block, const DeclarationDescriptor* declaration_descriptor, const DeclarationParsingResult::Declaration* declaration, - ZoneList<const AstRawString*>* names, bool* ok); + ZonePtrList<const AstRawString>* names, bool* ok); void RewriteDestructuringAssignment(RewritableExpression* expr); Expression* RewriteDestructuringAssignment(Assignment* assignment); @@ -382,7 +383,8 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { FunctionNameValidity function_name_validity, FunctionKind kind, int function_token_position, FunctionLiteral::FunctionType type, LanguageMode language_mode, - ZoneList<const AstRawString*>* arguments_for_wrapped_function, bool* ok); + ZonePtrList<const AstRawString>* arguments_for_wrapped_function, + bool* ok); ObjectLiteral* InitializeObjectLiteral(ObjectLiteral* object_literal) { object_literal->CalculateEmitStore(main_zone()); @@ -447,13 +449,14 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { const ParserFormalParameters& parameters, bool* ok); Block* BuildRejectPromiseOnException(Block* block); - ZoneList<Statement*>* ParseFunction( + ZonePtrList<Statement>* ParseFunction( const AstRawString* function_name, int pos, FunctionKind kind, FunctionLiteral::FunctionType function_type, DeclarationScope* function_scope, int* num_parameters, int* function_length, bool* has_duplicate_parameters, int* expected_property_count, int* suspend_count, - ZoneList<const AstRawString*>* arguments_for_wrapped_function, bool* ok); + ZonePtrList<const AstRawString>* arguments_for_wrapped_function, + bool* ok); void ThrowPendingError(Isolate* isolate, Handle<Script> script); @@ -462,9 +465,9 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { TemplateLiteral(Zone* zone, int pos) : cooked_(8, zone), raw_(8, zone), expressions_(8, zone), pos_(pos) {} - const ZoneList<const AstRawString*>* cooked() const { return &cooked_; } - const ZoneList<const AstRawString*>* raw() const { return &raw_; } - const ZoneList<Expression*>* expressions() const { return &expressions_; } + const ZonePtrList<const AstRawString>* cooked() const { return &cooked_; } + const ZonePtrList<const AstRawString>* raw() const { return &raw_; } + const ZonePtrList<Expression>* expressions() const { return &expressions_; } int position() const { return pos_; } void AddTemplateSpan(const AstRawString* cooked, const AstRawString* raw, @@ -480,9 +483,9 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { } private: - ZoneList<const AstRawString*> cooked_; - ZoneList<const AstRawString*> raw_; - ZoneList<Expression*> expressions_; + ZonePtrList<const AstRawString> cooked_; + ZonePtrList<const AstRawString> raw_; + ZonePtrList<Expression> expressions_; int pos_; }; @@ -502,10 +505,10 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { Expression* CloseTemplateLiteral(TemplateLiteralState* state, int start, Expression* tag); - ArrayLiteral* ArrayLiteralFromListWithSpread(ZoneList<Expression*>* list); - Expression* SpreadCall(Expression* function, ZoneList<Expression*>* args, + ArrayLiteral* ArrayLiteralFromListWithSpread(ZonePtrList<Expression>* list); + Expression* SpreadCall(Expression* function, ZonePtrList<Expression>* args, int pos, Call::PossiblyEval is_possibly_eval); - Expression* SpreadCallNew(Expression* function, ZoneList<Expression*>* args, + Expression* SpreadCallNew(Expression* function, ZonePtrList<Expression>* args, int pos); Expression* RewriteSuperCall(Expression* call_expression); @@ -541,15 +544,16 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { Statement* FinalizeForOfStatement(ForOfStatement* loop, Variable* completion, IteratorType type, int pos); - void BuildIteratorClose(ZoneList<Statement*>* statements, Variable* iterator, - Variable* input, Variable* output, IteratorType type); - void BuildIteratorCloseForCompletion(ZoneList<Statement*>* statements, + void BuildIteratorClose(ZonePtrList<Statement>* statements, + Variable* iterator, Variable* input, Variable* output, + IteratorType type); + void BuildIteratorCloseForCompletion(ZonePtrList<Statement>* statements, Variable* iterator, Expression* completion, IteratorType type); Statement* CheckCallable(Variable* var, Expression* error, int pos); - V8_INLINE void RewriteAsyncFunctionBody(ZoneList<Statement*>* body, + V8_INLINE void RewriteAsyncFunctionBody(ZonePtrList<Statement>* body, Block* block, Expression* return_value, bool* ok); @@ -709,7 +713,8 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { // A shortcut for performing a ToString operation V8_INLINE Expression* ToString(Expression* expr) { if (expr->IsStringLiteral()) return expr; - ZoneList<Expression*>* args = new (zone()) ZoneList<Expression*>(1, zone()); + ZonePtrList<Expression>* args = + new (zone()) ZonePtrList<Expression>(1, zone()); args->Add(expr, zone()); return factory()->NewCallRuntime(Runtime::kInlineToString, args, expr->position()); @@ -795,10 +800,12 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { V8_INLINE static std::nullptr_t NullIdentifier() { return nullptr; } V8_INLINE static std::nullptr_t NullExpression() { return nullptr; } V8_INLINE static std::nullptr_t NullLiteralProperty() { return nullptr; } - V8_INLINE static ZoneList<Expression*>* NullExpressionList() { + V8_INLINE static ZonePtrList<Expression>* NullExpressionList() { + return nullptr; + } + V8_INLINE static ZonePtrList<Statement>* NullStatementList() { return nullptr; } - V8_INLINE static ZoneList<Statement*>* NullStatementList() { return nullptr; } V8_INLINE static std::nullptr_t NullStatement() { return nullptr; } template <typename T> @@ -856,23 +863,23 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { return factory()->NewStringLiteral(symbol, pos); } - V8_INLINE ZoneList<Expression*>* NewExpressionList(int size) const { - return new (zone()) ZoneList<Expression*>(size, zone()); + V8_INLINE ZonePtrList<Expression>* NewExpressionList(int size) const { + return new (zone()) ZonePtrList<Expression>(size, zone()); } - V8_INLINE ZoneList<ObjectLiteral::Property*>* NewObjectPropertyList( + V8_INLINE ZonePtrList<ObjectLiteral::Property>* NewObjectPropertyList( int size) const { - return new (zone()) ZoneList<ObjectLiteral::Property*>(size, zone()); + return new (zone()) ZonePtrList<ObjectLiteral::Property>(size, zone()); } - V8_INLINE ZoneList<ClassLiteral::Property*>* NewClassPropertyList( + V8_INLINE ZonePtrList<ClassLiteral::Property>* NewClassPropertyList( int size) const { - return new (zone()) ZoneList<ClassLiteral::Property*>(size, zone()); + return new (zone()) ZonePtrList<ClassLiteral::Property>(size, zone()); } - V8_INLINE ZoneList<Statement*>* NewStatementList(int size) const { - return new (zone()) ZoneList<Statement*>(size, zone()); + V8_INLINE ZonePtrList<Statement>* NewStatementList(int size) const { + return new (zone()) ZonePtrList<Statement>(size, zone()); } V8_INLINE Expression* NewV8Intrinsic(const AstRawString* name, - ZoneList<Expression*>* args, int pos, + ZonePtrList<Expression>* args, int pos, bool* ok); V8_INLINE Statement* NewThrowStatement(Expression* exception, int pos) { @@ -881,7 +888,7 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { } V8_INLINE void AddParameterInitializationBlock( - const ParserFormalParameters& parameters, ZoneList<Statement*>* body, + const ParserFormalParameters& parameters, ZonePtrList<Statement>* body, bool is_async, bool* ok) { if (parameters.is_simple) return; auto* init_block = BuildParameterInitializationBlock(parameters, ok); @@ -923,8 +930,9 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { // BuildParamerterInitializationBlock. scope->DeclareParameter( is_simple ? parameter->name : ast_value_factory()->empty_string(), - is_simple ? VAR : TEMPORARY, is_optional, parameter->is_rest, - has_duplicate, ast_value_factory(), parameter->position); + is_simple ? VariableMode::kVar : VariableMode::kTemporary, + is_optional, parameter->is_rest, has_duplicate, ast_value_factory(), + parameter->position); } } @@ -934,7 +942,7 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) { Scanner::Location* duplicate_loc, bool* ok); - Expression* ExpressionListToExpression(ZoneList<Expression*>* args); + Expression* ExpressionListToExpression(ZonePtrList<Expression>* args); void SetFunctionNameFromPropertyName(LiteralProperty* property, const AstRawString* name, |