Changeset 247419 in webkit
- Timestamp:
- Jul 13, 2019 10:43:41 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r247418 r247419 1 2019-07-13 Robin Morisset <rmorisset@apple.com> 2 3 [WHLSL] Return statements don't need to keep track of the function they're in 4 https://bugs.webkit.org/show_bug.cgi?id=199763 5 6 Reviewed by Myles C. Maxfield. 7 8 Return::m_function is only used in the Checker, and it can easily enough keep track of the current function. 9 This means we no longer need to keep track of the current function in the NameResolver, and we can save 8 bytes per Return 10 11 Since I was touching the NameResolver I also removed a few pointless overrides of Visitor::visit(). 12 13 No new tests as there is no intended functional change. 14 15 * Modules/webgpu/WHLSL/AST/WHLSLReturn.h: 16 * Modules/webgpu/WHLSL/WHLSLChecker.cpp: 17 (WebCore::WHLSL::Checker::visit): 18 * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp: 19 (WebCore::WHLSL::NameResolver::NameResolver): 20 (WebCore::WHLSL::resolveTypeNamesInFunctions): 21 * Modules/webgpu/WHLSL/WHLSLNameResolver.h: 22 1 23 2019-07-13 Andres Gonzalez <andresg_22@apple.com> 2 24 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReturn.h
r247341 r247419 57 57 Expression* value() { return m_value.get(); } 58 58 59 FunctionDefinition* function() { return m_function; }60 void setFunction(FunctionDefinition* functionDefinition) { m_function = functionDefinition; }61 62 59 private: 63 60 std::unique_ptr<Expression> m_value; 64 FunctionDefinition* m_function { nullptr };65 61 }; 66 62 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp
r247329 r247419 518 518 const Intrinsics& m_intrinsics; 519 519 Program& m_program; 520 AST::FunctionDefinition* m_currentFunction { nullptr }; 520 521 }; 521 522 … … 573 574 void Checker::visit(AST::FunctionDefinition& functionDefinition) 574 575 { 576 m_currentFunction = &functionDefinition; 575 577 if (functionDefinition.entryPointType()) { 576 578 if (!checkShaderType(functionDefinition)) { … … 1145 1147 if (!valueInfo) 1146 1148 return; 1147 if (!matchAndCommit(valueInfo->resolvingType, returnStatement.function()->type()))1149 if (!matchAndCommit(valueInfo->resolvingType, m_currentFunction->type())) 1148 1150 setError(); 1149 1151 return; 1150 1152 } 1151 1153 1152 if (!matches( returnStatement.function()->type(), m_intrinsics.voidType()))1154 if (!matches(m_currentFunction->type(), m_intrinsics.voidType())) 1153 1155 setError(); 1154 1156 } -
trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLNameResolver.cpp
r247329 r247419 29 29 #if ENABLE(WEBGPU) 30 30 31 #include "WHLSLCallExpression.h"32 31 #include "WHLSLDoWhileLoop.h" 33 32 #include "WHLSLDotExpression.h" … … 39 38 #include "WHLSLNameContext.h" 40 39 #include "WHLSLProgram.h" 41 #include "WHLSLPropertyAccessExpression.h"42 40 #include "WHLSLReplaceWith.h" 43 41 #include "WHLSLResolveOverloadImpl.h" 44 #include "WHLSLReturn.h"45 42 #include "WHLSLScopedSetAdder.h" 46 43 #include "WHLSLTypeReference.h" … … 62 59 , m_parentNameResolver(&parentResolver) 63 60 { 64 setCurrentFunctionDefinition(parentResolver.m_currentFunction);65 61 } 66 62 … … 189 185 return; 190 186 } 191 }192 193 void NameResolver::visit(AST::Return& returnStatement)194 {195 ASSERT(m_currentFunction);196 returnStatement.setFunction(m_currentFunction);197 Visitor::visit(returnStatement);198 }199 200 void NameResolver::visit(AST::PropertyAccessExpression& propertyAccessExpression)201 {202 Visitor::visit(propertyAccessExpression);203 187 } 204 188 … … 227 211 } 228 212 229 void NameResolver::visit(AST::CallExpression& callExpression)230 {231 Visitor::visit(callExpression);232 }233 234 213 void NameResolver::visit(AST::EnumerationMemberLiteral& enumerationMemberLiteral) 235 214 { … … 289 268 { 290 269 for (auto& functionDefinition : program.functionDefinitions()) { 291 nameResolver.setCurrentFunctionDefinition(&functionDefinition);292 270 nameResolver.checkErrorAndVisit(functionDefinition); 293 271 if (nameResolver.error()) 294 272 return false; 295 273 } 296 nameResolver.setCurrentFunctionDefinition(nullptr);297 274 for (auto& nativeFunctionDeclaration : program.nativeFunctionDeclarations()) { 298 275 nameResolver.checkErrorAndVisit(nativeFunctionDeclaration); -
trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLNameResolver.h
r247171 r247419 45 45 virtual ~NameResolver(); 46 46 47 void setCurrentFunctionDefinition(AST::FunctionDefinition* functionDefinition)48 {49 m_currentFunction = functionDefinition;50 }51 52 47 private: 53 48 void visit(AST::FunctionDefinition&) override; … … 61 56 void visit(AST::VariableDeclaration&) override; 62 57 void visit(AST::VariableReference&) override; 63 void visit(AST::Return&) override;64 void visit(AST::PropertyAccessExpression&) override;65 58 void visit(AST::DotExpression&) override; 66 void visit(AST::CallExpression&) override;67 59 void visit(AST::EnumerationMemberLiteral&) override; 68 60 69 61 NameContext& m_nameContext; 70 62 HashSet<AST::TypeReference*> m_typeReferences; 71 AST::FunctionDefinition* m_currentFunction { nullptr };72 63 NameResolver* m_parentNameResolver { nullptr }; 73 64 };
Note: See TracChangeset
for help on using the changeset viewer.