Title: [248303] trunk/Source/WebCore
Revision
248303
Author
sbar...@apple.com
Date
2019-08-06 10:37:08 -0700 (Tue, 06 Aug 2019)

Log Message

[WHLSL] Reduce the number of variables that make it into the global struct by skipping stdlib functions and internal uses of MakePointerExpression/MakeArrayReference
https://bugs.webkit.org/show_bug.cgi?id=200463

Reviewed by Myles C. Maxfield.

This patch makes it so that we put fewer variables in the global struct.
This decreases end-to-end running time in compute_boids by 30% (with p = 0.0001).

We achieve this in two ways:
1. We track if each function is user code or "standard library" code. We also
count native functions as the standard library. We know a priori that the
standard library never escapes any variables. So the preserve variable
lifetimes phase skips analyzing all standard library functions and also
skips passing the global struct to any standard library functions.

2. We internally emit MakePointerExpression/MakeArrayReferenceExpression nodes in
the compiler in various phases. We sometimes emit these nodes in such a way
that we know that this address-of _expression_ does not cause the variable to
escape. We now mark each address-of expressions as either:
- Conservatively escaping. We conservatively do this for all user code.
- Not escaping. This means that this address-of operation definitely does
not escape the variable. If a variable never has an escaping use, we will
omit putting this variable in the struct.

* Modules/webgpu/WHLSL/AST/WHLSLAddressEscapeMode.h: Added.
* Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h:
(WebCore::WHLSL::AST::FunctionDeclaration::FunctionDeclaration):
(WebCore::WHLSL::AST::FunctionDeclaration::parsingMode const):
* Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h:
(WebCore::WHLSL::AST::MakeArrayReferenceExpression::MakeArrayReferenceExpression):
(WebCore::WHLSL::AST::MakeArrayReferenceExpression::mightEscape const):
* Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h:
(WebCore::WHLSL::AST::MakePointerExpression::MakePointerExpression):
(WebCore::WHLSL::AST::MakePointerExpression::mightEscape const):
* Modules/webgpu/WHLSL/WHLSLChecker.cpp:
(WebCore::WHLSL::resolveWithOperatorAnderIndexer):
(WebCore::WHLSL::resolveWithOperatorLength):
(WebCore::WHLSL::resolveWithReferenceComparator):
* Modules/webgpu/WHLSL/WHLSLParser.cpp:
(WebCore::WHLSL::Parser::parse):
(WebCore::WHLSL::Parser::parseComputeFunctionDeclaration):
(WebCore::WHLSL::Parser::parseVertexOrFragmentFunctionDeclaration):
(WebCore::WHLSL::Parser::parseRegularFunctionDeclaration):
(WebCore::WHLSL::Parser::parseOperatorFunctionDeclaration):
(WebCore::WHLSL::Parser::parsePossiblePrefix):
* Modules/webgpu/WHLSL/WHLSLParser.h:
* Modules/webgpu/WHLSL/WHLSLParsingMode.h: Added.
* Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
(WebCore::WHLSL::prepareShared):
* Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp:
* Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
(WebCore::WHLSL::wrapAnderCallArgument):
(WebCore::WHLSL::modify):
(WebCore::WHLSL::PropertyResolver::visit):
* Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.cpp:
(WebCore::WHLSL::includeStandardLibrary):
* Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp:
(WebCore::WHLSL::synthesizeArrayOperatorLength):
* Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp:
(WebCore::WHLSL::synthesizeConstructors):
* Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp:
(WebCore::WHLSL::synthesizeEnumerationFunctions):
* Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp:
(WebCore::WHLSL::synthesizeStructureAccessors):
* WebCore.xcodeproj/project.pbxproj:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (248302 => 248303)


--- trunk/Source/WebCore/ChangeLog	2019-08-06 17:34:27 UTC (rev 248302)
+++ trunk/Source/WebCore/ChangeLog	2019-08-06 17:37:08 UTC (rev 248303)
@@ -1,3 +1,71 @@
+2019-08-06  Saam Barati  <sbar...@apple.com>
+
+        [WHLSL] Reduce the number of variables that make it into the global struct by skipping stdlib functions and internal uses of MakePointerExpression/MakeArrayReference
+        https://bugs.webkit.org/show_bug.cgi?id=200463
+
+        Reviewed by Myles C. Maxfield.
+
+        This patch makes it so that we put fewer variables in the global struct.
+        This decreases end-to-end running time in compute_boids by 30% (with p = 0.0001).
+        
+        We achieve this in two ways:
+        1. We track if each function is user code or "standard library" code. We also
+        count native functions as the standard library. We know a priori that the
+        standard library never escapes any variables. So the preserve variable
+        lifetimes phase skips analyzing all standard library functions and also
+        skips passing the global struct to any standard library functions.
+        
+        2. We internally emit MakePointerExpression/MakeArrayReferenceExpression nodes in
+        the compiler in various phases. We sometimes emit these nodes in such a way
+        that we know that this address-of _expression_ does not cause the variable to
+        escape. We now mark each address-of expressions as either:
+        - Conservatively escaping. We conservatively do this for all user code.
+        - Not escaping. This means that this address-of operation definitely does
+        not escape the variable. If a variable never has an escaping use, we will
+        omit putting this variable in the struct.
+
+        * Modules/webgpu/WHLSL/AST/WHLSLAddressEscapeMode.h: Added.
+        * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h:
+        (WebCore::WHLSL::AST::FunctionDeclaration::FunctionDeclaration):
+        (WebCore::WHLSL::AST::FunctionDeclaration::parsingMode const):
+        * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h:
+        (WebCore::WHLSL::AST::MakeArrayReferenceExpression::MakeArrayReferenceExpression):
+        (WebCore::WHLSL::AST::MakeArrayReferenceExpression::mightEscape const):
+        * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h:
+        (WebCore::WHLSL::AST::MakePointerExpression::MakePointerExpression):
+        (WebCore::WHLSL::AST::MakePointerExpression::mightEscape const):
+        * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
+        (WebCore::WHLSL::resolveWithOperatorAnderIndexer):
+        (WebCore::WHLSL::resolveWithOperatorLength):
+        (WebCore::WHLSL::resolveWithReferenceComparator):
+        * Modules/webgpu/WHLSL/WHLSLParser.cpp:
+        (WebCore::WHLSL::Parser::parse):
+        (WebCore::WHLSL::Parser::parseComputeFunctionDeclaration):
+        (WebCore::WHLSL::Parser::parseVertexOrFragmentFunctionDeclaration):
+        (WebCore::WHLSL::Parser::parseRegularFunctionDeclaration):
+        (WebCore::WHLSL::Parser::parseOperatorFunctionDeclaration):
+        (WebCore::WHLSL::Parser::parsePossiblePrefix):
+        * Modules/webgpu/WHLSL/WHLSLParser.h:
+        * Modules/webgpu/WHLSL/WHLSLParsingMode.h: Added.
+        * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
+        (WebCore::WHLSL::prepareShared):
+        * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp:
+        * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
+        (WebCore::WHLSL::wrapAnderCallArgument):
+        (WebCore::WHLSL::modify):
+        (WebCore::WHLSL::PropertyResolver::visit):
+        * Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.cpp:
+        (WebCore::WHLSL::includeStandardLibrary):
+        * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp:
+        (WebCore::WHLSL::synthesizeArrayOperatorLength):
+        * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp:
+        (WebCore::WHLSL::synthesizeConstructors):
+        * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp:
+        (WebCore::WHLSL::synthesizeEnumerationFunctions):
+        * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp:
+        (WebCore::WHLSL::synthesizeStructureAccessors):
+        * WebCore.xcodeproj/project.pbxproj:
+
 2019-08-06  Jer Noble  <jer.no...@apple.com>
 
         Adopt -expectMinimumUpcomingSampleBufferPresentationTime:

Copied: trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLAddressEscapeMode.h (from rev 248302, trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h) (0 => 248303)


--- trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLAddressEscapeMode.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLAddressEscapeMode.h	2019-08-06 17:37:08 UTC (rev 248303)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEBGPU)
+
+namespace WebCore {
+
+namespace WHLSL {
+
+namespace AST {
+
+enum class AddressEscapeMode : uint8_t {
+    Escapes, // Conservatively, this address-of operation might escape.
+    DoesNotEscape // This address-of operation definitely does not escape.
+};
+
+} // namespace AST
+
+} // namespace WHLSL
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h (248302 => 248303)


--- trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h	2019-08-06 17:34:27 UTC (rev 248302)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h	2019-08-06 17:37:08 UTC (rev 248303)
@@ -30,6 +30,7 @@
 #include "WHLSLCodeLocation.h"
 #include "WHLSLEntryPointType.h"
 #include "WHLSLFunctionAttribute.h"
+#include "WHLSLParsingMode.h"
 #include "WHLSLSemantic.h"
 #include "WHLSLUnnamedType.h"
 #include "WHLSLVariableDeclaration.h"
@@ -46,11 +47,12 @@
 class FunctionDeclaration {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    FunctionDeclaration(CodeLocation location, AttributeBlock&& attributeBlock, Optional<EntryPointType> entryPointType, Ref<UnnamedType> type, String&& name, VariableDeclarations&& parameters, std::unique_ptr<Semantic>&& semantic, bool isOperator)
+    FunctionDeclaration(CodeLocation location, AttributeBlock&& attributeBlock, Optional<EntryPointType> entryPointType, Ref<UnnamedType> type, String&& name, VariableDeclarations&& parameters, std::unique_ptr<Semantic>&& semantic, bool isOperator, ParsingMode parsingMode)
         : m_codeLocation(location)
         , m_attributeBlock(WTFMove(attributeBlock))
         , m_entryPointType(entryPointType)
-        , m_isOperator(WTFMove(isOperator))
+        , m_isOperator(isOperator)
+        , m_parsingMode(parsingMode)
         , m_type(WTFMove(type))
         , m_name(WTFMove(name))
         , m_parameters(WTFMove(parameters))
@@ -79,11 +81,14 @@
     bool isOperator() const { return m_isOperator; }
     const CodeLocation& codeLocation() const { return m_codeLocation; }
 
+    ParsingMode parsingMode() const { return m_parsingMode; }
+
 private:
     CodeLocation m_codeLocation;
     AttributeBlock m_attributeBlock;
     Optional<EntryPointType> m_entryPointType;
     bool m_isOperator;
+    ParsingMode m_parsingMode;
     Ref<UnnamedType> m_type;
     String m_name;
     VariableDeclarations m_parameters;

Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h (248302 => 248303)


--- trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h	2019-08-06 17:34:27 UTC (rev 248302)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h	2019-08-06 17:37:08 UTC (rev 248303)
@@ -27,6 +27,7 @@
 
 #if ENABLE(WEBGPU)
 
+#include "WHLSLAddressEscapeMode.h"
 #include "WHLSLExpression.h"
 #include <wtf/FastMalloc.h>
 #include <wtf/UniqueRef.h>
@@ -40,9 +41,10 @@
 class MakeArrayReferenceExpression : public _expression_ {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    MakeArrayReferenceExpression(CodeLocation location, UniqueRef<_expression_>&& leftValue)
+    MakeArrayReferenceExpression(CodeLocation location, UniqueRef<_expression_>&& leftValue, AddressEscapeMode addressEscapeMode)
         : _expression_(location)
         , m_leftValue(WTFMove(leftValue))
+        , m_addressEscapeMode(addressEscapeMode)
     {
     }
 
@@ -55,8 +57,11 @@
 
     _expression_& leftValue() { return m_leftValue; }
 
+    bool mightEscape() const { return m_addressEscapeMode == AddressEscapeMode::Escapes; }
+
 private:
     UniqueRef<_expression_> m_leftValue;
+    AddressEscapeMode m_addressEscapeMode;
 };
 
 } // namespace AST

Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h (248302 => 248303)


--- trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h	2019-08-06 17:34:27 UTC (rev 248302)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h	2019-08-06 17:37:08 UTC (rev 248303)
@@ -27,6 +27,7 @@
 
 #if ENABLE(WEBGPU)
 
+#include "WHLSLAddressEscapeMode.h"
 #include "WHLSLExpression.h"
 #include <wtf/FastMalloc.h>
 #include <wtf/UniqueRef.h>
@@ -40,9 +41,10 @@
 class MakePointerExpression : public _expression_ {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    MakePointerExpression(CodeLocation location, UniqueRef<_expression_>&& leftValue)
+    MakePointerExpression(CodeLocation location, UniqueRef<_expression_>&& leftValue, AddressEscapeMode addressEscapeMode)
         : _expression_(location)
         , m_leftValue(WTFMove(leftValue))
+        , m_addressEscapeMode(addressEscapeMode)
     {
     }
 
@@ -55,8 +57,11 @@
 
     _expression_& leftValue() { return m_leftValue; }
 
+    bool mightEscape() const { return m_addressEscapeMode == AddressEscapeMode::Escapes; }
+
 private:
     UniqueRef<_expression_> m_leftValue;
+    AddressEscapeMode m_addressEscapeMode;
 };
 
 } // namespace AST

Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp (248302 => 248303)


