v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
ast.h File Reference
#include <algorithm>
#include <iostream>
#include <map>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <vector>
#include "src/numbers/integer-literal.h"
#include "src/torque/constants.h"
#include "src/torque/source-positions.h"
#include "src/torque/utils.h"
Include dependency graph for ast.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  v8::internal::torque::AstNode
 
struct  v8::internal::torque::AstNodeClassCheck
 
struct  v8::internal::torque::Expression
 
struct  v8::internal::torque::LocationExpression
 
struct  v8::internal::torque::TypeExpression
 
struct  v8::internal::torque::Declaration
 
struct  v8::internal::torque::Statement
 
struct  v8::internal::torque::NamespaceDeclaration
 
struct  v8::internal::torque::EnumDescription
 
struct  v8::internal::torque::EnumDescription::Entry
 
class  v8::internal::torque::Ast
 
struct  v8::internal::torque::Identifier
 
struct  v8::internal::torque::IdentifierPtrValueEq
 
struct  v8::internal::torque::IdentifierExpression
 
struct  v8::internal::torque::IntrinsicCallExpression
 
struct  v8::internal::torque::CallMethodExpression
 
struct  v8::internal::torque::CallExpression
 
struct  v8::internal::torque::NameAndExpression
 
struct  v8::internal::torque::StructExpression
 
struct  v8::internal::torque::LogicalOrExpression
 
struct  v8::internal::torque::LogicalAndExpression
 
struct  v8::internal::torque::SpreadExpression
 
struct  v8::internal::torque::ConditionalExpression
 
struct  v8::internal::torque::StringLiteralExpression
 
struct  v8::internal::torque::IntegerLiteralExpression
 
struct  v8::internal::torque::FloatingPointLiteralExpression
 
struct  v8::internal::torque::ElementAccessExpression
 
struct  v8::internal::torque::FieldAccessExpression
 
struct  v8::internal::torque::DereferenceExpression
 
struct  v8::internal::torque::AssignmentExpression
 
struct  v8::internal::torque::IncrementDecrementExpression
 
struct  v8::internal::torque::AssumeTypeImpossibleExpression
 
struct  v8::internal::torque::NewExpression
 
struct  v8::internal::torque::ParameterList
 
struct  v8::internal::torque::BasicTypeExpression
 
struct  v8::internal::torque::FunctionTypeExpression
 
struct  v8::internal::torque::PrecomputedTypeExpression
 
struct  v8::internal::torque::UnionTypeExpression
 
struct  v8::internal::torque::ExpressionStatement
 
struct  v8::internal::torque::IfStatement
 
struct  v8::internal::torque::WhileStatement
 
struct  v8::internal::torque::ReturnStatement
 
struct  v8::internal::torque::DebugStatement
 
struct  v8::internal::torque::AssertStatement
 
struct  v8::internal::torque::TailCallStatement
 
struct  v8::internal::torque::VarDeclarationStatement
 
struct  v8::internal::torque::BreakStatement
 
struct  v8::internal::torque::ContinueStatement
 
struct  v8::internal::torque::GotoStatement
 
struct  v8::internal::torque::ForLoopStatement
 
struct  v8::internal::torque::TryHandler
 
struct  v8::internal::torque::StatementExpression
 
struct  v8::internal::torque::TryLabelExpression
 
struct  v8::internal::torque::BlockStatement
 
struct  v8::internal::torque::TypeDeclaration
 
struct  v8::internal::torque::InstanceTypeConstraints
 
struct  v8::internal::torque::AbstractTypeDeclaration
 
struct  v8::internal::torque::TypeAliasDeclaration
 
struct  v8::internal::torque::NameAndTypeExpression
 
struct  v8::internal::torque::ImplicitParameters
 
struct  v8::internal::torque::StructFieldExpression
 
struct  v8::internal::torque::BitFieldDeclaration
 
struct  v8::internal::torque::ConditionalAnnotation
 
struct  v8::internal::torque::AnnotationParameter
 
struct  v8::internal::torque::Annotation
 
struct  v8::internal::torque::ClassFieldIndexInfo
 
struct  v8::internal::torque::ClassFieldExpression
 
struct  v8::internal::torque::LabelAndTypes
 
struct  v8::internal::torque::CallableDeclaration
 
struct  v8::internal::torque::MacroDeclaration
 
struct  v8::internal::torque::ExternalMacroDeclaration
 
struct  v8::internal::torque::IntrinsicDeclaration
 
struct  v8::internal::torque::TorqueMacroDeclaration
 
struct  v8::internal::torque::BuiltinDeclaration
 
struct  v8::internal::torque::ExternalBuiltinDeclaration
 
