WebKit Bugzilla
Attachment 371769 Details for
Bug 198306
: [WHLSL] The name resolver does not deal with nativeFunctionDeclaration
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
patch198306 (text/plain), 3.57 KB, created by
Robin Morisset
on 2019-06-10 12:12:52 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Robin Morisset
Created:
2019-06-10 12:12:52 PDT
Size:
3.57 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 72cd7ec6758..8da93a6442e 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,20 @@ >+2019-06-10 Robin Morisset <rmorisset@apple.com> >+ >+ [WHLSL] The name resolver does not deal with nativeFunctionDeclaration >+ https://bugs.webkit.org/show_bug.cgi?id=198306 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ We currently have a crash in the nameResolver when trying to use the full standard library. >+ What is happening is that because we don't specify anything to do to nativeFunctionDeclarations, names in their parameters >+ are added to the global environment. And so as soon as we have two such parameters with the same name, the name resolver fails. >+ >+ Tested by adding two native functions that share a parameter name to the standard library. >+ >+ * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp: >+ (WebCore::WHLSL::NameResolver::visit): >+ * Modules/webgpu/WHLSL/WHLSLNameResolver.h: >+ > 2019-06-10 Ali Juma <ajuma@chromium.org> > > REGRESSION (r245396): Page load time performance regression >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLNameResolver.cpp b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLNameResolver.cpp >index 21ca18dcfa3..c8004290ded 100644 >--- a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLNameResolver.cpp >+++ b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLNameResolver.cpp >@@ -94,6 +94,16 @@ void NameResolver::visit(AST::FunctionDefinition& functionDefinition) > newNameResolver.checkErrorAndVisit(functionDefinition.block()); > } > >+void NameResolver::visit(AST::NativeFunctionDeclaration& nativeFunctionDeclaration) >+{ >+ NameContext newNameContext(&m_nameContext); >+ NameResolver newNameResolver(newNameContext); >+ newNameResolver.setCurrentFunctionDefinition(m_currentFunction); >+ checkErrorAndVisit(nativeFunctionDeclaration.type()); >+ for (auto& parameter : nativeFunctionDeclaration.parameters()) >+ newNameResolver.checkErrorAndVisit(parameter); >+} >+ > void NameResolver::visit(AST::Block& block) > { > NameContext nameContext(&m_nameContext); >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLNameResolver.h b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLNameResolver.h >index 8fb4a34fbd4..89f08669075 100644 >--- a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLNameResolver.h >+++ b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLNameResolver.h >@@ -43,14 +43,14 @@ public: > > virtual ~NameResolver() = default; > >- void visit(AST::FunctionDefinition&) override; >- > void setCurrentFunctionDefinition(AST::FunctionDefinition* functionDefinition) > { > m_currentFunction = functionDefinition; > } > > private: >+ void visit(AST::FunctionDefinition&) override; >+ void visit(AST::NativeFunctionDeclaration&) override; > void visit(AST::TypeReference&) override; > void visit(AST::Block&) override; > void visit(AST::IfStatement&) override; >diff --git a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt >index 96630672d66..db260418ca2 100644 >--- a/Source/WebCore/Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt >+++ b/Source/WebCore/Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt >@@ -407,4 +407,7 @@ operator float4(float x, float y, float z, float w) { > return result; > } > >+native ushort Sample(Texture1D<ushort>, sampler, float location); >+native ushort Sample(Texture1D<ushort>, sampler, float location, int offset); >+ > // FIXME: https://bugs.webkit.org/show_bug.cgi?id=192890 Insert the rest of the standard library once the parser is fast enough
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 198306
:
371465
| 371769