--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp	2019-08-06 17:34:27 UTC (rev 248302)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp	2019-08-06 17:37:08 UTC (rev 248303)
@@ -125,7 +125,7 @@
     AST::VariableDeclarations parameters;
     parameters.append(makeUniqueRef<AST::VariableDeclaration>(location, AST::Qualifiers(), &firstArgument, String(), nullptr, nullptr));
     parameters.append(makeUniqueRef<AST::VariableDeclaration>(location, AST::Qualifiers(), AST::TypeReference::wrap(location, intrinsics.uintType()), String(), nullptr, nullptr));
-    return AST::NativeFunctionDeclaration(AST::FunctionDeclaration(location, AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), String("operator&[]", String::ConstructFromLiteral), WTFMove(parameters), nullptr, isOperator));
+    return AST::NativeFunctionDeclaration(AST::FunctionDeclaration(location, AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), String("operator&[]", String::ConstructFromLiteral), WTFMove(parameters), nullptr, isOperator, ParsingMode::StandardLibrary));
 }
 
 static AST::NativeFunctionDeclaration resolveWithOperatorLength(CodeLocation location, AST::UnnamedType& firstArgument, const Intrinsics& intrinsics)
@@ -134,7 +134,7 @@
     auto returnType = AST::TypeReference::wrap(location, intrinsics.uintType());
     AST::VariableDeclarations parameters;
     parameters.append(makeUniqueRef<AST::VariableDeclaration>(location, AST::Qualifiers(), &firstArgument, String(), nullptr, nullptr));
-    return AST::NativeFunctionDeclaration(AST::FunctionDeclaration(location, AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), String("operator.length", String::ConstructFromLiteral), WTFMove(parameters), nullptr, isOperator));
+    return AST::NativeFunctionDeclaration(AST::FunctionDeclaration(location, AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), String("operator.length", String::ConstructFromLiteral), WTFMove(parameters), nullptr, isOperator, ParsingMode::StandardLibrary));
 }
 
 static AST::NativeFunctionDeclaration resolveWithReferenceComparator(CodeLocation location, ResolvingType& firstArgument, ResolvingType& secondArgument, const Intrinsics& intrinsics)
@@ -156,7 +156,7 @@
     AST::VariableDeclarations parameters;
     parameters.append(makeUniqueRef<AST::VariableDeclaration>(location, AST::Qualifiers(), argumentType.copyRef(), String(), nullptr, nullptr));
     parameters.append(makeUniqueRef<AST::VariableDeclaration>(location, AST::Qualifiers(), WTFMove(argumentType), String(), nullptr, nullptr));
-    return AST::NativeFunctionDeclaration(AST::FunctionDeclaration(location, AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), String("operator==", String::ConstructFromLiteral), WTFMove(parameters), nullptr, isOperator));
+    return AST::NativeFunctionDeclaration(AST::FunctionDeclaration(location, AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), String("operator==", String::ConstructFromLiteral), WTFMove(parameters), nullptr, isOperator, ParsingMode::StandardLibrary));
 }
 
 enum class Acceptability {

Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp (248302 => 248303)


--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp	2019-08-06 17:34:27 UTC (rev 248302)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp	2019-08-06 17:37:08 UTC (rev 248303)
@@ -59,7 +59,7 @@
         return Unexpected<Error>(name.error());
 
 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=195682 Return a better error code from this, and report it to _javascript_.
-auto Parser::parse(Program& program, StringView stringView, Mode mode) -> Expected<void, Error>
+auto Parser::parse(Program& program, StringView stringView, ParsingMode mode) -> Expected<void, Error>
 {
     m_lexer = Lexer(stringView);
     m_mode = mode;
@@ -94,7 +94,7 @@
             continue;
         }
         case Token::Type::Native: {
-            ASSERT(m_mode == Mode::StandardLibrary);
+            ASSERT(m_mode == ParsingMode::StandardLibrary);
             auto furtherToken = peekFurther();
             if (!furtherToken)
                 return { };
@@ -986,7 +986,7 @@
     auto endOffset = m_lexer.peek().startOffset();
 
     bool isOperator = false;
-    return AST::FunctionDeclaration({ origin->startOffset(), endOffset }, WTFMove(*attributeBlock), AST::EntryPointType::Compute, WTFMove(*type), name->stringView(m_lexer).toString(), WTFMove(*parameters), WTFMove(*semantic), isOperator);
+    return AST::FunctionDeclaration({ origin->startOffset(), endOffset }, WTFMove(*attributeBlock), AST::EntryPointType::Compute, WTFMove(*type), name->stringView(m_lexer).toString(), WTFMove(*parameters), WTFMove(*semantic), isOperator, m_mode);
 }
 
 auto Parser::parseVertexOrFragmentFunctionDeclaration() -> Expected<AST::FunctionDeclaration, Error>
@@ -1004,7 +1004,7 @@
     auto endOffset = m_lexer.peek().startOffset();
 
     bool isOperator = false;
-    return AST::FunctionDeclaration({ entryPoint->startOffset(), endOffset }, { }, entryPointType, WTFMove(*type), name->stringView(m_lexer).toString(), WTFMove(*parameters), WTFMove(*semantic), isOperator);
+    return AST::FunctionDeclaration({ entryPoint->startOffset(), endOffset }, { }, entryPointType, WTFMove(*type), name->stringView(m_lexer).toString(), WTFMove(*parameters), WTFMove(*semantic), isOperator, m_mode);
 }
 
 auto Parser::parseRegularFunctionDeclaration() -> Expected<AST::FunctionDeclaration, Error>
