Changeset 248488 in webkit
- Timestamp:
- Aug 9, 2019 4:30:29 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 3 added
- 72 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r248446 r248488 1 2019-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 1 16 2019-08-08 Chris Dumez <cdumez@apple.com> 2 17 -
trunk/Source/WTF/wtf/RefCounted.h
r203257 r248488 137 137 #endif 138 138 139 template<typename T > class RefCounted : public RefCountedBase {139 template<typename T, typename Deleter = std::default_delete<T>> class RefCounted : public RefCountedBase { 140 140 WTF_MAKE_NONCOPYABLE(RefCounted); WTF_MAKE_FAST_ALLOCATED; 141 141 public: … … 143 143 { 144 144 if (derefBase()) 145 delete static_cast<const T*>(this);145 Deleter()(const_cast<T*>(static_cast<const T*>(this))); 146 146 } 147 147 -
trunk/Source/WTF/wtf/UniqueRef.h
r247062 r248488 44 44 template <typename U> 45 45 UniqueRef(UniqueRef<U>&& other) 46 : m_ref( WTFMove(other.m_ref))46 : m_ref(other.m_ref.release()) 47 47 { 48 48 ASSERT(m_ref); -
trunk/Source/WebCore/ChangeLog
r248473 r248488 1 2019-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 1 405 2019-08-09 Youenn Fablet <youenn@apple.com> 2 406 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLArrayReferenceType.h
r248395 r248488 33 33 #include <wtf/Noncopyable.h> 34 34 #include <wtf/UniqueRef.h> 35 #include <wtf/text/StringConcatenate.h> 35 36 #include <wtf/text/WTFString.h> 36 37 … … 47 48 48 49 ArrayReferenceType(CodeLocation location, AddressSpace addressSpace, Ref<UnnamedType> elementType) 49 : Base(location, addressSpace, WTFMove(elementType), Kind::ArrayReference Type)50 : Base(location, addressSpace, WTFMove(elementType), Kind::ArrayReference) 50 51 { 51 52 } … … 56 57 } 57 58 58 virtual~ArrayReferenceType() = default;59 ~ArrayReferenceType() = default; 59 60 60 61 unsigned hash() const … … 68 69 } 69 70 70 String toString() const override71 String toString() const 71 72 { 72 73 return makeString(elementType().toString(), "[]"); -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLArrayType.h
r248395 r248488 47 47 WTF_MAKE_NONCOPYABLE(ArrayType); 48 48 ArrayType(CodeLocation location, Ref<UnnamedType> elementType, unsigned numElements) 49 : UnnamedType(location, Kind::Array Type)49 : UnnamedType(location, Kind::Array) 50 50 , m_elementType(WTFMove(elementType)) 51 51 , m_numElements(numElements) … … 59 59 } 60 60 61 virtual~ArrayType() = default;61 ~ArrayType() = default; 62 62 63 63 const UnnamedType& type() const { return m_elementType; } … … 75 75 } 76 76 77 String toString() const override77 String toString() const 78 78 { 79 79 return makeString(type().toString(), '[', numElements(), ']'); … … 91 91 } 92 92 93 DEFINE_DEFAULT_DELETE(ArrayType) 94 93 95 SPECIALIZE_TYPE_TRAITS_WHLSL_UNNAMED_TYPE(ArrayType, isArrayType()) 94 96 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h
r247834 r248488 38 38 namespace AST { 39 39 40 class AssignmentExpression : public Expression {40 class AssignmentExpression final : public Expression { 41 41 WTF_MAKE_FAST_ALLOCATED; 42 42 public: 43 43 AssignmentExpression(CodeLocation location, UniqueRef<Expression>&& left, UniqueRef<Expression>&& right) 44 : Expression(location )44 : Expression(location, Kind::Assignment) 45 45 , m_left(WTFMove(left)) 46 46 , m_right(WTFMove(right)) … … 51 51 } 52 52 53 virtual~AssignmentExpression() = default;53 ~AssignmentExpression() = default; 54 54 55 55 AssignmentExpression(const AssignmentExpression&) = delete; 56 56 AssignmentExpression(AssignmentExpression&&) = default; 57 58 bool isAssignmentExpression() const override { return true; }59 57 60 58 Expression& left() { return m_left; } … … 76 74 } 77 75 76 DEFINE_DEFAULT_DELETE(AssignmentExpression) 77 78 78 SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(AssignmentExpression, isAssignmentExpression()) 79 79 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBlock.h
r247834 r248488 39 39 namespace AST { 40 40 41 class Block : public Statement {41 class Block final : public Statement { 42 42 WTF_MAKE_FAST_ALLOCATED; 43 43 public: 44 44 Block(CodeLocation location, Statements&& statements) 45 : Statement(location )45 : Statement(location, Kind::Block) 46 46 , m_statements(WTFMove(statements)) 47 47 { 48 48 } 49 49 50 virtual~Block() = default;50 ~Block() = default; 51 51 52 52 Block(const Block&) = delete; … … 54 54 55 55 Statements& statements() { return m_statements; } 56 57 bool isBlock() const override { return true; }58 56 59 57 private: … … 67 65 } 68 66 67 DEFINE_DEFAULT_DELETE(Block) 68 69 69 SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(Block, isBlock()) 70 70 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBooleanLiteral.h
r247834 r248488 37 37 namespace AST { 38 38 39 class BooleanLiteral : public Expression {39 class BooleanLiteral final : public Expression { 40 40 WTF_MAKE_FAST_ALLOCATED; 41 41 public: 42 42 BooleanLiteral(CodeLocation location, bool value) 43 : Expression(location )43 : Expression(location, Kind::BooleanLiteral) 44 44 , m_value(value) 45 45 { 46 46 } 47 47 48 virtual~BooleanLiteral() = default;48 ~BooleanLiteral() = default; 49 49 50 50 BooleanLiteral(const BooleanLiteral&) = delete; … … 55 55 56 56 bool value() const { return m_value; } 57 58 bool isBooleanLiteral() const override { return true; }59 57 60 58 BooleanLiteral clone() const … … 75 73 } 76 74 75 DEFINE_DEFAULT_DELETE(BooleanLiteral) 76 77 77 SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(BooleanLiteral, isBooleanLiteral()) 78 78 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLBreak.h
r247834 r248488 38 38 namespace AST { 39 39 40 class Break : public Statement {40 class Break final : public Statement { 41 41 WTF_MAKE_FAST_ALLOCATED; 42 42 public: 43 43 Break(CodeLocation location) 44 : Statement(location )44 : Statement(location, Kind::Break) 45 45 { 46 46 } 47 47 48 virtual~Break() = default;48 ~Break() = default; 49 49 50 50 Break(const Break&) = delete; 51 51 Break(Break&&) = default; 52 53 bool isBreak() const override { return true; }54 52 55 53 private: … … 62 60 } 63 61 62 DEFINE_DEFAULT_DELETE(Break) 63 64 64 SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(Break, isBreak()) 65 65 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLCallExpression.h
r247834 r248488 41 41 class NamedType; 42 42 43 class CallExpression : public Expression {43 class CallExpression final : public Expression { 44 44 WTF_MAKE_FAST_ALLOCATED; 45 45 public: 46 46 CallExpression(CodeLocation location, String&& name, Vector<UniqueRef<Expression>>&& arguments) 47 : Expression(location )47 : Expression(location, Kind::Call) 48 48 , m_name(WTFMove(name)) 49 49 , m_arguments(WTFMove(arguments)) … … 51 51 } 52 52 53 virtual ~CallExpression() = default;54 55 53 CallExpression(const CallExpression&) = delete; 56 54 CallExpression(CallExpression&&) = default; 57 58 bool isCallExpression() const override { return true; }59 55 60 56 Vector<UniqueRef<Expression>>& arguments() { return m_arguments; } 61 57 62 58 String& name() { return m_name; } 59 60 ~CallExpression() = default; 63 61 64 62 void setCastData(NamedType& namedType) … … 94 92 } 95 93 94 DEFINE_DEFAULT_DELETE(CallExpression) 95 96 96 SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(CallExpression, isCallExpression()) 97 97 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLCommaExpression.h
r247834 r248488 39 39 namespace AST { 40 40 41 class CommaExpression : public Expression {41 class CommaExpression final : public Expression { 42 42 WTF_MAKE_FAST_ALLOCATED; 43 43 public: 44 44 CommaExpression(CodeLocation location, Vector<UniqueRef<Expression>>&& list) 45 : Expression(location )45 : Expression(location, Kind::Comma) 46 46 , m_list(WTFMove(list)) 47 47 { 48 48 } 49 49 50 virtual~CommaExpression() = default;50 ~CommaExpression() = default; 51 51 52 52 CommaExpression(const CommaExpression&) = delete; 53 53 CommaExpression(CommaExpression&&) = default; 54 55 bool isCommaExpression() const override { return true; }56 54 57 55 Vector<UniqueRef<Expression>>& list() { return m_list; } … … 67 65 } 68 66 67 DEFINE_DEFAULT_DELETE(CommaExpression) 68 69 69 SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(CommaExpression, isCommaExpression()) 70 70 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h
r247813 r248488 46 46 // so this is a wrapper class to make sure that doesn't happen. As soon as we don't 47 47 // have to support Sierra, this can be migrated to a Variant proper. 48 class ConstantExpression {48 class ConstantExpression final { 49 49 WTF_MAKE_FAST_ALLOCATED; 50 50 public: -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLContinue.h
r247834 r248488 38 38 namespace AST { 39 39 40 class Continue : public Statement {40 class Continue final : public Statement { 41 41 WTF_MAKE_FAST_ALLOCATED; 42 42 public: 43 43 Continue(CodeLocation location) 44 : Statement(location )44 : Statement(location, Kind::Continue) 45 45 { 46 46 } 47 47 48 virtual~Continue() = default;48 ~Continue() = default; 49 49 50 50 Continue(const Continue&) = delete; 51 51 Continue(Continue&&) = default; 52 53 bool isContinue() const override { return true; }54 52 55 53 private: … … 62 60 } 63 61 62 DEFINE_DEFAULT_DELETE(Continue) 63 64 64 SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(Continue, isContinue()) 65 65 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLDefaultDelete.h
r248487 r248488 28 28 #if ENABLE(WEBGPU) 29 29 30 #include "WHLSLCodeLocation.h" 31 #include "WHLSLStatement.h" 32 #include <wtf/FastMalloc.h> 30 #include <type_traits> 33 31 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 } \ 65 55 66 56 #endif -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLDereferenceExpression.h
r247834 r248488 38 38 namespace AST { 39 39 40 class DereferenceExpression : public Expression {40 class DereferenceExpression final : public Expression { 41 41 WTF_MAKE_FAST_ALLOCATED; 42 42 public: 43 43 DereferenceExpression(CodeLocation location, UniqueRef<Expression>&& pointer) 44 : Expression(location )44 : Expression(location, Kind::Dereference) 45 45 , m_pointer(WTFMove(pointer)) 46 46 { 47 47 } 48 48 49 virtual~DereferenceExpression() = default;49 ~DereferenceExpression() = default; 50 50 51 51 DereferenceExpression(const DereferenceExpression&) = delete; 52 52 DereferenceExpression(DereferenceExpression&&) = default; 53 54 bool isDereferenceExpression() const override { return true; }55 53 56 54 Expression& pointer() { return m_pointer; } … … 66 64 } 67 65 66 DEFINE_DEFAULT_DELETE(DereferenceExpression) 67 68 68 SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(DereferenceExpression, isDereferenceExpression()) 69 69 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLDoWhileLoop.h
r247834 r248488 39 39 namespace AST { 40 40 41 class DoWhileLoop : public Statement {41 class DoWhileLoop final : public Statement { 42 42 WTF_MAKE_FAST_ALLOCATED; 43 43 public: 44 44 DoWhileLoop(CodeLocation location, UniqueRef<Statement>&& body, UniqueRef<Expression>&& conditional) 45 : Statement(location )45 : Statement(location, Kind::DoWhileLoop) 46 46 , m_body(WTFMove(body)) 47 47 , m_conditional(WTFMove(conditional)) … … 49 49 } 50 50 51 virtual~DoWhileLoop() = default;51 ~DoWhileLoop() = default; 52 52 53 53 DoWhileLoop(const DoWhileLoop&) = delete; 54 54 DoWhileLoop(DoWhileLoop&&) = default; 55 56 bool isDoWhileLoop() const override { return true; }57 55 58 56 Statement& body() { return m_body; } … … 70 68 } 71 69 70 DEFINE_DEFAULT_DELETE(DoWhileLoop) 71 72 72 SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(DoWhileLoop, isDoWhileLoop()) 73 73 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h
r247834 r248488 39 39 namespace AST { 40 40 41 class DotExpression : public PropertyAccessExpression {41 class DotExpression final : public PropertyAccessExpression { 42 42 WTF_MAKE_FAST_ALLOCATED; 43 43 public: 44 44 DotExpression(CodeLocation location, UniqueRef<Expression>&& base, String&& fieldName) 45 : PropertyAccessExpression(location, WTFMove(base))45 : PropertyAccessExpression(location, Kind::Dot, WTFMove(base)) 46 46 , m_fieldName(WTFMove(fieldName)) 47 47 { 48 48 } 49 49 50 virtual~DotExpression() = default;50 ~DotExpression() = default; 51 51 52 52 DotExpression(const DotExpression&) = delete; 53 53 DotExpression(DotExpression&&) = default; 54 54 55 bool isDotExpression() const override { return true; } 56 57 String getterFunctionName() const override 55 String getterFunctionName() const 58 56 { 59 57 return makeString("operator.", m_fieldName); 60 58 } 61 59 62 String setterFunctionName() const override60 String setterFunctionName() const 63 61 { 64 62 return makeString("operator.", m_fieldName, "="); 65 63 } 66 64 67 String anderFunctionName() const override65 String anderFunctionName() const 68 66 { 69 67 return makeString("operator&.", m_fieldName); … … 82 80 } 83 81 82 DEFINE_DEFAULT_DELETE(DotExpression) 83 84 84 SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(DotExpression, isDotExpression()) 85 85 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLEffectfulExpressionStatement.h
r247834 r248488 39 39 namespace AST { 40 40 41 class EffectfulExpressionStatement : public Statement {41 class EffectfulExpressionStatement final : public Statement { 42 42 WTF_MAKE_FAST_ALLOCATED; 43 43 public: 44 44 EffectfulExpressionStatement(UniqueRef<Expression>&& effectfulExpression) 45 : Statement(effectfulExpression->codeLocation() )45 : Statement(effectfulExpression->codeLocation(), Kind::EffectfulExpression) 46 46 , m_effectfulExpression(WTFMove(effectfulExpression)) 47 47 { 48 48 } 49 49 50 virtual~EffectfulExpressionStatement() = default;50 ~EffectfulExpressionStatement() = default; 51 51 52 52 EffectfulExpressionStatement(const EffectfulExpressionStatement&) = delete; 53 53 EffectfulExpressionStatement(EffectfulExpressionStatement&&) = default; 54 55 bool isEffectfulExpressionStatement() const override { return true; }56 54 57 55 Expression& effectfulExpression() { return m_effectfulExpression; } … … 67 65 } 68 66 67 DEFINE_DEFAULT_DELETE(EffectfulExpressionStatement) 68 69 69 SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(EffectfulExpressionStatement, isEffectfulExpressionStatement()) 70 70 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLEnumerationDefinition.h
r247878 r248488 46 46 namespace AST { 47 47 48 class EnumerationDefinition : public NamedType {48 class EnumerationDefinition final : public NamedType { 49 49 WTF_MAKE_FAST_ALLOCATED; 50 50 public: 51 51 EnumerationDefinition(CodeLocation location, String&& name, Ref<UnnamedType> type) 52 : NamedType( location, WTFMove(name))52 : NamedType(Kind::EnumerationDefinition, location, WTFMove(name)) 53 53 , m_type(WTFMove(type)) 54 54 { 55 55 } 56 56 57 virtual~EnumerationDefinition() = default;57 ~EnumerationDefinition() = default; 58 58 59 59 EnumerationDefinition(const EnumerationDefinition&) = delete; 60 60 EnumerationDefinition(EnumerationDefinition&&) = default; 61 62 bool isEnumerationDefinition() const override { return true; }63 61 64 62 UnnamedType& type() { return m_type; } … … 97 95 } 98 96 97 DEFINE_DEFAULT_DELETE(EnumerationDefinition) 98 99 99 SPECIALIZE_TYPE_TRAITS_WHLSL_NAMED_TYPE(EnumerationDefinition, isEnumerationDefinition()) 100 100 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLEnumerationMemberLiteral.h
r247834 r248488 41 41 class EnumerationMember; 42 42 43 class EnumerationMemberLiteral : public Expression {43 class EnumerationMemberLiteral final : public Expression { 44 44 WTF_MAKE_FAST_ALLOCATED; 45 45 public: 46 46 EnumerationMemberLiteral(CodeLocation location, String&& left, String&& right) 47 : Expression(location )47 : Expression(location, Kind::EnumerationMemberLiteral) 48 48 , m_left(WTFMove(left)) 49 49 , m_right(WTFMove(right)) … … 51 51 } 52 52 53 virtual~EnumerationMemberLiteral() = default;53 ~EnumerationMemberLiteral() = default; 54 54 55 55 explicit EnumerationMemberLiteral(const EnumerationMemberLiteral&) = delete; … … 58 58 EnumerationMemberLiteral& operator=(const EnumerationMemberLiteral&) = delete; 59 59 EnumerationMemberLiteral& operator=(EnumerationMemberLiteral&&) = default; 60 61 bool isEnumerationMemberLiteral() const override { return true; }62 60 63 61 static EnumerationMemberLiteral wrap(CodeLocation location, String&& left, String&& right, EnumerationDefinition& enumerationDefinition, EnumerationMember& enumerationMember) … … 119 117 } 120 118 119 DEFINE_DEFAULT_DELETE(EnumerationMemberLiteral) 120 121 121 SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(EnumerationMemberLiteral, isEnumerationMemberLiteral()) 122 122 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLExpression.h
r247878 r248488 30 30 #include "WHLSLAddressSpace.h" 31 31 #include "WHLSLCodeLocation.h" 32 #include "WHLSLDefaultDelete.h" 32 33 #include "WHLSLUnnamedType.h" 33 34 #include <wtf/FastMalloc.h> … … 43 44 class Expression { 44 45 WTF_MAKE_FAST_ALLOCATED; 46 47 protected: 48 ~Expression() = default; 49 45 50 public: 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) 47 76 : m_codeLocation(codeLocation) 77 , m_kind(kind) 48 78 { 49 79 } 50 80 51 virtual ~Expression() = default; 81 static void destroy(Expression&); 82 static void destruct(Expression&); 52 83 53 84 Expression(const Expression&) = delete; … … 93 124 } 94 125 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; } 116 148 117 149 CodeLocation codeLocation() const { return m_codeLocation; } … … 122 154 RefPtr<UnnamedType> m_type; 123 155 Optional<TypeAnnotation> m_typeAnnotation; 156 Kind m_kind; 124 157 }; 125 158 … … 130 163 } 131 164 165 DEFINE_DEFAULT_DELETE(Expression) 166 132 167 #define SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(ToValueTypeName, predicate) \ 133 168 SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::WHLSL::AST::ToValueTypeName) \ -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFallthrough.h
r247834 r248488 38 38 namespace AST { 39 39 40 class Fallthrough : public Statement {40 class Fallthrough final : public Statement { 41 41 WTF_MAKE_FAST_ALLOCATED; 42 42 public: 43 43 Fallthrough(CodeLocation location) 44 : Statement(location )44 : Statement(location, Kind::Fallthrough) 45 45 { 46 46 } 47 47 48 virtual~Fallthrough() = default;48 ~Fallthrough() = default; 49 49 50 50 Fallthrough(const Fallthrough&) = delete; 51 51 Fallthrough(Fallthrough&&) = default; 52 53 bool isFallthrough() const override { return true; }54 52 55 53 private: … … 62 60 } 63 61 62 DEFINE_DEFAULT_DELETE(Fallthrough) 63 64 64 SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(Fallthrough, isFallthrough()) 65 65 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFloatLiteral.h
r247878 r248488 38 38 namespace AST { 39 39 40 class FloatLiteral : public Expression {40 class FloatLiteral final : public Expression { 41 41 WTF_MAKE_FAST_ALLOCATED; 42 42 public: 43 43 FloatLiteral(CodeLocation location, float value) 44 : Expression(location )44 : Expression(location, Kind::FloatLiteral) 45 45 , m_type(location, value) 46 46 , m_value(value) … … 48 48 } 49 49 50 virtual~FloatLiteral() = default;50 ~FloatLiteral() = default; 51 51 52 52 FloatLiteral(const FloatLiteral&) = delete; … … 58 58 FloatLiteralType& type() { return m_type; } 59 59 float value() const { return m_value; } 60 61 bool isFloatLiteral() const override { return true; }62 60 63 61 FloatLiteral clone() const … … 82 80 } 83 81 82 DEFINE_DEFAULT_DELETE(FloatLiteral) 83 84 84 SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(FloatLiteral, isFloatLiteral()) 85 85 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.cpp
r247878 r248488 40 40 41 41 FloatLiteralType::FloatLiteralType(CodeLocation location, float value) 42 : m_value(value) 42 : ResolvableType(Kind::FloatLiteral) 43 , m_value(value) 43 44 , m_preferredType(TypeReference::create(location, "float"_str, TypeArguments())) 44 45 { 45 46 } 46 47 FloatLiteralType::~FloatLiteralType() = default;48 49 FloatLiteralType::FloatLiteralType(FloatLiteralType&&) = default;50 51 FloatLiteralType& FloatLiteralType::operator=(FloatLiteralType&&) = default;52 47 53 48 bool FloatLiteralType::canResolve(const Type& type) const -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFloatLiteralType.h
r247878 r248488 41 41 class TypeReference; 42 42 43 class FloatLiteralType : public ResolvableType {43 class FloatLiteralType final : public ResolvableType { 44 44 WTF_MAKE_FAST_ALLOCATED; 45 45 public: 46 46 FloatLiteralType(CodeLocation, float value); 47 47 48 virtual ~FloatLiteralType();48 ~FloatLiteralType() = default; 49 49 50 50 FloatLiteralType(const FloatLiteralType&) = delete; 51 FloatLiteralType(FloatLiteralType&&) ;51 FloatLiteralType(FloatLiteralType&&) = default; 52 52 53 53 FloatLiteralType& operator=(const FloatLiteralType&) = delete; 54 FloatLiteralType& operator=(FloatLiteralType&&); 55 56 bool isFloatLiteralType() const override { return true; } 54 FloatLiteralType& operator=(FloatLiteralType&&) = default; 57 55 58 56 float value() const { return m_value; } … … 60 58 TypeReference& preferredType() { return m_preferredType; } 61 59 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; 64 62 65 63 FloatLiteralType clone() const; … … 78 76 } 79 77 78 DEFINE_DEFAULT_DELETE(FloatLiteralType) 79 80 80 SPECIALIZE_TYPE_TRAITS_WHLSL_RESOLVABLE_TYPE(FloatLiteralType, isFloatLiteralType()) 81 81 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLForLoop.h
r247834 r248488 43 43 namespace AST { 44 44 45 class ForLoop : public Statement {45 class ForLoop final : public Statement { 46 46 WTF_MAKE_FAST_ALLOCATED; 47 47 public: 48 48 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) 50 50 , m_initialization(WTFMove(initialization)) 51 51 , m_condition(WTFMove(condition)) … … 55 55 } 56 56 57 virtual ~ForLoop() 58 { 59 } 57 ~ForLoop() = default; 60 58 61 59 ForLoop(const ForLoop&) = delete; 62 60 ForLoop(ForLoop&&) = default; 63 64 bool isForLoop() const override { return true; }65 61 66 62 Variant<UniqueRef<Statement>, UniqueRef<Expression>>& initialization() { return m_initialization; } … … 82 78 } 83 79 80 DEFINE_DEFAULT_DELETE(ForLoop) 81 84 82 SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(ForLoop, isForLoop()) 85 83 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLGlobalVariableReference.h
r247834 r248488 38 38 namespace AST { 39 39 40 class GlobalVariableReference : public Expression {40 class GlobalVariableReference final : public Expression { 41 41 WTF_MAKE_FAST_ALLOCATED; 42 42 public: 43 43 GlobalVariableReference(CodeLocation location, UniqueRef<Expression>&& base, StructureElement* structField) 44 : Expression(location )44 : Expression(location, Kind::GlobalVariableReference) 45 45 , m_base(WTFMove(base)) 46 46 , m_structField(*structField) … … 49 49 } 50 50 51 virtual~GlobalVariableReference() = default;52 bool isGlobalVariableReference() const override { return true; }51 ~GlobalVariableReference() = default; 52 53 53 StructureElement& structField() { return m_structField; } 54 54 … … 66 66 } 67 67 68 DEFINE_DEFAULT_DELETE(GlobalVariableReference) 69 68 70 SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(GlobalVariableReference, isGlobalVariableReference()) 69 71 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIfStatement.h
r247834 r248488 40 40 namespace AST { 41 41 42 class IfStatement : public Statement {42 class IfStatement final : public Statement { 43 43 WTF_MAKE_FAST_ALLOCATED; 44 44 public: 45 45 IfStatement(CodeLocation location, UniqueRef<Expression>&& conditional, UniqueRef<Statement>&& body, std::unique_ptr<Statement>&& elseBody) 46 : Statement(location )46 : Statement(location, Kind::If) 47 47 , m_conditional(WTFMove(conditional)) 48 48 , m_body(WTFMove(body)) … … 51 51 } 52 52 53 virtual~IfStatement() = default;53 ~IfStatement() = default; 54 54 55 55 IfStatement(const IfStatement&) = delete; 56 56 IfStatement(IfStatement&&) = default; 57 58 bool isIfStatement() const override { return true; }59 57 60 58 Expression& conditional() { return m_conditional; } … … 74 72 } 75 73 74 DEFINE_DEFAULT_DELETE(IfStatement) 75 76 76 SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(IfStatement, isIfStatement()) 77 77 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h
r247834 r248488 39 39 namespace AST { 40 40 41 class IndexExpression : public PropertyAccessExpression {41 class IndexExpression final : public PropertyAccessExpression { 42 42 WTF_MAKE_FAST_ALLOCATED; 43 43 public: 44 44 IndexExpression(CodeLocation location, UniqueRef<Expression>&& base, UniqueRef<Expression>&& index) 45 : PropertyAccessExpression(location, WTFMove(base))45 : PropertyAccessExpression(location, Kind::Index, WTFMove(base)) 46 46 , m_index(WTFMove(index)) 47 47 { 48 48 } 49 49 50 virtual~IndexExpression() = default;50 ~IndexExpression() = default; 51 51 52 52 IndexExpression(const IndexExpression&) = delete; 53 53 IndexExpression(IndexExpression&&) = default; 54 54 55 bool isIndexExpression() const override { return true; } 56 57 String getterFunctionName() const override 55 String getterFunctionName() const 58 56 { 59 57 return "operator[]"_str; 60 58 } 61 59 62 String setterFunctionName() const override60 String setterFunctionName() const 63 61 { 64 62 return "operator[]="_str; 65 63 } 66 64 67 String anderFunctionName() const override65 String anderFunctionName() const 68 66 { 69 67 return "operator&[]"_str; … … 83 81 } 84 82 83 DEFINE_DEFAULT_DELETE(IndexExpression) 84 85 85 SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(IndexExpression, isIndexExpression()) 86 86 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h
r247878 r248488 38 38 namespace AST { 39 39 40 class IntegerLiteral : public Expression {40 class IntegerLiteral final : public Expression { 41 41 WTF_MAKE_FAST_ALLOCATED; 42 42 public: 43 43 IntegerLiteral(CodeLocation location, int value) 44 : Expression(location )44 : Expression(location, Kind::IntegerLiteral) 45 45 , m_type(location, value) 46 46 , m_value(value) … … 48 48 } 49 49 50 virtual~IntegerLiteral() = default;50 ~IntegerLiteral() = default; 51 51 52 52 IntegerLiteral(const IntegerLiteral&) = delete; … … 58 58 IntegerLiteralType& type() { return m_type; } 59 59 int value() const { return m_value; } 60 61 bool isIntegerLiteral() const override { return true; }62 60 63 61 IntegerLiteral clone() const … … 84 82 } 85 83 84 DEFINE_DEFAULT_DELETE(IntegerLiteral) 85 86 86 SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(IntegerLiteral, isIntegerLiteral()) 87 87 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.cpp
r247878 r248488 41 41 42 42 IntegerLiteralType::IntegerLiteralType(CodeLocation location, int value) 43 : m_value(value) 43 : ResolvableType(Kind::IntegerLiteral) 44 , m_value(value) 44 45 , m_preferredType(TypeReference::create(location, "int"_str, TypeArguments())) 45 46 { 46 47 } 47 48 IntegerLiteralType::~IntegerLiteralType() = default;49 50 IntegerLiteralType::IntegerLiteralType(IntegerLiteralType&&) = default;51 52 IntegerLiteralType& IntegerLiteralType::operator=(IntegerLiteralType&&) = default;53 48 54 49 bool IntegerLiteralType::canResolve(const Type& type) const -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteralType.h
r247878 r248488 41 41 class TypeReference; 42 42 43 class IntegerLiteralType : public ResolvableType {43 class IntegerLiteralType final : public ResolvableType { 44 44 WTF_MAKE_FAST_ALLOCATED; 45 45 public: 46 46 IntegerLiteralType(CodeLocation, int value); 47 47 48 virtual ~IntegerLiteralType();48 ~IntegerLiteralType() = default; 49 49 50 50 IntegerLiteralType(const IntegerLiteralType&) = delete; 51 IntegerLiteralType(IntegerLiteralType&&) ;51 IntegerLiteralType(IntegerLiteralType&&) = default; 52 52 53 53 IntegerLiteralType& operator=(const IntegerLiteralType&) = delete; 54 IntegerLiteralType& operator=(IntegerLiteralType&&); 55 56 bool isIntegerLiteralType() const override { return true; } 54 IntegerLiteralType& operator=(IntegerLiteralType&&) = default; 57 55 58 56 int value() const { return m_value; } … … 60 58 TypeReference& preferredType() { return m_preferredType; } 61 59 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; 64 62 65 63 IntegerLiteralType clone() const; … … 78 76 } 79 77 78 DEFINE_DEFAULT_DELETE(IntegerLiteralType) 79 80 80 SPECIALIZE_TYPE_TRAITS_WHLSL_RESOLVABLE_TYPE(IntegerLiteralType, isIntegerLiteralType()) 81 81 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLLogicalExpression.h
r247834 r248488 38 38 namespace AST { 39 39 40 class LogicalExpression : public Expression {40 class LogicalExpression final : public Expression { 41 41 WTF_MAKE_FAST_ALLOCATED; 42 42 public: … … 47 47 48 48 LogicalExpression(CodeLocation location, Type type, UniqueRef<Expression>&& left, UniqueRef<Expression>&& right) 49 : Expression(location )49 : Expression(location, Kind::Logical) 50 50 , m_type(type) 51 51 , m_left(WTFMove(left)) … … 54 54 } 55 55 56 virtual~LogicalExpression() = default;56 ~LogicalExpression() = default; 57 57 58 58 LogicalExpression(const LogicalExpression&) = delete; … … 60 60 61 61 Type type() const { return m_type; } 62 63 bool isLogicalExpression() const override { return true; }64 62 65 63 Expression& left() { return m_left; } … … 78 76 } 79 77 78 DEFINE_DEFAULT_DELETE(LogicalExpression) 79 80 80 SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(LogicalExpression, isLogicalExpression()) 81 81 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLLogicalNotExpression.h
r247834 r248488 38 38 namespace AST { 39 39 40 class LogicalNotExpression : public Expression {40 class LogicalNotExpression final : public Expression { 41 41 WTF_MAKE_FAST_ALLOCATED; 42 42 public: 43 43 LogicalNotExpression(CodeLocation location, UniqueRef<Expression>&& operand) 44 : Expression(location )44 : Expression(location, Kind::LogicalNot) 45 45 , m_operand(WTFMove(operand)) 46 46 { 47 47 } 48 48 49 virtual~LogicalNotExpression() = default;49 ~LogicalNotExpression() = default; 50 50 51 51 LogicalNotExpression(const LogicalNotExpression&) = delete; 52 52 LogicalNotExpression(LogicalNotExpression&&) = default; 53 54 bool isLogicalNotExpression() const override { return true; }55 53 56 54 Expression& operand() { return m_operand; } … … 66 64 } 67 65 66 DEFINE_DEFAULT_DELETE(LogicalNotExpression) 67 68 68 SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(LogicalNotExpression, isLogicalNotExpression()) 69 69 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h
r248303 r248488 39 39 namespace AST { 40 40 41 class MakeArrayReferenceExpression : public Expression {41 class MakeArrayReferenceExpression final : public Expression { 42 42 WTF_MAKE_FAST_ALLOCATED; 43 43 public: 44 44 MakeArrayReferenceExpression(CodeLocation location, UniqueRef<Expression>&& leftValue, AddressEscapeMode addressEscapeMode) 45 : Expression(location )45 : Expression(location, Kind::MakeArrayReference) 46 46 , m_leftValue(WTFMove(leftValue)) 47 47 , m_addressEscapeMode(addressEscapeMode) … … 49 49 } 50 50 51 virtual~MakeArrayReferenceExpression() = default;51 ~MakeArrayReferenceExpression() = default; 52 52 53 53 MakeArrayReferenceExpression(const MakeArrayReferenceExpression&) = delete; 54 54 MakeArrayReferenceExpression(MakeArrayReferenceExpression&&) = default; 55 56 bool isMakeArrayReferenceExpression() const override { return true; }57 55 58 56 Expression& leftValue() { return m_leftValue; } … … 71 69 } 72 70 71 DEFINE_DEFAULT_DELETE(MakeArrayReferenceExpression) 72 73 73 SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(MakeArrayReferenceExpression, isMakeArrayReferenceExpression()) 74 74 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h
r248303 r248488 39 39 namespace AST { 40 40 41 class MakePointerExpression : public Expression {41 class MakePointerExpression final : public Expression { 42 42 WTF_MAKE_FAST_ALLOCATED; 43 43 public: 44 44 MakePointerExpression(CodeLocation location, UniqueRef<Expression>&& leftValue, AddressEscapeMode addressEscapeMode) 45 : Expression(location )45 : Expression(location, Kind::MakePointer) 46 46 , m_leftValue(WTFMove(leftValue)) 47 47 , m_addressEscapeMode(addressEscapeMode) … … 49 49 } 50 50 51 virtual~MakePointerExpression() = default;51 ~MakePointerExpression() = default; 52 52 53 53 MakePointerExpression(const MakePointerExpression&) = delete; 54 54 MakePointerExpression(MakePointerExpression&&) = default; 55 56 bool isMakePointerExpression() const override { return true; }57 55 58 56 Expression& leftValue() { return m_leftValue; } … … 71 69 } 72 70 71 DEFINE_DEFAULT_DELETE(MakePointerExpression) 72 73 73 SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(MakePointerExpression, isMakePointerExpression()) 74 74 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNamedType.h
r247834 r248488 41 41 class NamedType : public Type { 42 42 WTF_MAKE_FAST_ALLOCATED; 43 44 protected: 45 ~NamedType() = default; 46 43 47 public: 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) 46 51 , m_name(WTFMove(name)) 47 52 { 48 53 } 49 50 virtual ~NamedType() = default;51 54 52 55 NamedType(const NamedType&) = delete; … … 58 61 String& name() { return m_name; } 59 62 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; }68 63 69 64 private: 65 friend class Type; 66 Type& unifyNodeImpl() { return *this; } 70 67 CodeLocation m_codeLocation; 71 68 String m_name; … … 78 75 } 79 76 77 DEFINE_DEFAULT_DELETE(NamedType) 78 80 79 #define SPECIALIZE_TYPE_TRAITS_WHLSL_NAMED_TYPE(ToValueTypeName, predicate) \ 81 80 SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::WHLSL::AST::ToValueTypeName) \ -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNativeTypeDeclaration.h
r247834 r248488 41 41 namespace AST { 42 42 43 class NativeTypeDeclaration : public NamedType {43 class NativeTypeDeclaration final : public NamedType { 44 44 WTF_MAKE_FAST_ALLOCATED; 45 45 public: 46 46 NativeTypeDeclaration(CodeLocation location, String&& name, TypeArguments&& typeArguments) 47 : NamedType( location, WTFMove(name))47 : NamedType(Kind::NativeTypeDeclaration, location, WTFMove(name)) 48 48 , m_typeArguments(WTFMove(typeArguments)) 49 49 { 50 50 } 51 51 52 virtual~NativeTypeDeclaration() = default;52 ~NativeTypeDeclaration() = default; 53 53 54 54 NativeTypeDeclaration(const NativeTypeDeclaration&) = delete; 55 55 NativeTypeDeclaration(NativeTypeDeclaration&&) = default; 56 57 bool isNativeTypeDeclaration() const override { return true; }58 56 59 57 TypeArguments& typeArguments() { return m_typeArguments; } -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h
r247878 r248488 38 38 namespace AST { 39 39 40 class NullLiteral : public Expression {40 class NullLiteral final : public Expression { 41 41 WTF_MAKE_FAST_ALLOCATED; 42 42 public: 43 43 NullLiteral(CodeLocation location) 44 : Expression(location )44 : Expression(location, Kind::NullLiteral) 45 45 { 46 46 } 47 47 48 virtual~NullLiteral() = default;48 ~NullLiteral() = default; 49 49 50 50 NullLiteral(const NullLiteral&) = delete; … … 55 55 56 56 NullLiteralType& type() { return m_type; } 57 58 bool isNullLiteral() const override { return true; }59 57 60 58 NullLiteral clone() const … … 77 75 } 78 76 77 DEFINE_DEFAULT_DELETE(NullLiteral) 78 79 79 SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(NullLiteral, isNullLiteral()) 80 80 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.h
r247813 r248488 37 37 namespace AST { 38 38 39 class NullLiteralType : public ResolvableType {39 class NullLiteralType final : public ResolvableType { 40 40 WTF_MAKE_FAST_ALLOCATED; 41 41 public: 42 NullLiteralType() = default; 42 NullLiteralType() 43 : ResolvableType(Kind::NullLiteral) 44 { } 43 45 44 virtual~NullLiteralType() = default;46 ~NullLiteralType() = default; 45 47 46 48 NullLiteralType(const NullLiteralType&) = delete; … … 50 52 NullLiteralType& operator=(NullLiteralType&&) = default; 51 53 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; 56 56 57 57 private: … … 64 64 } 65 65 66 DEFINE_DEFAULT_DELETE(NullLiteralType) 67 66 68 SPECIALIZE_TYPE_TRAITS_WHLSL_RESOLVABLE_TYPE(NullLiteralType, isNullLiteralType()) 67 69 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLPointerType.h
r248395 r248488 33 33 #include <wtf/Noncopyable.h> 34 34 #include <wtf/UniqueRef.h> 35 #include <wtf/text/StringConcatenate.h> 35 36 #include <wtf/text/WTFString.h> 36 37 … … 47 48 48 49 PointerType(CodeLocation location, AddressSpace addressSpace, Ref<UnnamedType> elementType) 49 : Base(location, addressSpace, WTFMove(elementType), Kind::Pointer Type)50 : Base(location, addressSpace, WTFMove(elementType), Kind::Pointer) 50 51 { 51 52 } … … 54 55 static Ref<PointerType> create(CodeLocation location, AddressSpace addressSpace, Ref<UnnamedType> elementType) 55 56 { 56 return adoptRef(*new PointerType(location, addressSpace, WTFMove(elementType))); 57 auto result = adoptRef(*new PointerType(location, addressSpace, WTFMove(elementType))); 58 return result; 57 59 } 58 60 59 virtual~PointerType() = default;61 ~PointerType() = default; 60 62 61 63 unsigned hash() const … … 69 71 } 70 72 71 String toString() const override73 String toString() const 72 74 { 73 75 return makeString(elementType().toString(), '*'); … … 81 83 } 82 84 85 DEFINE_DEFAULT_DELETE(PointerType) 86 83 87 SPECIALIZE_TYPE_TRAITS_WHLSL_UNNAMED_TYPE(PointerType, isPointerType()) 84 88 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h
r247834 r248488 41 41 class PropertyAccessExpression : public Expression { 42 42 WTF_MAKE_FAST_ALLOCATED; 43 protected: 44 ~PropertyAccessExpression() = default; 45 43 46 public: 44 PropertyAccessExpression(CodeLocation location, UniqueRef<Expression>&& base)45 : Expression(location )47 PropertyAccessExpression(CodeLocation location, Kind kind, UniqueRef<Expression>&& base) 48 : Expression(location, kind) 46 49 , m_base(WTFMove(base)) 47 50 { 48 51 } 49 52 50 virtual ~PropertyAccessExpression() = default;51 52 53 PropertyAccessExpression(const PropertyAccessExpression&) = delete; 53 54 PropertyAccessExpression(PropertyAccessExpression&&) = default; 54 55 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; 60 59 61 60 FunctionDeclaration* getterFunction() { return m_getterFunction; } -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h
r247878 r248488 50 50 * 7. Return the result 51 51 */ 52 class ReadModifyWriteExpression : public Expression {52 class ReadModifyWriteExpression final : public Expression { 53 53 WTF_MAKE_FAST_ALLOCATED; 54 54 public: 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)) 56 60 { 57 return makeUniqueRef<ReadModifyWriteExpression>(location, WTFMove(lValue));58 61 } 59 62 60 virtual ~ReadModifyWriteExpression() = default; 63 64 ~ReadModifyWriteExpression() = default; 61 65 62 66 ReadModifyWriteExpression(const ReadModifyWriteExpression&) = delete; … … 82 86 return makeUniqueRef<VariableReference>(VariableReference::wrap(m_newValue)); 83 87 } 84 85 bool isReadModifyWriteExpression() const override { return true; }86 88 87 89 Expression& leftValue() { return m_leftValue; } … … 115 117 116 118 private: 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 127 119 UniqueRef<Expression> m_leftValue; 128 120 UniqueRef<VariableDeclaration> m_oldValue; … … 138 130 } 139 131 132 DEFINE_DEFAULT_DELETE(ReadModifyWriteExpression) 133 140 134 SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(ReadModifyWriteExpression, isReadModifyWriteExpression()) 141 135 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReferenceType.h
r248395 r248488 44 44 WTF_MAKE_FAST_ALLOCATED; 45 45 WTF_MAKE_NONCOPYABLE(ReferenceType); 46 47 protected: 48 ~ReferenceType() = default; 49 46 50 protected: 47 51 ReferenceType(CodeLocation location, AddressSpace addressSpace, Ref<UnnamedType> elementType, Kind kind) … … 51 55 { 52 56 } 57 58 53 59 public: 54 virtual ~ReferenceType() = default;55 56 60 AddressSpace addressSpace() const { return m_addressSpace; } 57 61 const UnnamedType& elementType() const { return m_elementType; } … … 74 78 } 75 79 80 DEFINE_DEFAULT_DELETE(ReferenceType) 81 76 82 SPECIALIZE_TYPE_TRAITS_WHLSL_UNNAMED_TYPE(ReferenceType, isReferenceType()) 77 83 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReplaceWith.h
r247105 r248488 39 39 static_assert(sizeof(New) <= sizeof(Old), "This is needed for the placement new below to not overwrite unowned memory."); 40 40 void* location = &old; 41 old.~Old();41 Old::destruct(old); 42 42 return new (location) New(std::forward<Args>(args)...); 43 43 } -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h
r247878 r248488 41 41 class ResolvableType : public Type { 42 42 WTF_MAKE_FAST_ALLOCATED; 43 44 protected: 45 ~ResolvableType() = default; 46 43 47 public: 44 ResolvableType() = default; 48 ResolvableType(Kind kind) 49 : Type(kind) 50 { } 45 51 46 virtual ~ResolvableType() = default;47 52 48 53 ResolvableType(const ResolvableType&) = delete; … … 52 57 ResolvableType& operator=(ResolvableType&&) = default; 53 58 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; 62 61 63 62 const UnnamedType* maybeResolvedType() const { return m_resolvedType ? &*m_resolvedType : nullptr; } … … 90 89 } 91 90 91 DEFINE_DEFAULT_DELETE(ResolvableType) 92 92 93 #define SPECIALIZE_TYPE_TRAITS_WHLSL_RESOLVABLE_TYPE(ToValueTypeName, predicate) \ 93 94 SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::WHLSL::AST::ToValueTypeName) \ -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReturn.h
r247834 r248488 40 40 namespace AST { 41 41 42 class Return : public Statement {42 class Return final : public Statement { 43 43 WTF_MAKE_FAST_ALLOCATED; 44 44 public: 45 45 Return(CodeLocation location, std::unique_ptr<Expression>&& value) 46 : Statement(location )46 : Statement(location, Kind::Return) 47 47 , m_value(WTFMove(value)) 48 48 { 49 49 } 50 50 51 virtual~Return() = default;51 ~Return() = default; 52 52 53 53 Return(const Return&) = delete; 54 54 Return(Return&&) = default; 55 56 bool isReturn() const override { return true; }57 55 58 56 Expression* value() { return m_value.get(); } … … 68 66 } 69 67 68 DEFINE_DEFAULT_DELETE(Return) 69 70 70 SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(Return, isReturn()) 71 71 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStatement.h
r247834 r248488 29 29 30 30 #include "WHLSLCodeLocation.h" 31 #include "WHLSLDefaultDelete.h" 31 32 #include <wtf/FastMalloc.h> 32 33 #include <wtf/UniqueRef.h> … … 40 41 class Statement { 41 42 WTF_MAKE_FAST_ALLOCATED; 43 44 protected: 45 ~Statement() = default; 46 42 47 public: 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) 44 65 : m_codeLocation(codeLocation) 66 , m_kind(kind) 45 67 { 46 68 } 47 69 48 virtual ~Statement() = default; 70 static void destroy(Statement&); 71 static void destruct(Statement&); 49 72 50 73 Statement(const Statement&) = delete; 51 74 Statement(Statement&&) = default; 52 75 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; } 67 92 68 93 CodeLocation codeLocation() const { return m_codeLocation; } … … 71 96 private: 72 97 CodeLocation m_codeLocation; 98 Kind m_kind; 73 99 }; 74 100 75 101 using Statements = Vector<UniqueRef<Statement>>; 76 102 77 } // namespace AST103 } 78 104 79 105 } 80 106 81 107 } 108 109 DEFINE_DEFAULT_DELETE(Statement) 82 110 83 111 #define SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(ToValueTypeName, predicate) \ -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStatementList.h
r247834 r248488 39 39 namespace AST { 40 40 41 class StatementList : public Statement {41 class StatementList final : public Statement { 42 42 WTF_MAKE_FAST_ALLOCATED; 43 43 using Base = Statement; 44 44 public: 45 45 StatementList(CodeLocation location, Statements&& statements) 46 : Base(location )46 : Base(location, Kind::StatementList) 47 47 , m_statements(WTFMove(statements)) 48 48 { } 49 49 50 virtual~StatementList() = default;50 ~StatementList() = default; 51 51 52 52 Statements& statements() { return m_statements; } 53 54 bool isStatementList() const override { return true; }55 53 56 54 private: … … 64 62 } 65 63 64 DEFINE_DEFAULT_DELETE(StatementList) 65 66 66 SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(StatementList, isStatementList()) 67 67 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h
r247834 r248488 41 41 namespace AST { 42 42 43 class StructureDefinition : public NamedType {43 class StructureDefinition final : public NamedType { 44 44 WTF_MAKE_FAST_ALLOCATED; 45 45 public: 46 46 StructureDefinition(CodeLocation location, String&& name, StructureElements&& structureElements) 47 : NamedType( location, WTFMove(name))47 : NamedType(Kind::StructureDefinition, location, WTFMove(name)) 48 48 , m_structureElements(WTFMove(structureElements)) 49 49 { 50 50 } 51 51 52 virtual~StructureDefinition() = default;52 ~StructureDefinition() = default; 53 53 54 54 StructureDefinition(const StructureDefinition&) = delete; 55 55 StructureDefinition(StructureDefinition&&) = default; 56 57 bool isStructureDefinition() const override { return true; }58 56 59 57 StructureElements& structureElements() { return m_structureElements; } … … 78 76 } 79 77 78 DEFINE_DEFAULT_DELETE(StructureDefinition) 79 80 80 SPECIALIZE_TYPE_TRAITS_WHLSL_NAMED_TYPE(StructureDefinition, isStructureDefinition()) 81 81 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h
r247878 r248488 41 41 namespace AST { 42 42 43 class StructureElement {43 class StructureElement final { 44 44 WTF_MAKE_FAST_ALLOCATED; 45 45 public: … … 53 53 } 54 54 55 virtual~StructureElement() = default;55 ~StructureElement() = default; 56 56 57 57 StructureElement(const StructureElement&) = delete; -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLSwitchCase.h
r247834 r248488 41 41 namespace AST { 42 42 43 class SwitchCase : public Statement {43 class SwitchCase final : public Statement { 44 44 WTF_MAKE_FAST_ALLOCATED; 45 45 public: 46 46 SwitchCase(CodeLocation location, Optional<ConstantExpression>&& value, Block&& block) 47 : Statement(location )47 : Statement(location, Kind::SwitchCase) 48 48 , m_value(WTFMove(value)) 49 49 , m_block(WTFMove(block)) … … 51 51 } 52 52 53 virtual~SwitchCase() = default;53 ~SwitchCase() = default; 54 54 55 55 SwitchCase(const SwitchCase&) = delete; 56 56 SwitchCase(SwitchCase&&) = default; 57 58 bool isSwitchCase() const override { return true; }59 57 60 58 Optional<ConstantExpression>& value() { return m_value; } … … 72 70 } 73 71 72 DEFINE_DEFAULT_DELETE(SwitchCase) 73 74 74 SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(SwitchCase, isSwitchCase()) 75 75 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLSwitchStatement.h
r247834 r248488 40 40 namespace AST { 41 41 42 class SwitchStatement : public Statement {42 class SwitchStatement final : public Statement { 43 43 WTF_MAKE_FAST_ALLOCATED; 44 44 public: 45 45 SwitchStatement(CodeLocation location, UniqueRef<Expression>&& value, Vector<SwitchCase>&& switchCases) 46 : Statement(location )46 : Statement(location, Kind::Switch) 47 47 , m_value(WTFMove(value)) 48 48 , m_switchCases(WTFMove(switchCases)) … … 50 50 } 51 51 52 virtual~SwitchStatement() = default;52 ~SwitchStatement() = default; 53 53 54 54 SwitchStatement(const SwitchStatement&) = delete; 55 55 SwitchStatement(SwitchStatement&&) = default; 56 57 bool isSwitchStatement() const override { return true; }58 56 59 57 Expression& value() { return m_value; } … … 71 69 } 72 70 71 DEFINE_DEFAULT_DELETE(SwitchStatement) 72 73 73 SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(SwitchStatement, isSwitchStatement()) 74 74 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLTernaryExpression.h
r247834 r248488 38 38 namespace AST { 39 39 40 class TernaryExpression : public Expression {40 class TernaryExpression final : public Expression { 41 41 WTF_MAKE_FAST_ALLOCATED; 42 42 public: 43 43 TernaryExpression(CodeLocation location, UniqueRef<Expression>&& predicate, UniqueRef<Expression>&& bodyExpression, UniqueRef<Expression>&& elseExpression) 44 : Expression(location )44 : Expression(location, Kind::Ternary) 45 45 , m_predicate(WTFMove(predicate)) 46 46 , m_bodyExpression(WTFMove(bodyExpression)) … … 49 49 } 50 50 51 virtual~TernaryExpression() = default;51 ~TernaryExpression() = default; 52 52 53 53 TernaryExpression(const TernaryExpression&) = delete; 54 54 TernaryExpression(TernaryExpression&&) = default; 55 56 bool isTernaryExpression() const override { return true; }57 55 58 56 Expression& predicate() { return m_predicate; } … … 72 70 } 73 71 72 DEFINE_DEFAULT_DELETE(TernaryExpression) 73 74 74 SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(TernaryExpression, isTernaryExpression()) 75 75 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLType.h
r247813 r248488 28 28 #if ENABLE(WEBGPU) 29 29 30 #include "WHLSLDefaultDelete.h" 30 31 #include <wtf/FastMalloc.h> 31 32 #include <wtf/TypeCasts.h> … … 39 40 class Type { 40 41 WTF_MAKE_FAST_ALLOCATED; 42 43 protected: 44 ~Type() = default; 45 41 46 public: 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 }; 43 64 44 virtual ~Type() = default; 65 Type(Kind kind) 66 : m_kind(kind) 67 { } 68 static void destroy(Type&); 69 static void destruct(Type&); 45 70 46 71 explicit Type(const Type&) = delete; … … 50 75 Type& operator=(Type&&) = default; 51 76 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 } 55 104 56 105 private: 106 Kind m_kind; 57 107 }; 58 108 … … 63 113 } 64 114 115 DEFINE_DEFAULT_DELETE(Type) 116 65 117 #define SPECIALIZE_TYPE_TRAITS_WHLSL_TYPE(ToValueTypeName, predicate) \ 66 118 SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::WHLSL::AST::ToValueTypeName) \ -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLTypeDefinition.h
r247878 r248488 41 41 namespace AST { 42 42 43 class TypeDefinition : public NamedType {43 class TypeDefinition final : public NamedType { 44 44 WTF_MAKE_FAST_ALLOCATED; 45 45 public: 46 46 TypeDefinition(CodeLocation location, String&& name, Ref<UnnamedType> type) 47 : NamedType( location, WTFMove(name))47 : NamedType(Kind::TypeDefinition, location, WTFMove(name)) 48 48 , m_type(WTFMove(type)) 49 49 { 50 50 } 51 51 52 virtual~TypeDefinition() = default;52 ~TypeDefinition() = default; 53 53 54 54 TypeDefinition(const TypeDefinition&) = delete; 55 55 TypeDefinition(TypeDefinition&&) = default; 56 56 57 bool isTypeDefinition() const override { return true; }58 59 57 UnnamedType& type() { return m_type; } 60 58 61 const Type& unifyNode() const override 59 private: 60 friend class Type; 61 Type& unifyNodeImpl() 62 62 { 63 63 return m_type->unifyNode(); 64 64 } 65 65 66 Type& unifyNode() override67 {68 return m_type->unifyNode();69 }70 71 private:72 66 Ref<UnnamedType> m_type; 73 67 }; … … 79 73 } 80 74 75 DEFINE_DEFAULT_DELETE(TypeDefinition) 76 81 77 SPECIALIZE_TYPE_TRAITS_WHLSL_NAMED_TYPE(TypeDefinition, isTypeDefinition()) 82 78 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h
r248395 r248488 60 60 } 61 61 62 virtual~TypeReference() = default;62 ~TypeReference() = default; 63 63 64 64 static Ref<TypeReference> wrap(CodeLocation, NamedType& resolvedType); … … 71 71 ASSERT(m_resolvedType); 72 72 return *m_resolvedType; 73 }74 75 const Type& unifyNode() const override76 {77 ASSERT(m_resolvedType);78 return m_resolvedType->unifyNode();79 }80 81 Type& unifyNode() override82 {83 ASSERT(m_resolvedType);84 return m_resolvedType->unifyNode();85 73 } 86 74 … … 104 92 } 105 93 106 String toString() const override94 String toString() const 107 95 { 108 96 ASSERT(m_resolvedType); … … 111 99 112 100 private: 101 friend class Type; 102 Type& unifyNodeImpl() 103 { 104 ASSERT(m_resolvedType); 105 return m_resolvedType->unifyNode(); 106 } 107 113 108 String m_name; 114 109 TypeArguments m_typeArguments; … … 122 117 } 123 118 119 DEFINE_DEFAULT_DELETE(TypeReference) 120 124 121 SPECIALIZE_TYPE_TRAITS_WHLSL_UNNAMED_TYPE(TypeReference, isTypeReference()) 125 122 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.cpp
r248395 r248488 42 42 unsigned UnnamedType::hash() const 43 43 { 44 switch ( m_kind) {44 switch (kind()) { 45 45 case Kind::TypeReference: 46 46 return downcast<TypeReference>(*this).hash(); 47 case Kind::Pointer Type:47 case Kind::Pointer: 48 48 return downcast<PointerType>(*this).hash(); 49 case Kind::ArrayReference Type:49 case Kind::ArrayReference: 50 50 return downcast<ArrayReferenceType>(*this).hash(); 51 case Kind::Array Type:51 case Kind::Array: 52 52 return downcast<ArrayType>(*this).hash(); 53 default: 54 RELEASE_ASSERT_NOT_REACHED(); 53 55 } 54 56 } … … 56 58 bool UnnamedType::operator==(const UnnamedType& other) const 57 59 { 58 if (other. m_kind != m_kind)60 if (other.kind() != kind()) 59 61 return false; 60 62 61 switch ( m_kind) {63 switch (kind()) { 62 64 case Kind::TypeReference: 63 65 return downcast<TypeReference>(*this) == downcast<TypeReference>(other); 64 case Kind::Pointer Type:66 case Kind::Pointer: 65 67 return downcast<PointerType>(*this) == downcast<PointerType>(other); 66 case Kind::ArrayReference Type:68 case Kind::ArrayReference: 67 69 return downcast<ArrayReferenceType>(*this) == downcast<ArrayReferenceType>(other); 68 case Kind::Array Type:70 case Kind::Array: 69 71 return downcast<ArrayType>(*this) == downcast<ArrayType>(other); 72 default: 73 RELEASE_ASSERT_NOT_REACHED(); 70 74 } 71 75 } -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.h
r248395 r248488 46 46 WTF_MAKE_NONCOPYABLE(UnnamedType); 47 47 public: 48 enum class Kind {49 TypeReference,50 PointerType,51 ArrayReferenceType,52 ArrayType53 };54 55 48 UnnamedType(CodeLocation location, Kind kind) 56 : m_codeLocation(location)57 , m_ kind(kind)49 : Type(kind) 50 , m_codeLocation(location) 58 51 { 59 52 } 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; }74 53 75 54 unsigned hash() const; 76 55 bool operator==(const UnnamedType&) const; 77 56 78 virtual String toString() const = 0;57 String toString() const; 79 58 80 const CodeLocation&codeLocation() const { return m_codeLocation; }59 CodeLocation codeLocation() const { return m_codeLocation; } 81 60 82 61 private: 62 friend class Type; 63 Type& unifyNodeImpl() { return *this; } 83 64 CodeLocation m_codeLocation; 84 Kind m_kind;85 65 }; 86 66 … … 90 70 91 71 } 72 73 DEFINE_DEFAULT_DELETE(UnnamedType) 92 74 93 75 #define SPECIALIZE_TYPE_TRAITS_WHLSL_UNNAMED_TYPE(ToValueTypeName, predicate) \ -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h
r247878 r248488 38 38 namespace AST { 39 39 40 class UnsignedIntegerLiteral : public Expression {40 class UnsignedIntegerLiteral final : public Expression { 41 41 WTF_MAKE_FAST_ALLOCATED; 42 42 public: 43 43 UnsignedIntegerLiteral(CodeLocation location, unsigned value) 44 : Expression(location )44 : Expression(location, Kind::UnsignedIntegerLiteral) 45 45 , m_type(location, value) 46 46 , m_value(value) … … 48 48 } 49 49 50 virtual~UnsignedIntegerLiteral() = default;50 ~UnsignedIntegerLiteral() = default; 51 51 52 52 UnsignedIntegerLiteral(const UnsignedIntegerLiteral&) = delete; … … 58 58 UnsignedIntegerLiteralType& type() { return m_type; } 59 59 unsigned value() const { return m_value; } 60 61 bool isUnsignedIntegerLiteral() const override { return true; }62 60 63 61 UnsignedIntegerLiteral clone() const … … 84 82 } 85 83 84 DEFINE_DEFAULT_DELETE(UnsignedIntegerLiteral) 85 86 86 SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(UnsignedIntegerLiteral, isUnsignedIntegerLiteral()) 87 87 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp
r247878 r248488 42 42 43 43 UnsignedIntegerLiteralType::UnsignedIntegerLiteralType(CodeLocation location, unsigned value) 44 : m_value(value) 44 : ResolvableType(Kind::UnsignedIntegerLiteral) 45 , m_value(value) 45 46 , m_preferredType(TypeReference::create(location, "uint"_str, TypeArguments())) 46 47 { 47 48 } 48 49 UnsignedIntegerLiteralType::~UnsignedIntegerLiteralType() = default;50 51 UnsignedIntegerLiteralType::UnsignedIntegerLiteralType(UnsignedIntegerLiteralType&&) = default;52 53 UnsignedIntegerLiteralType& UnsignedIntegerLiteralType::operator=(UnsignedIntegerLiteralType&&) = default;54 49 55 50 bool UnsignedIntegerLiteralType::canResolve(const Type& type) const -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.h
r247878 r248488 41 41 class TypeReference; 42 42 43 class UnsignedIntegerLiteralType : public ResolvableType {43 class UnsignedIntegerLiteralType final : public ResolvableType { 44 44 WTF_MAKE_FAST_ALLOCATED; 45 45 public: 46 46 UnsignedIntegerLiteralType(CodeLocation, unsigned value); 47 47 48 virtual ~UnsignedIntegerLiteralType();48 ~UnsignedIntegerLiteralType() = default; 49 49 50 50 UnsignedIntegerLiteralType(const UnsignedIntegerLiteralType&) = delete; 51 UnsignedIntegerLiteralType(UnsignedIntegerLiteralType&&) ;51 UnsignedIntegerLiteralType(UnsignedIntegerLiteralType&&) = default; 52 52 53 53 UnsignedIntegerLiteralType& operator=(const UnsignedIntegerLiteralType&) = delete; 54 UnsignedIntegerLiteralType& operator=(UnsignedIntegerLiteralType&&); 55 56 bool isUnsignedIntegerLiteralType() const override { return true; } 54 UnsignedIntegerLiteralType& operator=(UnsignedIntegerLiteralType&&) = default; 57 55 58 56 unsigned value() const { return m_value; } … … 60 58 TypeReference& preferredType() { return m_preferredType; } 61 59 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; 64 62 65 63 UnsignedIntegerLiteralType clone() const; … … 78 76 } 79 77 78 DEFINE_DEFAULT_DELETE(UnsignedIntegerLiteralType) 79 80 80 SPECIALIZE_TYPE_TRAITS_WHLSL_RESOLVABLE_TYPE(UnsignedIntegerLiteralType, isUnsignedIntegerLiteralType()) 81 81 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h
r247834 r248488 40 40 namespace AST { 41 41 42 class VariableDeclarationsStatement : public Statement {42 class VariableDeclarationsStatement final : public Statement { 43 43 WTF_MAKE_FAST_ALLOCATED; 44 44 public: 45 45 VariableDeclarationsStatement(CodeLocation location, VariableDeclarations&& variableDeclarations) 46 : Statement(location )46 : Statement(location, Kind::VariableDeclarations) 47 47 , m_variableDeclarations(WTFMove(variableDeclarations)) 48 48 { 49 49 } 50 50 51 virtual~VariableDeclarationsStatement() = default;51 ~VariableDeclarationsStatement() = default; 52 52 53 53 VariableDeclarationsStatement(const VariableDeclarationsStatement&) = delete; 54 54 VariableDeclarationsStatement(VariableDeclarationsStatement&&) = default; 55 56 bool isVariableDeclarationsStatement() const override { return true; }57 55 58 56 Vector<UniqueRef<VariableDeclaration>>& variableDeclarations() { return m_variableDeclarations; } … … 68 66 } 69 67 68 DEFINE_DEFAULT_DELETE(VariableDeclarationsStatement) 69 70 70 SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(VariableDeclarationsStatement, isVariableDeclarationsStatement()) 71 71 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h
r247834 r248488 39 39 namespace AST { 40 40 41 class VariableReference : public Expression {41 class VariableReference final : public Expression { 42 42 WTF_MAKE_FAST_ALLOCATED; 43 43 public: 44 44 VariableReference(CodeLocation location, String&& name) 45 : Expression(location )45 : Expression(location, Kind::VariableReference) 46 46 , m_name(WTFMove(name)) 47 47 { 48 48 } 49 49 50 virtual~VariableReference() = default;50 ~VariableReference() = default; 51 51 52 52 VariableReference(const VariableReference&) = delete; … … 61 61 } 62 62 63 bool isVariableReference() const override { return true; }64 65 63 String& name() { return m_name; } 66 64 … … 74 72 private: 75 73 VariableReference(CodeLocation location) 76 : Expression(location )74 : Expression(location, Kind::VariableReference) 77 75 { 78 76 } … … 88 86 } 89 87 88 DEFINE_DEFAULT_DELETE(VariableReference) 89 90 90 SPECIALIZE_TYPE_TRAITS_WHLSL_EXPRESSION(VariableReference, isVariableReference()) 91 91 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLWhileLoop.h
r247834 r248488 39 39 namespace AST { 40 40 41 class WhileLoop : public Statement {41 class WhileLoop final : public Statement { 42 42 WTF_MAKE_FAST_ALLOCATED; 43 43 public: 44 44 WhileLoop(CodeLocation location, UniqueRef<Expression>&& conditional, UniqueRef<Statement>&& body) 45 : Statement(location )45 : Statement(location, Kind::WhileLoop) 46 46 , m_conditional(WTFMove(conditional)) 47 47 , m_body(WTFMove(body)) … … 49 49 } 50 50 51 virtual~WhileLoop() = default;51 ~WhileLoop() = default; 52 52 53 53 WhileLoop(const WhileLoop&) = delete; 54 54 WhileLoop(WhileLoop&&) = default; 55 56 bool isWhileLoop() const override { return true; }57 55 58 56 Expression& conditional() { return m_conditional; } … … 70 68 } 71 69 70 DEFINE_DEFAULT_DELETE(WhileLoop) 71 72 72 SPECIALIZE_TYPE_TRAITS_WHLSL_STATEMENT(WhileLoop, isWhileLoop()) 73 73 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp
r248395 r248488 73 73 AST::UnnamedType::Kind kind() { return m_kind; } 74 74 bool isReferenceTypeNameNode() const { return m_kind == AST::UnnamedType::Kind::TypeReference; } 75 bool isPointerTypeNameNode() const { return m_kind == AST::UnnamedType::Kind::Pointer Type; }76 bool isArrayReferenceTypeNameNode() const { return m_kind == AST::UnnamedType::Kind::ArrayReference Type; }77 bool isArrayTypeNameNode() const { return m_kind == AST::UnnamedType::Kind::Array Type; }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; } 78 78 79 79 BaseTypeNameNode* parent() { return m_parent; } … … 90 90 public: 91 91 ArrayTypeNameNode(BaseTypeNameNode* parent, MangledTypeName&& mangledName, unsigned numElements) 92 : BaseTypeNameNode(parent, WTFMove(mangledName), AST::UnnamedType::Kind::Array Type)92 : BaseTypeNameNode(parent, WTFMove(mangledName), AST::UnnamedType::Kind::Array) 93 93 , m_numElements(numElements) 94 94 { … … 105 105 public: 106 106 ArrayReferenceTypeNameNode(BaseTypeNameNode* parent, MangledTypeName&& mangledName, AST::AddressSpace addressSpace) 107 : BaseTypeNameNode(parent, WTFMove(mangledName), AST::UnnamedType::Kind::ArrayReference Type)107 : BaseTypeNameNode(parent, WTFMove(mangledName), AST::UnnamedType::Kind::ArrayReference) 108 108 , m_addressSpace(addressSpace) 109 109 { … … 120 120 public: 121 121 PointerTypeNameNode(BaseTypeNameNode* parent, MangledTypeName&& mangledName, AST::AddressSpace addressSpace) 122 : BaseTypeNameNode(parent, WTFMove(mangledName), AST::UnnamedType::Kind::Pointer Type)122 : BaseTypeNameNode(parent, WTFMove(mangledName), AST::UnnamedType::Kind::Pointer) 123 123 , m_addressSpace(addressSpace) 124 124 { … … 275 275 return std::make_unique<ReferenceTypeNameNode>(parent, generateNextTypeName(), typeReference.resolvedType()); 276 276 } 277 case AST::UnnamedType::Kind::Pointer Type: {277 case AST::UnnamedType::Kind::Pointer: { 278 278 auto& pointerType = downcast<AST::PointerType>(unnamedType); 279 279 return std::make_unique<PointerTypeNameNode>(parent, generateNextTypeName(), pointerType.addressSpace()); 280 280 } 281 case AST::UnnamedType::Kind::ArrayReference Type: {281 case AST::UnnamedType::Kind::ArrayReference: { 282 282 auto& arrayReferenceType = downcast<AST::ArrayReferenceType>(unnamedType); 283 283 return std::make_unique<ArrayReferenceTypeNameNode>(parent, generateNextTypeName(), arrayReferenceType.addressSpace()); 284 284 } 285 case AST::UnnamedType::Kind::Array Type: {285 case AST::UnnamedType::Kind::Array: { 286 286 auto& arrayType = downcast<AST::ArrayType>(unnamedType); 287 287 return std::make_unique<ArrayTypeNameNode>(parent, generateNextTypeName(), arrayType.numElements()); 288 288 } 289 default: 290 RELEASE_ASSERT_NOT_REACHED(); 289 291 } 290 292 } … … 295 297 case AST::UnnamedType::Kind::TypeReference: 296 298 return nullptr; 297 case AST::UnnamedType::Kind::Pointer Type:299 case AST::UnnamedType::Kind::Pointer: 298 300 return &downcast<AST::PointerType>(unnamedType).elementType(); 299 case AST::UnnamedType::Kind::ArrayReference Type:301 case AST::UnnamedType::Kind::ArrayReference: 300 302 return &downcast<AST::ArrayReferenceType>(unnamedType).elementType(); 301 case AST::UnnamedType::Kind::Array Type:303 case AST::UnnamedType::Kind::Array: 302 304 return &downcast<AST::ArrayType>(unnamedType).type(); 305 default: 306 RELEASE_ASSERT_NOT_REACHED(); 303 307 } 304 308 } … … 362 366 break; 363 367 } 364 case AST::UnnamedType::Kind::Pointer Type: {368 case AST::UnnamedType::Kind::Pointer: { 365 369 auto& pointerType = downcast<PointerTypeNameNode>(baseTypeNameNode); 366 370 ASSERT(baseTypeNameNode.parent()); … … 368 372 break; 369 373 } 370 case AST::UnnamedType::Kind::ArrayReference Type: {374 case AST::UnnamedType::Kind::ArrayReference: { 371 375 auto& arrayReferenceType = downcast<ArrayReferenceTypeNameNode>(baseTypeNameNode); 372 376 ASSERT(baseTypeNameNode.parent()); … … 379 383 break; 380 384 } 381 case AST::UnnamedType::Kind::Array Type: {385 case AST::UnnamedType::Kind::Array: { 382 386 auto& arrayType = downcast<ArrayTypeNameNode>(baseTypeNameNode); 383 387 ASSERT(baseTypeNameNode.parent()); … … 385 389 break; 386 390 } 391 default: 392 RELEASE_ASSERT_NOT_REACHED(); 387 393 } 388 394 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp
r248307 r248488 1495 1495 case Token::Type::PlusPlus: { 1496 1496 CodeLocation location(previous->codeLocation(), *suffix); 1497 auto result = AST::ReadModifyWriteExpression::create(location, WTFMove(previous));1497 auto result = makeUniqueRef<AST::ReadModifyWriteExpression>(location, WTFMove(previous)); 1498 1498 Vector<UniqueRef<AST::Expression>> callArguments; 1499 1499 callArguments.append(result->oldVariableReference()); … … 1505 1505 ASSERT(suffix->type == Token::Type::MinusMinus); 1506 1506 CodeLocation location(previous->codeLocation(), *suffix); 1507 auto result = AST::ReadModifyWriteExpression::create(location, WTFMove(previous));1507 auto result = makeUniqueRef<AST::ReadModifyWriteExpression>(location, WTFMove(previous)); 1508 1508 Vector<UniqueRef<AST::Expression>> callArguments; 1509 1509 callArguments.append(result->oldVariableReference()); … … 1607 1607 } 1608 1608 1609 auto result = AST::ReadModifyWriteExpression::create(location, WTFMove(left));1609 auto result = makeUniqueRef<AST::ReadModifyWriteExpression>(location, WTFMove(left)); 1610 1610 Vector<UniqueRef<AST::Expression>> callArguments; 1611 1611 callArguments.append(result->oldVariableReference()); … … 1899 1899 if (isEffectful) 1900 1900 *isEffectful = true; 1901 auto result = AST::ReadModifyWriteExpression::create(location, WTFMove(*next));1901 auto result = makeUniqueRef<AST::ReadModifyWriteExpression>(location, WTFMove(*next)); 1902 1902 Vector<UniqueRef<AST::Expression>> callArguments; 1903 1903 callArguments.append(result->oldVariableReference()); … … 1909 1909 if (isEffectful) 1910 1910 *isEffectful = true; 1911 auto result = AST::ReadModifyWriteExpression::create(location, WTFMove(*next));1911 auto result = makeUniqueRef<AST::ReadModifyWriteExpression>(location, WTFMove(*next)); 1912 1912 Vector<UniqueRef<AST::Expression>> callArguments; 1913 1913 callArguments.append(result->oldVariableReference()); -
trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp
r248382 r248488 158 158 auto structDeclarationStatement = makeUniqueRef<AST::VariableDeclarationsStatement>(functionDefinition.codeLocation(), WTFMove(structVariableDeclarations)); 159 159 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)); 161 161 makePointerExpression->setType(m_pointerToStructType.copyRef()); 162 162 makePointerExpression->setTypeAnnotation(AST::RightValue()); -
trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLVisitor.cpp
r247878 r248488 304 304 void Visitor::visit(AST::Statement& statement) 305 305 { 306 if (is<AST::Block>(statement)) 306 switch (statement.kind()) { 307 case AST::Statement::Kind::Block: 307 308 checkErrorAndVisit(downcast<AST::Block>(statement)); 308 else if (is<AST::Break>(statement)) 309 break; 310 case AST::Statement::Kind::Break: 309 311 checkErrorAndVisit(downcast<AST::Break>(statement)); 310 else if (is<AST::Continue>(statement)) 312 break; 313 case AST::Statement::Kind::Continue: 311 314 checkErrorAndVisit(downcast<AST::Continue>(statement)); 312 else if (is<AST::DoWhileLoop>(statement)) 315 break; 316 case AST::Statement::Kind::DoWhileLoop: 313 317 checkErrorAndVisit(downcast<AST::DoWhileLoop>(statement)); 314 else if (is<AST::EffectfulExpressionStatement>(statement)) 318 break; 319 case AST::Statement::Kind::EffectfulExpression: 315 320 checkErrorAndVisit(downcast<AST::EffectfulExpressionStatement>(statement)); 316 else if (is<AST::Fallthrough>(statement)) 321 break; 322 case AST::Statement::Kind::Fallthrough: 317 323 checkErrorAndVisit(downcast<AST::Fallthrough>(statement)); 318 else if (is<AST::ForLoop>(statement)) 324 break; 325 case AST::Statement::Kind::ForLoop: 319 326 checkErrorAndVisit(downcast<AST::ForLoop>(statement)); 320 else if (is<AST::IfStatement>(statement)) 327 break; 328 case AST::Statement::Kind::If: 321 329 checkErrorAndVisit(downcast<AST::IfStatement>(statement)); 322 else if (is<AST::Return>(statement)) 330 break; 331 case AST::Statement::Kind::Return: 323 332 checkErrorAndVisit(downcast<AST::Return>(statement)); 324 else if (is<AST::StatementList>(statement)) 333 break; 334 case AST::Statement::Kind::StatementList: 325 335 checkErrorAndVisit(downcast<AST::StatementList>(statement)); 326 else if (is<AST::SwitchCase>(statement)) 336 break; 337 case AST::Statement::Kind::SwitchCase: 327 338 checkErrorAndVisit(downcast<AST::SwitchCase>(statement)); 328 else if (is<AST::SwitchStatement>(statement)) 339 break; 340 case AST::Statement::Kind::Switch: 329 341 checkErrorAndVisit(downcast<AST::SwitchStatement>(statement)); 330 else if (is<AST::VariableDeclarationsStatement>(statement)) 342 break; 343 case AST::Statement::Kind::VariableDeclarations: 331 344 checkErrorAndVisit(downcast<AST::VariableDeclarationsStatement>(statement)); 332 else 345 break; 346 case AST::Statement::Kind::WhileLoop: 333 347 checkErrorAndVisit(downcast<AST::WhileLoop>(statement)); 348 break; 349 } 334 350 } 335 351 … … 350 366 void Visitor::visit(AST::Expression& expression) 351 367 { 352 if (is<AST::AssignmentExpression>(expression)) 368 switch (expression.kind()) { 369 case AST::Expression::Kind::Assignment: 353 370 checkErrorAndVisit(downcast<AST::AssignmentExpression>(expression)); 354 else if (is<AST::BooleanLiteral>(expression)) 371 break; 372 case AST::Expression::Kind::BooleanLiteral: 355 373 checkErrorAndVisit(downcast<AST::BooleanLiteral>(expression)); 356 else if (is<AST::CallExpression>(expression)) 374 break; 375 case AST::Expression::Kind::Call: 357 376 checkErrorAndVisit(downcast<AST::CallExpression>(expression)); 358 else if (is<AST::CommaExpression>(expression)) 377 break; 378 case AST::Expression::Kind::Comma: 359 379 checkErrorAndVisit(downcast<AST::CommaExpression>(expression)); 360 else if (is<AST::DereferenceExpression>(expression)) 380 break; 381 case AST::Expression::Kind::Dereference: 361 382 checkErrorAndVisit(downcast<AST::DereferenceExpression>(expression)); 362 else if (is<AST::FloatLiteral>(expression)) 383 break; 384 case AST::Expression::Kind::FloatLiteral: 363 385 checkErrorAndVisit(downcast<AST::FloatLiteral>(expression)); 364 else if (is<AST::IntegerLiteral>(expression)) 386 break; 387 case AST::Expression::Kind::IntegerLiteral: 365 388 checkErrorAndVisit(downcast<AST::IntegerLiteral>(expression)); 366 else if (is<AST::LogicalExpression>(expression)) 389 break; 390 case AST::Expression::Kind::Logical: 367 391 checkErrorAndVisit(downcast<AST::LogicalExpression>(expression)); 368 else if (is<AST::LogicalNotExpression>(expression)) 392 break; 393 case AST::Expression::Kind::LogicalNot: 369 394 checkErrorAndVisit(downcast<AST::LogicalNotExpression>(expression)); 370 else if (is<AST::MakeArrayReferenceExpression>(expression)) 395 break; 396 case AST::Expression::Kind::MakeArrayReference: 371 397 checkErrorAndVisit(downcast<AST::MakeArrayReferenceExpression>(expression)); 372 else if (is<AST::MakePointerExpression>(expression)) 398 break; 399 case AST::Expression::Kind::MakePointer: 373 400 checkErrorAndVisit(downcast<AST::MakePointerExpression>(expression)); 374 else if (is<AST::NullLiteral>(expression)) 401 break; 402 case AST::Expression::Kind::NullLiteral: 375 403 checkErrorAndVisit(downcast<AST::NullLiteral>(expression)); 376 else if (is<AST::DotExpression>(expression)) 404 break; 405 case AST::Expression::Kind::Dot: 377 406 checkErrorAndVisit(downcast<AST::DotExpression>(expression)); 378 else if (is<AST::GlobalVariableReference>(expression)) 407 break; 408 case AST::Expression::Kind::GlobalVariableReference: 379 409 checkErrorAndVisit(downcast<AST::GlobalVariableReference>(expression)); 380 else if (is<AST::IndexExpression>(expression)) 410 break; 411 case AST::Expression::Kind::Index: 381 412 checkErrorAndVisit(downcast<AST::IndexExpression>(expression)); 382 else if (is<AST::ReadModifyWriteExpression>(expression)) 413 break; 414 case AST::Expression::Kind::ReadModifyWrite: 383 415 checkErrorAndVisit(downcast<AST::ReadModifyWriteExpression>(expression)); 384 else if (is<AST::TernaryExpression>(expression)) 416 break; 417 case AST::Expression::Kind::Ternary: 385 418 checkErrorAndVisit(downcast<AST::TernaryExpression>(expression)); 386 else if (is<AST::UnsignedIntegerLiteral>(expression)) 419 break; 420 case AST::Expression::Kind::UnsignedIntegerLiteral: 387 421 checkErrorAndVisit(downcast<AST::UnsignedIntegerLiteral>(expression)); 388 else if (is<AST::EnumerationMemberLiteral>(expression)) 422 break; 423 case AST::Expression::Kind::EnumerationMemberLiteral: 389 424 checkErrorAndVisit(downcast<AST::EnumerationMemberLiteral>(expression)); 390 else 425 break; 426 case AST::Expression::Kind::VariableReference: 391 427 checkErrorAndVisit(downcast<AST::VariableReference>(expression)); 428 break; 429 } 392 430 } 393 431 -
trunk/Source/WebCore/Sources.txt
r248467 r248488 342 342 Modules/webgpu/WHLSL/WHLSLFunctionStageChecker.cpp 343 343 Modules/webgpu/WHLSL/AST/WHLSLTypeArgument.cpp 344 Modules/webgpu/WHLSL/AST/WHLSLExpression.cpp 344 345 Modules/webgpu/WHLSL/AST/WHLSLBuiltInSemantic.cpp 345 346 Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp … … 350 351 Modules/webgpu/WHLSL/AST/WHLSLNullLiteralType.cpp 351 352 Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteralType.cpp 353 Modules/webgpu/WHLSL/AST/WHLSLStatement.cpp 354 Modules/webgpu/WHLSL/AST/WHLSLType.cpp 352 355 Modules/webgpu/WHLSL/AST/WHLSLTypeReference.cpp 353 356 Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.cpp 354 357 Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.cpp 358 Modules/webgpu/WHLSL/AST/WHLSLUnnamedType.cpp 355 359 Modules/webgpu/WHLSL/WHLSLPrepare.cpp 356 360 Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r248467 r248488 2231 2231 7C8139AA1ED6604B00CE26E8 /* JSDOMCastedThisErrorBehavior.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C8139A91ED62DF200CE26E8 /* JSDOMCastedThisErrorBehavior.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2232 2232 7C83DE861D04CC5D00FEBCF3 /* SpringSolver.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C83DE851D04CBD400FEBCF3 /* SpringSolver.h */; }; 2233 7C85B20222FB04850030684F /* WHLSLUnnamedType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C85B20122FB04850030684F /* WHLSLUnnamedType.cpp */; };2234 2233 7C8E34AD1E4A33AF0054CE23 /* JSDOMConvertAny.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C8E34921E4A338E0054CE23 /* JSDOMConvertAny.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2235 2234 7C8E34AE1E4A33AF0054CE23 /* JSDOMConvertBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C8E34931E4A338E0054CE23 /* JSDOMConvertBase.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 8314 8313 5215862C229377B7005925EF /* WHLSLAST.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLAST.h; sourceTree = "<group>"; }; 8315 8314 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>"; }; 8316 8316 522DA3D3229E1D390042D151 /* WHLSLGlobalVariableReference.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLGlobalVariableReference.h; sourceTree = "<group>"; }; 8317 8317 522E1A172297D6D400E5D36A /* WHLSLPreserveVariableLifetimes.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WHLSLPreserveVariableLifetimes.cpp; sourceTree = "<group>"; }; … … 8326 8326 52B0D4BF1C57FD660077CE53 /* VideoFullscreenChangeObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenChangeObserver.h; sourceTree = "<group>"; }; 8327 8327 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>"; }; 8328 8329 52D5A18D1C54590300DE34A3 /* VideoFullscreenLayerManagerObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = VideoFullscreenLayerManagerObjC.mm; sourceTree = "<group>"; }; 8329 8330 52D5A18E1C54590300DE34A3 /* VideoFullscreenLayerManagerObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenLayerManagerObjC.h; sourceTree = "<group>"; }; … … 17075 17076 C21BF73321CD89F000227979 /* WHLSLConstantExpression.h */, 17076 17077 C21BF6F521CD89B500227979 /* WHLSLContinue.h */, 17078 52CB11DB22FDDB2E009F0A64 /* WHLSLDefaultDelete.h */, 17077 17079 C21BF70121CD89C400227979 /* WHLSLDereferenceExpression.h */, 17078 17080 C21BF71821CD89D700227979 /* WHLSLDotExpression.h */, … … 17084 17086 C21BF70221CD89C400227979 /* WHLSLEnumerationMemberLiteral.h */, 17085 17087 C21BF70C21CD89CC00227979 /* WHLSLExpression.h */, 17088 522D07A322FBAB4300B905BE /* WHLSLExpression.cpp */, 17086 17089 C21BF70021CD89C200227979 /* WHLSLFallthrough.h */, 17087 17090 C21BF73521CD89F200227979 /* WHLSLFloatLiteral.h */, … … 33517 33520 5D21A80213ECE5DF00BB7064 /* WebVTTParser.cpp in Sources */, 33518 33521 B10B6981140C174000BC1C26 /* WebVTTTokenizer.cpp in Sources */, 33519 7C85B20222FB04850030684F /* WHLSLUnnamedType.cpp in Sources */,33520 33522 A14832C2187F65C700DA63A6 /* WKUtilities.c in Sources */, 33521 33523 A833C7CC0A2CF07400D57664 /* XLinkNames.cpp in Sources */, -
trunk/Source/WebCore/workers/WorkerScriptLoader.h
r244115 r248488 80 80 private: 81 81 friend class WTF::RefCounted<WorkerScriptLoader>; 82 friend struct std::default_delete<WorkerScriptLoader>; 82 83 83 84 WorkerScriptLoader();
Note: See TracChangeset
for help on using the changeset viewer.