Title: [248920] trunk
- Revision
- 248920
- Author
- sbar...@apple.com
- Date
- 2019-08-20 16:11:41 -0700 (Tue, 20 Aug 2019)
Log Message
[WHLSL] We need to null check when emitting native code for operator&.<field-name>
https://bugs.webkit.org/show_bug.cgi?id=200846
Reviewed by Myles C. Maxfield.
Source/WebCore:
Test: webgpu/whlsl/structure-field-access-on-null.html
* Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
(WebCore::WHLSL::Metal::inlineNativeFunction):
LayoutTests:
* webgpu/whlsl/structure-field-access-on-null-expected.txt: Added.
* webgpu/whlsl/structure-field-access-on-null.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (248919 => 248920)
--- trunk/LayoutTests/ChangeLog 2019-08-20 22:35:28 UTC (rev 248919)
+++ trunk/LayoutTests/ChangeLog 2019-08-20 23:11:41 UTC (rev 248920)
@@ -1,3 +1,13 @@
+2019-08-20 Saam Barati <sbar...@apple.com>
+
+ [WHLSL] We need to null check when emitting native code for operator&.<field-name>
+ https://bugs.webkit.org/show_bug.cgi?id=200846
+
+ Reviewed by Myles C. Maxfield.
+
+ * webgpu/whlsl/structure-field-access-on-null-expected.txt: Added.
+ * webgpu/whlsl/structure-field-access-on-null.html: Added.
+
2019-08-20 Russell Epstein <repst...@apple.com>
Updating Expectations for Multiple Newly Passing Tests.
Added: trunk/LayoutTests/webgpu/whlsl/structure-field-access-on-null-expected.txt (0 => 248920)
--- trunk/LayoutTests/webgpu/whlsl/structure-field-access-on-null-expected.txt (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl/structure-field-access-on-null-expected.txt 2019-08-20 23:11:41 UTC (rev 248920)
@@ -0,0 +1,3 @@
+
+PASS fieldShouldBeNull
+
Added: trunk/LayoutTests/webgpu/whlsl/structure-field-access-on-null.html (0 => 248920)
--- trunk/LayoutTests/webgpu/whlsl/structure-field-access-on-null.html (rev 0)
+++ trunk/LayoutTests/webgpu/whlsl/structure-field-access-on-null.html 2019-08-20 23:11:41 UTC (rev 248920)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>field ander on nullptr should return null.</title>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+const whlslTests = {};
+
+whlslTests.fieldShouldBeNull = async () => {
+ const program = `
+ struct Foo {
+ int x;
+ int y;
+ int z;
+ }
+ bool foo(uint i) {
+ Foo[10] foos;
+ thread Foo* foo = &foos[i];
+ thread int* ptr = &(foo->z);
+ return ptr == null && foo == null;
+ }
+ `;
+
+ for (let i = 0; i < 10; ++i)
+ assert_equals(await callBoolFunction(program, "foo", [makeUint(i)]), false);
+ assert_equals(await callBoolFunction(program, "foo", [makeUint(10)]), true);
+ assert_equals(await callBoolFunction(program, "foo", [makeUint(1000000)]), true);
+ assert_equals(await callBoolFunction(program, "foo", [makeUint(0xffffffff)]), true);
+};
+
+runTests(whlslTests);
+</script>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (248919 => 248920)
--- trunk/Source/WebCore/ChangeLog 2019-08-20 22:35:28 UTC (rev 248919)
+++ trunk/Source/WebCore/ChangeLog 2019-08-20 23:11:41 UTC (rev 248920)
@@ -1,3 +1,15 @@
+2019-08-20 Saam Barati <sbar...@apple.com>
+
+ [WHLSL] We need to null check when emitting native code for operator&.<field-name>
+ https://bugs.webkit.org/show_bug.cgi?id=200846
+
+ Reviewed by Myles C. Maxfield.
+
+ Test: webgpu/whlsl/structure-field-access-on-null.html
+
+ * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
+ (WebCore::WHLSL::Metal::inlineNativeFunction):
+
2019-08-20 Justin Fan <justin_...@apple.com>
Unreviewed comment follow-up for https://bugs.webkit.org/show_bug.cgi?id=200752.
Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp (248919 => 248920)
--- trunk/Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp 2019-08-20 22:35:28 UTC (rev 248919)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp 2019-08-20 23:11:41 UTC (rev 248920)
@@ -282,7 +282,7 @@
auto fieldName = nativeFunctionDeclaration.name().substring("operator&."_str.length());
stringBuilder.append(
- indent, returnName, " = &(", args[0], "->");
+ indent, returnName, " = ", args[0], " ? &(", args[0], "->");
auto& unnamedType = *nativeFunctionDeclaration.parameters()[0]->type();
auto& unifyNode = downcast<AST::PointerType>(unnamedType).elementType().unifyNode();
@@ -295,7 +295,7 @@
} else
stringBuilder.append(fieldName);
- stringBuilder.append(");\n");
+ stringBuilder.append(") : nullptr;\n");
return;
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes