chromium/v8/src/torque/types.cc

// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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 {

// This custom copy constructor doesn't copy aliases_ and id_ because they
// should be distinct for each type.
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 {}

// TODO(danno): HandlifiedCppTypeName should be used universally in Torque
// where the C++ type of a Torque object is required.
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 {}

// static
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 {}

// static
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 {}

// static
std::string Type::ComputeName(const std::string& basename,
                              MaybeSpecializationKey specialized_from) {}

std::string StructType::SimpleNameImpl() const {}

// static
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) {}
}  // namespace

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) {}
}  // namespace

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) {}
}  // namespace

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 {}

}  // namespace v8::internal::torque