Changeset 248488 in webkit


Ignore:
Timestamp:
Aug 9, 2019 4:30:29 PM (5 years ago)
Author:
sbarati@apple.com
Message:

[WHLSL] Devirtualize the AST
https://bugs.webkit.org/show_bug.cgi?id=200522

Reviewed by Robin Morisset.

Source/WebCore:

This patch devirtualizes the AST for Type, Expression, and Statement.
We now have an enum which represents all the concrete types in the
three hierarchies. Doing dynamic dispatch is implemented as a switch
on that type enum.

The interesting part of this patch is how to handle destruction. We do
this by defining a custom deleter for all nodes in the AST. This ensures
that when they're used inside UniqueRef, unique_ptr, Ref, and RefPtr,
we do dynamic dispatch when we delete the object. This allows each base
class to define a "destroy" method which does dynamic dispatch on type
and calls the appropriate delete. We also mark all non-concrete nodes
in all type hierarchies with a protected destructor, which ensures it's
never called except from within the concrete child classes. We allow
all concrete classes to have public destructors, as it's valid for
their destructors to be called explicitly since there is no need for
dynamic dispatch in such scenarios. All concrete classes are also marked
as final.

This is a 3ms speedup on compute_boids, which is about a 10% improvement
in the WHLSL compiler.

  • Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h:
  • Modules/webgpu/WHLSL/AST/WHLSLArrayType.h:
  • Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h:

(WebCore::WHLSL::AST::AssignmentExpression::AssignmentExpression): Deleted.
(WebCore::WHLSL::AST::AssignmentExpression::left): Deleted.
(WebCore::WHLSL::AST::AssignmentExpression::right): Deleted.
(WebCore::WHLSL::AST::AssignmentExpression::takeRight): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLBlock.h:

(WebCore::WHLSL::AST::Block::Block): Deleted.
(WebCore::WHLSL::AST::Block::statements): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h:

(WebCore::WHLSL::AST::BooleanLiteral::BooleanLiteral): Deleted.
(WebCore::WHLSL::AST::BooleanLiteral::value const): Deleted.
(WebCore::WHLSL::AST::BooleanLiteral::clone const): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLBreak.h:

(WebCore::WHLSL::AST::Break::Break): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h:

(WebCore::WHLSL::AST::CallExpression::CallExpression): Deleted.
(WebCore::WHLSL::AST::CallExpression::arguments): Deleted.
(WebCore::WHLSL::AST::CallExpression::name): Deleted.
(WebCore::WHLSL::AST::CallExpression::setCastData): Deleted.
(WebCore::WHLSL::AST::CallExpression::isCast): Deleted.
(WebCore::WHLSL::AST::CallExpression::castReturnType): Deleted.
(WebCore::WHLSL::AST::CallExpression::function): Deleted.
(WebCore::WHLSL::AST::CallExpression::setFunction): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h:

(WebCore::WHLSL::AST::CommaExpression::CommaExpression): Deleted.
(WebCore::WHLSL::AST::CommaExpression::list): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h:

(WebCore::WHLSL::AST::ConstantExpression::ConstantExpression): Deleted.
(WebCore::WHLSL::AST::ConstantExpression::integerLiteral): Deleted.
(WebCore::WHLSL::AST::ConstantExpression::visit): Deleted.
(WebCore::WHLSL::AST::ConstantExpression::visit const): Deleted.
(WebCore::WHLSL::AST::ConstantExpression::clone const): Deleted.
(WebCore::WHLSL::AST::ConstantExpression::matches const): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLContinue.h:

(WebCore::WHLSL::AST::Continue::Continue): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLDefaultDelete.h: Added.
  • Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h:

(WebCore::WHLSL::AST::DereferenceExpression::DereferenceExpression): Deleted.
(WebCore::WHLSL::AST::DereferenceExpression::pointer): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h:

(WebCore::WHLSL::AST::DoWhileLoop::DoWhileLoop): Deleted.
(WebCore::WHLSL::AST::DoWhileLoop::body): Deleted.
(WebCore::WHLSL::AST::DoWhileLoop::conditional): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h:

(WebCore::WHLSL::AST::DotExpression::DotExpression): Deleted.
(WebCore::WHLSL::AST::DotExpression::fieldName): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h:

(WebCore::WHLSL::AST::EffectfulExpressionStatement::EffectfulExpressionStatement): Deleted.
(WebCore::WHLSL::AST::EffectfulExpressionStatement::effectfulExpression): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h:

(WebCore::WHLSL::AST::EnumerationDefinition::EnumerationDefinition): Deleted.
(WebCore::WHLSL::AST::EnumerationDefinition::type): Deleted.
(WebCore::WHLSL::AST::EnumerationDefinition::add): Deleted.
(WebCore::WHLSL::AST::EnumerationDefinition::memberByName): Deleted.
(WebCore::WHLSL::AST::EnumerationDefinition::enumerationMembers): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h:

(WebCore::WHLSL::AST::EnumerationMemberLiteral::EnumerationMemberLiteral): Deleted.
(WebCore::WHLSL::AST::EnumerationMemberLiteral::wrap): Deleted.
(WebCore::WHLSL::AST::EnumerationMemberLiteral::left const): Deleted.
(WebCore::WHLSL::AST::EnumerationMemberLiteral::right const): Deleted.
(WebCore::WHLSL::AST::EnumerationMemberLiteral::clone const): Deleted.
(WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationDefinition): Deleted.
(WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationDefinition const): Deleted.
(WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationMember): Deleted.
(WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationMember const): Deleted.
(WebCore::WHLSL::AST::EnumerationMemberLiteral::setEnumerationMember): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLExpression.cpp: Added.

(WebCore::WHLSL::AST::Expression::destroy):
(WebCore::WHLSL::AST::PropertyAccessExpression::getterFunctionName const):
(WebCore::WHLSL::AST::PropertyAccessExpression::setterFunctionName const):
(WebCore::WHLSL::AST::PropertyAccessExpression::anderFunctionName const):

  • Modules/webgpu/WHLSL/AST/WHLSLExpression.h:

(WebCore::WHLSL::AST::Expression::Expression):
(WebCore::WHLSL::AST::Expression::kind const):
(WebCore::WHLSL::AST::Expression::isAssignmentExpression const):
(WebCore::WHLSL::AST::Expression::isBooleanLiteral const):
(WebCore::WHLSL::AST::Expression::isCallExpression const):
(WebCore::WHLSL::AST::Expression::isCommaExpression const):
(WebCore::WHLSL::AST::Expression::isDereferenceExpression const):
(WebCore::WHLSL::AST::Expression::isDotExpression const):
(WebCore::WHLSL::AST::Expression::isGlobalVariableReference const):
(WebCore::WHLSL::AST::Expression::isFloatLiteral const):
(WebCore::WHLSL::AST::Expression::isIndexExpression const):
(WebCore::WHLSL::AST::Expression::isIntegerLiteral const):
(WebCore::WHLSL::AST::Expression::isLogicalExpression const):
(WebCore::WHLSL::AST::Expression::isLogicalNotExpression const):
(WebCore::WHLSL::AST::Expression::isMakeArrayReferenceExpression const):
(WebCore::WHLSL::AST::Expression::isMakePointerExpression const):
(WebCore::WHLSL::AST::Expression::isNullLiteral const):
(WebCore::WHLSL::AST::Expression::isPropertyAccessExpression const):
(WebCore::WHLSL::AST::Expression::isReadModifyWriteExpression const):
(WebCore::WHLSL::AST::Expression::isTernaryExpression const):
(WebCore::WHLSL::AST::Expression::isUnsignedIntegerLiteral const):
(WebCore::WHLSL::AST::Expression::isVariableReference const):
(WebCore::WHLSL::AST::Expression::isEnumerationMemberLiteral const):
(WebCore::WHLSL::AST::Expression::codeLocation const):
(WebCore::WHLSL::AST::Expression::updateCodeLocation):

  • Modules/webgpu/WHLSL/AST/WHLSLFallthrough.h:

(WebCore::WHLSL::AST::Fallthrough::Fallthrough): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLFloatLiteral.h:

(WebCore::WHLSL::AST::FloatLiteral::FloatLiteral): Deleted.
(WebCore::WHLSL::AST::FloatLiteral::type): Deleted.
(WebCore::WHLSL::AST::FloatLiteral::value const): Deleted.
(WebCore::WHLSL::AST::FloatLiteral::clone const): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp:

(WebCore::WHLSL::AST::FloatLiteralType::FloatLiteralType):

  • Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h:

(WebCore::WHLSL::AST::FloatLiteralType::value const): Deleted.
(WebCore::WHLSL::AST::FloatLiteralType::preferredType): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLForLoop.h:

(WebCore::WHLSL::AST::ForLoop::ForLoop): Deleted.
(WebCore::WHLSL::AST::ForLoop::~ForLoop): Deleted.
(WebCore::WHLSL::AST::ForLoop::initialization): Deleted.
(WebCore::WHLSL::AST::ForLoop::condition): Deleted.
(WebCore::WHLSL::AST::ForLoop::increment): Deleted.
(WebCore::WHLSL::AST::ForLoop::body): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLGlobalVariableReference.h:

(WebCore::WHLSL::AST::GlobalVariableReference::GlobalVariableReference): Deleted.
(WebCore::WHLSL::AST::GlobalVariableReference::structField): Deleted.
(WebCore::WHLSL::AST::GlobalVariableReference::base): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h:

(WebCore::WHLSL::AST::IfStatement::IfStatement): Deleted.
(WebCore::WHLSL::AST::IfStatement::conditional): Deleted.
(WebCore::WHLSL::AST::IfStatement::body): Deleted.
(WebCore::WHLSL::AST::IfStatement::elseBody): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h:

(WebCore::WHLSL::AST::IndexExpression::IndexExpression): Deleted.
(WebCore::WHLSL::AST::IndexExpression::indexExpression): Deleted.
(WebCore::WHLSL::AST::IndexExpression::takeIndex): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h:

(WebCore::WHLSL::AST::IntegerLiteral::IntegerLiteral): Deleted.
(WebCore::WHLSL::AST::IntegerLiteral::type): Deleted.
(WebCore::WHLSL::AST::IntegerLiteral::value const): Deleted.
(WebCore::WHLSL::AST::IntegerLiteral::clone const): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp:

(WebCore::WHLSL::AST::IntegerLiteralType::IntegerLiteralType):

  • Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h:

(WebCore::WHLSL::AST::IntegerLiteralType::value const): Deleted.
(WebCore::WHLSL::AST::IntegerLiteralType::preferredType): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h:

(WebCore::WHLSL::AST::LogicalExpression::LogicalExpression): Deleted.
(WebCore::WHLSL::AST::LogicalExpression::type const): Deleted.
(WebCore::WHLSL::AST::LogicalExpression::left): Deleted.
(WebCore::WHLSL::AST::LogicalExpression::right): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h:

(WebCore::WHLSL::AST::LogicalNotExpression::LogicalNotExpression): Deleted.
(WebCore::WHLSL::AST::LogicalNotExpression::operand): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h:

(WebCore::WHLSL::AST::MakeArrayReferenceExpression::MakeArrayReferenceExpression): Deleted.
(WebCore::WHLSL::AST::MakeArrayReferenceExpression::leftValue): Deleted.
(WebCore::WHLSL::AST::MakeArrayReferenceExpression::mightEscape const): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h:

(WebCore::WHLSL::AST::MakePointerExpression::MakePointerExpression): Deleted.
(WebCore::WHLSL::AST::MakePointerExpression::leftValue): Deleted.
(WebCore::WHLSL::AST::MakePointerExpression::mightEscape const): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLNamedType.h:

(WebCore::WHLSL::AST::NamedType::NamedType):
(WebCore::WHLSL::AST::NamedType::unifyNodeImpl):
(): Deleted.
(WebCore::WHLSL::AST::NamedType::isTypeDefinition const): Deleted.
(WebCore::WHLSL::AST::NamedType::isStructureDefinition const): Deleted.
(WebCore::WHLSL::AST::NamedType::isEnumerationDefinition const): Deleted.
(WebCore::WHLSL::AST::NamedType::isNativeTypeDeclaration const): Deleted.
(WebCore::WHLSL::AST::NamedType::unifyNode const): Deleted.
(WebCore::WHLSL::AST::NamedType::unifyNode): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLNativeTypeDeclaration.h:

(WebCore::WHLSL::AST::NativeTypeDeclaration::NativeTypeDeclaration): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::typeArguments): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::isInt const): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::isNumber const): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::isFloating const): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::isAtomic const): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::isVector const): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::isMatrix const): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::isOpaqueType const): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::isTexture const): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::isTextureArray const): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::isDepthTexture const): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::isWritableTexture const): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::textureDimension const): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::isSigned const): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<bool const): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<int64_t const): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::iterateAllValues): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::setIsInt): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::setIsNumber): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::setIsFloating): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::setIsAtomic): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::setIsVector): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::setIsMatrix): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::setIsOpaqueType): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::setIsTexture): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::setIsTextureArray): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::setIsDepthTexture): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::setIsWritableTexture): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::setTextureDimension): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::setIsSigned): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentInteger): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentUnsignedInteger): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentFloat): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::setSuccessor): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromInteger): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromUnsignedInteger): Deleted.
(WebCore::WHLSL::AST::NativeTypeDeclaration::setIterateAllValues): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h:

(WebCore::WHLSL::AST::NullLiteral::NullLiteral): Deleted.
(WebCore::WHLSL::AST::NullLiteral::type): Deleted.
(WebCore::WHLSL::AST::NullLiteral::clone const): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.h:
  • Modules/webgpu/WHLSL/AST/WHLSLPointerType.h:
  • Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h:

(WebCore::WHLSL::AST::PropertyAccessExpression::PropertyAccessExpression):

  • Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:

(WebCore::WHLSL::AST::ReadModifyWriteExpression::create): Deleted.
(WebCore::WHLSL::AST::ReadModifyWriteExpression::setNewValueExpression): Deleted.
(WebCore::WHLSL::AST::ReadModifyWriteExpression::setResultExpression): Deleted.
(WebCore::WHLSL::AST::ReadModifyWriteExpression::oldVariableReference): Deleted.
(WebCore::WHLSL::AST::ReadModifyWriteExpression::newVariableReference): Deleted.
(WebCore::WHLSL::AST::ReadModifyWriteExpression::leftValue): Deleted.
(WebCore::WHLSL::AST::ReadModifyWriteExpression::oldValue): Deleted.
(WebCore::WHLSL::AST::ReadModifyWriteExpression::newValue): Deleted.
(WebCore::WHLSL::AST::ReadModifyWriteExpression::newValueExpression): Deleted.
(WebCore::WHLSL::AST::ReadModifyWriteExpression::resultExpression): Deleted.
(WebCore::WHLSL::AST::ReadModifyWriteExpression::takeLeftValue): Deleted.
(WebCore::WHLSL::AST::ReadModifyWriteExpression::takeOldValue): Deleted.
(WebCore::WHLSL::AST::ReadModifyWriteExpression::takeNewValue): Deleted.
(WebCore::WHLSL::AST::ReadModifyWriteExpression::takeNewValueExpression): Deleted.
(WebCore::WHLSL::AST::ReadModifyWriteExpression::takeResultExpression): Deleted.
(WebCore::WHLSL::AST::ReadModifyWriteExpression::ReadModifyWriteExpression): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h:

(WebCore::WHLSL::AST::ReferenceType::ReferenceType):

  • Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h:

(WebCore::WHLSL::AST::ResolvableType::ResolvableType):
(): Deleted.
(WebCore::WHLSL::AST::ResolvableType::isFloatLiteralType const): Deleted.
(WebCore::WHLSL::AST::ResolvableType::isIntegerLiteralType const): Deleted.
(WebCore::WHLSL::AST::ResolvableType::isNullLiteralType const): Deleted.
(WebCore::WHLSL::AST::ResolvableType::isUnsignedIntegerLiteralType const): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLReturn.h:

(WebCore::WHLSL::AST::Return::Return): Deleted.
(WebCore::WHLSL::AST::Return::value): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLStatement.cpp: Added.

(WebCore::WHLSL::AST::Statement::destroy):

  • Modules/webgpu/WHLSL/AST/WHLSLStatement.h:

(WebCore::WHLSL::AST::Statement::Statement):
(WebCore::WHLSL::AST::Statement::kind const):
(WebCore::WHLSL::AST::Statement::isBlock const):
(WebCore::WHLSL::AST::Statement::isBreak const):
(WebCore::WHLSL::AST::Statement::isContinue const):
(WebCore::WHLSL::AST::Statement::isDoWhileLoop const):
(WebCore::WHLSL::AST::Statement::isEffectfulExpressionStatement const):
(WebCore::WHLSL::AST::Statement::isFallthrough const):
(WebCore::WHLSL::AST::Statement::isForLoop const):
(WebCore::WHLSL::AST::Statement::isIfStatement const):
(WebCore::WHLSL::AST::Statement::isReturn const):
(WebCore::WHLSL::AST::Statement::isStatementList const):
(WebCore::WHLSL::AST::Statement::isSwitchCase const):
(WebCore::WHLSL::AST::Statement::isSwitchStatement const):
(WebCore::WHLSL::AST::Statement::isVariableDeclarationsStatement const):
(WebCore::WHLSL::AST::Statement::isWhileLoop const):
(WebCore::WHLSL::AST::Statement::codeLocation const):
(WebCore::WHLSL::AST::Statement::updateCodeLocation):

  • Modules/webgpu/WHLSL/AST/WHLSLStatementList.h:

(WebCore::WHLSL::AST::StatementList::StatementList): Deleted.
(WebCore::WHLSL::AST::StatementList::statements): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h:

(WebCore::WHLSL::AST::StructureDefinition::StructureDefinition): Deleted.
(WebCore::WHLSL::AST::StructureDefinition::structureElements): Deleted.
(WebCore::WHLSL::AST::StructureDefinition::find): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h:

(WebCore::WHLSL::AST::StructureElement::StructureElement): Deleted.
(WebCore::WHLSL::AST::StructureElement::codeLocation const): Deleted.
(WebCore::WHLSL::AST::StructureElement::type): Deleted.
(WebCore::WHLSL::AST::StructureElement::name): Deleted.
(WebCore::WHLSL::AST::StructureElement::semantic): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h:

(WebCore::WHLSL::AST::SwitchCase::SwitchCase): Deleted.
(WebCore::WHLSL::AST::SwitchCase::value): Deleted.
(WebCore::WHLSL::AST::SwitchCase::block): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h:

(WebCore::WHLSL::AST::SwitchStatement::SwitchStatement): Deleted.
(WebCore::WHLSL::AST::SwitchStatement::value): Deleted.
(WebCore::WHLSL::AST::SwitchStatement::switchCases): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h:

(WebCore::WHLSL::AST::TernaryExpression::TernaryExpression): Deleted.
(WebCore::WHLSL::AST::TernaryExpression::predicate): Deleted.
(WebCore::WHLSL::AST::TernaryExpression::bodyExpression): Deleted.
(WebCore::WHLSL::AST::TernaryExpression::elseExpression): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLType.cpp: Added.

(WebCore::WHLSL::AST::Type::destroy):
(WebCore::WHLSL::AST::Type::unifyNode):
(WebCore::WHLSL::AST::ResolvableType::canResolve const):
(WebCore::WHLSL::AST::ResolvableType::conversionCost const):
(WebCore::WHLSL::AST::UnnamedType::toString const):

  • Modules/webgpu/WHLSL/AST/WHLSLType.h:

(WebCore::WHLSL::AST::Type::Type):
(WebCore::WHLSL::AST::Type::kind const):
(WebCore::WHLSL::AST::Type::isUnnamedType const):
(WebCore::WHLSL::AST::Type::isNamedType const):
(WebCore::WHLSL::AST::Type::isResolvableType const):
(WebCore::WHLSL::AST::Type::isTypeReference const):
(WebCore::WHLSL::AST::Type::isPointerType const):
(WebCore::WHLSL::AST::Type::isArrayReferenceType const):
(WebCore::WHLSL::AST::Type::isArrayType const):
(WebCore::WHLSL::AST::Type::isReferenceType const):
(WebCore::WHLSL::AST::Type::isTypeDefinition const):
(WebCore::WHLSL::AST::Type::isStructureDefinition const):
(WebCore::WHLSL::AST::Type::isEnumerationDefinition const):
(WebCore::WHLSL::AST::Type::isNativeTypeDeclaration const):
(WebCore::WHLSL::AST::Type::isFloatLiteralType const):
(WebCore::WHLSL::AST::Type::isIntegerLiteralType const):
(WebCore::WHLSL::AST::Type::isNullLiteralType const):
(WebCore::WHLSL::AST::Type::isUnsignedIntegerLiteralType const):
(WebCore::WHLSL::AST::Type::unifyNode const):

  • Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h:

(WebCore::WHLSL::AST::TypeDefinition::TypeDefinition): Deleted.
(WebCore::WHLSL::AST::TypeDefinition::type): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h:
  • Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.cpp:

(WebCore::WHLSL::AST::UnnamedType::hash const):
(WebCore::WHLSL::AST::UnnamedType::operator== const):

  • Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h:

(WebCore::WHLSL::AST::UnnamedType::UnnamedType):
(WebCore::WHLSL::AST::UnnamedType::unifyNodeImpl):
(): Deleted.
(WebCore::WHLSL::AST::UnnamedType::kind const): Deleted.
(WebCore::WHLSL::AST::UnnamedType::isTypeReference const): Deleted.
(WebCore::WHLSL::AST::UnnamedType::isPointerType const): Deleted.
(WebCore::WHLSL::AST::UnnamedType::isArrayReferenceType const): Deleted.
(WebCore::WHLSL::AST::UnnamedType::isArrayType const): Deleted.
(WebCore::WHLSL::AST::UnnamedType::isReferenceType const): Deleted.
(WebCore::WHLSL::AST::UnnamedType::unifyNode const): Deleted.
(WebCore::WHLSL::AST::UnnamedType::unifyNode): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h:

(WebCore::WHLSL::AST::UnsignedIntegerLiteral::UnsignedIntegerLiteral): Deleted.
(WebCore::WHLSL::AST::UnsignedIntegerLiteral::type): Deleted.
(WebCore::WHLSL::AST::UnsignedIntegerLiteral::value const): Deleted.
(WebCore::WHLSL::AST::UnsignedIntegerLiteral::clone const): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp:

(WebCore::WHLSL::AST::UnsignedIntegerLiteralType::UnsignedIntegerLiteralType):

  • Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h:

(WebCore::WHLSL::AST::UnsignedIntegerLiteralType::value const): Deleted.
(WebCore::WHLSL::AST::UnsignedIntegerLiteralType::preferredType): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h:

(WebCore::WHLSL::AST::VariableDeclarationsStatement::VariableDeclarationsStatement): Deleted.
(WebCore::WHLSL::AST::VariableDeclarationsStatement::variableDeclarations): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h:

(WebCore::WHLSL::AST::VariableReference::VariableReference): Deleted.
(WebCore::WHLSL::AST::VariableReference::wrap): Deleted.
(WebCore::WHLSL::AST::VariableReference::name): Deleted.
(WebCore::WHLSL::AST::VariableReference::variable): Deleted.
(WebCore::WHLSL::AST::VariableReference::setVariable): Deleted.

  • Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h:

(WebCore::WHLSL::AST::WhileLoop::WhileLoop): Deleted.
(WebCore::WHLSL::AST::WhileLoop::conditional): Deleted.
(WebCore::WHLSL::AST::WhileLoop::body): Deleted.

  • Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:

(WebCore::WHLSL::Metal::BaseTypeNameNode::isPointerTypeNameNode const):
(WebCore::WHLSL::Metal::BaseTypeNameNode::isArrayReferenceTypeNameNode const):
(WebCore::WHLSL::Metal::BaseTypeNameNode::isArrayTypeNameNode const):
(WebCore::WHLSL::Metal::TypeNamer::createNameNode):
(WebCore::WHLSL::Metal::parent):
(WebCore::WHLSL::Metal::TypeNamer::emitUnnamedTypeDefinition):

  • Modules/webgpu/WHLSL/WHLSLParser.cpp:

(WebCore::WHLSL::Parser::parseSuffixOperator):
(WebCore::WHLSL::Parser::completeAssignment):
(WebCore::WHLSL::Parser::parsePossiblePrefix):

  • Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp:
  • Modules/webgpu/WHLSL/WHLSLVisitor.cpp:

(WebCore::WHLSL::Visitor::visit):

  • Sources.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • workers/WorkerScriptLoader.h:

Source/WTF:

Make RefCounted use std::default_delete instead of explicitly calling delete.
This allows uses of RefCounted to define their own custom deleter.

  • wtf/RefCounted.h:

(WTF::RefCounted::deref const):

  • wtf/UniqueRef.h:

(WTF::UniqueRef::UniqueRef):