struct  v8::internal::torque::TorqueBuiltinDeclaration
 
struct  v8::internal::torque::ExternalRuntimeDeclaration
 
struct  v8::internal::torque::ConstDeclaration
 
struct  v8::internal::torque::GenericParameter
 
struct  v8::internal::torque::GenericCallableDeclaration
 
struct  v8::internal::torque::GenericTypeDeclaration
 
struct  v8::internal::torque::SpecializationDeclaration
 
struct  v8::internal::torque::ExternConstDeclaration
 
struct  v8::internal::torque::StructDeclaration
 
struct  v8::internal::torque::BitFieldStructDeclaration
 
struct  v8::internal::torque::ClassBody
 
struct  v8::internal::torque::ClassDeclaration
 
struct  v8::internal::torque::CppIncludeDeclaration
 

Namespaces

namespace  v8
 
namespace  v8::internal
 
namespace  v8::internal::torque
 

Macros

#define AST_EXPRESSION_NODE_KIND_LIST(V)
 
#define AST_TYPE_EXPRESSION_NODE_KIND_LIST(V)
 
#define AST_STATEMENT_NODE_KIND_LIST(V)
 
#define AST_TYPE_DECLARATION_NODE_KIND_LIST(V)
 
#define AST_DECLARATION_NODE_KIND_LIST(V)
 
#define AST_NODE_KIND_LIST(V)
 
#define ENUM_ITEM(name)
 
#define DEFINE_AST_NODE_LEAF_BOILERPLATE(T)
 
#define DEFINE_AST_NODE_INNER_BOILERPLATE(T)
 
#define ENUM_ITEM(name)
 

Typedefs

using v8::internal::torque::LabelAndTypesVector = std::vector<LabelAndTypes>
 
using v8::internal::torque::GenericParameters = std::vector<GenericParameter>
 

Enumerations

enum class  v8::internal::torque::IncrementDecrementOperator { v8::internal::torque::kIncrement , v8::internal::torque::kDecrement }
 
enum class  v8::internal::torque::ImplicitKind { v8::internal::torque::kNoImplicit , v8::internal::torque::kJSImplicit , v8::internal::torque::kImplicit }
 
enum class  v8::internal::torque::ConditionalAnnotationType { v8::internal::torque::kPositive , v8::internal::torque::kNegative }
 

Functions

std::ostream & v8::internal::torque::operator<< (std::ostream &os, Identifier *id)
 
bool v8::internal::torque::IsDeferred (Statement *stmt)
 
 v8::internal::torque::DECLARE_CONTEXTUAL_VARIABLE (CurrentAst, Ast)
 
template<class T , class... Args>
Tv8::internal::torque::MakeNode (Args... args)
 
FieldAccessExpressionv8::internal::torque::MakeFieldAccessExpression (Expression *object, std::string field)
 
IdentifierExpressionv8::internal::torque::MakeIdentifierExpression (std::vector< std::string > namespace_qualification, std::string name, std::vector< TypeExpression * > args={})
 
IdentifierExpressionv8::internal::torque::MakeIdentifierExpression (std::string name)
 
CallExpressionv8::internal::torque::MakeCallExpression (IdentifierExpression *callee, std::vector< Expression * > arguments, std::vector< Identifier * > labels={})
 
CallExpressionv8::internal::torque::MakeCallExpression (std::string callee, std::vector< Expression * > arguments, std::vector< Identifier * > labels={})
 
VarDeclarationStatementv8::internal::torque::MakeConstDeclarationStatement (std::string name, Expression *initializer)
 
BasicTypeExpressionv8::internal::torque::MakeBasicTypeExpression (std::vector< std::string > namespace_qualification, Identifier *name, std::vector< TypeExpression * > generic_arguments={})
 
StructExpressionv8::internal::torque::MakeStructExpression (TypeExpression *type, std::vector< NameAndExpression > initializers)
 

Variables

static const char *const v8::internal::torque::kThisParameterName = "this"
 

Macro Definition Documentation

◆ AST_DECLARATION_NODE_KIND_LIST

#define AST_DECLARATION_NODE_KIND_LIST ( V)
Value:
V(GenericCallableDeclaration) \
V(GenericTypeDeclaration) \
V(SpecializationDeclaration) \
V(ExternConstDeclaration) \
V(NamespaceDeclaration) \
V(ConstDeclaration) \
V(CppIncludeDeclaration) \
V(TorqueMacroDeclaration) \
V(TorqueBuiltinDeclaration) \
V(ExternalMacroDeclaration) \
V(ExternalBuiltinDeclaration) \
V(ExternalRuntimeDeclaration) \
V(IntrinsicDeclaration)
#define V(Name)
#define AST_TYPE_DECLARATION_NODE_KIND_LIST(V)
Definition ast.h:68