@@ -1023,7 +1023,7 @@
 
     auto endOffset = m_lexer.peek().startOffset();
 
-    return AST::FunctionDeclaration({ origin->startOffset(), endOffset }, { }, WTF::nullopt, WTFMove(*type), name->stringView(m_lexer).toString(), WTFMove(*parameters), WTFMove(*semantic), isOperator);
+    return AST::FunctionDeclaration({ origin->startOffset(), endOffset }, { }, WTF::nullopt, WTFMove(*type), name->stringView(m_lexer).toString(), WTFMove(*parameters), WTFMove(*semantic), isOperator, m_mode);
 }
 
 auto Parser::parseOperatorFunctionDeclaration() -> Expected<AST::FunctionDeclaration, Error>
@@ -1036,7 +1036,7 @@
     auto endOffset = m_lexer.peek().startOffset();
 
     bool isOperator = true;
-    return AST::FunctionDeclaration({ origin->startOffset(), endOffset }, { }, WTF::nullopt, WTFMove(*type), "operator cast"_str, WTFMove(*parameters), WTFMove(*semantic), isOperator);
+    return AST::FunctionDeclaration({ origin->startOffset(), endOffset }, { }, WTF::nullopt, WTFMove(*type), "operator cast"_str, WTFMove(*parameters), WTFMove(*semantic), isOperator, m_mode);
 }
 
 auto Parser::parseFunctionDeclaration() -> Expected<AST::FunctionDeclaration, Error>
@@ -1937,9 +1937,9 @@
             return { makeUniqueRef<AST::LogicalNotExpression>(location, WTFMove(boolCast)) };
         }
         case Token::Type::And:
-            return { makeUniqueRef<AST::MakePointerExpression>(location, WTFMove(*next)) };
+            return { makeUniqueRef<AST::MakePointerExpression>(location, WTFMove(*next), AST::AddressEscapeMode::Escapes) };
         case Token::Type::At:
-            return { makeUniqueRef<AST::MakeArrayReferenceExpression>(location, WTFMove(*next)) };
+            return { makeUniqueRef<AST::MakeArrayReferenceExpression>(location, WTFMove(*next), AST::AddressEscapeMode::Escapes) };
         default:
             ASSERT(prefix->type == Token::Type::Star);
             return { makeUniqueRef<AST::DereferenceExpression>(location, WTFMove(*next)) };

Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.h (248302 => 248303)


--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.h	2019-08-06 17:34:27 UTC (rev 248302)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.h	2019-08-06 17:37:08 UTC (rev 248303)
@@ -27,71 +27,11 @@
 
 #if ENABLE(WEBGPU)
 
-#include "WHLSLArrayReferenceType.h"
-#include "WHLSLArrayType.h"
-#include "WHLSLAssignmentExpression.h"
-#include "WHLSLBaseFunctionAttribute.h"
-#include "WHLSLBaseSemantic.h"
-#include "WHLSLBlock.h"
-#include "WHLSLBooleanLiteral.h"
-#include "WHLSLBreak.h"
-#include "WHLSLBuiltInSemantic.h"
-#include "WHLSLCallExpression.h"
-#include "WHLSLCommaExpression.h"
-#include "WHLSLConstantExpression.h"
-#include "WHLSLContinue.h"
-#include "WHLSLDereferenceExpression.h"
-#include "WHLSLDoWhileLoop.h"
-#include "WHLSLDotExpression.h"
-#include "WHLSLEffectfulExpressionStatement.h"
-#include "WHLSLEnumerationDefinition.h"
-#include "WHLSLEnumerationMember.h"
+#include "WHLSLAST.h"
 #include "WHLSLError.h"
-#include "WHLSLExpression.h"
-#include "WHLSLFallthrough.h"
-#include "WHLSLFloatLiteral.h"
-#include "WHLSLForLoop.h"
-#include "WHLSLFunctionAttribute.h"
-#include "WHLSLFunctionDeclaration.h"
-#include "WHLSLFunctionDefinition.h"
-#include "WHLSLIfStatement.h"
-#include "WHLSLIndexExpression.h"
-#include "WHLSLIntegerLiteral.h"
 #include "WHLSLLexer.h"
-#include "WHLSLLogicalExpression.h"
-#include "WHLSLLogicalNotExpression.h"
-#include "WHLSLMakeArrayReferenceExpression.h"
-#include "WHLSLMakePointerExpression.h"
-#include "WHLSLNativeFunctionDeclaration.h"
-#include "WHLSLNativeTypeDeclaration.h"
-#include "WHLSLNullLiteral.h"
-#include "WHLSLNumThreadsFunctionAttribute.h"
-#include "WHLSLPointerType.h"
+#include "WHLSLParsingMode.h"
 #include "WHLSLProgram.h"
