Changeset 247189 in webkit
- Timestamp:
- Jul 5, 2019 5:33:01 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r247187 r247189 1 2019-07-05 Robin Morisset <rmorisset@apple.com> 2 3 [WHLSL] The checker does not need to keep a separate m_typeAnnotations map 4 https://bugs.webkit.org/show_bug.cgi?id=199537 5 6 Reviewed by Myles C. Maxfield. 7 8 Nothing is ever deleted from it, and all of its contents are eventually copied into the expressions. 9 We might as well put the type annotations directly into the expressions in the first place. 10 It is about a 5% speedup of the checker. 11 12 No new test as there is no inteded functional change. 13 14 * Modules/webgpu/WHLSL/WHLSLChecker.cpp: 15 (WebCore::WHLSL::Checker::assignTypes): 16 (WebCore::WHLSL::Checker::getInfo): 17 (WebCore::WHLSL::Checker::assignType): 18 (WebCore::WHLSL::Checker::forwardType): 19 (WebCore::WHLSL::Checker::visit): 20 1 21 2019-07-05 Youenn Fablet <youenn@apple.com> and Simon Fraser <simon.fraser@apple.com> 2 22 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp
r247174 r247189 513 513 514 514 HashMap<AST::Expression*, std::unique_ptr<ResolvingType>> m_typeMap; 515 HashMap<AST::Expression*, AST::TypeAnnotation> m_typeAnnotations;516 515 HashSet<String> m_vertexEntryPoints; 517 516 HashSet<String> m_fragmentEntryPoints; … … 557 556 } 558 557 559 for (auto& keyValuePair : m_typeAnnotations)560 keyValuePair.key->setTypeAnnotation(WTFMove(keyValuePair.value));561 558 return true; 562 559 } … … 779 776 ASSERT(typeIterator != m_typeMap.end()); 780 777 781 auto typeAnnotationIterator = m_typeAnnotations.find(&expression); 782 ASSERT(typeAnnotationIterator != m_typeAnnotations.end()); 783 if (requiresLeftValue && typeAnnotationIterator->value.isRightValue()) { 778 const auto& typeAnnotation = expression.typeAnnotation(); 779 if (requiresLeftValue && typeAnnotation.isRightValue()) { 784 780 setError(); 785 781 return WTF::nullopt; 786 782 } 787 return {{ *typeIterator->value, typeAnnotation Iterator->value}};783 return {{ *typeIterator->value, typeAnnotation }}; 788 784 } 789 785 … … 809 805 auto addResult = m_typeMap.add(&expression, std::make_unique<ResolvingType>(WTFMove(unnamedType))); 810 806 ASSERT_UNUSED(addResult, addResult.isNewEntry); 811 auto typeAnnotationAddResult = m_typeAnnotations.add(&expression, WTFMove(typeAnnotation)); 812 ASSERT_UNUSED(typeAnnotationAddResult, typeAnnotationAddResult.isNewEntry); 807 expression.setTypeAnnotation(WTFMove(typeAnnotation)); 813 808 } 814 809 … … 817 812 auto addResult = m_typeMap.add(&expression, std::make_unique<ResolvingType>(WTFMove(resolvableTypeReference))); 818 813 ASSERT_UNUSED(addResult, addResult.isNewEntry); 819 auto typeAnnotationAddResult = m_typeAnnotations.add(&expression, WTFMove(typeAnnotation)); 820 ASSERT_UNUSED(typeAnnotationAddResult, typeAnnotationAddResult.isNewEntry); 814 expression.setTypeAnnotation(WTFMove(typeAnnotation)); 821 815 } 822 816 … … 830 824 ASSERT_UNUSED(addResult, addResult.isNewEntry); 831 825 })); 832 auto typeAnnotationAddResult = m_typeAnnotations.add(&expression, WTFMove(typeAnnotation)); 833 ASSERT_UNUSED(typeAnnotationAddResult, typeAnnotationAddResult.isNewEntry); 826 expression.setTypeAnnotation(WTFMove(typeAnnotation)); 834 827 } 835 828 … … 839 832 if (!leftInfo) 840 833 return; 841 842 if (leftInfo->typeAnnotation.isRightValue()) {843 setError();844 return;845 }846 834 847 835 auto rightInfo = recurseAndGetInfo(assignmentExpression.right());
Note: See TracChangeset
for help on using the changeset viewer.