Definition at line 75 of file ast.h.

◆ AST_EXPRESSION_NODE_KIND_LIST

#define AST_EXPRESSION_NODE_KIND_LIST ( V)
Value:
V(CallExpression) \
V(CallMethodExpression) \
V(IntrinsicCallExpression) \
V(StructExpression) \
V(LogicalOrExpression) \
V(LogicalAndExpression) \
V(SpreadExpression) \
V(ConditionalExpression) \
V(IdentifierExpression) \
V(StringLiteralExpression) \
V(IntegerLiteralExpression) \
V(FloatingPointLiteralExpression) \
V(FieldAccessExpression) \
V(ElementAccessExpression) \
V(DereferenceExpression) \
V(AssignmentExpression) \
V(IncrementDecrementExpression) \
V(NewExpression) \
V(AssumeTypeImpossibleExpression) \
V(StatementExpression) \
V(TryLabelExpression)

Definition at line 24 of file ast.h.

◆ AST_NODE_KIND_LIST

#define AST_NODE_KIND_LIST ( V)
Value:
AST_TYPE_EXPRESSION_NODE_KIND_LIST(V) \
AST_STATEMENT_NODE_KIND_LIST(V) \
AST_DECLARATION_NODE_KIND_LIST(V) \
V(Identifier) \
V(TryHandler) \
V(ClassBody)
#define AST_EXPRESSION_NODE_KIND_LIST(V)
Definition ast.h:24

Definition at line 91 of file ast.h.

◆ AST_STATEMENT_NODE_KIND_LIST

#define AST_STATEMENT_NODE_KIND_LIST ( V)
Value:
V(BlockStatement) \
V(ExpressionStatement) \
V(IfStatement) \
V(WhileStatement) \
V(ForLoopStatement) \
V(BreakStatement) \
V(ContinueStatement) \
V(ReturnStatement) \
V(DebugStatement) \
V(AssertStatement) \
V(TailCallStatement) \
V(VarDeclarationStatement) \
V(GotoStatement)

Definition at line 53 of file ast.h.

◆ AST_TYPE_DECLARATION_NODE_KIND_LIST

#define AST_TYPE_DECLARATION_NODE_KIND_LIST ( V)
Value:
V(AbstractTypeDeclaration) \
V(TypeAliasDeclaration) \
V(BitFieldStructDeclaration) \
V(ClassDeclaration) \
V(StructDeclaration)

Definition at line 68 of file ast.h.

◆ AST_TYPE_EXPRESSION_NODE_KIND_LIST

#define AST_TYPE_EXPRESSION_NODE_KIND_LIST ( V)
Value:
V(BasicTypeExpression) \
V(FunctionTypeExpression) \
V(PrecomputedTypeExpression) \
V(UnionTypeExpression)

Definition at line 47 of file ast.h.

◆ DEFINE_AST_NODE_INNER_BOILERPLATE

#define DEFINE_AST_NODE_INNER_BOILERPLATE ( T)
Value:
static T* cast(AstNode* node) { \
DCHECK(AstNodeClassCheck::IsInstanceOf<T>(node)); \
return static_cast<T*>(node); \
} \
static T* DynamicCast(AstNode* node) { \
if (!node) return nullptr; \
if (!AstNodeClassCheck::IsInstanceOf<T>(node)) return nullptr; \
return static_cast<T*>(node); \
}
Node * node
uint32_t cast

Definition at line 134 of file ast.h.

◆ DEFINE_AST_NODE_LEAF_BOILERPLATE

#define DEFINE_AST_NODE_LEAF_BOILERPLATE ( T)
Value:
static const Kind kKind = Kind::k##T; \
static T* cast(AstNode* node) { \
DCHECK_EQ(node->kind, kKind); \
return static_cast<T*>(node); \
} \
static T* DynamicCast(AstNode* node) { \
if (!node) return nullptr; \
if (node->kind != kKind) return nullptr; \
return static_cast<T*>(node); \
}
#define T

Definition at line 121 of file ast.h.

◆ ENUM_ITEM [1/2]

#define ENUM_ITEM ( name)
Value:
k##name,
const char * name
Definition builtins.cc:39

Definition at line 103 of file ast.h.

◆ ENUM_ITEM [2/2]

#define ENUM_ITEM ( name)
Value:
case AstNode::Kind::k##name: \
return std::is_base_of<T, name>::value; \
break;

Definition at line 103 of file ast.h.