-#include "WHLSLPropertyAccessExpression.h"
-#include "WHLSLQualifier.h"
-#include "WHLSLReadModifyWriteExpression.h"
-#include "WHLSLReferenceType.h"
-#include "WHLSLResourceSemantic.h"
-#include "WHLSLReturn.h"
-#include "WHLSLSemantic.h"
-#include "WHLSLSpecializationConstantSemantic.h"
-#include "WHLSLStageInOutSemantic.h"
-#include "WHLSLStatement.h"
-#include "WHLSLStructureDefinition.h"
-#include "WHLSLStructureElement.h"
-#include "WHLSLSwitchCase.h"
-#include "WHLSLSwitchStatement.h"
-#include "WHLSLTernaryExpression.h"
-#include "WHLSLType.h"
-#include "WHLSLTypeArgument.h"
-#include "WHLSLTypeDefinition.h"
-#include "WHLSLTypeReference.h"
-#include "WHLSLUnsignedIntegerLiteral.h"
-#include "WHLSLVariableDeclaration.h"
-#include "WHLSLVariableDeclarationsStatement.h"
-#include "WHLSLVariableReference.h"
-#include "WHLSLWhileLoop.h"
 #include <wtf/Expected.h>
 #include <wtf/Optional.h>
 #include <wtf/PrintStream.h>
@@ -102,13 +42,8 @@
 
 class Parser {
 public:
-    enum class Mode {
-        StandardLibrary,
-        User
-    };
+    Expected<void, Error> parse(Program&, StringView, ParsingMode);
 
-    Expected<void, Error> parse(Program&, StringView, Mode);
-
 private:
     // FIXME: We should not need this
     // https://bugs.webkit.org/show_bug.cgi?id=198357
@@ -232,7 +167,7 @@
     Expected<UniqueRef<AST::_expression_>, Error> parseTerm();
 
     Lexer m_lexer;
-    Mode m_mode;
+    ParsingMode m_mode;
 };
 
 } // namespace WHLSL

Copied: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParsingMode.h (from rev 248302, trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h) (0 => 248303)


--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParsingMode.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParsingMode.h	2019-08-06 17:37:08 UTC (rev 248303)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEBGPU)
+
+namespace WebCore {
+
+namespace WHLSL {
+
+enum class ParsingMode : uint8_t {
+    StandardLibrary,
+    User
+};
+
+} // namespace WHLSL
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)

Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPrepare.cpp (248302 => 248303)


