WebKit Bugzilla
Attachment 373554 Details for
Bug 199537
: [WHLSL] The checker does not need to keep a separate m_typeAnnotations map
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
patch199537 (text/plain), 4.93 KB, created by
Robin Morisset
on 2019-07-05 16:42:31 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Robin Morisset
Created:
2019-07-05 16:42:31 PDT
Size:
4.93 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index bdc0b32c4b6..b105cc0f95b 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,23 @@ >+2019-07-05 Robin Morisset <rmorisset@apple.com> >+ >+ [WHLSL] The checker does not need to keep a separate m_typeAnnotations map >+ https://bugs.webkit.org/show_bug.cgi?id=199537 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Nothing is ever deleted from it, and all of its contents are eventually copied into the expressions. >+ We might as well put the type annotations directly into the expressions in the first place. >+ It is about a 5% speedup of the checker. >+ >+ No new test as there is no inteded functional change. >+ >+ * Modules/webgpu/WHLSL/WHLSLChecker.cpp: >+ (WebCore::WHLSL::Checker::assignTypes): >+ (WebCore::WHLSL::Checker::getInfo): >+ (WebCore::WHLSL::Checker::assignType): >+ (WebCore::WHLSL::Checker::forwardType): >+ (WebCore::WHLSL::Checker::visit): >+ > 2019-07-05 Ryosuke Niwa <rniwa@webkit.org> > > [iOS] Crash in WebKit::WebPage::positionInformation via Range::startPosition >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp >index 0e50869a3cf..d809414af8e 100644 >--- a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp >+++ b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp >@@ -512,7 +512,6 @@ private: > void finishVisiting(AST::PropertyAccessExpression&, ResolvingType* additionalArgumentType = nullptr); > > HashMap<AST::Expression*, std::unique_ptr<ResolvingType>> m_typeMap; >- HashMap<AST::Expression*, AST::TypeAnnotation> m_typeAnnotations; > HashSet<String> m_vertexEntryPoints; > HashSet<String> m_fragmentEntryPoints; > HashSet<String> m_computeEntryPoints; >@@ -556,8 +555,6 @@ bool Checker::assignTypes() > return false; > } > >- for (auto& keyValuePair : m_typeAnnotations) >- keyValuePair.key->setTypeAnnotation(WTFMove(keyValuePair.value)); > return true; > } > >@@ -778,13 +775,12 @@ auto Checker::getInfo(AST::Expression& expression, bool requiresLeftValue) -> Op > auto typeIterator = m_typeMap.find(&expression); > ASSERT(typeIterator != m_typeMap.end()); > >- auto typeAnnotationIterator = m_typeAnnotations.find(&expression); >- ASSERT(typeAnnotationIterator != m_typeAnnotations.end()); >- if (requiresLeftValue && typeAnnotationIterator->value.isRightValue()) { >+ const auto& typeAnnotation = expression.typeAnnotation(); >+ if (requiresLeftValue && typeAnnotation.isRightValue()) { > setError(); > return WTF::nullopt; > } >- return {{ *typeIterator->value, typeAnnotationIterator->value }}; >+ return {{ *typeIterator->value, typeAnnotation }}; > } > > void Checker::visit(AST::VariableDeclaration& variableDeclaration) >@@ -808,16 +804,14 @@ void Checker::assignType(AST::Expression& expression, UniqueRef<AST::UnnamedType > { > auto addResult = m_typeMap.add(&expression, std::make_unique<ResolvingType>(WTFMove(unnamedType))); > ASSERT_UNUSED(addResult, addResult.isNewEntry); >- auto typeAnnotationAddResult = m_typeAnnotations.add(&expression, WTFMove(typeAnnotation)); >- ASSERT_UNUSED(typeAnnotationAddResult, typeAnnotationAddResult.isNewEntry); >+ expression.setTypeAnnotation(WTFMove(typeAnnotation)); > } > > void Checker::assignType(AST::Expression& expression, RefPtr<ResolvableTypeReference>&& resolvableTypeReference, AST::TypeAnnotation typeAnnotation = AST::RightValue()) > { > auto addResult = m_typeMap.add(&expression, std::make_unique<ResolvingType>(WTFMove(resolvableTypeReference))); > ASSERT_UNUSED(addResult, addResult.isNewEntry); >- auto typeAnnotationAddResult = m_typeAnnotations.add(&expression, WTFMove(typeAnnotation)); >- ASSERT_UNUSED(typeAnnotationAddResult, typeAnnotationAddResult.isNewEntry); >+ expression.setTypeAnnotation(WTFMove(typeAnnotation)); > } > > void Checker::forwardType(AST::Expression& expression, ResolvingType& resolvingType, AST::TypeAnnotation typeAnnotation = AST::RightValue()) >@@ -829,8 +823,7 @@ void Checker::forwardType(AST::Expression& expression, ResolvingType& resolvingT > auto addResult = m_typeMap.add(&expression, std::make_unique<ResolvingType>(result.copyRef())); > ASSERT_UNUSED(addResult, addResult.isNewEntry); > })); >- auto typeAnnotationAddResult = m_typeAnnotations.add(&expression, WTFMove(typeAnnotation)); >- ASSERT_UNUSED(typeAnnotationAddResult, typeAnnotationAddResult.isNewEntry); >+ expression.setTypeAnnotation(WTFMove(typeAnnotation)); > } > > void Checker::visit(AST::AssignmentExpression& assignmentExpression) >@@ -839,11 +832,6 @@ void Checker::visit(AST::AssignmentExpression& assignmentExpression) > if (!leftInfo) > return; > >- if (leftInfo->typeAnnotation.isRightValue()) { >- setError(); >- return; >- } >- > auto rightInfo = recurseAndGetInfo(assignmentExpression.right()); > if (!rightInfo) > return;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199537
: 373554