#include "src/torque/types.h"
#include <cmath>
#include <iostream>
#include <optional>
#include "src/base/bits.h"
#include "src/torque/ast.h"
#include "src/torque/declarable.h"
#include "src/torque/global-context.h"
#include "src/torque/source-positions.h"
#include "src/torque/type-oracle.h"
#include "src/torque/type-visitor.h"
namespace v8::internal::torque {
Type::Type(const Type& other) V8_NOEXCEPT
: … { … }
Type::Type(TypeBase::Kind kind, const Type* parent,
MaybeSpecializationKey specialized_from)
: … { … }
std::string Type::ToString() const { … }
std::string Type::SimpleName() const { … }
std::string Type::GetHandleTypeName(HandleKind kind,
const std::string& type_name) const { … }
std::string Type::HandlifiedCppTypeName(HandleKind kind) const { … }
std::string Type::TagglifiedCppTypeName() const { … }
bool Type::IsSubtypeOf(const Type* supertype) const { … }
std::string Type::GetConstexprGeneratedTypeName() const { … }
std::optional<const ClassType*> Type::ClassSupertype() const { … }
std::optional<const StructType*> Type::StructSupertype() const { … }
std::optional<const AggregateType*> Type::AggregateSupertype() const { … }
const Type* Type::CommonSupertype(const Type* a, const Type* b) { … }
int Type::Depth() const { … }
bool Type::IsAbstractName(const std::string& name) const { … }
std::string Type::GetGeneratedTypeName() const { … }
std::string Type::GetGeneratedTNodeTypeName() const { … }
std::string AbstractType::GetGeneratedTypeNameImpl() const { … }
std::string AbstractType::GetGeneratedTNodeTypeNameImpl() const { … }
std::vector<TypeChecker> AbstractType::GetTypeCheckers() const { … }
std::string BuiltinPointerType::ToExplicitString() const { … }
std::string BuiltinPointerType::SimpleNameImpl() const { … }
std::string UnionType::ToExplicitString() const { … }
std::string UnionType::SimpleNameImpl() const { … }
std::string UnionType::GetGeneratedTNodeTypeNameImpl() const { … }
std::string UnionType::GetRuntimeType() const { … }
void UnionType::InsertConstexprGeneratedTypeName(std::set<std::string>& names,
const Type* t) { … }
std::string UnionType::GetConstexprGeneratedTypeName() const { … }
std::string UnionType::GetDebugType() const { … }
void UnionType::RecomputeParent() { … }
void UnionType::Subtract(const Type* t) { … }
const Type* SubtractType(const Type* a, const Type* b) { … }
std::string BitFieldStructType::ToExplicitString() const { … }
const BitField& BitFieldStructType::LookupField(const std::string& name) const { … }
void AggregateType::CheckForDuplicateFields() const { … }
std::vector<const AggregateType*> AggregateType::GetHierarchy() const { … }
bool AggregateType::HasField(const std::string& name) const { … }
const Field& AggregateType::LookupFieldInternal(const std::string& name) const { … }
const Field& AggregateType::LookupField(const std::string& name) const { … }
StructType::StructType(Namespace* nspace, const StructDeclaration* decl,
MaybeSpecializationKey specialized_from)
: … { … }
std::string StructType::GetGeneratedTypeNameImpl() const { … }
size_t StructType::PackedSize() const { … }
StructType::Classification StructType::ClassifyContents() const { … }
std::string Type::ComputeName(const std::string& basename,
MaybeSpecializationKey specialized_from) { … }
std::string StructType::SimpleNameImpl() const { … }
std::optional<const Type*> Type::MatchUnaryGeneric(const Type* type,
GenericType* generic) { … }
std::vector<Method*> AggregateType::Methods(const std::string& name) const { … }
std::string StructType::ToExplicitString() const { … }
void StructType::Finalize() const { … }
ClassType::ClassType(const Type* parent, Namespace* nspace,
const std::string& name, ClassFlags flags,
const std::string& generates, const ClassDeclaration* decl,
const TypeAlias* alias)
: … { … }
std::string ClassType::GetGeneratedTNodeTypeNameImpl() const { … }
std::string ClassType::GetGeneratedTypeNameImpl() const { … }
std::string ClassType::ToExplicitString() const { … }
bool ClassType::AllowInstantiation() const { … }
void ClassType::Finalize() const { … }
std::vector<Field> ClassType::ComputeAllFields() const { … }
std::vector<Field> ClassType::ComputeHeaderFields() const { … }
std::vector<Field> ClassType::ComputeArrayFields() const { … }
void ClassType::InitializeInstanceTypes(
std::optional<int> own, std::optional<std::pair<int, int>> range) const { … }
std::optional<int> ClassType::OwnInstanceType() const { … }
std::optional<std::pair<int, int>> ClassType::InstanceTypeRange() const { … }
namespace {
void ComputeSlotKindsHelper(std::vector<ObjectSlotKind>* slots,
size_t start_offset,
const std::vector<Field>& fields) { … }
}
std::vector<ObjectSlotKind> ClassType::ComputeHeaderSlotKinds() const { … }
std::optional<ObjectSlotKind> ClassType::ComputeArraySlotKind() const { … }
bool ClassType::HasNoPointerSlotsExceptMap() const { … }
bool ClassType::HasIndexedFieldsIncludingInParents() const { … }
const Field* ClassType::GetFieldPreceding(size_t field_index) const { … }
const ClassType* ClassType::GetClassDeclaringField(const Field& f) const { … }
std::string ClassType::GetSliceMacroName(const Field& field) const { … }
void ClassType::GenerateAccessors() { … }
void ClassType::GenerateSliceAccessor(size_t field_index) { … }
bool ClassType::HasStaticSize() const { … }
SourceId ClassType::AttributedToFile() const { … }
void PrintSignature(std::ostream& os, const Signature& sig, bool with_names) { … }
std::ostream& operator<<(std::ostream& os, const NameAndType& name_and_type) { … }
std::ostream& operator<<(std::ostream& os, const Field& field) { … }
std::ostream& operator<<(std::ostream& os, const Signature& sig) { … }
std::ostream& operator<<(std::ostream& os, const TypeVector& types) { … }
std::ostream& operator<<(std::ostream& os, const ParameterTypes& p) { … }
bool Signature::HasSameTypesAs(const Signature& other,
ParameterMode mode) const { … }
namespace {
bool FirstTypeIsContext(const std::vector<const Type*> parameter_types) { … }
}
bool Signature::HasContextParameter() const { … }
bool BuiltinPointerType::HasContextParameter() const { … }
bool IsAssignableFrom(const Type* to, const Type* from) { … }
bool operator<(const Type& a, const Type& b) { … }
VisitResult ProjectStructField(VisitResult structure,
const std::string& fieldname) { … }
namespace {
void AppendLoweredTypes(const Type* type, std::vector<const Type*>* result) { … }
}
TypeVector LowerType(const Type* type) { … }
size_t LoweredSlotCount(const Type* type) { … }
TypeVector LowerParameterTypes(const TypeVector& parameters) { … }
TypeVector LowerParameterTypes(const ParameterTypes& parameter_types,
size_t arg_count) { … }
VisitResult VisitResult::NeverResult() { … }
VisitResult VisitResult::TopTypeResult(std::string top_reason,
const Type* from_type) { … }
std::tuple<size_t, std::string> Field::GetFieldSizeInformation() const { … }
size_t Type::AlignmentLog2() const { … }
size_t AbstractType::AlignmentLog2() const { … }
size_t StructType::AlignmentLog2() const { … }
void Field::ValidateAlignment(ResidueClass at_offset) const { … }
std::optional<std::tuple<size_t, std::string>> SizeOf(const Type* type) { … }
bool IsAnyUnsignedInteger(const Type* type) { … }
bool IsAllowedAsBitField(const Type* type) { … }
bool IsPointerSizeIntegralType(const Type* type) { … }
bool Is32BitIntegralType(const Type* type) { … }
std::optional<NameAndType> ExtractSimpleFieldArraySize(
const ClassType& class_type, Expression* array_size) { … }
std::string Type::GetRuntimeType() const { … }
std::string Type::GetDebugType() const { … }
}