--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPrepare.cpp	2019-08-06 17:34:27 UTC (rev 248302)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPrepare.cpp	2019-08-06 17:37:08 UTC (rev 248303)
@@ -157,7 +157,7 @@
 
     {
         PhaseTimer phaseTimer("parse", phaseTimes);
-        auto parseResult = parser.parse(program, whlslSource, Parser::Mode::User);
+        auto parseResult = parser.parse(program, whlslSource, ParsingMode::User);
         if (!parseResult) {
             if (dumpPassFailure)
                 dataLogLn("failed to parse the program: ", Lexer::errorString(whlslSource, parseResult.error()));

Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp (248302 => 248303)


--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp	2019-08-06 17:34:27 UTC (rev 248302)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp	2019-08-06 17:37:08 UTC (rev 248303)
@@ -77,12 +77,14 @@
 
     void visit(AST::MakePointerExpression& makePointerExpression) override
     {
-        escapeVariableUse(makePointerExpression.leftValue());
+        if (makePointerExpression.mightEscape())
+            escapeVariableUse(makePointerExpression.leftValue());
     }
 
     void visit(AST::MakeArrayReferenceExpression& makeArrayReferenceExpression) override
     {
-        escapeVariableUse(makeArrayReferenceExpression.leftValue());
+        if (makeArrayReferenceExpression.mightEscape())
+            escapeVariableUse(makeArrayReferenceExpression.leftValue());
     }
 
     HashMap<AST::VariableDeclaration*, String> takeEscapedVariables() { return WTFMove(m_escapedVariables); }
@@ -133,6 +135,9 @@
 
     void visit(AST::FunctionDefinition& functionDefinition) override
     {
+        if (functionDefinition.parsingMode() == ParsingMode::StandardLibrary)
+            return;
+
         bool isEntryPoint = !!functionDefinition.entryPointType();
         if (isEntryPoint) {
             auto structVariableDeclaration = makeUniqueRef<AST::VariableDeclaration>(functionDefinition.codeLocation(), AST::Qualifiers(),
@@ -146,7 +151,7 @@
             structVariableDeclarations.append(WTFMove(structVariableDeclaration));
             auto structDeclarationStatement = makeUniqueRef<AST::VariableDeclarationsStatement>(functionDefinition.codeLocation(), WTFMove(structVariableDeclarations));
 
-            auto makePointerExpression = std::make_unique<AST::MakePointerExpression>(functionDefinition.codeLocation(), WTFMove(structVariableReference));
+            auto makePointerExpression = std::make_unique<AST::MakePointerExpression>(functionDefinition.codeLocation(), WTFMove(structVariableReference), AST::AddressEscapeMode::DoesNotEscape);
             makePointerExpression->setType(m_pointerToStructType.copyRef());
             makePointerExpression->setTypeAnnotation(AST::RightValue());
 
@@ -190,7 +195,7 @@
 
         // This works because it's illegal to call an entrypoint. Therefore, we can only
         // call functions where we've already appended this struct as its final parameter.
-        if (!callExpression.function().isNativeFunctionDeclaration())
+        if (!callExpression.function().isNativeFunctionDeclaration() && callExpression.function().parsingMode() != ParsingMode::StandardLibrary)
             callExpression.arguments().append(makeStructVariableReference());
     }
 

Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp (248302 => 248303)


--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp	2019-08-06 17:34:27 UTC (rev 248302)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp	2019-08-06 17:37:08 UTC (rev 248303)
@@ -98,13 +98,19 @@
 };
 
 template <typename ExpressionConstructor, typename TypeConstructor>
-static Optional<AnderCallArgumentResult> wrapAnderCallArgument(UniqueRef<AST::_expression_>& _expression_, Ref<AST::UnnamedType> baseType, bool anderFunction, bool threadAnderFunction)
+static Optional<AnderCallArgumentResult> wrapAnderCallArgument(UniqueRef<AST::_expression_>& _expression_, Ref<AST::UnnamedType> baseType, AST::FunctionDeclaration* anderFunction, AST::FunctionDeclaration* threadAnderFunction)
 {
+    auto functionEscapeMode = [] (AST::FunctionDeclaration& functionDeclaration) {
+        if (functionDeclaration.isNativeFunctionDeclaration() || functionDeclaration.parsingMode() == ParsingMode::StandardLibrary)
+            return AST::AddressEscapeMode::DoesNotEscape;
+        return AST::AddressEscapeMode::Escapes;
+    };
+
     auto location = _expression_->codeLocation();
     if (auto addressSpace = _expression_->typeAnnotation().leftAddressSpace()) {
         if (!anderFunction)
             return WTF::nullopt;
-        auto makeArrayReference = makeUniqueRef<ExpressionConstructor>(location, WTFMove(_expression_));
+        auto makeArrayReference = makeUniqueRef<ExpressionConstructor>(location, WTFMove(_expression_), functionEscapeMode(*anderFunction));
         makeArrayReference->setType(TypeConstructor::create(location, *addressSpace, WTFMove(baseType)));
         makeArrayReference->setTypeAnnotation(AST::RightValue());
         return {{ WTFMove(makeArrayReference), WTF::nullopt, WhichAnder::Ander }};
@@ -124,7 +130,7 @@
         variableReference2->setType(baseType.copyRef());
         variableReference2->setTypeAnnotation(AST::LeftValue { AST::AddressSpace::Thread });
 
-        auto _expression_ = makeUniqueRef<ExpressionConstructor>(location, WTFMove(variableReference2));
+        auto _expression_ = makeUniqueRef<ExpressionConstructor>(location, WTFMove(variableReference2), functionEscapeMode(*threadAnderFunction));
         auto resultType = TypeConstructor::create(location, AST::AddressSpace::Thread, WTFMove(baseType));
         _expression_->setType(resultType.copyRef());
         _expression_->setTypeAnnotation(AST::RightValue());
@@ -140,7 +146,7 @@
     return WTF::nullopt;
 }
 
-static Optional<AnderCallArgumentResult> anderCallArgument(UniqueRef<AST::_expression_>& _expression_, bool anderFunction, bool threadAnderFunction)
+static Optional<AnderCallArgumentResult> anderCallArgument(UniqueRef<AST::_expression_>& _expression_, AST::FunctionDeclaration* anderFunction, AST::FunctionDeclaration* threadAnderFunction)
 {
     if (!anderFunction && !threadAnderFunction)
         return WTF::nullopt;
@@ -172,7 +178,7 @@
     if (relevantAnder) {
         // *operator&.foo(&v) = newValue
         auto leftValue = leftValueFactory();
-        auto argument = anderCallArgument(leftValue, true, true);
+        auto argument = anderCallArgument(leftValue, relevantAnder, relevantAnder);
         ASSERT(argument);
         ASSERT(!argument->variableDeclaration);
         ASSERT(argument->whichAnder == WhichAnder::Ander);
@@ -233,7 +239,7 @@
     if (relevantAnder) {
         // *operator&.foo(&v)
         auto leftValue = leftValueFactory();
-        auto argument = anderCallArgument(leftValue, true, true);
+        auto argument = anderCallArgument(leftValue, relevantAnder, relevantAnder);
         ASSERT(argument);
         ASSERT(!argument->variableDeclaration);
         ASSERT(argument->whichAnder == WhichAnder::Ander);
@@ -362,7 +368,7 @@
 
     // Step 1:
     {
-        auto makePointerExpression = makeUniqueRef<AST::MakePointerExpression>(innerLeftExpression.codeLocation(), WTFMove(leftExpression));
+        auto makePointerExpression = makeUniqueRef<AST::MakePointerExpression>(innerLeftExpression.codeLocation(), WTFMove(leftExpression), AST::AddressEscapeMode::DoesNotEscape);
         makePointerExpression->setType(AST::PointerType::create(innerLeftExpression.codeLocation(), *innerLeftExpression.typeAnnotation().leftAddressSpace(), innerLeftExpression.resolvedType()));
         makePointerExpression->setTypeAnnotation(AST::RightValue());
 
@@ -559,7 +565,7 @@
         Vector<UniqueRef<AST::_expression_>> expressions;
 
         {
-            auto makePointerExpression = makeUniqueRef<AST::MakePointerExpression>(leftValueLocation, readModifyWriteExpression.takeLeftValue());
+            auto makePointerExpression = makeUniqueRef<AST::MakePointerExpression>(leftValueLocation, readModifyWriteExpression.takeLeftValue(), AST::AddressEscapeMode::DoesNotEscape);
             makePointerExpression->setType(pointerType.copyRef());
             makePointerExpression->setTypeAnnotation(AST::RightValue());
 

Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.cpp (248302 => 248303)


--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.cpp	2019-08-06 17:34:27 UTC (rev 248302)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLStandardLibraryUtilities.cpp	2019-08-06 17:37:08 UTC (rev 248303)
@@ -79,7 +79,7 @@
 {
     static NeverDestroyed<String> standardLibrary(decompressAndDecodeStandardLibrary());
     if (parseFullStandardLibrary) {
-        auto parseResult = parser.parse(program, standardLibrary.get(), Parser::Mode::StandardLibrary);
+        auto parseResult = parser.parse(program, standardLibrary.get(), ParsingMode::StandardLibrary);
         if (!parseResult) {
             dataLogLn("failed to parse the (full) standard library: ", Lexer::errorString(StringView(standardLibrary), parseResult.error()));
             ASSERT_NOT_REACHED();
@@ -90,7 +90,7 @@
     static NeverDestroyed<HashMap<String, SubstringLocation>> standardLibraryFunctionMap(computeStandardLibraryFunctionMap());
 
     auto stringView = StringView(standardLibrary.get()).substring(0, firstFunctionOffsetInStandardLibrary());
-    auto parseResult = parser.parse(program, stringView, Parser::Mode::StandardLibrary);
+    auto parseResult = parser.parse(program, stringView, ParsingMode::StandardLibrary);
     ASSERT_UNUSED(parseResult, parseResult);
 
     NameFinder nameFinder;
@@ -110,7 +110,7 @@
             if (iterator == standardLibraryFunctionMap.get().end())
                 continue;
             auto stringView = StringView(standardLibrary.get()).substring(iterator->value.start, iterator->value.end - iterator->value.start);
-            auto parseResult = parser.parse(program, stringView, Parser::Mode::StandardLibrary);
+            auto parseResult = parser.parse(program, stringView, ParsingMode::StandardLibrary);
             if (!parseResult) {
                 dataLogLn("failed to parse the (partial) standard library: ", Lexer::errorString(stringView, parseResult.error()));
                 ASSERT_NOT_REACHED();

Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp (248302 => 248303)


--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp	2019-08-06 17:34:27 UTC (rev 248302)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp	2019-08-06 17:37:08 UTC (rev 248303)
@@ -69,7 +69,7 @@
         auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(location, AST::Qualifiers(), &arrayType.get(), String(), nullptr, nullptr);
         AST::VariableDeclarations parameters;
         parameters.append(WTFMove(variableDeclaration));
-        AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(location, AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(location, program.intrinsics().uintType()), "operator.length"_str, WTFMove(parameters), nullptr, isOperator));
+        AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(location, AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(location, program.intrinsics().uintType()), "operator.length"_str, WTFMove(parameters), nullptr, isOperator, ParsingMode::StandardLibrary));
         if (!program.append(WTFMove(nativeFunctionDeclaration)))
             return makeUnexpected(Error("Cannot synthesize operator.length for array type."));
     }

Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp (248302 => 248303)


--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp	2019-08-06 17:34:27 UTC (rev 248302)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp	2019-08-06 17:37:08 UTC (rev 248303)
@@ -162,11 +162,11 @@
             auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(location, AST::Qualifiers(), &unnamedType, String(), nullptr, nullptr);
             AST::VariableDeclarations parameters;
             parameters.append(WTFMove(variableDeclaration));
-            AST::NativeFunctionDeclaration copyConstructor(AST::FunctionDeclaration(location, AST::AttributeBlock(), WTF::nullopt, unnamedType, "operator cast"_str, WTFMove(parameters), nullptr, isOperator));
+            AST::NativeFunctionDeclaration copyConstructor(AST::FunctionDeclaration(location, AST::AttributeBlock(), WTF::nullopt, unnamedType, "operator cast"_str, WTFMove(parameters), nullptr, isOperator, ParsingMode::StandardLibrary));
             program.append(WTFMove(copyConstructor));
         }
 
-        AST::NativeFunctionDeclaration defaultConstructor(AST::FunctionDeclaration(location, AST::AttributeBlock(), WTF::nullopt, unnamedType, "operator cast"_str, AST::VariableDeclarations(), nullptr, isOperator));
+        AST::NativeFunctionDeclaration defaultConstructor(AST::FunctionDeclaration(location, AST::AttributeBlock(), WTF::nullopt, unnamedType, "operator cast"_str, AST::VariableDeclarations(), nullptr, isOperator, ParsingMode::StandardLibrary));
         if (!program.append(WTFMove(defaultConstructor)))
             return makeUnexpected(Error("Could not synthesize default constructor"));
     }
@@ -182,7 +182,7 @@
         auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(location, AST::Qualifiers(), AST::TypeReference::wrap(location, namedType.get()), String(), nullptr, nullptr);
         AST::VariableDeclarations parameters;
         parameters.append(WTFMove(variableDeclaration));
-        AST::NativeFunctionDeclaration copyConstructor(AST::FunctionDeclaration(location, AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(location, namedType.get()), "operator cast"_str, WTFMove(parameters), nullptr, isOperator));
+        AST::NativeFunctionDeclaration copyConstructor(AST::FunctionDeclaration(location, AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(location, namedType.get()), "operator cast"_str, WTFMove(parameters), nullptr, isOperator, ParsingMode::StandardLibrary));
         program.append(WTFMove(copyConstructor));
 
         if (is<AST::NativeTypeDeclaration>(static_cast<AST::NamedType&>(namedType))) {
@@ -190,7 +190,7 @@
             if (nativeTypeDeclaration.isOpaqueType())
                 continue;
         }
-        AST::NativeFunctionDeclaration defaultConstructor(AST::FunctionDeclaration(location, AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(location, namedType.get()), "operator cast"_str, AST::VariableDeclarations(), nullptr, isOperator));
+        AST::NativeFunctionDeclaration defaultConstructor(AST::FunctionDeclaration(location, AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(location, namedType.get()), "operator cast"_str, AST::VariableDeclarations(), nullptr, isOperator, ParsingMode::StandardLibrary));
         if (!program.append(WTFMove(defaultConstructor)))
             return makeUnexpected(Error("Could not synthesize default constructor"));
     }

Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp (248302 => 248303)


--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp	2019-08-06 17:34:27 UTC (rev 248302)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp	2019-08-06 17:37:08 UTC (rev 248303)
@@ -47,7 +47,7 @@
             AST::VariableDeclarations parameters;
             parameters.append(WTFMove(variableDeclaration1));
             parameters.append(WTFMove(variableDeclaration2));
-            AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(location, AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(location, program.intrinsics().boolType()), "operator=="_str, WTFMove(parameters), nullptr, isOperator));
+            AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(location, AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(location, program.intrinsics().boolType()), "operator=="_str, WTFMove(parameters), nullptr, isOperator, ParsingMode::StandardLibrary));
             if (!program.append(WTFMove(nativeFunctionDeclaration)))
                 return makeUnexpected(Error("Cannot create operator== for enum type."));
         }
@@ -56,7 +56,7 @@
             auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(location, AST::Qualifiers(), AST::TypeReference::wrap(location, enumerationDefinition), String(), nullptr, nullptr);
             AST::VariableDeclarations parameters;
             parameters.append(WTFMove(variableDeclaration));
-            AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(location, AST::AttributeBlock(), WTF::nullopt, enumerationDefinition->type(), "operator.value"_str, WTFMove(parameters), nullptr, isOperator));
+            AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(location, AST::AttributeBlock(), WTF::nullopt, enumerationDefinition->type(), "operator.value"_str, WTFMove(parameters), nullptr, isOperator, ParsingMode::StandardLibrary));
             if (!program.append(WTFMove(nativeFunctionDeclaration)))
                 return makeUnexpected(Error("Cannot create operator.value for enum type."));
         }
@@ -65,7 +65,7 @@
             auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(location, AST::Qualifiers(), AST::TypeReference::wrap(location, enumerationDefinition), String(), nullptr, nullptr);
             AST::VariableDeclarations parameters;
             parameters.append(WTFMove(variableDeclaration));
-            AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(location, AST::AttributeBlock(), WTF::nullopt, enumerationDefinition->type(), "operator cast"_str, WTFMove(parameters), nullptr, isOperator));
+            AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(location, AST::AttributeBlock(), WTF::nullopt, enumerationDefinition->type(), "operator cast"_str, WTFMove(parameters), nullptr, isOperator, ParsingMode::StandardLibrary));
             if (!program.append(WTFMove(nativeFunctionDeclaration)))
                 return makeUnexpected(Error("Cannot create copy constructor for enum type."));
         }
