[webkit-reviews] review granted: [Bug 199688] [WHLSL] The recursion checker should not have quadratic complexity : [Attachment 373878] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jul 10 17:10:20 PDT 2019

Saam Barati <sbarati at apple.com> has granted Robin Morisset
<rmorisset at apple.com>'s request for review:
Bug 199688: [WHLSL] The recursion checker should not have quadratic complexity

Attachment 373878: Patch


--- Comment #2 from Saam Barati <sbarati at apple.com> ---
Comment on attachment 373878
  --> https://bugs.webkit.org/attachment.cgi?id=373878

View in context: https://bugs.webkit.org/attachment.cgi?id=373878&action=review

> Source/WebCore/Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp:47
> +    void visit(Program& program) override
> +    {
> +	   for (auto& functionDefinition : program.functionDefinitions())
> +	       checkErrorAndVisit(functionDefinition);
> +    }

Nice. We should probably do this in more phases.

> Source/WebCore/Modules/webgpu/WHLSL/WHLSLRecursionChecker.cpp:62
> +	   auto addResult2 = m_finishedVisiting.add(&functionDefinition);
> +	   ASSERT_UNUSED(addResult2, addResult2);

this probably doesn't compile on debug builds. You want addResult2.isNewEntry.

Also, can you just give it its own scope instead of calling it addResult2? Or
perhaps limit scope to above addResult?

More information about the webkit-reviews mailing list