Location:
trunk/Source
Files:
3 added
72 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r248446 r248488  
     12019-08-09  Saam Barati  <sbarati@apple.com>
     2
     3        [WHLSL] Devirtualize the AST
     4        https://bugs.webkit.org/show_bug.cgi?id=200522
     5
     6        Reviewed by Robin Morisset.
     7
     8        Make RefCounted use std::default_delete instead of explicitly calling delete.
     9        This allows uses of RefCounted to define their own custom deleter.
     10
     11        * wtf/RefCounted.h:
     12        (WTF::RefCounted::deref const):
     13        * wtf/UniqueRef.h:
     14        (WTF::UniqueRef::UniqueRef):
     15
    1162019-08-08  Chris Dumez  <cdumez@apple.com>
    217
  • trunk/Source/WTF/wtf/RefCounted.h

    r203257 r248488  
    137137#endif
    138138
    139 template<typename T> class RefCounted : public RefCountedBase {
     139template<typename T, typename Deleter = std::default_delete<T>> class RefCounted : public RefCountedBase {
    140140    WTF_MAKE_NONCOPYABLE(RefCounted); WTF_MAKE_FAST_ALLOCATED;
    141141public:
     
    143143    {
    144144        if (derefBase())
    145             delete static_cast<const T*>(this);
     145            Deleter()(const_cast<T*>(static_cast<const T*>(this)));
    146146    }
    147147
  • trunk/Source/WTF/wtf/UniqueRef.h

    r247062 r248488  
    4444    template <typename U>
    4545    UniqueRef(UniqueRef<U>&& other)
    46         : m_ref(WTFMove(other.m_ref))
     46        : m_ref(other.m_ref.release())
    4747    {
    4848        ASSERT(m_ref);
  • trunk/Source/WebCore/ChangeLog

    r248473 r248488  
     12019-08-09  Saam Barati  <sbarati@apple.com>
     2
     3        [WHLSL] Devirtualize the AST
     4        https://bugs.webkit.org/show_bug.cgi?id=200522
     5
     6        Reviewed by Robin Morisset.
     7
     8        This patch devirtualizes the AST for Type, Expression, and Statement.
     9        We now have an enum which represents all the concrete types in the
     10        three hierarchies. Doing dynamic dispatch is implemented as a switch
     11        on that type enum.
     12       
     13        The interesting part of this patch is how to handle destruction. We do
     14        this by defining a custom deleter for all nodes in the AST. This ensures
     15        that when they're used inside UniqueRef, unique_ptr, Ref, and RefPtr,
     16        we do dynamic dispatch when we delete the object. This allows each base
     17        class to define a "destroy" method which does dynamic dispatch on type
     18        and calls the appropriate delete. We also mark all non-concrete nodes
     19        in all type hierarchies with a protected destructor, which ensures it's
     20        never called except from within the concrete child classes. We allow
     21        all concrete classes to have public destructors, as it's valid for
     22        their destructors to be called explicitly since there is no need for
     23        dynamic dispatch in such scenarios. All concrete classes are also marked
     24        as final.
     25       
     26        This is a 3ms speedup on compute_boids, which is about a 10% improvement
     27        in the WHLSL compiler.
     28
     29        * Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h:
     30        * Modules/webgpu/WHLSL/AST/WHLSLArrayType.h:
     31        * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h:
     32        (WebCore::WHLSL::AST::AssignmentExpression::AssignmentExpression): Deleted.
     33        (WebCore::WHLSL::AST::AssignmentExpression::left): Deleted.
     34        (WebCore::WHLSL::AST::AssignmentExpression::right): Deleted.
     35        (WebCore::WHLSL::AST::AssignmentExpression::takeRight): Deleted.
     36        * Modules/webgpu/WHLSL/AST/WHLSLBlock.h:
     37        (WebCore::WHLSL::AST::Block::Block): Deleted.
     38        (WebCore::WHLSL::AST::Block::statements): Deleted.
     39        * Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h:
     40        (WebCore::WHLSL::AST::BooleanLiteral::BooleanLiteral): Deleted.
     41        (WebCore::WHLSL::AST::BooleanLiteral::value const): Deleted.
     42        (WebCore::WHLSL::AST::BooleanLiteral::clone const): Deleted.
     43        * Modules/webgpu/WHLSL/AST/WHLSLBreak.h:
     44        (WebCore::WHLSL::AST::Break::Break): Deleted.
     45        * Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h:
     46        (WebCore::WHLSL::AST::CallExpression::CallExpression): Deleted.
     47        (WebCore::WHLSL::AST::CallExpression::arguments): Deleted.
     48        (WebCore::WHLSL::AST::CallExpression::name): Deleted.
     49        (WebCore::WHLSL::AST::CallExpression::setCastData): Deleted.
     50        (WebCore::WHLSL::AST::CallExpression::isCast): Deleted.
     51        (WebCore::WHLSL::AST::CallExpression::castReturnType): Deleted.
     52        (WebCore::WHLSL::AST::CallExpression::function): Deleted.
     53        (WebCore::WHLSL::AST::CallExpression::setFunction): Deleted.
     54        * Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h:
     55        (WebCore::WHLSL::AST::CommaExpression::CommaExpression): Deleted.
     56        (WebCore::WHLSL::AST::CommaExpression::list): Deleted.
     57        * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h:
     58        (WebCore::WHLSL::AST::ConstantExpression::ConstantExpression): Deleted.
     59        (WebCore::WHLSL::AST::ConstantExpression::integerLiteral): Deleted.
     60        (WebCore::WHLSL::AST::ConstantExpression::visit): Deleted.
     61        (WebCore::WHLSL::AST::ConstantExpression::visit const): Deleted.
     62        (WebCore::WHLSL::AST::ConstantExpression::clone const): Deleted.
     63        (WebCore::WHLSL::AST::ConstantExpression::matches const): Deleted.
     64        * Modules/webgpu/WHLSL/AST/WHLSLContinue.h:
     65        (WebCore::WHLSL::AST::Continue::Continue): Deleted.
     66        * Modules/webgpu/WHLSL/AST/WHLSLDefaultDelete.h: Added.
     67        * Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h:
     68        (WebCore::WHLSL::AST::DereferenceExpression::DereferenceExpression): Deleted.
     69        (WebCore::WHLSL::AST::DereferenceExpression::pointer): Deleted.
     70        * Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h:
     71        (WebCore::WHLSL::AST::DoWhileLoop::DoWhileLoop): Deleted.
     72        (WebCore::WHLSL::AST::DoWhileLoop::body): Deleted.
     73        (WebCore::WHLSL::AST::DoWhileLoop::conditional): Deleted.
     74        * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h:
     75        (WebCore::WHLSL::AST::DotExpression::DotExpression): Deleted.
     76        (WebCore::WHLSL::AST::DotExpression::fieldName): Deleted.
     77        * Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h:
     78        (WebCore::WHLSL::AST::EffectfulExpressionStatement::EffectfulExpressionStatement): Deleted.
     79        (WebCore::WHLSL::AST::EffectfulExpressionStatement::effectfulExpression): Deleted.
     80        * Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h:
     81        (WebCore::WHLSL::AST::EnumerationDefinition::EnumerationDefinition): Deleted.
     82        (WebCore::WHLSL::AST::EnumerationDefinition::type): Deleted.
     83        (WebCore::WHLSL::AST::EnumerationDefinition::add): Deleted.
     84        (WebCore::WHLSL::AST::EnumerationDefinition::memberByName): Deleted.
     85        (WebCore::WHLSL::AST::EnumerationDefinition::enumerationMembers): Deleted.
     86        * Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h:
     87        (WebCore::WHLSL::AST::EnumerationMemberLiteral::EnumerationMemberLiteral): Deleted.
     88        (WebCore::WHLSL::AST::EnumerationMemberLiteral::wrap): Deleted.
     89        (WebCore::WHLSL::AST::EnumerationMemberLiteral::left const): Deleted.
     90        (WebCore::WHLSL::AST::EnumerationMemberLiteral::right const): Deleted.
     91        (WebCore::WHLSL::AST::EnumerationMemberLiteral::clone const): Deleted.
     92        (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationDefinition): Deleted.
     93        (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationDefinition const): Deleted.
     94        (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationMember): Deleted.
     95        (WebCore::WHLSL::AST::EnumerationMemberLiteral::enumerationMember const): Deleted.
     96        (WebCore::WHLSL::AST::EnumerationMemberLiteral::setEnumerationMember): Deleted.
     97        * Modules/webgpu/WHLSL/AST/WHLSLExpression.cpp: Added.
     98        (WebCore::WHLSL::AST::Expression::destroy):
     99        (WebCore::WHLSL::AST::PropertyAccessExpression::getterFunctionName const):
     100        (WebCore::WHLSL::AST::PropertyAccessExpression::setterFunctionName const):
     101        (WebCore::WHLSL::AST::PropertyAccessExpression::anderFunctionName const):
     102        * Modules/webgpu/WHLSL/AST/WHLSLExpression.h:
     103        (WebCore::WHLSL::AST::Expression::Expression):
     104        (WebCore::WHLSL::AST::Expression::kind const):
     105        (WebCore::WHLSL::AST::Expression::isAssignmentExpression const):
     106        (WebCore::WHLSL::AST::Expression::isBooleanLiteral const):
     107        (WebCore::WHLSL::AST::Expression::isCallExpression const):
     108        (WebCore::WHLSL::AST::Expression::isCommaExpression const):
     109        (WebCore::WHLSL::AST::Expression::isDereferenceExpression const):
     110        (WebCore::WHLSL::AST::Expression::isDotExpression const):
     111        (WebCore::WHLSL::AST::Expression::isGlobalVariableReference const):
     112        (WebCore::WHLSL::AST::Expression::isFloatLiteral const):
     113        (WebCore::WHLSL::AST::Expression::isIndexExpression const):
     114        (WebCore::WHLSL::AST::Expression::isIntegerLiteral const):
     115        (WebCore::WHLSL::AST::Expression::isLogicalExpression const):
     116        (WebCore::WHLSL::AST::Expression::isLogicalNotExpression const):
     117        (WebCore::WHLSL::AST::Expression::isMakeArrayReferenceExpression const):
     118        (WebCore::WHLSL::AST::Expression::isMakePointerExpression const):
     119        (WebCore::WHLSL::AST::Expression::isNullLiteral const):
     120        (WebCore::WHLSL::AST::Expression::isPropertyAccessExpression const):
     121        (WebCore::WHLSL::AST::Expression::isReadModifyWriteExpression const):
     122        (WebCore::WHLSL::AST::Expression::isTernaryExpression const):
     123        (WebCore::WHLSL::AST::Expression::isUnsignedIntegerLiteral const):
     124        (WebCore::WHLSL::AST::Expression::isVariableReference const):
     125        (WebCore::WHLSL::AST::Expression::isEnumerationMemberLiteral const):
     126        (WebCore::WHLSL::AST::Expression::codeLocation const):
     127        (WebCore::WHLSL::AST::Expression::updateCodeLocation):
     128        * Modules/webgpu/WHLSL/AST/WHLSLFallthrough.h:
     129        (WebCore::WHLSL::AST::Fallthrough::Fallthrough): Deleted.
     130        * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteral.h:
     131        (WebCore::WHLSL::AST::FloatLiteral::FloatLiteral): Deleted.
     132        (WebCore::WHLSL::AST::FloatLiteral::type): Deleted.
     133        (WebCore::WHLSL::AST::FloatLiteral::value const): Deleted.
     134        (WebCore::WHLSL::AST::FloatLiteral::clone const): Deleted.
     135        * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp:
     136        (WebCore::WHLSL::AST::FloatLiteralType::FloatLiteralType):
     137        * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h:
     138        (WebCore::WHLSL::AST::FloatLiteralType::value const): Deleted.
     139        (WebCore::WHLSL::AST::FloatLiteralType::preferredType): Deleted.
     140        * Modules/webgpu/WHLSL/AST/WHLSLForLoop.h:
     141        (WebCore::WHLSL::AST::ForLoop::ForLoop): Deleted.
     142        (WebCore::WHLSL::AST::ForLoop::~ForLoop): Deleted.
     143        (WebCore::WHLSL::AST::ForLoop::initialization): Deleted.
     144        (WebCore::WHLSL::AST::ForLoop::condition): Deleted.
     145        (WebCore::WHLSL::AST::ForLoop::increment): Deleted.
     146        (WebCore::WHLSL::AST::ForLoop::body): Deleted.
     147        * Modules/webgpu/WHLSL/AST/WHLSLGlobalVariableReference.h:
     148        (WebCore::WHLSL::AST::GlobalVariableReference::GlobalVariableReference): Deleted.
     149        (WebCore::WHLSL::AST::GlobalVariableReference::structField): Deleted.
     150        (WebCore::WHLSL::AST::GlobalVariableReference::base): Deleted.
     151        * Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h:
     152        (WebCore::WHLSL::AST::IfStatement::IfStatement): Deleted.
     153        (WebCore::WHLSL::AST::IfStatement::conditional): Deleted.
     154        (WebCore::WHLSL::AST::IfStatement::body): Deleted.
     155        (WebCore::WHLSL::AST::IfStatement::elseBody): Deleted.
     156        * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h:
     157        (WebCore::WHLSL::AST::IndexExpression::IndexExpression): Deleted.
     158        (WebCore::WHLSL::AST::IndexExpression::indexExpression): Deleted.
     159        (WebCore::WHLSL::AST::IndexExpression::takeIndex): Deleted.
     160        * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h:
     161        (WebCore::WHLSL::AST::IntegerLiteral::IntegerLiteral): Deleted.
     162        (WebCore::WHLSL::AST::IntegerLiteral::type): Deleted.
     163        (WebCore::WHLSL::AST::IntegerLiteral::value const): Deleted.
     164        (WebCore::WHLSL::AST::IntegerLiteral::clone const): Deleted.
     165        * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp:
     166        (WebCore::WHLSL::AST::IntegerLiteralType::IntegerLiteralType):
     167        * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h:
     168        (WebCore::WHLSL::AST::IntegerLiteralType::value const): Deleted.
     169        (WebCore::WHLSL::AST::IntegerLiteralType::preferredType): Deleted.
     170        * Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h:
     171        (WebCore::WHLSL::AST::LogicalExpression::LogicalExpression): Deleted.
     172        (WebCore::WHLSL::AST::LogicalExpression::type const): Deleted.
     173        (WebCore::WHLSL::AST::LogicalExpression::left): Deleted.
     174        (WebCore::WHLSL::AST::LogicalExpression::right): Deleted.
     175        * Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h:
     176        (WebCore::WHLSL::AST::LogicalNotExpression::LogicalNotExpression): Deleted.
     177        (WebCore::WHLSL::AST::LogicalNotExpression::operand): Deleted.
     178        * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h:
     179        (WebCore::WHLSL::AST::MakeArrayReferenceExpression::MakeArrayReferenceExpression): Deleted.
     180        (WebCore::WHLSL::AST::MakeArrayReferenceExpression::leftValue): Deleted.
     181        (WebCore::WHLSL::AST::MakeArrayReferenceExpression::mightEscape const): Deleted.
     182        * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h:
     183        (WebCore::WHLSL::AST::MakePointerExpression::MakePointerExpression): Deleted.
     184        (WebCore::WHLSL::AST::MakePointerExpression::leftValue): Deleted.
     185        (WebCore::WHLSL::AST::MakePointerExpression::mightEscape const): Deleted.
     186        * Modules/webgpu/WHLSL/AST/WHLSLNamedType.h:
     187        (WebCore::WHLSL::AST::NamedType::NamedType):
     188        (WebCore::WHLSL::AST::NamedType::unifyNodeImpl):
     189        (): Deleted.
     190        (WebCore::WHLSL::AST::NamedType::isTypeDefinition const): Deleted.
     191        (WebCore::WHLSL::AST::NamedType::isStructureDefinition const): Deleted.
     192        (WebCore::WHLSL::AST::NamedType::isEnumerationDefinition const): Deleted.
     193        (WebCore::WHLSL::AST::NamedType::isNativeTypeDeclaration const): Deleted.
     194        (WebCore::WHLSL::AST::NamedType::unifyNode const): Deleted.
     195        (WebCore::WHLSL::AST::NamedType::unifyNode): Deleted.
     196        * Modules/webgpu/WHLSL/AST/WHLSLNativeTypeDeclaration.h:
     197        (WebCore::WHLSL::AST::NativeTypeDeclaration::NativeTypeDeclaration): Deleted.
     198        (WebCore::WHLSL::AST::NativeTypeDeclaration::typeArguments): Deleted.
     199        (WebCore::WHLSL::AST::NativeTypeDeclaration::isInt const): Deleted.
     200        (WebCore::WHLSL::AST::NativeTypeDeclaration::isNumber const): Deleted.
     201        (WebCore::WHLSL::AST::NativeTypeDeclaration::isFloating const): Deleted.
     202        (WebCore::WHLSL::AST::NativeTypeDeclaration::isAtomic const): Deleted.
     203        (WebCore::WHLSL::AST::NativeTypeDeclaration::isVector const): Deleted.
     204        (WebCore::WHLSL::AST::NativeTypeDeclaration::isMatrix const): Deleted.
     205        (WebCore::WHLSL::AST::NativeTypeDeclaration::isOpaqueType const): Deleted.
     206        (WebCore::WHLSL::AST::NativeTypeDeclaration::isTexture const): Deleted.
     207        (WebCore::WHLSL::AST::NativeTypeDeclaration::isTextureArray const): Deleted.
     208        (WebCore::WHLSL::AST::NativeTypeDeclaration::isDepthTexture const): Deleted.
     209        (WebCore::WHLSL::AST::NativeTypeDeclaration::isWritableTexture const): Deleted.
     210        (WebCore::WHLSL::AST::NativeTypeDeclaration::textureDimension const): Deleted.
     211        (WebCore::WHLSL::AST::NativeTypeDeclaration::isSigned const): Deleted.
     212        (WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<bool const): Deleted.
     213        (WebCore::WHLSL::AST::NativeTypeDeclaration::std::function<int64_t const): Deleted.
     214        (WebCore::WHLSL::AST::NativeTypeDeclaration::iterateAllValues): Deleted.
     215        (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsInt): Deleted.
     216        (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsNumber): Deleted.
     217        (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsFloating): Deleted.
     218        (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsAtomic): Deleted.
     219        (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsVector): Deleted.
     220        (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsMatrix): Deleted.
     221        (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsOpaqueType): Deleted.
     222        (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsTexture): Deleted.
     223        (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsTextureArray): Deleted.
     224        (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsDepthTexture): Deleted.
     225        (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsWritableTexture): Deleted.
     226        (WebCore::WHLSL::AST::NativeTypeDeclaration::setTextureDimension): Deleted.
     227        (WebCore::WHLSL::AST::NativeTypeDeclaration::setIsSigned): Deleted.
     228        (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentInteger): Deleted.
     229        (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentUnsignedInteger): Deleted.
     230        (WebCore::WHLSL::AST::NativeTypeDeclaration::setCanRepresentFloat): Deleted.
     231        (WebCore::WHLSL::AST::NativeTypeDeclaration::setSuccessor): Deleted.
     232        (WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromInteger): Deleted.
     233        (WebCore::WHLSL::AST::NativeTypeDeclaration::setFormatValueFromUnsignedInteger): Deleted.
     234        (WebCore::WHLSL::AST::NativeTypeDeclaration::setIterateAllValues): Deleted.
     235        * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h:
     236        (WebCore::WHLSL::AST::NullLiteral::NullLiteral): Deleted.
     237        (WebCore::WHLSL::AST::NullLiteral::type): Deleted.
     238        (WebCore::WHLSL::AST::NullLiteral::clone const): Deleted.
     239        * Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.h:
     240        * Modules/webgpu/WHLSL/AST/WHLSLPointerType.h:
     241        * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h:
     242        (WebCore::WHLSL::AST::PropertyAccessExpression::PropertyAccessExpression):
     243        * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:
     244        (WebCore::WHLSL::AST::ReadModifyWriteExpression::create): Deleted.
     245        (WebCore::WHLSL::AST::ReadModifyWriteExpression::setNewValueExpression): Deleted.
     246        (WebCore::WHLSL::AST::ReadModifyWriteExpression::setResultExpression): Deleted.
     247        (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldVariableReference): Deleted.
     248        (WebCore::WHLSL::AST::ReadModifyWriteExpression::newVariableReference): Deleted.
     249        (WebCore::WHLSL::AST::ReadModifyWriteExpression::leftValue): Deleted.
     250        (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldValue): Deleted.
     251        (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValue): Deleted.
     252        (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValueExpression): Deleted.
     253        (WebCore::WHLSL::AST::ReadModifyWriteExpression::resultExpression): Deleted.
     254        (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeLeftValue): Deleted.
     255        (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeOldValue): Deleted.
     256        (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeNewValue): Deleted.
     257        (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeNewValueExpression): Deleted.
     258        (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeResultExpression): Deleted.
     259        (WebCore::WHLSL::AST::ReadModifyWriteExpression::ReadModifyWriteExpression): Deleted.
     260        * Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h:
     261        (WebCore::WHLSL::AST::ReferenceType::ReferenceType):
     262        * Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h:
     263        (WebCore::WHLSL::AST::ResolvableType::ResolvableType):
     264        (): Deleted.
     265        (WebCore::WHLSL::AST::ResolvableType::isFloatLiteralType const): Deleted.
     266        (WebCore::WHLSL::AST::ResolvableType::isIntegerLiteralType const): Deleted.
     267        (WebCore::WHLSL::AST::ResolvableType::isNullLiteralType const): Deleted.
     268        (WebCore::WHLSL::AST::ResolvableType::isUnsignedIntegerLiteralType const): Deleted.
     269        * Modules/webgpu/WHLSL/AST/WHLSLReturn.h:
     270        (WebCore::WHLSL::AST::Return::Return): Deleted.
     271        (WebCore::WHLSL::AST::Return::value): Deleted.
     272        * Modules/webgpu/WHLSL/AST/WHLSLStatement.cpp: Added.
     273        (WebCore::WHLSL::AST::Statement::destroy):
     274        * Modules/webgpu/WHLSL/AST/WHLSLStatement.h:
     275        (WebCore::WHLSL::AST::Statement::Statement):
     276        (WebCore::WHLSL::AST::Statement::kind const):
     277        (WebCore::WHLSL::AST::Statement::isBlock const):
     278        (WebCore::WHLSL::AST::Statement::isBreak const):
     279        (WebCore::WHLSL::AST::Statement::isContinue const):
     280        (WebCore::WHLSL::AST::Statement::isDoWhileLoop const):
     281        (WebCore::WHLSL::AST::Statement::isEffectfulExpressionStatement const):
     282        (WebCore::WHLSL::AST::Statement::isFallthrough const):
     283        (WebCore::WHLSL::AST::Statement::isForLoop const):
     284        (WebCore::WHLSL::AST::Statement::isIfStatement const):
     285        (WebCore::WHLSL::AST::Statement::isReturn const):
     286        (WebCore::WHLSL::AST::Statement::isStatementList const):
     287        (WebCore::WHLSL::AST::Statement::isSwitchCase const):
     288        (WebCore::WHLSL::AST::Statement::isSwitchStatement const):
     289        (WebCore::WHLSL::AST::Statement::isVariableDeclarationsStatement const):
     290        (WebCore::WHLSL::AST::Statement::isWhileLoop const):
     291        (WebCore::WHLSL::AST::Statement::codeLocation const):
     292        (WebCore::WHLSL::AST::Statement::updateCodeLocation):
     293        * Modules/webgpu/WHLSL/AST/WHLSLStatementList.h:
     294        (WebCore::WHLSL::AST::StatementList::StatementList): Deleted.
     295        (WebCore::WHLSL::AST::StatementList::statements): Deleted.
     296        * Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h:
     297        (WebCore::WHLSL::AST::StructureDefinition::StructureDefinition): Deleted.
     298        (WebCore::WHLSL::AST::StructureDefinition::structureElements): Deleted.
     299        (WebCore::WHLSL::AST::StructureDefinition::find): Deleted.
     300        * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h:
     301        (WebCore::WHLSL::AST::StructureElement::StructureElement): Deleted.
     302        (WebCore::WHLSL::AST::StructureElement::codeLocation const): Deleted.
     303        (WebCore::WHLSL::AST::StructureElement::type): Deleted.
     304        (WebCore::WHLSL::AST::StructureElement::name): Deleted.
     305        (WebCore::WHLSL::AST::StructureElement::semantic): Deleted.
     306        * Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h:
     307        (WebCore::WHLSL::AST::SwitchCase::SwitchCase): Deleted.
     308        (WebCore::WHLSL::AST::SwitchCase::value): Deleted.
     309        (WebCore::WHLSL::AST::SwitchCase::block): Deleted.
     310        * Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h:
     311        (WebCore::WHLSL::AST::SwitchStatement::SwitchStatement): Deleted.
     312        (WebCore::WHLSL::AST::SwitchStatement::value): Deleted.
     313        (WebCore::WHLSL::AST::SwitchStatement::switchCases): Deleted.
     314        * Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h:
     315        (WebCore::WHLSL::AST::TernaryExpression::TernaryExpression): Deleted.
     316        (WebCore::WHLSL::AST::TernaryExpression::predicate): Deleted.
     317        (WebCore::WHLSL::AST::TernaryExpression::bodyExpression): Deleted.
     318        (WebCore::WHLSL::AST::TernaryExpression::elseExpression): Deleted.
     319        * Modules/webgpu/WHLSL/AST/WHLSLType.cpp: Added.
     320        (WebCore::WHLSL::AST::Type::destroy):
     321        (WebCore::WHLSL::AST::Type::unifyNode):
     322        (WebCore::WHLSL::AST::ResolvableType::canResolve const):
     323        (WebCore::WHLSL::AST::ResolvableType::conversionCost const):
     324        (WebCore::WHLSL::AST::UnnamedType::toString const):
     325        * Modules/webgpu/WHLSL/AST/WHLSLType.h:
     326        (WebCore::WHLSL::AST::Type::Type):
     327        (WebCore::WHLSL::AST::Type::kind const):
     328        (WebCore::WHLSL::AST::Type::isUnnamedType const):
     329        (WebCore::WHLSL::AST::Type::isNamedType const):
     330        (WebCore::WHLSL::AST::Type::isResolvableType const):
     331        (WebCore::WHLSL::AST::Type::isTypeReference const):
     332        (WebCore::WHLSL::AST::Type::isPointerType const):
     333        (WebCore::WHLSL::AST::Type::isArrayReferenceType const):
     334        (WebCore::WHLSL::AST::Type::isArrayType const):
     335        (WebCore::WHLSL::AST::Type::isReferenceType const):
     336        (WebCore::WHLSL::AST::Type::isTypeDefinition const):
     337        (WebCore::WHLSL::AST::Type::isStructureDefinition const):
     338        (WebCore::WHLSL::AST::Type::isEnumerationDefinition const):
     339        (WebCore::WHLSL::AST::Type::isNativeTypeDeclaration const):
     340        (WebCore::WHLSL::AST::Type::isFloatLiteralType const):
     341        (WebCore::WHLSL::AST::Type::isIntegerLiteralType const):
     342        (WebCore::WHLSL::AST::Type::isNullLiteralType const):
     343        (WebCore::WHLSL::AST::Type::isUnsignedIntegerLiteralType const):
     344        (WebCore::WHLSL::AST::Type::unifyNode const):
     345        * Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h:
     346        (WebCore::WHLSL::AST::TypeDefinition::TypeDefinition): Deleted.
     347        (WebCore::WHLSL::AST::TypeDefinition::type): Deleted.
     348        * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h:
     349        * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.cpp:
     350        (WebCore::WHLSL::AST::UnnamedType::hash const):
     351        (WebCore::WHLSL::AST::UnnamedType::operator== const):
     352        * Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h:
     353        (WebCore::WHLSL::AST::UnnamedType::UnnamedType):
     354        (WebCore::WHLSL::AST::UnnamedType::unifyNodeImpl):
     355        (): Deleted.
     356        (WebCore::WHLSL::AST::UnnamedType::kind const): Deleted.
     357        (WebCore::WHLSL::AST::UnnamedType::isTypeReference const): Deleted.
     358        (WebCore::WHLSL::AST::UnnamedType::isPointerType const): Deleted.
     359        (WebCore::WHLSL::AST::UnnamedType::isArrayReferenceType const): Deleted.
     360        (WebCore::WHLSL::AST::UnnamedType::isArrayType const): Deleted.
     361        (WebCore::WHLSL::AST::UnnamedType::isReferenceType const): Deleted.
     362        (WebCore::WHLSL::AST::UnnamedType::unifyNode const): Deleted.
     363        (WebCore::WHLSL::AST::UnnamedType::unifyNode): Deleted.
     364        * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h:
     365        (WebCore::WHLSL::AST::UnsignedIntegerLiteral::UnsignedIntegerLiteral): Deleted.
     366        (WebCore::WHLSL::AST::UnsignedIntegerLiteral::type): Deleted.
     367        (WebCore::WHLSL::AST::UnsignedIntegerLiteral::value const): Deleted.
     368        (WebCore::WHLSL::AST::UnsignedIntegerLiteral::clone const): Deleted.
     369        * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp:
     370        (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::UnsignedIntegerLiteralType):
     371        * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h:
     372        (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::value const): Deleted.
     373        (WebCore::WHLSL::AST::UnsignedIntegerLiteralType::preferredType): Deleted.
     374        * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h:
     375        (WebCore::WHLSL::AST::VariableDeclarationsStatement::VariableDeclarationsStatement): Deleted.
     376        (WebCore::WHLSL::AST::VariableDeclarationsStatement::variableDeclarations): Deleted.
     377        * Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h:
     378        (WebCore::WHLSL::AST::VariableReference::VariableReference): Deleted.
     379        (WebCore::WHLSL::AST::VariableReference::wrap): Deleted.
     380        (WebCore::WHLSL::AST::VariableReference::name): Deleted.
     381        (WebCore::WHLSL::AST::VariableReference::variable): Deleted.
     382        (WebCore::WHLSL::AST::VariableReference::setVariable): Deleted.
     383        * Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h:
     384        (WebCore::WHLSL::AST::WhileLoop::WhileLoop): Deleted.
     385        (WebCore::WHLSL::AST::WhileLoop::conditional): Deleted.
     386        (WebCore::WHLSL::AST::WhileLoop::body): Deleted.
     387        * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
     388        (WebCore::WHLSL::Metal::BaseTypeNameNode::isPointerTypeNameNode const):
     389        (WebCore::WHLSL::Metal::BaseTypeNameNode::isArrayReferenceTypeNameNode const):
     390        (WebCore::WHLSL::Metal::BaseTypeNameNode::isArrayTypeNameNode const):
     391        (WebCore::WHLSL::Metal::TypeNamer::createNameNode):
     392        (WebCore::WHLSL::Metal::parent):
     393        (WebCore::WHLSL::Metal::TypeNamer::emitUnnamedTypeDefinition):
     394        * Modules/webgpu/WHLSL/WHLSLParser.cpp:
     395        (WebCore::WHLSL::Parser::parseSuffixOperator):
     396        (WebCore::WHLSL::Parser::completeAssignment):
     397        (WebCore::WHLSL::Parser::parsePossiblePrefix):
     398        * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp:
     399        * Modules/webgpu/WHLSL/WHLSLVisitor.cpp:
     400        (WebCore::WHLSL::Visitor::visit):
     401        * Sources.txt:
     402        * WebCore.xcodeproj/project.pbxproj:
     403        * workers/WorkerScriptLoader.h:
     404
    14052019-08-09  Youenn Fablet  <youenn@apple.com>
    2406
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h

    r248395 r248488  
    3333#include <wtf/Noncopyable.h>
    3434#include <wtf/UniqueRef.h>
     35#include <wtf/text/StringConcatenate.h>
    3536#include <wtf/text/WTFString.h>
    3637
     
    4748
    4849    ArrayReferenceType(CodeLocation location, AddressSpace addressSpace, Ref<UnnamedType> elementType)
    49         : Base(location, addressSpace, WTFMove(elementType), Kind::ArrayReferenceType)
     50        : Base(location, addressSpace, WTFMove(elementType), Kind::ArrayReference)
    5051    {
    5152    }
     
    5657    }
    5758
    58     virtual ~ArrayReferenceType() = default;
     59    ~ArrayReferenceType() = default;
    5960
    6061    unsigned hash() const
     
    6869    }
    6970
    70     String toString() const override
     71    String toString() const
    7172    {
    7273        return makeString(elementType().toString(), "[]");
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLArrayType.h

    r248395 r248488  
    4747    WTF_MAKE_NONCOPYABLE(ArrayType);
    4848    ArrayType(CodeLocation location, Ref<UnnamedType> elementType, unsigned numElements)
    49         : UnnamedType(location, Kind::ArrayType)
     49        : UnnamedType(location, Kind::Array)
    5050        , m_elementType(WTFMove(elementType))
    5151        , m_numElements(numElements)
     
    5959    }
    6060
    61     virtual ~ArrayType() = default;
     61    ~ArrayType() = default;
    6262
    6363    const UnnamedType& type() const { return m_elementType; }
     
    7575    }
    7676
    77     String toString() const override
     77    String toString() const
    7878    {
    7979        return makeString(type().toString(), '[', numElements(), ']');
     
    9191}
    9292
     93DEFINE_DEFAULT_DELETE(ArrayType)
     94
    9395SPECIALIZE_TYPE_TRAITS_WHLSL_UNNAMED_TYPE(ArrayType, isArrayType())
    9496
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h

    r247834 r248488  
    3838namespace AST {
    3939
    40 class AssignmentExpression : public Expression {
     40class AssignmentExpression final : public Expression {
    4141    WTF_MAKE_FAST_ALLOCATED;
    4242public:
    4343    AssignmentExpression(CodeLocation location, UniqueRef<Expression>&& left, UniqueRef<Expression>&& right)
    44         : Expression(location)
     44        : Expression(location, Kind::Assignment)
    4545        , m_left(WTFMove(left))
    4646        , m_right(WTFMove(right))
     
    5151    }
    5252
    53     virtual ~AssignmentExpression() = default;
     53    ~AssignmentExpression() = default;
    5454
    5555    AssignmentExpression(const AssignmentExpression&) = delete;
    5656    AssignmentExpression(AssignmentExpression&&) = default;
    57 
    58     bool isAssignmentExpression() const override { return true; }
    5957
    6058    Expression& left() { return m_left; }
     
    7674}
    7775
     76DEFINE_DEFAULT_DELETE(AssignmentExpression)
     77
    7878SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(AssignmentExpression, isAssignmentExpression())
    7979
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBlock.h

    r247834 r248488  
    3939namespace AST {
    4040
    41 class Block : public Statement {
     41class Block final : public Statement {
    4242    WTF_MAKE_FAST_ALLOCATED;
    4343public:
    4444    Block(CodeLocation location, Statements&& statements)
    45         : Statement(location)
     45        : Statement(location, Kind::Block)
    4646        , m_statements(WTFMove(statements))
    4747    {
    4848    }
    4949
    50     virtual ~Block() = default;
     50    ~Block() = default;
    5151
    5252    Block(const Block&) = delete;
     
    5454
    5555    Statements& statements() { return m_statements; }
    56 
    57     bool isBlock() const override { return true; }
    5856
    5957private:
     
    6765}
    6866
     67DEFINE_DEFAULT_DELETE(Block)
     68
    6969SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(Block, isBlock())
    7070
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h

    r247834 r248488  
    3737namespace AST {
    3838
    39 class BooleanLiteral : public Expression {
     39class BooleanLiteral final : public Expression {
    4040    WTF_MAKE_FAST_ALLOCATED;
    4141public:
    4242    BooleanLiteral(CodeLocation location, bool value)
    43         : Expression(location)
     43        : Expression(location, Kind::BooleanLiteral)
    4444        , m_value(value)
    4545    {
    4646    }
    4747
    48     virtual ~BooleanLiteral() = default;
     48    ~BooleanLiteral() = default;
    4949
    5050    BooleanLiteral(const BooleanLiteral&) = delete;
     
    5555
    5656    bool value() const { return m_value; }
    57 
    58     bool isBooleanLiteral() const override { return true; }
    5957
    6058    BooleanLiteral clone() const
     
    7573}
    7674
     75DEFINE_DEFAULT_DELETE(BooleanLiteral)
     76
    7777SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(BooleanLiteral, isBooleanLiteral())
    7878
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBreak.h

    r247834 r248488  
    3838namespace AST {
    3939
    40 class Break : public Statement {
     40class Break final : public Statement {
    4141    WTF_MAKE_FAST_ALLOCATED;
    4242public:
    4343    Break(CodeLocation location)
    44         : Statement(location)
     44        : Statement(location, Kind::Break)
    4545    {
    4646    }
    4747
    48     virtual ~Break() = default;
     48    ~Break() = default;
    4949
    5050    Break(const Break&) = delete;
    5151    Break(Break&&) = default;
    52 
    53     bool isBreak() const override { return true; }
    5452
    5553private:
     
    6260}
    6361
     62DEFINE_DEFAULT_DELETE(Break)
     63
    6464SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(Break, isBreak())
    6565
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h

    r247834 r248488  
    4141class NamedType;
    4242
    43 class CallExpression : public Expression {
     43class CallExpression final : public Expression {
    4444    WTF_MAKE_FAST_ALLOCATED;
    4545public:
    4646    CallExpression(CodeLocation location, String&& name, Vector<UniqueRef<Expression>>&& arguments)
    47         : Expression(location)
     47        : Expression(location, Kind::Call)
    4848        , m_name(WTFMove(name))
    4949        , m_arguments(WTFMove(arguments))
     
    5151    }
    5252
    53     virtual ~CallExpression() = default;
    54 
    5553    CallExpression(const CallExpression&) = delete;
    5654    CallExpression(CallExpression&&) = default;
    57 
    58     bool isCallExpression() const override { return true; }
    5955
    6056    Vector<UniqueRef<Expression>>& arguments() { return m_arguments; }
    6157
    6258    String& name() { return m_name; }
     59
     60    ~CallExpression() = default;
    6361
    6462    void setCastData(NamedType& namedType)
     
    9492}
    9593
     94DEFINE_DEFAULT_DELETE(CallExpression)
     95
    9696SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(CallExpression, isCallExpression())
    9797
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h

    r247834 r248488  
    3939namespace AST {
    4040
    41 class CommaExpression : public Expression {
     41class CommaExpression final : public Expression {
    4242    WTF_MAKE_FAST_ALLOCATED;
    4343public:
    4444    CommaExpression(CodeLocation location, Vector<UniqueRef<Expression>>&& list)
    45         : Expression(location)
     45        : Expression(location, Kind::Comma)
    4646        , m_list(WTFMove(list))
    4747    {
    4848    }
    4949
    50     virtual ~CommaExpression() = default;
     50    ~CommaExpression() = default;
    5151
    5252    CommaExpression(const CommaExpression&) = delete;
    5353    CommaExpression(CommaExpression&&) = default;
    54 
    55     bool isCommaExpression() const override { return true; }
    5654
    5755    Vector<UniqueRef<Expression>>& list() { return m_list; }
     
    6765}
    6866
     67DEFINE_DEFAULT_DELETE(CommaExpression)
     68
    6969SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(CommaExpression, isCommaExpression())
    7070
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h

    r247813 r248488  
    4646// so this is a wrapper class to make sure that doesn't happen. As soon as we don't
    4747// have to support Sierra, this can be migrated to a Variant proper.
    48 class ConstantExpression {
     48class ConstantExpression final {
    4949    WTF_MAKE_FAST_ALLOCATED;
    5050public:
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLContinue.h

    r247834 r248488  
    3838namespace AST {
    3939
    40 class Continue : public Statement {
     40class Continue final : public Statement {
    4141    WTF_MAKE_FAST_ALLOCATED;
    4242public:
    4343    Continue(CodeLocation location)
    44         : Statement(location)
     44        : Statement(location, Kind::Continue)
    4545    {
    4646    }
    4747
    48     virtual ~Continue() = default;
     48    ~Continue() = default;
    4949
    5050    Continue(const Continue&) = delete;
    5151    Continue(Continue&&) = default;
    52 
    53     bool isContinue() const override { return true; }
    5452
    5553private:
     
    6260}
    6361
     62DEFINE_DEFAULT_DELETE(Continue)
     63
    6464SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(Continue, isContinue())
    6565
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLDefaultDelete.h

    r248487 r248488  
    2828#if ENABLE(WEBGPU)
    2929
    30 #include "WHLSLCodeLocation.h"
    31 #include "WHLSLStatement.h"
    32 #include <wtf/FastMalloc.h>
     30#include <type_traits>
    3331
    34 namespace WebCore {
    35 
    36 namespace WHLSL {
    37 
    38 namespace AST {
    39 
    40 class Break : public Statement {
    41     WTF_MAKE_FAST_ALLOCATED;
    42 public:
    43     Break(CodeLocation location)
    44         : Statement(location)
    45     {
    46     }
    47 
    48     virtual ~Break() = default;
    49 
    50     Break(const Break&) = delete;
    51     Break(Break&&) = default;
    52 
    53     bool isBreak() const override { return true; }
    54 
    55 private:
    56 };
    57 
    58 } // namespace AST
    59 
    60 }
    61 
    62 }
    63 
    64 SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(Break, isBreak())
     32#define DEFINE_DEFAULT_DELETE(type) \
     33    namespace std { \
     34        template<> \
     35        struct default_delete<WebCore::WHLSL::AST::type> { \
     36            template <typename T> \
     37            void callDelete(T* t) \
     38            { \
     39                delete t; \
     40            } \
     41            template <typename T> \
     42            void callDestroy(T* t) \
     43            { \
     44                WebCore::WHLSL::AST::type::destroy(*t); \
     45            } \
     46            constexpr void operator()(WebCore::WHLSL::AST::type* value) \
     47            { \
     48                if constexpr (std::is_final<WebCore::WHLSL::AST::type>::value) \
     49                    callDelete(value); \
     50                else \
     51                    callDestroy(value); \
     52            } \
     53        }; \
     54    } \
    6555
    6656#endif
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h

    r247834 r248488  
    3838namespace AST {
    3939
    40 class DereferenceExpression : public Expression {
     40class DereferenceExpression final : public Expression {
    4141    WTF_MAKE_FAST_ALLOCATED;
    4242public:
    4343    DereferenceExpression(CodeLocation location, UniqueRef<Expression>&& pointer)
    44         : Expression(location)
     44        : Expression(location, Kind::Dereference)
    4545        , m_pointer(WTFMove(pointer))
    4646    {
    4747    }
    4848
    49     virtual ~DereferenceExpression() = default;
     49    ~DereferenceExpression() = default;
    5050
    5151    DereferenceExpression(const DereferenceExpression&) = delete;
    5252    DereferenceExpression(DereferenceExpression&&) = default;
    53 
    54     bool isDereferenceExpression() const override { return true; }
    5553
    5654    Expression& pointer() { return m_pointer; }
     
    6664}
    6765
     66DEFINE_DEFAULT_DELETE(DereferenceExpression)
     67
    6868SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(DereferenceExpression, isDereferenceExpression())
    6969
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h

    r247834 r248488  
    3939namespace AST {
    4040
    41 class DoWhileLoop : public Statement {
     41class DoWhileLoop final : public Statement {
    4242    WTF_MAKE_FAST_ALLOCATED;
    4343public:
    4444    DoWhileLoop(CodeLocation location, UniqueRef<Statement>&& body, UniqueRef<Expression>&& conditional)
    45         : Statement(location)
     45        : Statement(location, Kind::DoWhileLoop)
    4646        , m_body(WTFMove(body))
    4747        , m_conditional(WTFMove(conditional))
     
    4949    }
    5050
    51     virtual ~DoWhileLoop() = default;
     51    ~DoWhileLoop() = default;
    5252
    5353    DoWhileLoop(const DoWhileLoop&) = delete;
    5454    DoWhileLoop(DoWhileLoop&&) = default;
    55 
    56     bool isDoWhileLoop() const override { return true; }
    5755
    5856    Statement& body() { return m_body; }
     
    7068}
    7169
     70DEFINE_DEFAULT_DELETE(DoWhileLoop)
     71
    7272SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(DoWhileLoop, isDoWhileLoop())
    7373
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h

    r247834 r248488  
    3939namespace AST {
    4040
    41 class DotExpression : public PropertyAccessExpression {
     41class DotExpression final : public PropertyAccessExpression {
    4242    WTF_MAKE_FAST_ALLOCATED;
    4343public:
    4444    DotExpression(CodeLocation location, UniqueRef<Expression>&& base, String&& fieldName)
    45         : PropertyAccessExpression(location, WTFMove(base))
     45        : PropertyAccessExpression(location, Kind::Dot, WTFMove(base))
    4646        , m_fieldName(WTFMove(fieldName))
    4747    {
    4848    }
    4949
    50     virtual ~DotExpression() = default;
     50    ~DotExpression() = default;
    5151
    5252    DotExpression(const DotExpression&) = delete;
    5353    DotExpression(DotExpression&&) = default;
    5454
    55     bool isDotExpression() const override { return true; }
    56 
    57     String getterFunctionName() const override
     55    String getterFunctionName() const
    5856    {
    5957        return makeString("operator.", m_fieldName);
    6058    }
    6159
    62     String setterFunctionName() const override
     60    String setterFunctionName() const
    6361    {
    6462        return makeString("operator.", m_fieldName, "=");
    6563    }
    6664
    67     String anderFunctionName() const override
     65    String anderFunctionName() const
    6866    {
    6967        return makeString("operator&.", m_fieldName);
     
    8280}
    8381
     82DEFINE_DEFAULT_DELETE(DotExpression)
     83
    8484SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(DotExpression, isDotExpression())
    8585
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h

    r247834 r248488  
    3939namespace AST {
    4040
    41 class EffectfulExpressionStatement : public Statement {
     41class EffectfulExpressionStatement final : public Statement {
    4242    WTF_MAKE_FAST_ALLOCATED;
    4343public:
    4444    EffectfulExpressionStatement(UniqueRef<Expression>&& effectfulExpression)
    45         : Statement(effectfulExpression->codeLocation())
     45        : Statement(effectfulExpression->codeLocation(), Kind::EffectfulExpression)
    4646        , m_effectfulExpression(WTFMove(effectfulExpression))
    4747    {
    4848    }
    4949
    50     virtual ~EffectfulExpressionStatement() = default;
     50    ~EffectfulExpressionStatement() = default;
    5151
    5252    EffectfulExpressionStatement(const EffectfulExpressionStatement&) = delete;
    5353    EffectfulExpressionStatement(EffectfulExpressionStatement&&) = default;
    54 
    55     bool isEffectfulExpressionStatement() const override { return true; }
    5654
    5755    Expression& effectfulExpression() { return m_effectfulExpression; }
     
    6765}
    6866
     67DEFINE_DEFAULT_DELETE(EffectfulExpressionStatement)
     68
    6969SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(EffectfulExpressionStatement, isEffectfulExpressionStatement())
    7070
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h

    r247878 r248488  
    4646namespace AST {
    4747
    48 class EnumerationDefinition : public NamedType {
     48class EnumerationDefinition final : public NamedType {
    4949    WTF_MAKE_FAST_ALLOCATED;
    5050public:
    5151    EnumerationDefinition(CodeLocation location, String&& name, Ref<UnnamedType> type)
    52         : NamedType(location, WTFMove(name))
     52        : NamedType(Kind::EnumerationDefinition, location, WTFMove(name))
    5353        , m_type(WTFMove(type))
    5454    {
    5555    }
    5656
    57     virtual ~EnumerationDefinition() = default;
     57    ~EnumerationDefinition() = default;
    5858
    5959    EnumerationDefinition(const EnumerationDefinition&) = delete;
    6060    EnumerationDefinition(EnumerationDefinition&&) = default;
    61 
    62     bool isEnumerationDefinition() const override { return true; }
    6361
    6462    UnnamedType& type() { return m_type; }
     
    9795}
    9896
     97DEFINE_DEFAULT_DELETE(EnumerationDefinition)
     98
    9999SPECIALIZE_TYPE_TRAITS_WHLSL_NAMED_TYPE(EnumerationDefinition, isEnumerationDefinition())
    100100
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h

    r247834 r248488  
    4141class EnumerationMember;
    4242
    43 class EnumerationMemberLiteral : public Expression {
     43class EnumerationMemberLiteral final : public Expression {
    4444    WTF_MAKE_FAST_ALLOCATED;
    4545public:
    4646    EnumerationMemberLiteral(CodeLocation location, String&& left, String&& right)
    47         : Expression(location)
     47        : Expression(location, Kind::EnumerationMemberLiteral)
    4848        , m_left(WTFMove(left))
    4949        , m_right(WTFMove(right))
     
    5151    }
    5252
    53     virtual ~EnumerationMemberLiteral() = default;
     53    ~EnumerationMemberLiteral() = default;
    5454
    5555    explicit EnumerationMemberLiteral(const EnumerationMemberLiteral&) = delete;
     
    5858    EnumerationMemberLiteral& operator=(const EnumerationMemberLiteral&) = delete;
    5959    EnumerationMemberLiteral& operator=(EnumerationMemberLiteral&&) = default;
    60 
    61     bool isEnumerationMemberLiteral() const override { return true; }
    6260
    6361    static EnumerationMemberLiteral wrap(CodeLocation location, String&& left, String&& right, EnumerationDefinition& enumerationDefinition, EnumerationMember& enumerationMember)
     
    119117}
    120118
     119DEFINE_DEFAULT_DELETE(EnumerationMemberLiteral)
     120
    121121SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(EnumerationMemberLiteral, isEnumerationMemberLiteral())
    122122
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLExpression.h

    r247878 r248488  
    3030#include "WHLSLAddressSpace.h"
    3131#include "WHLSLCodeLocation.h"
     32#include "WHLSLDefaultDelete.h"
    3233#include "WHLSLUnnamedType.h"
    3334#include <wtf/FastMalloc.h>
     
    4344class Expression {
    4445    WTF_MAKE_FAST_ALLOCATED;
     46
     47protected:
     48    ~Expression() = default;
     49
    4550public:
    46     Expression(CodeLocation codeLocation)
     51
     52    enum class Kind : uint8_t {
     53        Assignment,
     54        BooleanLiteral,
     55        Call,
     56        Comma,
     57        Dereference,
     58        Dot,
     59        GlobalVariableReference,
     60        FloatLiteral,
     61        Index,
     62        IntegerLiteral,
     63        Logical,
     64        LogicalNot,
     65        MakeArrayReference,
     66        MakePointer,
     67        NullLiteral,
     68        ReadModifyWrite,
     69        Ternary,
     70        UnsignedIntegerLiteral,
     71        VariableReference,
     72        EnumerationMemberLiteral,
     73    };
     74
     75    Expression(CodeLocation codeLocation, Kind kind)
    4776        : m_codeLocation(codeLocation)
     77        , m_kind(kind)
    4878    {
    4979    }
    5080
    51     virtual ~Expression() = default;
     81    static void destroy(Expression&);
     82    static void destruct(Expression&);
    5283
    5384    Expression(const Expression&) = delete;
     
    93124    }
    94125
    95     virtual bool isAssignmentExpression() const { return false; }
    96     virtual bool isBooleanLiteral() const { return false; }
    97     virtual bool isCallExpression() const { return false; }
    98     virtual bool isCommaExpression() const { return false; }
    99     virtual bool isDereferenceExpression() const { return false; }
    100     virtual bool isDotExpression() const { return false; }
    101     virtual bool isGlobalVariableReference() const { return false; }
    102     virtual bool isFloatLiteral() const { return false; }
    103     virtual bool isIndexExpression() const { return false; }
    104     virtual bool isIntegerLiteral() const { return false; }
    105     virtual bool isLogicalExpression() const { return false; }
    106     virtual bool isLogicalNotExpression() const { return false; }
    107     virtual bool isMakeArrayReferenceExpression() const { return false; }
    108     virtual bool isMakePointerExpression() const { return false; }
    109     virtual bool isNullLiteral() const { return false; }
    110     virtual bool isPropertyAccessExpression() const { return false; }
    111     virtual bool isReadModifyWriteExpression() const { return false; }
    112     virtual bool isTernaryExpression() const { return false; }
    113     virtual bool isUnsignedIntegerLiteral() const { return false; }
    114     virtual bool isVariableReference() const { return false; }
    115     virtual bool isEnumerationMemberLiteral() const { return false; }
     126    Kind kind() const  { return m_kind; }
     127    bool isAssignmentExpression() const { return kind() == Kind::Assignment; }
     128    bool isBooleanLiteral() const { return kind() == Kind::BooleanLiteral; }
     129    bool isCallExpression() const { return kind() == Kind::Call; }
     130    bool isCommaExpression() const { return kind() == Kind::Comma; }
     131    bool isDereferenceExpression() const { return kind() == Kind::Dereference; }
     132    bool isDotExpression() const { return kind() == Kind::Dot; }
     133    bool isGlobalVariableReference() const { return kind() == Kind::GlobalVariableReference; }
     134    bool isFloatLiteral() const { return kind() == Kind::FloatLiteral; }
     135    bool isIndexExpression() const { return kind() == Kind::Index; }
     136    bool isIntegerLiteral() const { return kind() == Kind::IntegerLiteral; }
     137    bool isLogicalExpression() const { return kind() == Kind::Logical; }
     138    bool isLogicalNotExpression() const { return kind() == Kind::LogicalNot; }
     139    bool isMakeArrayReferenceExpression() const { return kind() == Kind::MakeArrayReference; }
     140    bool isMakePointerExpression() const { return kind() == Kind::MakePointer; }
     141    bool isNullLiteral() const { return kind() == Kind::NullLiteral; }
     142    bool isPropertyAccessExpression() const { return isDotExpression() || isIndexExpression(); }
     143    bool isReadModifyWriteExpression() const { return kind() == Kind::ReadModifyWrite; }
     144    bool isTernaryExpression() const { return kind() == Kind::Ternary; }
     145    bool isUnsignedIntegerLiteral() const { return kind() == Kind::UnsignedIntegerLiteral; }
     146    bool isVariableReference() const { return kind() == Kind::VariableReference; }
     147    bool isEnumerationMemberLiteral() const { return kind() == Kind::EnumerationMemberLiteral; }
    116148
    117149    CodeLocation codeLocation() const { return m_codeLocation; }
     
    122154    RefPtr<UnnamedType> m_type;
    123155    Optional<TypeAnnotation> m_typeAnnotation;
     156    Kind m_kind;
    124157};
    125158
     
    130163}
    131164
     165DEFINE_DEFAULT_DELETE(Expression)
     166
    132167#define SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(ToValueTypeName, predicate) \
    133168SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::WHLSL::AST::ToValueTypeName) \
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFallthrough.h

    r247834 r248488  
    3838namespace AST {
    3939
    40 class Fallthrough : public Statement {
     40class Fallthrough final : public Statement {
    4141    WTF_MAKE_FAST_ALLOCATED;
    4242public:
    4343    Fallthrough(CodeLocation location)
    44         : Statement(location)
     44        : Statement(location, Kind::Fallthrough)
    4545    {
    4646    }
    4747
    48     virtual ~Fallthrough() = default;
     48    ~Fallthrough() = default;
    4949
    5050    Fallthrough(const Fallthrough&) = delete;
    5151    Fallthrough(Fallthrough&&) = default;
    52 
    53     bool isFallthrough() const override { return true; }
    5452
    5553private:
     
    6260}
    6361
     62DEFINE_DEFAULT_DELETE(Fallthrough)
     63
    6464SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(Fallthrough, isFallthrough())
    6565
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFloatLiteral.h

    r247878 r248488  
    3838namespace AST {
    3939
    40 class FloatLiteral : public Expression {
     40class FloatLiteral final : public Expression {
    4141    WTF_MAKE_FAST_ALLOCATED;
    4242public:
    4343    FloatLiteral(CodeLocation location, float value)
    44         : Expression(location)
     44        : Expression(location, Kind::FloatLiteral)
    4545        , m_type(location, value)
    4646        , m_value(value)
     
    4848    }
    4949
    50     virtual ~FloatLiteral() = default;
     50    ~FloatLiteral() = default;
    5151
    5252    FloatLiteral(const FloatLiteral&) = delete;
     
    5858    FloatLiteralType& type() { return m_type; }
    5959    float value() const { return m_value; }
    60 
    61     bool isFloatLiteral() const override { return true; }
    6260
    6361    FloatLiteral clone() const
     
    8280}
    8381
     82DEFINE_DEFAULT_DELETE(FloatLiteral)
     83
    8484SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(FloatLiteral, isFloatLiteral())
    8585
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp

    r247878 r248488  
    4040
    4141FloatLiteralType::FloatLiteralType(CodeLocation location, float value)
    42     : m_value(value)
     42    : ResolvableType(Kind::FloatLiteral)
     43    , m_value(value)
    4344    , m_preferredType(TypeReference::create(location, "float"_str, TypeArguments()))
    4445{
    4546}
    46 
    47 FloatLiteralType::~FloatLiteralType() = default;
    48 
    49 FloatLiteralType::FloatLiteralType(FloatLiteralType&&) = default;
    50 
    51 FloatLiteralType& FloatLiteralType::operator=(FloatLiteralType&&) = default;
    5247
    5348bool FloatLiteralType::canResolve(const Type& type) const
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h

    r247878 r248488  
    4141class TypeReference;
    4242
    43 class FloatLiteralType : public ResolvableType {
     43class FloatLiteralType final : public ResolvableType {
    4444    WTF_MAKE_FAST_ALLOCATED;
    4545public:
    4646    FloatLiteralType(CodeLocation, float value);
    4747
    48     virtual ~FloatLiteralType();
     48    ~FloatLiteralType() = default;
    4949
    5050    FloatLiteralType(const FloatLiteralType&) = delete;
    51     FloatLiteralType(FloatLiteralType&&);
     51    FloatLiteralType(FloatLiteralType&&) = default;
    5252
    5353    FloatLiteralType& operator=(const FloatLiteralType&) = delete;
    54     FloatLiteralType& operator=(FloatLiteralType&&);
    55 
    56     bool isFloatLiteralType() const override { return true; }
     54    FloatLiteralType& operator=(FloatLiteralType&&) = default;
    5755
    5856    float value() const { return m_value; }
     
    6058    TypeReference& preferredType() { return m_preferredType; }
    6159
    62     bool canResolve(const Type&) const override;
    63     unsigned conversionCost(const UnnamedType&) const override;
     60    bool canResolve(const Type&) const;
     61    unsigned conversionCost(const UnnamedType&) const;
    6462
    6563    FloatLiteralType clone() const;
     
    7876}
    7977
     78DEFINE_DEFAULT_DELETE(FloatLiteralType)
     79
    8080SPECIALIZE_TYPE_TRAITS_WHLSL_RESOLVABLE_TYPE(FloatLiteralType, isFloatLiteralType())
    8181
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLForLoop.h

    r247834 r248488  
    4343namespace AST {
    4444
    45 class ForLoop : public Statement {
     45class ForLoop final : public Statement {
    4646    WTF_MAKE_FAST_ALLOCATED;
    4747public:
    4848    ForLoop(CodeLocation location, Variant<UniqueRef<Statement>, UniqueRef<Expression>>&& initialization, std::unique_ptr<Expression>&& condition, std::unique_ptr<Expression>&& increment, UniqueRef<Statement>&& body)
    49         : Statement(location)
     49        : Statement(location, Kind::ForLoop)
    5050        , m_initialization(WTFMove(initialization))
    5151        , m_condition(WTFMove(condition))
     
    5555    }
    5656
    57     virtual ~ForLoop()
    58     {
    59     }
     57    ~ForLoop() = default;
    6058
    6159    ForLoop(const ForLoop&) = delete;
    6260    ForLoop(ForLoop&&) = default;
    63 
    64     bool isForLoop() const override { return true; }
    6561
    6662    Variant<UniqueRef<Statement>, UniqueRef<Expression>>& initialization() { return m_initialization; }
     
    8278}
    8379
     80DEFINE_DEFAULT_DELETE(ForLoop)
     81
    8482SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(ForLoop, isForLoop())
    8583
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLGlobalVariableReference.h

    r247834 r248488  
    3838namespace AST {
    3939
    40 class GlobalVariableReference : public Expression {
     40class GlobalVariableReference final : public Expression {
    4141    WTF_MAKE_FAST_ALLOCATED;
    4242public:
    4343    GlobalVariableReference(CodeLocation location, UniqueRef<Expression>&& base, StructureElement* structField)
    44         : Expression(location)
     44        : Expression(location, Kind::GlobalVariableReference)
    4545        , m_base(WTFMove(base))
    4646        , m_structField(*structField)
     
    4949    }
    5050
    51     virtual ~GlobalVariableReference() = default;
    52     bool isGlobalVariableReference() const override { return true; }
     51    ~GlobalVariableReference() = default;
     52   
    5353    StructureElement& structField() { return m_structField; }
    5454
     
    6666}
    6767
     68DEFINE_DEFAULT_DELETE(GlobalVariableReference)
     69
    6870SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(GlobalVariableReference, isGlobalVariableReference())
    6971
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h

    r247834 r248488  
    4040namespace AST {
    4141
    42 class IfStatement : public Statement {
     42class IfStatement final : public Statement {
    4343    WTF_MAKE_FAST_ALLOCATED;
    4444public:
    4545    IfStatement(CodeLocation location, UniqueRef<Expression>&& conditional, UniqueRef<Statement>&& body, std::unique_ptr<Statement>&& elseBody)
    46         : Statement(location)
     46        : Statement(location, Kind::If)
    4747        , m_conditional(WTFMove(conditional))
    4848        , m_body(WTFMove(body))
     
    5151    }
    5252
    53     virtual ~IfStatement() = default;
     53    ~IfStatement() = default;
    5454
    5555    IfStatement(const IfStatement&) = delete;
    5656    IfStatement(IfStatement&&) = default;
    57 
    58     bool isIfStatement() const override { return true; }
    5957
    6058    Expression& conditional() { return m_conditional; }
     
    7472}
    7573
     74DEFINE_DEFAULT_DELETE(IfStatement)
     75
    7676SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(IfStatement, isIfStatement())
    7777
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h

    r247834 r248488  
    3939namespace AST {
    4040
    41 class IndexExpression : public PropertyAccessExpression {
     41class IndexExpression final : public PropertyAccessExpression {
    4242    WTF_MAKE_FAST_ALLOCATED;
    4343public:
    4444    IndexExpression(CodeLocation location, UniqueRef<Expression>&& base, UniqueRef<Expression>&& index)
    45         : PropertyAccessExpression(location, WTFMove(base))
     45        : PropertyAccessExpression(location, Kind::Index, WTFMove(base))
    4646        , m_index(WTFMove(index))
    4747    {
    4848    }
    4949
    50     virtual ~IndexExpression() = default;
     50    ~IndexExpression() = default;
    5151
    5252    IndexExpression(const IndexExpression&) = delete;
    5353    IndexExpression(IndexExpression&&) = default;
    5454
    55     bool isIndexExpression() const override { return true; }
    56 
    57     String getterFunctionName() const override
     55    String getterFunctionName() const
    5856    {
    5957        return "operator[]"_str;
    6058    }
    6159
    62     String setterFunctionName() const override
     60    String setterFunctionName() const
    6361    {
    6462        return "operator[]="_str;
    6563    }
    6664
    67     String anderFunctionName() const override
     65    String anderFunctionName() const
    6866    {
    6967        return "operator&[]"_str;
     
    8381}
    8482
     83DEFINE_DEFAULT_DELETE(IndexExpression)
     84
    8585SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(IndexExpression, isIndexExpression())
    8686
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h

    r247878 r248488  
    3838namespace AST {
    3939
    40 class IntegerLiteral : public Expression {
     40class IntegerLiteral final : public Expression {
    4141    WTF_MAKE_FAST_ALLOCATED;
    4242public:
    4343    IntegerLiteral(CodeLocation location, int value)
    44         : Expression(location)
     44        : Expression(location, Kind::IntegerLiteral)
    4545        , m_type(location, value)
    4646        , m_value(value)
     
    4848    }
    4949
    50     virtual ~IntegerLiteral() = default;
     50    ~IntegerLiteral() = default;
    5151
    5252    IntegerLiteral(const IntegerLiteral&) = delete;
     
    5858    IntegerLiteralType& type() { return m_type; }
    5959    int value() const { return m_value; }
    60 
    61     bool isIntegerLiteral() const override { return true; }
    6260
    6361    IntegerLiteral clone() const
     
    8482}
    8583
     84DEFINE_DEFAULT_DELETE(IntegerLiteral)
     85
    8686SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(IntegerLiteral, isIntegerLiteral())
    8787
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp

    r247878 r248488  
    4141
    4242IntegerLiteralType::IntegerLiteralType(CodeLocation location, int value)
    43     : m_value(value)
     43    : ResolvableType(Kind::IntegerLiteral)
     44    , m_value(value)
    4445    , m_preferredType(TypeReference::create(location, "int"_str, TypeArguments()))
    4546{
    4647}
    47 
    48 IntegerLiteralType::~IntegerLiteralType() = default;
    49 
    50 IntegerLiteralType::IntegerLiteralType(IntegerLiteralType&&) = default;
    51 
    52 IntegerLiteralType& IntegerLiteralType::operator=(IntegerLiteralType&&) = default;
    5348
    5449bool IntegerLiteralType::canResolve(const Type& type) const
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h

    r247878 r248488  
    4141class TypeReference;
    4242
    43 class IntegerLiteralType : public ResolvableType {
     43class IntegerLiteralType final : public ResolvableType {
    4444    WTF_MAKE_FAST_ALLOCATED;
    4545public:
    4646    IntegerLiteralType(CodeLocation, int value);
    4747
    48     virtual ~IntegerLiteralType();
     48    ~IntegerLiteralType() = default;
    4949
    5050    IntegerLiteralType(const IntegerLiteralType&) = delete;
    51     IntegerLiteralType(IntegerLiteralType&&);
     51    IntegerLiteralType(IntegerLiteralType&&) = default;
    5252
    5353    IntegerLiteralType& operator=(const IntegerLiteralType&) = delete;
    54     IntegerLiteralType& operator=(IntegerLiteralType&&);
    55 
    56     bool isIntegerLiteralType() const override { return true; }
     54    IntegerLiteralType& operator=(IntegerLiteralType&&) = default;
    5755
    5856    int value() const { return m_value; }
     
    6058    TypeReference& preferredType() { return m_preferredType; }
    6159
    62     bool canResolve(const Type&) const override;
    63     unsigned conversionCost(const UnnamedType&) const override;
     60    bool canResolve(const Type&) const;
     61    unsigned conversionCost(const UnnamedType&) const;
    6462
    6563    IntegerLiteralType clone() const;
     
    7876}
    7977
     78DEFINE_DEFAULT_DELETE(IntegerLiteralType)
     79
    8080SPECIALIZE_TYPE_TRAITS_WHLSL_RESOLVABLE_TYPE(IntegerLiteralType, isIntegerLiteralType())
    8181
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h

    r247834 r248488  
    3838namespace AST {
    3939
    40 class LogicalExpression : public Expression {
     40class LogicalExpression final : public Expression {
    4141    WTF_MAKE_FAST_ALLOCATED;
    4242public:
     
    4747
    4848    LogicalExpression(CodeLocation location, Type type, UniqueRef<Expression>&& left, UniqueRef<Expression>&& right)
    49         : Expression(location)
     49        : Expression(location, Kind::Logical)
    5050        , m_type(type)
    5151        , m_left(WTFMove(left))
     
    5454    }
    5555
    56     virtual ~LogicalExpression() = default;
     56    ~LogicalExpression() = default;
    5757
    5858    LogicalExpression(const LogicalExpression&) = delete;
     
    6060
    6161    Type type() const { return m_type; }
    62 
    63     bool isLogicalExpression() const override { return true; }
    6462
    6563    Expression& left() { return m_left; }
     
    7876}
    7977
     78DEFINE_DEFAULT_DELETE(LogicalExpression)
     79
    8080SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(LogicalExpression, isLogicalExpression())
    8181
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h

    r247834 r248488  
    3838namespace AST {
    3939
    40 class LogicalNotExpression : public Expression {
     40class LogicalNotExpression final : public Expression {
    4141    WTF_MAKE_FAST_ALLOCATED;
    4242public:
    4343    LogicalNotExpression(CodeLocation location, UniqueRef<Expression>&& operand)
    44         : Expression(location)
     44        : Expression(location, Kind::LogicalNot)
    4545        , m_operand(WTFMove(operand))
    4646    {
    4747    }
    4848
    49     virtual ~LogicalNotExpression() = default;
     49    ~LogicalNotExpression() = default;
    5050
    5151    LogicalNotExpression(const LogicalNotExpression&) = delete;
    5252    LogicalNotExpression(LogicalNotExpression&&) = default;
    53 
    54     bool isLogicalNotExpression() const override { return true; }
    5553
    5654    Expression& operand() { return m_operand; }
     
    6664}
    6765
     66DEFINE_DEFAULT_DELETE(LogicalNotExpression)
     67
    6868SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(LogicalNotExpression, isLogicalNotExpression())
    6969
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h

    r248303 r248488  
    3939namespace AST {
    4040
    41 class MakeArrayReferenceExpression : public Expression {
     41class MakeArrayReferenceExpression final : public Expression {
    4242    WTF_MAKE_FAST_ALLOCATED;
    4343public:
    4444    MakeArrayReferenceExpression(CodeLocation location, UniqueRef<Expression>&& leftValue, AddressEscapeMode addressEscapeMode)
    45         : Expression(location)
     45        : Expression(location, Kind::MakeArrayReference)
    4646        , m_leftValue(WTFMove(leftValue))
    4747        , m_addressEscapeMode(addressEscapeMode)
     
    4949    }
    5050
    51     virtual ~MakeArrayReferenceExpression() = default;
     51    ~MakeArrayReferenceExpression() = default;
    5252
    5353    MakeArrayReferenceExpression(const MakeArrayReferenceExpression&) = delete;
    5454    MakeArrayReferenceExpression(MakeArrayReferenceExpression&&) = default;
    55 
    56     bool isMakeArrayReferenceExpression() const override { return true; }
    5755
    5856    Expression& leftValue() { return m_leftValue; }
     
    7169}
    7270
     71DEFINE_DEFAULT_DELETE(MakeArrayReferenceExpression)
     72
    7373SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(MakeArrayReferenceExpression, isMakeArrayReferenceExpression())
    7474
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h

    r248303 r248488  
    3939namespace AST {
    4040
    41 class MakePointerExpression : public Expression {
     41class MakePointerExpression final : public Expression {
    4242    WTF_MAKE_FAST_ALLOCATED;
    4343public:
    4444    MakePointerExpression(CodeLocation location, UniqueRef<Expression>&& leftValue, AddressEscapeMode addressEscapeMode)
    45         : Expression(location)
     45        : Expression(location, Kind::MakePointer)
    4646        , m_leftValue(WTFMove(leftValue))
    4747        , m_addressEscapeMode(addressEscapeMode)
     
    4949    }
    5050
    51     virtual ~MakePointerExpression() = default;
     51    ~MakePointerExpression() = default;
    5252
    5353    MakePointerExpression(const MakePointerExpression&) = delete;
    5454    MakePointerExpression(MakePointerExpression&&) = default;
    55 
    56     bool isMakePointerExpression() const override { return true; }
    5755
    5856    Expression& leftValue() { return m_leftValue; }
     
    7169}
    7270
     71DEFINE_DEFAULT_DELETE(MakePointerExpression)
     72
    7373SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(MakePointerExpression, isMakePointerExpression())
    7474
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNamedType.h

    r247834 r248488  
    4141class NamedType : public Type {
    4242    WTF_MAKE_FAST_ALLOCATED;
     43
     44protected:
     45    ~NamedType() = default;
     46
    4347public:
    44     NamedType(CodeLocation location, String&& name)
    45         : m_codeLocation(location)
     48    NamedType(Kind kind, CodeLocation location, String&& name)
     49        : Type(kind)
     50        , m_codeLocation(location)
    4651        , m_name(WTFMove(name))
    4752    {
    4853    }
    49 
    50     virtual ~NamedType() = default;
    5154
    5255    NamedType(const NamedType&) = delete;
     
    5861    String& name() { return m_name; }
    5962
    60     bool isNamedType() const override { return true; }
    61     virtual bool isTypeDefinition() const { return false; }
    62     virtual bool isStructureDefinition() const { return false; }
    63     virtual bool isEnumerationDefinition() const { return false; }
    64     virtual bool isNativeTypeDeclaration() const { return false; }
    65 
    66     virtual const Type& unifyNode() const { return *this; }
    67     virtual Type& unifyNode() { return *this; }
    6863
    6964private:
     65    friend class Type;
     66    Type& unifyNodeImpl() { return *this; }
    7067    CodeLocation m_codeLocation;
    7168    String m_name;
     
    7875}
    7976
     77DEFINE_DEFAULT_DELETE(NamedType)
     78
    8079#define SPECIALIZE_TYPE_TRAITS_WHLSL_NAMED_TYPE(ToValueTypeName, predicate) \
    8180SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::WHLSL::AST::ToValueTypeName) \
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNativeTypeDeclaration.h

    r247834 r248488  
    4141namespace AST {
    4242
    43 class NativeTypeDeclaration : public NamedType {
     43class NativeTypeDeclaration final : public NamedType {
    4444    WTF_MAKE_FAST_ALLOCATED;
    4545public:
    4646    NativeTypeDeclaration(CodeLocation location, String&& name, TypeArguments&& typeArguments)
    47         : NamedType(location, WTFMove(name))
     47        : NamedType(Kind::NativeTypeDeclaration, location, WTFMove(name))
    4848        , m_typeArguments(WTFMove(typeArguments))
    4949    {
    5050    }
    5151
    52     virtual ~NativeTypeDeclaration() = default;
     52    ~NativeTypeDeclaration() = default;
    5353
    5454    NativeTypeDeclaration(const NativeTypeDeclaration&) = delete;
    5555    NativeTypeDeclaration(NativeTypeDeclaration&&) = default;
    56 
    57     bool isNativeTypeDeclaration() const override { return true; }
    5856
    5957    TypeArguments& typeArguments() { return m_typeArguments; }
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h

    r247878 r248488  
    3838namespace AST {
    3939
    40 class NullLiteral : public Expression {
     40class NullLiteral final : public Expression {
    4141    WTF_MAKE_FAST_ALLOCATED;
    4242public:
    4343    NullLiteral(CodeLocation location)
    44         : Expression(location)
     44        : Expression(location, Kind::NullLiteral)
    4545    {
    4646    }
    4747
    48     virtual ~NullLiteral() = default;
     48    ~NullLiteral() = default;
    4949
    5050    NullLiteral(const NullLiteral&) = delete;
     
    5555
    5656    NullLiteralType& type() { return m_type; }
    57 
    58     bool isNullLiteral() const override { return true; }
    5957
    6058    NullLiteral clone() const
     
    7775}
    7876
     77DEFINE_DEFAULT_DELETE(NullLiteral)
     78
    7979SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(NullLiteral, isNullLiteral())
    8080
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.h

    r247813 r248488  
    3737namespace AST {
    3838
    39 class NullLiteralType : public ResolvableType {
     39class NullLiteralType final : public ResolvableType {
    4040    WTF_MAKE_FAST_ALLOCATED;
    4141public:
    42     NullLiteralType() = default;
     42    NullLiteralType()
     43        : ResolvableType(Kind::NullLiteral)
     44    { }
    4345
    44     virtual ~NullLiteralType() = default;
     46    ~NullLiteralType() = default;
    4547
    4648    NullLiteralType(const NullLiteralType&) = delete;
     
    5052    NullLiteralType& operator=(NullLiteralType&&) = default;
    5153
    52     bool isNullLiteralType() const override { return true; }
    53 
    54     bool canResolve(const Type&) const override;
    55     unsigned conversionCost(const UnnamedType&) const override;
     54    bool canResolve(const Type&) const;
     55    unsigned conversionCost(const UnnamedType&) const;
    5656
    5757private:
     
    6464}
    6565
     66DEFINE_DEFAULT_DELETE(NullLiteralType)
     67
    6668SPECIALIZE_TYPE_TRAITS_WHLSL_RESOLVABLE_TYPE(NullLiteralType, isNullLiteralType())
    6769
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLPointerType.h

    r248395 r248488  
    3333#include <wtf/Noncopyable.h>
    3434#include <wtf/UniqueRef.h>
     35#include <wtf/text/StringConcatenate.h>
    3536#include <wtf/text/WTFString.h>
    3637
     
    4748
    4849    PointerType(CodeLocation location, AddressSpace addressSpace, Ref<UnnamedType> elementType)
    49         : Base(location, addressSpace, WTFMove(elementType), Kind::PointerType)
     50        : Base(location, addressSpace, WTFMove(elementType), Kind::Pointer)
    5051    {
    5152    }
     
    5455    static Ref<PointerType> create(CodeLocation location, AddressSpace addressSpace, Ref<UnnamedType> elementType)
    5556    {
    56         return adoptRef(*new PointerType(location, addressSpace, WTFMove(elementType)));
     57        auto result = adoptRef(*new PointerType(location, addressSpace, WTFMove(elementType)));
     58        return result;
    5759    }
    5860
    59     virtual ~PointerType() = default;
     61    ~PointerType() = default;
    6062
    6163    unsigned hash() const
     
    6971    }
    7072
    71     String toString() const override
     73    String toString() const
    7274    {
    7375        return makeString(elementType().toString(), '*');
     
    8183}
    8284
     85DEFINE_DEFAULT_DELETE(PointerType)
     86
    8387SPECIALIZE_TYPE_TRAITS_WHLSL_UNNAMED_TYPE(PointerType, isPointerType())
    8488
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h

    r247834 r248488  
    4141class PropertyAccessExpression : public Expression {
    4242    WTF_MAKE_FAST_ALLOCATED;
     43protected:
     44    ~PropertyAccessExpression() = default;
     45
    4346public:
    44     PropertyAccessExpression(CodeLocation location, UniqueRef<Expression>&& base)
    45         : Expression(location)
     47    PropertyAccessExpression(CodeLocation location, Kind kind, UniqueRef<Expression>&& base)
     48        : Expression(location, kind)
    4649        , m_base(WTFMove(base))
    4750    {
    4851    }
    4952
    50     virtual ~PropertyAccessExpression() = default;
    51 
    5253    PropertyAccessExpression(const PropertyAccessExpression&) = delete;
    5354    PropertyAccessExpression(PropertyAccessExpression&&) = default;
    5455
    55     bool isPropertyAccessExpression() const override { return true; }
    56 
    57     virtual String getterFunctionName() const = 0;
    58     virtual String setterFunctionName() const = 0;
    59     virtual String anderFunctionName() const = 0;
     56    String getterFunctionName() const;
     57    String setterFunctionName() const;
     58    String anderFunctionName() const;
    6059
    6160    FunctionDeclaration* getterFunction() { return m_getterFunction; }
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h

    r247878 r248488  
    5050 *  7. Return the result
    5151 */
    52 class ReadModifyWriteExpression : public Expression {
     52class ReadModifyWriteExpression final : public Expression {
    5353    WTF_MAKE_FAST_ALLOCATED;
    5454public:
    55     static UniqueRef<ReadModifyWriteExpression> create(CodeLocation location, UniqueRef<Expression> lValue)
     55    ReadModifyWriteExpression(CodeLocation location, UniqueRef<Expression> leftValue)
     56        : Expression(location, Kind::ReadModifyWrite)
     57        , m_leftValue(WTFMove(leftValue))
     58        , m_oldValue(makeUniqueRef<VariableDeclaration>(location, Qualifiers(), nullptr, String(), nullptr, nullptr))
     59        , m_newValue(makeUniqueRef<VariableDeclaration>(location, Qualifiers(), nullptr, String(), nullptr, nullptr))
    5660    {
    57         return makeUniqueRef<ReadModifyWriteExpression>(location, WTFMove(lValue));
    5861    }
    5962
    60     virtual ~ReadModifyWriteExpression() = default;
     63
     64    ~ReadModifyWriteExpression() = default;
    6165
    6266    ReadModifyWriteExpression(const ReadModifyWriteExpression&) = delete;
     
    8286        return makeUniqueRef<VariableReference>(VariableReference::wrap(m_newValue));
    8387    }
    84 
    85     bool isReadModifyWriteExpression() const override { return true; }
    8688
    8789    Expression& leftValue() { return m_leftValue; }
     
    115117
    116118private:
    117     template<class U, class... Args> friend UniqueRef<U> WTF::makeUniqueRef(Args&&...);
    118 
    119     ReadModifyWriteExpression(CodeLocation location, UniqueRef<Expression> leftValue)
    120         : Expression(location)
    121         , m_leftValue(WTFMove(leftValue))
    122         , m_oldValue(makeUniqueRef<VariableDeclaration>(location, Qualifiers(), nullptr, String(), nullptr, nullptr))
    123         , m_newValue(makeUniqueRef<VariableDeclaration>(location, Qualifiers(), nullptr, String(), nullptr, nullptr))
    124     {
    125     }
    126 
    127119    UniqueRef<Expression> m_leftValue;
    128120    UniqueRef<VariableDeclaration> m_oldValue;
     
    138130}
    139131
     132DEFINE_DEFAULT_DELETE(ReadModifyWriteExpression)
     133
    140134SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(ReadModifyWriteExpression, isReadModifyWriteExpression())
    141135
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h

    r248395 r248488  
    4444    WTF_MAKE_FAST_ALLOCATED;
    4545    WTF_MAKE_NONCOPYABLE(ReferenceType);
     46
     47protected:
     48    ~ReferenceType() = default;
     49
    4650protected:
    4751    ReferenceType(CodeLocation location, AddressSpace addressSpace, Ref<UnnamedType> elementType, Kind kind)
     
    5155    {
    5256    }
     57
     58
    5359public:
    54     virtual ~ReferenceType() = default;
    55 
    5660    AddressSpace addressSpace() const { return m_addressSpace; }
    5761    const UnnamedType& elementType() const { return m_elementType; }
     
    7478}
    7579
     80DEFINE_DEFAULT_DELETE(ReferenceType)
     81
    7682SPECIALIZE_TYPE_TRAITS_WHLSL_UNNAMED_TYPE(ReferenceType, isReferenceType())
    7783
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReplaceWith.h

    r247105 r248488  
    3939    static_assert(sizeof(New) <= sizeof(Old), "This is needed for the placement new below to not overwrite unowned memory.");
    4040    void* location = &old;
    41     old.~Old();
     41    Old::destruct(old);
    4242    return new (location) New(std::forward<Args>(args)...);
    4343}
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h

    r247878 r248488  
    4141class ResolvableType : public Type {
    4242    WTF_MAKE_FAST_ALLOCATED;
     43
     44protected:
     45    ~ResolvableType() = default;
     46
    4347public:
    44     ResolvableType() = default;
     48    ResolvableType(Kind kind)
     49        : Type(kind)
     50    { }
    4551
    46     virtual ~ResolvableType() = default;
    4752
    4853    ResolvableType(const ResolvableType&) = delete;
     
    5257    ResolvableType& operator=(ResolvableType&&) = default;
    5358
    54     bool isResolvableType() const override { return true; }
    55     virtual bool isFloatLiteralType() const { return false; }
    56     virtual bool isIntegerLiteralType() const { return false; }
    57     virtual bool isNullLiteralType() const { return false; }
    58     virtual bool isUnsignedIntegerLiteralType() const { return false; }
    59 
    60     virtual bool canResolve(const Type&) const = 0;
    61     virtual unsigned conversionCost(const UnnamedType&) const = 0;
     59    bool canResolve(const Type&) const;
     60    unsigned conversionCost(const UnnamedType&) const;
    6261
    6362    const UnnamedType* maybeResolvedType() const { return m_resolvedType ? &*m_resolvedType : nullptr; }
     
    9089}
    9190
     91DEFINE_DEFAULT_DELETE(ResolvableType)
     92
    9293#define SPECIALIZE_TYPE_TRAITS_WHLSL_RESOLVABLE_TYPE(ToValueTypeName, predicate) \
    9394SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::WHLSL::AST::ToValueTypeName) \
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReturn.h

    r247834 r248488  
    4040namespace AST {
    4141
    42 class Return : public Statement {
     42class Return final : public Statement {
    4343    WTF_MAKE_FAST_ALLOCATED;
    4444public:
    4545    Return(CodeLocation location, std::unique_ptr<Expression>&& value)
    46         : Statement(location)
     46        : Statement(location, Kind::Return)
    4747        , m_value(WTFMove(value))
    4848    {
    4949    }
    5050
    51     virtual ~Return() = default;
     51    ~Return() = default;
    5252
    5353    Return(const Return&) = delete;
    5454    Return(Return&&) = default;
    55 
    56     bool isReturn() const override { return true; }
    5755
    5856    Expression* value() { return m_value.get(); }
     
    6866}
    6967
     68DEFINE_DEFAULT_DELETE(Return)
     69
    7070SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(Return, isReturn())
    7171
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStatement.h

    r247834 r248488  
    2929
    3030#include "WHLSLCodeLocation.h"
     31#include "WHLSLDefaultDelete.h"
    3132#include <wtf/FastMalloc.h>
    3233#include <wtf/UniqueRef.h>
     
    4041class Statement {
    4142    WTF_MAKE_FAST_ALLOCATED;
     43
     44protected:
     45    ~Statement() = default;
     46
    4247public:
    43     Statement(CodeLocation codeLocation)
     48    enum class Kind : uint8_t {
     49        Block,
     50        Break,
     51        Continue,
     52        DoWhileLoop,
     53        EffectfulExpression,
     54        Fallthrough,
     55        ForLoop,
     56        If,
     57        Return,
     58        StatementList,
     59        SwitchCase,
     60        Switch,
     61        VariableDeclarations,
     62        WhileLoop,
     63    };
     64    Statement(CodeLocation codeLocation, Kind kind)
    4465        : m_codeLocation(codeLocation)
     66        , m_kind(kind)
    4567    {
    4668    }
    4769
    48     virtual ~Statement() = default;
     70    static void destroy(Statement&);
     71    static void destruct(Statement&);
    4972
    5073    Statement(const Statement&) = delete;
    5174    Statement(Statement&&) = default;
    5275
    53     virtual bool isBlock() const { return false; }
    54     virtual bool isBreak() const { return false; }
    55     virtual bool isContinue() const { return false; }
    56     virtual bool isDoWhileLoop() const { return false; }
    57     virtual bool isEffectfulExpressionStatement() const { return false; }
    58     virtual bool isFallthrough() const { return false; }
    59     virtual bool isForLoop() const { return false; }
    60     virtual bool isIfStatement() const { return false; }
    61     virtual bool isReturn() const { return false; }
    62     virtual bool isStatementList() const { return false; }
    63     virtual bool isSwitchCase() const { return false; }
    64     virtual bool isSwitchStatement() const { return false; }
    65     virtual bool isVariableDeclarationsStatement() const { return false; }
    66     virtual bool isWhileLoop() const { return false; }
     76    Kind kind() const { return m_kind; }
     77
     78    bool isBlock() const { return kind() == Kind::Block; }
     79    bool isBreak() const { return kind() == Kind::Break; }
     80    bool isContinue() const { return kind() == Kind::Continue; }
     81    bool isDoWhileLoop() const { return kind() == Kind::DoWhileLoop; }
     82    bool isEffectfulExpressionStatement() const { return kind() == Kind::EffectfulExpression; }
     83    bool isFallthrough() const { return kind() == Kind::Fallthrough; }
     84    bool isForLoop() const { return kind() == Kind::ForLoop; }
     85    bool isIfStatement() const { return kind() == Kind::If; }
     86    bool isReturn() const { return kind() == Kind::Return; }
     87    bool isStatementList() const { return kind() == Kind::StatementList; }
     88    bool isSwitchCase() const { return kind() == Kind::SwitchCase; }
     89    bool isSwitchStatement() const { return kind() == Kind::Switch; }
     90    bool isVariableDeclarationsStatement() const { return kind() == Kind::VariableDeclarations; }
     91    bool isWhileLoop() const { return kind() == Kind::WhileLoop; }
    6792
    6893    CodeLocation codeLocation() const { return m_codeLocation; }
     
    7196private:
    7297    CodeLocation m_codeLocation;
     98    Kind m_kind;
    7399};
    74100
    75101using Statements = Vector<UniqueRef<Statement>>;
    76102
    77 } // namespace AST
     103}
    78104
    79105}
    80106
    81107}
     108
     109DEFINE_DEFAULT_DELETE(Statement)
    82110
    83111#define SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(ToValueTypeName, predicate) \
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStatementList.h

    r247834 r248488  
    3939namespace AST {
    4040
    41 class StatementList : public Statement {
     41class StatementList final : public Statement {
    4242    WTF_MAKE_FAST_ALLOCATED;
    4343    using Base = Statement;
    4444public:
    4545    StatementList(CodeLocation location, Statements&& statements)
    46         : Base(location)
     46        : Base(location, Kind::StatementList)
    4747        , m_statements(WTFMove(statements))
    4848    { }
    4949
    50     virtual ~StatementList() = default;
     50    ~StatementList() = default;
    5151
    5252    Statements& statements() { return m_statements; }
    53 
    54     bool isStatementList() const override { return true; }
    5553
    5654private:
     
    6462}
    6563
     64DEFINE_DEFAULT_DELETE(StatementList)
     65
    6666SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(StatementList, isStatementList())
    6767
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h

    r247834 r248488  
    4141namespace AST {
    4242
    43 class StructureDefinition : public NamedType {
     43class StructureDefinition final : public NamedType {
    4444    WTF_MAKE_FAST_ALLOCATED;
    4545public:
    4646    StructureDefinition(CodeLocation location, String&& name, StructureElements&& structureElements)
    47         : NamedType(location, WTFMove(name))
     47        : NamedType(Kind::StructureDefinition, location, WTFMove(name))
    4848        , m_structureElements(WTFMove(structureElements))
    4949    {
    5050    }
    5151
    52     virtual ~StructureDefinition() = default;
     52    ~StructureDefinition() = default;
    5353
    5454    StructureDefinition(const StructureDefinition&) = delete;
    5555    StructureDefinition(StructureDefinition&&) = default;
    56 
    57     bool isStructureDefinition() const override { return true; }
    5856
    5957    StructureElements& structureElements() { return m_structureElements; }
     
    7876}
    7977
     78DEFINE_DEFAULT_DELETE(StructureDefinition)
     79
    8080SPECIALIZE_TYPE_TRAITS_WHLSL_NAMED_TYPE(StructureDefinition, isStructureDefinition())
    8181
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h

    r247878 r248488  
    4141namespace AST {
    4242
    43 class StructureElement {
     43class StructureElement final {
    4444    WTF_MAKE_FAST_ALLOCATED;
    4545public:
     
    5353    }
    5454
    55     virtual ~StructureElement() = default;
     55    ~StructureElement() = default;
    5656
    5757    StructureElement(const StructureElement&) = delete;
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h

    r247834 r248488  
    4141namespace AST {
    4242
    43 class SwitchCase : public Statement {
     43class SwitchCase final : public Statement {
    4444    WTF_MAKE_FAST_ALLOCATED;
    4545public:
    4646    SwitchCase(CodeLocation location, Optional<ConstantExpression>&& value, Block&& block)
    47         : Statement(location)
     47        : Statement(location, Kind::SwitchCase)
    4848        , m_value(WTFMove(value))
    4949        , m_block(WTFMove(block))
     
    5151    }
    5252
    53     virtual ~SwitchCase() = default;
     53    ~SwitchCase() = default;
    5454
    5555    SwitchCase(const SwitchCase&) = delete;
    5656    SwitchCase(SwitchCase&&) = default;
    57 
    58     bool isSwitchCase() const override { return true; }
    5957
    6058    Optional<ConstantExpression>& value() { return m_value; }
     
    7270}
    7371
     72DEFINE_DEFAULT_DELETE(SwitchCase)
     73
    7474SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(SwitchCase, isSwitchCase())
    7575
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h

    r247834 r248488  
    4040namespace AST {
    4141
    42 class SwitchStatement : public Statement {
     42class SwitchStatement final : public Statement {
    4343    WTF_MAKE_FAST_ALLOCATED;
    4444public:
    4545    SwitchStatement(CodeLocation location, UniqueRef<Expression>&& value, Vector<SwitchCase>&& switchCases)
    46         : Statement(location)
     46        : Statement(location, Kind::Switch)
    4747        , m_value(WTFMove(value))
    4848        , m_switchCases(WTFMove(switchCases))
     
    5050    }
    5151
    52     virtual ~SwitchStatement() = default;
     52    ~SwitchStatement() = default;
    5353
    5454    SwitchStatement(const SwitchStatement&) = delete;
    5555    SwitchStatement(SwitchStatement&&) = default;
    56 
    57     bool isSwitchStatement() const override { return true; }
    5856
    5957    Expression& value() { return m_value; }
     
    7169}
    7270
     71DEFINE_DEFAULT_DELETE(SwitchStatement)
     72
    7373SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(SwitchStatement, isSwitchStatement())
    7474
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h

    r247834 r248488  
    3838namespace AST {
    3939
    40 class TernaryExpression : public Expression {
     40class TernaryExpression final : public Expression {
    4141    WTF_MAKE_FAST_ALLOCATED;
    4242public:
    4343    TernaryExpression(CodeLocation location, UniqueRef<Expression>&& predicate, UniqueRef<Expression>&& bodyExpression, UniqueRef<Expression>&& elseExpression)
    44         : Expression(location)
     44        : Expression(location, Kind::Ternary)
    4545        , m_predicate(WTFMove(predicate))
    4646        , m_bodyExpression(WTFMove(bodyExpression))
     
    4949    }
    5050
    51     virtual ~TernaryExpression() = default;
     51    ~TernaryExpression() = default;
    5252
    5353    TernaryExpression(const TernaryExpression&) = delete;
    5454    TernaryExpression(TernaryExpression&&) = default;
    55 
    56     bool isTernaryExpression() const override { return true; }
    5755
    5856    Expression& predicate() { return m_predicate; }
     
    7270}
    7371
     72DEFINE_DEFAULT_DELETE(TernaryExpression)
     73
    7474SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(TernaryExpression, isTernaryExpression())
    7575
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLType.h

    r247813 r248488  
    2828#if ENABLE(WEBGPU)
    2929
     30#include "WHLSLDefaultDelete.h"
    3031#include <wtf/FastMalloc.h>
    3132#include <wtf/TypeCasts.h>
     
    3940class Type {
    4041    WTF_MAKE_FAST_ALLOCATED;
     42
     43protected:
     44    ~Type() = default;
     45
    4146public:
    42     Type() = default;
     47    enum class Kind : uint8_t {
     48        // UnnamedTypes
     49        TypeReference,
     50        Pointer,
     51        ArrayReference,
     52        Array,
     53        // NamedTypes
     54        TypeDefinition,
     55        StructureDefinition,
     56        EnumerationDefinition,
     57        NativeTypeDeclaration,
     58        // ResolvableTypes
     59        FloatLiteral,
     60        IntegerLiteral,
     61        NullLiteral,
     62        UnsignedIntegerLiteral,
     63    };
    4364
    44     virtual ~Type() = default;
     65    Type(Kind kind)
     66        : m_kind(kind)
     67    { }
     68    static void destroy(Type&);
     69    static void destruct(Type&);
    4570
    4671    explicit Type(const Type&) = delete;
     
    5075    Type& operator=(Type&&) = default;
    5176
    52     virtual bool isNamedType() const { return false; }
    53     virtual bool isUnnamedType() const { return false; }
    54     virtual bool isResolvableType() const { return false; }
     77    Kind kind() const { return m_kind; }
     78
     79    bool isUnnamedType() const { return kind() >= Kind::TypeReference && kind() <= Kind::Array; }
     80    bool isNamedType() const { return kind() >= Kind::TypeDefinition && kind() <= Kind::NativeTypeDeclaration; }
     81    bool isResolvableType() const { return kind() >= Kind::FloatLiteral && kind() <= Kind::UnsignedIntegerLiteral; }
     82
     83    bool isTypeReference() const { return kind() == Kind::TypeReference; }
     84    bool isPointerType() const { return kind() == Kind::Pointer; }
     85    bool isArrayReferenceType() const { return kind() == Kind::ArrayReference; }
     86    bool isArrayType() const { return kind() == Kind::Array; }
     87    bool isReferenceType() const { return isPointerType() || isArrayReferenceType(); }
     88
     89    bool isTypeDefinition() const { return kind() == Kind::TypeDefinition; }
     90    bool isStructureDefinition() const { return kind() == Kind::StructureDefinition; }
     91    bool isEnumerationDefinition() const { return kind() == Kind::EnumerationDefinition; }
     92    bool isNativeTypeDeclaration() const { return kind() == Kind::NativeTypeDeclaration; }
     93
     94    bool isFloatLiteralType() const { return kind() == Kind::FloatLiteral; }
     95    bool isIntegerLiteralType() const { return kind() == Kind::IntegerLiteral; }
     96    bool isNullLiteralType() const { return kind() == Kind::NullLiteral; }
     97    bool isUnsignedIntegerLiteralType() const { return kind() == Kind::UnsignedIntegerLiteral; }
     98
     99    Type& unifyNode();
     100    const Type& unifyNode() const
     101    {
     102        return const_cast<Type*>(this)->unifyNode();
     103    }
    55104
    56105private:
     106    Kind m_kind;
    57107};
    58108
     
    63113}
    64114
     115DEFINE_DEFAULT_DELETE(Type)
     116
    65117#define SPECIALIZE_TYPE_TRAITS_WHLSL_TYPE(ToValueTypeName, predicate) \
    66118SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::WHLSL::AST::ToValueTypeName) \
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h

    r247878 r248488  
    4141namespace AST {
    4242
    43 class TypeDefinition : public NamedType {
     43class TypeDefinition final : public NamedType {
    4444    WTF_MAKE_FAST_ALLOCATED;
    4545public:
    4646    TypeDefinition(CodeLocation location, String&& name, Ref<UnnamedType> type)
    47         : NamedType(location, WTFMove(name))
     47        : NamedType(Kind::TypeDefinition, location, WTFMove(name))
    4848        , m_type(WTFMove(type))
    4949    {
    5050    }
    5151
    52     virtual ~TypeDefinition() = default;
     52    ~TypeDefinition() = default;
    5353
    5454    TypeDefinition(const TypeDefinition&) = delete;
    5555    TypeDefinition(TypeDefinition&&) = default;
    5656
    57     bool isTypeDefinition() const override { return true; }
    58 
    5957    UnnamedType& type() { return m_type; }
    6058
    61     const Type& unifyNode() const override
     59private:
     60    friend class Type;
     61    Type& unifyNodeImpl()
    6262    {
    6363        return m_type->unifyNode();
    6464    }
    6565
    66     Type& unifyNode() override
    67     {
    68         return m_type->unifyNode();
    69     }
    70 
    71 private:
    7266    Ref<UnnamedType> m_type;
    7367};
     
    7973}
    8074
     75DEFINE_DEFAULT_DELETE(TypeDefinition)
     76
    8177SPECIALIZE_TYPE_TRAITS_WHLSL_NAMED_TYPE(TypeDefinition, isTypeDefinition())
    8278
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h

    r248395 r248488  
    6060    }
    6161
    62     virtual ~TypeReference() = default;
     62    ~TypeReference() = default;
    6363
    6464    static Ref<TypeReference> wrap(CodeLocation, NamedType& resolvedType);
     
    7171        ASSERT(m_resolvedType);
    7272        return *m_resolvedType;
    73     }
    74 
    75     const Type& unifyNode() const override
    76     {
    77         ASSERT(m_resolvedType);
    78         return m_resolvedType->unifyNode();
    79     }
    80 
    81     Type& unifyNode() override
    82     {
    83         ASSERT(m_resolvedType);
    84         return m_resolvedType->unifyNode();
    8573    }
    8674
     
    10492    }
    10593
    106     String toString() const override
     94    String toString() const
    10795    {
    10896        ASSERT(m_resolvedType);
     
    11199
    112100private:
     101    friend class Type;
     102    Type& unifyNodeImpl()
     103    {
     104        ASSERT(m_resolvedType);
     105        return m_resolvedType->unifyNode();
     106    }
     107
    113108    String m_name;
    114109    TypeArguments m_typeArguments;
     
    122117}
    123118
     119DEFINE_DEFAULT_DELETE(TypeReference)
     120
    124121SPECIALIZE_TYPE_TRAITS_WHLSL_UNNAMED_TYPE(TypeReference, isTypeReference())
    125122
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.cpp

    r248395 r248488  
    4242unsigned UnnamedType::hash() const
    4343{
    44     switch (m_kind) {
     44    switch (kind()) {
    4545    case Kind::TypeReference:
    4646        return downcast<TypeReference>(*this).hash();
    47     case Kind::PointerType:
     47    case Kind::Pointer:
    4848        return downcast<PointerType>(*this).hash();
    49     case Kind::ArrayReferenceType:
     49    case Kind::ArrayReference:
    5050        return downcast<ArrayReferenceType>(*this).hash();
    51     case Kind::ArrayType:
     51    case Kind::Array:
    5252        return downcast<ArrayType>(*this).hash();
     53    default:
     54        RELEASE_ASSERT_NOT_REACHED();
    5355    }
    5456}
     
    5658bool UnnamedType::operator==(const UnnamedType& other) const
    5759{
    58     if (other.m_kind != m_kind)
     60    if (other.kind() != kind())
    5961        return false;
    6062
    61     switch (m_kind) {
     63    switch (kind()) {
    6264    case Kind::TypeReference:
    6365        return downcast<TypeReference>(*this) == downcast<TypeReference>(other);
    64     case Kind::PointerType:
     66    case Kind::Pointer:
    6567        return downcast<PointerType>(*this) == downcast<PointerType>(other);
    66     case Kind::ArrayReferenceType:
     68    case Kind::ArrayReference:
    6769        return downcast<ArrayReferenceType>(*this) == downcast<ArrayReferenceType>(other);
    68     case Kind::ArrayType:
     70    case Kind::Array:
    6971        return downcast<ArrayType>(*this) == downcast<ArrayType>(other);
     72    default:
     73        RELEASE_ASSERT_NOT_REACHED();
    7074    }
    7175}
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h

    r248395 r248488  
    4646    WTF_MAKE_NONCOPYABLE(UnnamedType);
    4747public:
    48     enum class Kind {
    49         TypeReference,
    50         PointerType,
    51         ArrayReferenceType,
    52         ArrayType
    53     };
    54 
    5548    UnnamedType(CodeLocation location, Kind kind)
    56         : m_codeLocation(location)
    57         , m_kind(kind)
     49        : Type(kind)
     50        , m_codeLocation(location)
    5851    {
    5952    }
    60 
    61     virtual ~UnnamedType() = default;
    62 
    63     bool isUnnamedType() const override { return true; }
    64 
    65     Kind kind() const { return m_kind; }
    66     bool isTypeReference() const { return m_kind == Kind::TypeReference; }
    67     bool isPointerType() const { return m_kind == Kind::PointerType; }
    68     bool isArrayReferenceType() const { return m_kind == Kind::ArrayReferenceType; }
    69     bool isArrayType() const { return m_kind == Kind::ArrayType; }
    70     bool isReferenceType() const { return isPointerType() || isArrayReferenceType(); }
    71 
    72     virtual const Type& unifyNode() const { return *this; }
    73     virtual Type& unifyNode() { return *this; }
    7453
    7554    unsigned hash() const;
    7655    bool operator==(const UnnamedType&) const;
    7756
    78     virtual String toString() const = 0;
     57    String toString() const;
    7958
    80     const CodeLocation& codeLocation() const { return m_codeLocation; }
     59    CodeLocation codeLocation() const { return m_codeLocation; }
    8160
    8261private:
     62    friend class Type;
     63    Type& unifyNodeImpl() { return *this; }
    8364    CodeLocation m_codeLocation;
    84     Kind m_kind;
    8565};
    8666
     
    9070
    9171}
     72
     73DEFINE_DEFAULT_DELETE(UnnamedType)
    9274
    9375#define SPECIALIZE_TYPE_TRAITS_WHLSL_UNNAMED_TYPE(ToValueTypeName, predicate) \
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h

    r247878 r248488  
    3838namespace AST {
    3939
    40 class UnsignedIntegerLiteral : public Expression {
     40class UnsignedIntegerLiteral final : public Expression {
    4141    WTF_MAKE_FAST_ALLOCATED;
    4242public:
    4343    UnsignedIntegerLiteral(CodeLocation location, unsigned value)
    44         : Expression(location)
     44        : Expression(location, Kind::UnsignedIntegerLiteral)
    4545        , m_type(location, value)
    4646        , m_value(value)
     
    4848    }
    4949
    50     virtual ~UnsignedIntegerLiteral() = default;
     50    ~UnsignedIntegerLiteral() = default;
    5151
    5252    UnsignedIntegerLiteral(const UnsignedIntegerLiteral&) = delete;
     
    5858    UnsignedIntegerLiteralType& type() { return m_type; }
    5959    unsigned value() const { return m_value; }
    60 
    61     bool isUnsignedIntegerLiteral() const override { return true; }
    6260
    6361    UnsignedIntegerLiteral clone() const
     
    8482}
    8583
     84DEFINE_DEFAULT_DELETE(UnsignedIntegerLiteral)
     85
    8686SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(UnsignedIntegerLiteral, isUnsignedIntegerLiteral())
    8787
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp

    r247878 r248488  
    4242
    4343UnsignedIntegerLiteralType::UnsignedIntegerLiteralType(CodeLocation location, unsigned value)
    44     : m_value(value)
     44    : ResolvableType(Kind::UnsignedIntegerLiteral)
     45    , m_value(value)
    4546    , m_preferredType(TypeReference::create(location, "uint"_str, TypeArguments()))
    4647{
    4748}
    48 
    49 UnsignedIntegerLiteralType::~UnsignedIntegerLiteralType() = default;
    50 
    51 UnsignedIntegerLiteralType::UnsignedIntegerLiteralType(UnsignedIntegerLiteralType&&) = default;
    52 
    53 UnsignedIntegerLiteralType& UnsignedIntegerLiteralType::operator=(UnsignedIntegerLiteralType&&) = default;
    5449
    5550bool UnsignedIntegerLiteralType::canResolve(const Type& type) const
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h

    r247878 r248488  
    4141class TypeReference;
    4242
    43 class UnsignedIntegerLiteralType : public ResolvableType {
     43class UnsignedIntegerLiteralType final : public ResolvableType {
    4444    WTF_MAKE_FAST_ALLOCATED;
    4545public:
    4646    UnsignedIntegerLiteralType(CodeLocation, unsigned value);
    4747
    48     virtual ~UnsignedIntegerLiteralType();
     48    ~UnsignedIntegerLiteralType() = default;
    4949
    5050    UnsignedIntegerLiteralType(const UnsignedIntegerLiteralType&) = delete;
    51     UnsignedIntegerLiteralType(UnsignedIntegerLiteralType&&);
     51    UnsignedIntegerLiteralType(UnsignedIntegerLiteralType&&) = default;
    5252
    5353    UnsignedIntegerLiteralType& operator=(const UnsignedIntegerLiteralType&) = delete;
    54     UnsignedIntegerLiteralType& operator=(UnsignedIntegerLiteralType&&);
    55 
    56     bool isUnsignedIntegerLiteralType() const override { return true; }
     54    UnsignedIntegerLiteralType& operator=(UnsignedIntegerLiteralType&&) = default;
    5755
    5856    unsigned value() const { return m_value; }
     
    6058    TypeReference& preferredType() { return m_preferredType; }
    6159
    62     bool canResolve(const Type&) const override;
    63     unsigned conversionCost(const UnnamedType&) const override;
     60    bool canResolve(const Type&) const;
     61    unsigned conversionCost(const UnnamedType&) const;
    6462
    6563    UnsignedIntegerLiteralType clone() const;
     
    7876}
    7977
     78DEFINE_DEFAULT_DELETE(UnsignedIntegerLiteralType)
     79
    8080SPECIALIZE_TYPE_TRAITS_WHLSL_RESOLVABLE_TYPE(UnsignedIntegerLiteralType, isUnsignedIntegerLiteralType())
    8181
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h

    r247834 r248488  
    4040namespace AST {
    4141
    42 class VariableDeclarationsStatement : public Statement {
     42class VariableDeclarationsStatement final : public Statement {
    4343    WTF_MAKE_FAST_ALLOCATED;
    4444public:
    4545    VariableDeclarationsStatement(CodeLocation location, VariableDeclarations&& variableDeclarations)
    46         : Statement(location)
     46        : Statement(location, Kind::VariableDeclarations)
    4747        , m_variableDeclarations(WTFMove(variableDeclarations))
    4848    {
    4949    }
    5050
    51     virtual ~VariableDeclarationsStatement() = default;
     51    ~VariableDeclarationsStatement() = default;
    5252
    5353    VariableDeclarationsStatement(const VariableDeclarationsStatement&) = delete;
    5454    VariableDeclarationsStatement(VariableDeclarationsStatement&&) = default;
    55 
    56     bool isVariableDeclarationsStatement() const override { return true; }
    5755
    5856    Vector<UniqueRef<VariableDeclaration>>& variableDeclarations() { return m_variableDeclarations; }
     
    6866}
    6967
     68DEFINE_DEFAULT_DELETE(VariableDeclarationsStatement)
     69
    7070SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(VariableDeclarationsStatement, isVariableDeclarationsStatement())
    7171
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h

    r247834 r248488  
    3939namespace AST {
    4040
    41 class VariableReference : public Expression {
     41class VariableReference final : public Expression {
    4242    WTF_MAKE_FAST_ALLOCATED;
    4343public:
    4444    VariableReference(CodeLocation location, String&& name)
    45         : Expression(location)
     45        : Expression(location, Kind::VariableReference)
    4646        , m_name(WTFMove(name))
    4747    {
    4848    }
    4949
    50     virtual ~VariableReference() = default;
     50    ~VariableReference() = default;
    5151
    5252    VariableReference(const VariableReference&) = delete;
     
    6161    }
    6262
    63     bool isVariableReference() const override { return true; }
    64 
    6563    String& name() { return m_name; }
    6664
     
    7472private:
    7573    VariableReference(CodeLocation location)
    76         : Expression(location)
     74        : Expression(location, Kind::VariableReference)
    7775    {
    7876    }
     
    8886}
    8987
     88DEFINE_DEFAULT_DELETE(VariableReference)
     89
    9090SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(VariableReference, isVariableReference())
    9191
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h

    r247834 r248488  
    3939namespace AST {
    4040
    41 class WhileLoop : public Statement {
     41class WhileLoop final : public Statement {
    4242    WTF_MAKE_FAST_ALLOCATED;
    4343public:
    4444    WhileLoop(CodeLocation location, UniqueRef<Expression>&& conditional, UniqueRef<Statement>&& body)
    45         : Statement(location)
     45        : Statement(location, Kind::WhileLoop)
    4646        , m_conditional(WTFMove(conditional))
    4747        , m_body(WTFMove(body))
     
    4949    }
    5050
    51     virtual ~WhileLoop() = default;
     51    ~WhileLoop() = default;
    5252
    5353    WhileLoop(const WhileLoop&) = delete;
    5454    WhileLoop(WhileLoop&&) = default;
    55 
    56     bool isWhileLoop() const override { return true; }
    5755
    5856    Expression& conditional() { return m_conditional; }
     
    7068}
    7169
     70DEFINE_DEFAULT_DELETE(WhileLoop)
     71
    7272SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(WhileLoop, isWhileLoop())
    7373
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp

    r248395 r248488  
    7373    AST::UnnamedType::Kind kind() { return m_kind; }
    7474    bool isReferenceTypeNameNode() const { return m_kind == AST::UnnamedType::Kind::TypeReference; }
    75     bool isPointerTypeNameNode() const { return m_kind == AST::UnnamedType::Kind::PointerType; }
    76     bool isArrayReferenceTypeNameNode() const { return m_kind == AST::UnnamedType::Kind::ArrayReferenceType; }
    77     bool isArrayTypeNameNode() const { return m_kind == AST::UnnamedType::Kind::ArrayType; }
     75    bool isPointerTypeNameNode() const { return m_kind == AST::UnnamedType::Kind::Pointer; }
     76    bool isArrayReferenceTypeNameNode() const { return m_kind == AST::UnnamedType::Kind::ArrayReference; }
     77    bool isArrayTypeNameNode() const { return m_kind == AST::UnnamedType::Kind::Array; }
    7878
    7979    BaseTypeNameNode* parent() { return m_parent; }
     
    9090public:
    9191    ArrayTypeNameNode(BaseTypeNameNode* parent, MangledTypeName&& mangledName, unsigned numElements)
    92         : BaseTypeNameNode(parent, WTFMove(mangledName), AST::UnnamedType::Kind::ArrayType)
     92        : BaseTypeNameNode(parent, WTFMove(mangledName), AST::UnnamedType::Kind::Array)
    9393        , m_numElements(numElements)
    9494    {
     
    105105public:
    106106    ArrayReferenceTypeNameNode(BaseTypeNameNode* parent, MangledTypeName&& mangledName, AST::AddressSpace addressSpace)
    107         : BaseTypeNameNode(parent, WTFMove(mangledName), AST::UnnamedType::Kind::ArrayReferenceType)
     107        : BaseTypeNameNode(parent, WTFMove(mangledName), AST::UnnamedType::Kind::ArrayReference)
    108108        , m_addressSpace(addressSpace)
    109109    {
     
    120120public:
    121121    PointerTypeNameNode(BaseTypeNameNode* parent, MangledTypeName&& mangledName, AST::AddressSpace addressSpace)
    122         : BaseTypeNameNode(parent, WTFMove(mangledName), AST::UnnamedType::Kind::PointerType)
     122        : BaseTypeNameNode(parent, WTFMove(mangledName), AST::UnnamedType::Kind::Pointer)
    123123        , m_addressSpace(addressSpace)
    124124    {
     
    275275        return std::make_unique<ReferenceTypeNameNode>(parent, generateNextTypeName(), typeReference.resolvedType());
    276276    }
    277     case AST::UnnamedType::Kind::PointerType: {
     277    case AST::UnnamedType::Kind::Pointer: {
    278278        auto& pointerType = downcast<AST::PointerType>(unnamedType);
    279279        return std::make_unique<PointerTypeNameNode>(parent, generateNextTypeName(), pointerType.addressSpace());
    280280    }
    281     case AST::UnnamedType::Kind::ArrayReferenceType: {
     281    case AST::UnnamedType::Kind::ArrayReference: {
    282282        auto& arrayReferenceType = downcast<AST::ArrayReferenceType>(unnamedType);
    283283        return std::make_unique<ArrayReferenceTypeNameNode>(parent, generateNextTypeName(), arrayReferenceType.addressSpace());
    284284    }
    285     case AST::UnnamedType::Kind::ArrayType: {
     285    case AST::UnnamedType::Kind::Array: {
    286286        auto& arrayType = downcast<AST::ArrayType>(unnamedType);
    287287        return std::make_unique<ArrayTypeNameNode>(parent, generateNextTypeName(), arrayType.numElements());
    288288    }
     289    default:
     290        RELEASE_ASSERT_NOT_REACHED();
    289291    }
    290292}
     
    295297    case AST::UnnamedType::Kind::TypeReference:
    296298        return nullptr;
    297     case AST::UnnamedType::Kind::PointerType:
     299    case AST::UnnamedType::Kind::Pointer:
    298300        return &downcast<AST::PointerType>(unnamedType).elementType();
    299     case AST::UnnamedType::Kind::ArrayReferenceType:
     301    case AST::UnnamedType::Kind::ArrayReference:
    300302        return &downcast<AST::ArrayReferenceType>(unnamedType).elementType();
    301     case AST::UnnamedType::Kind::ArrayType:
     303    case AST::UnnamedType::Kind::Array:
    302304        return &downcast<AST::ArrayType>(unnamedType).type();
     305    default:
     306        RELEASE_ASSERT_NOT_REACHED();
    303307    }
    304308}
     
    362366        break;
    363367    }
    364     case AST::UnnamedType::Kind::PointerType: {
     368    case AST::UnnamedType::Kind::Pointer: {
    365369        auto& pointerType = downcast<PointerTypeNameNode>(baseTypeNameNode);
    366370        ASSERT(baseTypeNameNode.parent());
     
    368372        break;
    369373    }
    370     case AST::UnnamedType::Kind::ArrayReferenceType: {
     374    case AST::UnnamedType::Kind::ArrayReference: {
    371375        auto& arrayReferenceType = downcast<ArrayReferenceTypeNameNode>(baseTypeNameNode);
    372376        ASSERT(baseTypeNameNode.parent());
     
    379383        break;
    380384    }
    381     case AST::UnnamedType::Kind::ArrayType: {
     385    case AST::UnnamedType::Kind::Array: {
    382386        auto& arrayType = downcast<ArrayTypeNameNode>(baseTypeNameNode);
    383387        ASSERT(baseTypeNameNode.parent());
     
    385389        break;
    386390    }
     391    default:
     392        RELEASE_ASSERT_NOT_REACHED();
    387393    }
    388394
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp

    r248307 r248488  
    14951495    case Token::Type::PlusPlus: {
    14961496        CodeLocation location(previous->codeLocation(), *suffix);
    1497         auto result = AST::ReadModifyWriteExpression::create(location, WTFMove(previous));
     1497        auto result = makeUniqueRef<AST::ReadModifyWriteExpression>(location, WTFMove(previous));
    14981498        Vector<UniqueRef<AST::Expression>> callArguments;
    14991499        callArguments.append(result->oldVariableReference());
     
    15051505        ASSERT(suffix->type == Token::Type::MinusMinus);
    15061506        CodeLocation location(previous->codeLocation(), *suffix);
    1507         auto result = AST::ReadModifyWriteExpression::create(location, WTFMove(previous));
     1507        auto result = makeUniqueRef<AST::ReadModifyWriteExpression>(location, WTFMove(previous));
    15081508        Vector<UniqueRef<AST::Expression>> callArguments;
    15091509        callArguments.append(result->oldVariableReference());
     
    16071607    }
    16081608
    1609     auto result = AST::ReadModifyWriteExpression::create(location, WTFMove(left));
     1609    auto result = makeUniqueRef<AST::ReadModifyWriteExpression>(location, WTFMove(left));
    16101610    Vector<UniqueRef<AST::Expression>> callArguments;
    16111611    callArguments.append(result->oldVariableReference());
     
    18991899            if (isEffectful)
    19001900                *isEffectful = true;
    1901             auto result = AST::ReadModifyWriteExpression::create(location, WTFMove(*next));
     1901            auto result = makeUniqueRef<AST::ReadModifyWriteExpression>(location, WTFMove(*next));
    19021902            Vector<UniqueRef<AST::Expression>> callArguments;
    19031903            callArguments.append(result->oldVariableReference());
     
    19091909            if (isEffectful)
    19101910                *isEffectful = true;
    1911             auto result = AST::ReadModifyWriteExpression::create(location, WTFMove(*next));
     1911            auto result = makeUniqueRef<AST::ReadModifyWriteExpression>(location, WTFMove(*next));
    19121912            Vector<UniqueRef<AST::Expression>> callArguments;
    19131913            callArguments.append(result->oldVariableReference());
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp

    r248382 r248488  
    158158            auto structDeclarationStatement = makeUniqueRef<AST::VariableDeclarationsStatement>(functionDefinition.codeLocation(), WTFMove(structVariableDeclarations));
    159159
    160             auto makePointerExpression = std::make_unique<AST::MakePointerExpression>(functionDefinition.codeLocation(), WTFMove(structVariableReference), AST::AddressEscapeMode::DoesNotEscape);
     160            std::unique_ptr<AST::Expression> makePointerExpression(new AST::MakePointerExpression(functionDefinition.codeLocation(), WTFMove(structVariableReference), AST::AddressEscapeMode::DoesNotEscape));
    161161            makePointerExpression->setType(m_pointerToStructType.copyRef());
    162162            makePointerExpression->setTypeAnnotation(AST::RightValue());
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLVisitor.cpp

    r247878 r248488  
    304304void Visitor::visit(AST::Statement& statement)
    305305{
    306     if (is<AST::Block>(statement))
     306    switch (statement.kind()) {
     307    case AST::Statement::Kind::Block:
    307308        checkErrorAndVisit(downcast<AST::Block>(statement));
    308     else if (is<AST::Break>(statement))
     309        break;
     310    case AST::Statement::Kind::Break:
    309311        checkErrorAndVisit(downcast<AST::Break>(statement));
    310     else if (is<AST::Continue>(statement))
     312        break;
     313    case AST::Statement::Kind::Continue:
    311314        checkErrorAndVisit(downcast<AST::Continue>(statement));
    312     else if (is<AST::DoWhileLoop>(statement))
     315        break;
     316    case AST::Statement::Kind::DoWhileLoop:
    313317        checkErrorAndVisit(downcast<AST::DoWhileLoop>(statement));
    314     else if (is<AST::EffectfulExpressionStatement>(statement))
     318        break;
     319    case AST::Statement::Kind::EffectfulExpression:
    315320        checkErrorAndVisit(downcast<AST::EffectfulExpressionStatement>(statement));
    316     else if (is<AST::Fallthrough>(statement))
     321        break;
     322    case AST::Statement::Kind::Fallthrough:
    317323        checkErrorAndVisit(downcast<AST::Fallthrough>(statement));
    318     else if (is<AST::ForLoop>(statement))
     324        break;
     325    case AST::Statement::Kind::ForLoop:
    319326        checkErrorAndVisit(downcast<AST::ForLoop>(statement));
    320     else if (is<AST::IfStatement>(statement))
     327        break;
     328    case AST::Statement::Kind::If:
    321329        checkErrorAndVisit(downcast<AST::IfStatement>(statement));
    322     else if (is<AST::Return>(statement))
     330        break;
     331    case AST::Statement::Kind::Return:
    323332        checkErrorAndVisit(downcast<AST::Return>(statement));
    324     else if (is<AST::StatementList>(statement))
     333        break;
     334    case AST::Statement::Kind::StatementList:
    325335        checkErrorAndVisit(downcast<AST::StatementList>(statement));
    326     else if (is<AST::SwitchCase>(statement))
     336        break;
     337    case AST::Statement::Kind::SwitchCase:
    327338        checkErrorAndVisit(downcast<AST::SwitchCase>(statement));
    328     else if (is<AST::SwitchStatement>(statement))
     339        break;
     340    case AST::Statement::Kind::Switch:
    329341        checkErrorAndVisit(downcast<AST::SwitchStatement>(statement));
    330     else if (is<AST::VariableDeclarationsStatement>(statement))
     342        break;
     343    case AST::Statement::Kind::VariableDeclarations:
    331344        checkErrorAndVisit(downcast<AST::VariableDeclarationsStatement>(statement));
    332     else
     345        break;
     346    case AST::Statement::Kind::WhileLoop:
    333347        checkErrorAndVisit(downcast<AST::WhileLoop>(statement));
     348        break;
     349    }
    334350}
    335351
     
    350366void Visitor::visit(AST::Expression& expression)
    351367{
    352     if (is<AST::AssignmentExpression>(expression))
     368    switch (expression.kind()) {
     369    case AST::Expression::Kind::Assignment:
    353370        checkErrorAndVisit(downcast<AST::AssignmentExpression>(expression));
    354     else if (is<AST::BooleanLiteral>(expression))
     371        break;
     372    case AST::Expression::Kind::BooleanLiteral:
    355373        checkErrorAndVisit(downcast<AST::BooleanLiteral>(expression));
    356     else if (is<AST::CallExpression>(expression))
     374        break;
     375    case AST::Expression::Kind::Call:
    357376        checkErrorAndVisit(downcast<AST::CallExpression>(expression));
    358     else if (is<AST::CommaExpression>(expression))
     377        break;
     378    case AST::Expression::Kind::Comma:
    359379        checkErrorAndVisit(downcast<AST::CommaExpression>(expression));
    360     else if (is<AST::DereferenceExpression>(expression))
     380        break;
     381    case AST::Expression::Kind::Dereference:
    361382        checkErrorAndVisit(downcast<AST::DereferenceExpression>(expression));
    362     else if (is<AST::FloatLiteral>(expression))
     383        break;
     384    case AST::Expression::Kind::FloatLiteral:
    363385        checkErrorAndVisit(downcast<AST::FloatLiteral>(expression));
    364     else if (is<AST::IntegerLiteral>(expression))
     386        break;
     387    case AST::Expression::Kind::IntegerLiteral:
    365388        checkErrorAndVisit(downcast<AST::IntegerLiteral>(expression));
    366     else if (is<AST::LogicalExpression>(expression))
     389        break;
     390    case AST::Expression::Kind::Logical:
    367391        checkErrorAndVisit(downcast<AST::LogicalExpression>(expression));
    368     else if (is<AST::LogicalNotExpression>(expression))
     392        break;
     393    case AST::Expression::Kind::LogicalNot:
    369394        checkErrorAndVisit(downcast<AST::LogicalNotExpression>(expression));
    370     else if (is<AST::MakeArrayReferenceExpression>(expression))
     395        break;
     396    case AST::Expression::Kind::MakeArrayReference:
    371397        checkErrorAndVisit(downcast<AST::MakeArrayReferenceExpression>(expression));
    372     else if (is<AST::MakePointerExpression>(expression))
     398        break;
     399    case AST::Expression::Kind::MakePointer:
    373400        checkErrorAndVisit(downcast<AST::MakePointerExpression>(expression));
    374     else if (is<AST::NullLiteral>(expression))
     401        break;
     402    case AST::Expression::Kind::NullLiteral:
    375403        checkErrorAndVisit(downcast<AST::NullLiteral>(expression));
    376     else if (is<AST::DotExpression>(expression))
     404        break;
     405    case AST::Expression::Kind::Dot:
    377406        checkErrorAndVisit(downcast<AST::DotExpression>(expression));
    378     else if (is<AST::GlobalVariableReference>(expression))
     407        break;
     408    case AST::Expression::Kind::GlobalVariableReference:
    379409        checkErrorAndVisit(downcast<AST::GlobalVariableReference>(expression));
    380     else if (is<AST::IndexExpression>(expression))
     410        break;
     411    case AST::Expression::Kind::Index:
    381412        checkErrorAndVisit(downcast<AST::IndexExpression>(expression));
    382     else if (is<AST::ReadModifyWriteExpression>(expression))
     413        break;
     414    case AST::Expression::Kind::ReadModifyWrite:
    383415        checkErrorAndVisit(downcast<AST::ReadModifyWriteExpression>(expression));
    384     else if (is<AST::TernaryExpression>(expression))
     416        break;
     417    case AST::Expression::Kind::Ternary:
    385418        checkErrorAndVisit(downcast<AST::TernaryExpression>(expression));
    386     else if (is<AST::UnsignedIntegerLiteral>(expression))
     419        break;
     420    case AST::Expression::Kind::UnsignedIntegerLiteral:
    387421        checkErrorAndVisit(downcast<AST::UnsignedIntegerLiteral>(expression));
    388     else if (is<AST::EnumerationMemberLiteral>(expression))
     422        break;
     423    case AST::Expression::Kind::EnumerationMemberLiteral:
    389424        checkErrorAndVisit(downcast<AST::EnumerationMemberLiteral>(expression));
    390     else
     425        break;
     426    case AST::Expression::Kind::VariableReference:
    391427        checkErrorAndVisit(downcast<AST::VariableReference>(expression));
     428        break;
     429    }
    392430}
    393431
  • trunk/Source/WebCore/Sources.txt

    r248467 r248488  
    342342Modules/webgpu/WHLSL/WHLSLFunctionStageChecker.cpp
    343343Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.cpp
     344Modules/webgpu/WHLSL/AST/WHLSLExpression.cpp
    344345Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp
    345346Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp
     
    350351Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.cpp
    351352Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp
     353Modules/webgpu/WHLSL/AST/WHLSLStatement.cpp
     354Modules/webgpu/WHLSL/AST/WHLSLType.cpp
    352355Modules/webgpu/WHLSL/AST/WHLSLTypeReference.cpp
    353356Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.cpp
    354357Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.cpp
     358Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.cpp
    355359Modules/webgpu/WHLSL/WHLSLPrepare.cpp
    356360Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r248467 r248488  
    22312231                7C8139AA1ED6604B00CE26E8 /* JSDOMCastedThisErrorBehavior.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C8139A91ED62DF200CE26E8 /* JSDOMCastedThisErrorBehavior.h */; settings = {ATTRIBUTES = (Private, ); }; };
    22322232                7C83DE861D04CC5D00FEBCF3 /* SpringSolver.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C83DE851D04CBD400FEBCF3 /* SpringSolver.h */; };
    2233                 7C85B20222FB04850030684F /* WHLSLUnnamedType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C85B20122FB04850030684F /* WHLSLUnnamedType.cpp */; };
    22342233                7C8E34AD1E4A33AF0054CE23 /* JSDOMConvertAny.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C8E34921E4A338E0054CE23 /* JSDOMConvertAny.h */; settings = {ATTRIBUTES = (Private, ); }; };
    22352234                7C8E34AE1E4A33AF0054CE23 /* JSDOMConvertBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C8E34931E4A338E0054CE23 /* JSDOMConvertBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    83148313                5215862C229377B7005925EF /* WHLSLAST.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLAST.h; sourceTree = "<group>"; };
    83158314                522BAB9622E6A36200C54CE9 /* WHLSLCodeLocation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLCodeLocation.h; sourceTree = "<group>"; };
     8315                522D07A322FBAB4300B905BE /* WHLSLExpression.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WHLSLExpression.cpp; sourceTree = "<group>"; };
    83168316                522DA3D3229E1D390042D151 /* WHLSLGlobalVariableReference.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLGlobalVariableReference.h; sourceTree = "<group>"; };
    83178317                522E1A172297D6D400E5D36A /* WHLSLPreserveVariableLifetimes.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WHLSLPreserveVariableLifetimes.cpp; sourceTree = "<group>"; };
     
    83268326                52B0D4BF1C57FD660077CE53 /* VideoFullscreenChangeObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenChangeObserver.h; sourceTree = "<group>"; };
    83278327                52B0D4C11C57FF910077CE53 /* VideoFullscreenInterfaceMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenInterfaceMac.h; sourceTree = "<group>"; };
     8328                52CB11DB22FDDB2E009F0A64 /* WHLSLDefaultDelete.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLDefaultDelete.h; sourceTree = "<group>"; };
    83288329                52D5A18D1C54590300DE34A3 /* VideoFullscreenLayerManagerObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = VideoFullscreenLayerManagerObjC.mm; sourceTree = "<group>"; };
    83298330                52D5A18E1C54590300DE34A3 /* VideoFullscreenLayerManagerObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenLayerManagerObjC.h; sourceTree = "<group>"; };
     
    1707517076                                C21BF73321CD89F000227979 /* WHLSLConstantExpression.h */,
    1707617077                                C21BF6F521CD89B500227979 /* WHLSLContinue.h */,
     17078                                52CB11DB22FDDB2E009F0A64 /* WHLSLDefaultDelete.h */,
    1707717079                                C21BF70121CD89C400227979 /* WHLSLDereferenceExpression.h */,
    1707817080                                C21BF71821CD89D700227979 /* WHLSLDotExpression.h */,
     
    1708417086                                C21BF70221CD89C400227979 /* WHLSLEnumerationMemberLiteral.h */,
    1708517087                                C21BF70C21CD89CC00227979 /* WHLSLExpression.h */,
     17088                                522D07A322FBAB4300B905BE /* WHLSLExpression.cpp */,
    1708617089                                C21BF70021CD89C200227979 /* WHLSLFallthrough.h */,
    1708717090                                C21BF73521CD89F200227979 /* WHLSLFloatLiteral.h */,
     
    3351733520                                5D21A80213ECE5DF00BB7064 /* WebVTTParser.cpp in Sources */,
    3351833521                                B10B6981140C174000BC1C26 /* WebVTTTokenizer.cpp in Sources */,
    33519                                 7C85B20222FB04850030684F /* WHLSLUnnamedType.cpp in Sources */,
    3352033522                                A14832C2187F65C700DA63A6 /* WKUtilities.c in Sources */,
    3352133523                                A833C7CC0A2CF07400D57664 /* XLinkNames.cpp in Sources */,
  • trunk/Source/WebCore/workers/WorkerScriptLoader.h

    r244115 r248488  
    8080private:
    8181    friend class WTF::RefCounted<WorkerScriptLoader>;
     82    friend struct std::default_delete<WorkerScriptLoader>;
    8283
    8384    WorkerScriptLoader();
Note: See TracChangeset for help on using the changeset viewer.