@@ -74,7 +74,7 @@
             auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(location, AST::Qualifiers(), &enumerationDefinition->type(), String(), nullptr, nullptr);
             AST::VariableDeclarations parameters;
             parameters.append(WTFMove(variableDeclaration));
-            AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(location, AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(location, enumerationDefinition), "operator cast"_str, WTFMove(parameters), nullptr, isOperator));
+            AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(location, AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(location, enumerationDefinition), "operator cast"_str, WTFMove(parameters), nullptr, isOperator, ParsingMode::StandardLibrary));
             if (!program.append(WTFMove(nativeFunctionDeclaration)))
                 return makeUnexpected(Error("Cannot create 'operator cast' for enum type."));
         }

Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp (248302 => 248303)


--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp	2019-08-06 17:34:27 UTC (rev 248302)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp	2019-08-06 17:37:08 UTC (rev 248303)
@@ -51,7 +51,7 @@
                 AST::VariableDeclarations parameters;
                 parameters.append(WTFMove(variableDeclaration));
                 auto returnType = AST::PointerType::create(structureElement.codeLocation(), addressSpace, structureElement.type());
-                AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(structureElement.codeLocation(), AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), makeString("operator&.", structureElement.name()), WTFMove(parameters), nullptr, isOperator));
+                AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(structureElement.codeLocation(), AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), makeString("operator&.", structureElement.name()), WTFMove(parameters), nullptr, isOperator, ParsingMode::StandardLibrary));
                 return nativeFunctionDeclaration;
             };
             if (!program.append(createAnder(AST::AddressSpace::Constant))

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (248302 => 248303)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-08-06 17:34:27 UTC (rev 248302)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-08-06 17:37:08 UTC (rev 248303)
@@ -8319,6 +8319,8 @@
 		522E1A192297D6D400E5D36A /* WHLSLPreserveVariableLifetimes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLPreserveVariableLifetimes.h; sourceTree = "<group>"; };
 		526724F11CB2FDF60075974D /* TextTrackRepresentationCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TextTrackRepresentationCocoa.mm; sourceTree = "<group>"; };
 		526724F21CB2FDF60075974D /* TextTrackRepresentationCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextTrackRepresentationCocoa.h; sourceTree = "<group>"; };
+		52914C2A22F93E4E00578150 /* WHLSLParsingMode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLParsingMode.h; sourceTree = "<group>"; };
+		52914C2C22F93E5D00578150 /* WHLSLAddressEscapeMode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLAddressEscapeMode.h; sourceTree = "<group>"; };
 		52B0D4BD1C57FD1E0077CE53 /* PlatformView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformView.h; sourceTree = "<group>"; };
 		52B0D4BF1C57FD660077CE53 /* VideoFullscreenChangeObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenChangeObserver.h; sourceTree = "<group>"; };
 		52B0D4C11C57FF910077CE53 /* VideoFullscreenInterfaceMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenInterfaceMac.h; sourceTree = "<group>"; };
@@ -17055,6 +17057,7 @@
 			isa = PBXGroup;
 			children = (
 				1C840B9021EC30F900D0500D /* WHLSLAddressSpace.h */,
+				52914C2C22F93E5D00578150 /* WHLSLAddressEscapeMode.h */,
 				C21BF72521CD89E200227979 /* WHLSLArrayReferenceType.h */,
 				C21BF70921CD89CA00227979 /* WHLSLArrayType.h */,
 				C21BF73021CD89ED00227979 /* WHLSLAssignmentExpression.h */,
@@ -25526,6 +25529,7 @@
 				C234A98C21E8883E003C984D /* WHLSLNameResolver.h */,
 				C21BF73721CD8A0200227979 /* WHLSLParser.cpp */,
 				C21BF73821CD8A0300227979 /* WHLSLParser.h */,
+				52914C2A22F93E4E00578150 /* WHLSLParsingMode.h */,
 				C24A57AF21FAD53F004C6DD1 /* WHLSLPipelineDescriptor.h */,
 				C24A57BA21FEAFEA004C6DD1 /* WHLSLPrepare.cpp */,
 				C24A57BB21FEAFEA004C6DD1 /* WHLSLPrepare.h */,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to