Diff
Modified: trunk/Source/WebCore/ChangeLog (247109 => 247110)
--- trunk/Source/WebCore/ChangeLog 2019-07-03 21:59:07 UTC (rev 247109)
+++ trunk/Source/WebCore/ChangeLog 2019-07-03 22:11:36 UTC (rev 247110)
@@ -1,5 +1,57 @@
2019-07-03 Robin Morisset <[email protected]>
+ [WHLSL] "Semantic" should be held by a unique_ptr, not an Optional
+ https://bugs.webkit.org/show_bug.cgi?id=199462
+
+ Reviewed by Myles C. Maxfield.
+
+ Most StructureElement, FunctionDeclaration and (especially) VariableDeclaration don't have a 'Semantic' field.
+ Using an Optional<Semantic> to represent this is a major memory waste, as Semantic is 56 bytes, so Optional<Semantic> is 64 bytes!
+ Putting one level of indirection through a unique_ptr thus saves 56 bytes for each VariableDeclaration (and FunctionDeclaration and StructureElement) that does not have a Semantic,
+ at the low cost of one pointer dereference when accessing the field for those that have one.
+
+ This patch also reorders the fields of FunctionDefinition to save another 8 bytes.
+
+ No new tests as there is no intended functional change.
+
+ * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h:
+ (WebCore::WHLSL::AST::FunctionDeclaration::FunctionDeclaration):
+ (WebCore::WHLSL::AST::FunctionDeclaration::semantic):
+ * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:
+ (WebCore::WHLSL::AST::ReadModifyWriteExpression::ReadModifyWriteExpression):
+ * Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h:
+ (WebCore::WHLSL::AST::StructureElement::StructureElement):
+ (WebCore::WHLSL::AST::StructureElement::semantic):
+ * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h:
+ (WebCore::WHLSL::AST::VariableDeclaration::VariableDeclaration):
+ (WebCore::WHLSL::AST::VariableDeclaration::semantic):
+ * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
+ (WebCore::WHLSL::resolveWithOperatorAnderIndexer):
+ (WebCore::WHLSL::resolveWithOperatorLength):
+ (WebCore::WHLSL::resolveWithReferenceComparator):
+ * Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.cpp:
+ (WebCore::WHLSL::Gatherer::visit):
+ (WebCore::WHLSL::gatherEntryPointItems):
+ * Modules/webgpu/WHLSL/WHLSLParser.cpp:
+ (WebCore::WHLSL::Parser::parseSemantic):
+ * Modules/webgpu/WHLSL/WHLSLParser.h:
+ * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp:
+ (WebCore::WHLSL::preserveVariableLifetimes):
+ * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
+ (WebCore::WHLSL::wrapAnderCallArgument):
+ (WebCore::WHLSL::modify):
+ (WebCore::WHLSL::PropertyResolver::visit):
+ * 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):
+
+2019-07-03 Robin Morisset <[email protected]>
+
[WHLSL] WHLSL::AST::Node is useless
https://bugs.webkit.org/show_bug.cgi?id=199391
Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h (247109 => 247110)
--- trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h 2019-07-03 21:59:07 UTC (rev 247109)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h 2019-07-03 22:11:36 UTC (rev 247110)
@@ -44,15 +44,15 @@
class FunctionDeclaration {
public:
- FunctionDeclaration(Lexer::Token&& origin, AttributeBlock&& attributeBlock, Optional<EntryPointType> entryPointType, UniqueRef<UnnamedType>&& type, String&& name, VariableDeclarations&& parameters, Optional<Semantic>&& semantic, bool isOperator)
+ FunctionDeclaration(Lexer::Token&& origin, AttributeBlock&& attributeBlock, Optional<EntryPointType> entryPointType, UniqueRef<UnnamedType>&& type, String&& name, VariableDeclarations&& parameters, std::unique_ptr<Semantic>&& semantic, bool isOperator)
: m_origin(WTFMove(origin))
, m_attributeBlock(WTFMove(attributeBlock))
, m_entryPointType(entryPointType)
+ , m_isOperator(WTFMove(isOperator))
, m_type(WTFMove(type))
, m_name(WTFMove(name))
, m_parameters(WTFMove(parameters))
, m_semantic(WTFMove(semantic))
- , m_isOperator(WTFMove(isOperator))
{
}
@@ -73,7 +73,7 @@
bool isCast() const { return m_name == "operator cast"; }
const VariableDeclarations& parameters() const { return m_parameters; }
VariableDeclarations& parameters() { return m_parameters; }
- Optional<Semantic>& semantic() { return m_semantic; }
+ Semantic* semantic() { return m_semantic.get(); }
bool isOperator() const { return m_isOperator; }
Lexer::Token origin() { return m_origin; }
@@ -81,11 +81,11 @@
Lexer::Token m_origin;
AttributeBlock m_attributeBlock;
Optional<EntryPointType> m_entryPointType;
+ bool m_isOperator;
UniqueRef<UnnamedType> m_type;
String m_name;
VariableDeclarations m_parameters;
- Optional<Semantic> m_semantic;
- bool m_isOperator;
+ std::unique_ptr<Semantic> m_semantic;
};
} // namespace AST
Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h (247109 => 247110)
--- trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h 2019-07-03 21:59:07 UTC (rev 247109)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h 2019-07-03 22:11:36 UTC (rev 247110)
@@ -118,8 +118,8 @@
ReadModifyWriteExpression(Lexer::Token&& origin, UniqueRef<_expression_> leftValue)
: _expression_(Lexer::Token(origin))
, m_leftValue(WTFMove(leftValue))
- , m_oldValue(makeUniqueRef<VariableDeclaration>(Lexer::Token(origin), Qualifiers(), WTF::nullopt, String(), WTF::nullopt, nullptr))
- , m_newValue(makeUniqueRef<VariableDeclaration>(WTFMove(origin), Qualifiers(), WTF::nullopt, String(), WTF::nullopt, nullptr))
+ , m_oldValue(makeUniqueRef<VariableDeclaration>(Lexer::Token(origin), Qualifiers(), WTF::nullopt, String(), nullptr, nullptr))
+ , m_newValue(makeUniqueRef<VariableDeclaration>(WTFMove(origin), Qualifiers(), WTF::nullopt, String(), nullptr, nullptr))
{
}
Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h (247109 => 247110)
--- trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h 2019-07-03 21:59:07 UTC (rev 247109)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStructureElement.h 2019-07-03 22:11:36 UTC (rev 247110)
@@ -41,7 +41,7 @@
class StructureElement {
public:
- StructureElement(Lexer::Token&& origin, Qualifiers&& qualifiers, UniqueRef<UnnamedType>&& type, String&& name, Optional<Semantic> semantic)
+ StructureElement(Lexer::Token&& origin, Qualifiers&& qualifiers, UniqueRef<UnnamedType>&& type, String&& name, std::unique_ptr<Semantic>&& semantic)
: m_origin(WTFMove(origin))
, m_qualifiers(WTFMove(qualifiers))
, m_type(WTFMove(type))
@@ -58,7 +58,7 @@
const Lexer::Token& origin() const { return m_origin; }
UnnamedType& type() { return m_type; }
const String& name() { return m_name; }
- Optional<Semantic>& semantic() { return m_semantic; }
+ Semantic* semantic() { return m_semantic.get(); }
private:
Lexer::Token m_origin;
@@ -65,7 +65,7 @@
Qualifiers m_qualifiers;
UniqueRef<UnnamedType> m_type;
String m_name;
- Optional<Semantic> m_semantic;
+ std::unique_ptr<Semantic> m_semantic;
};
using StructureElements = Vector<StructureElement>;
Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h (247109 => 247110)
--- trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h 2019-07-03 21:59:07 UTC (rev 247109)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h 2019-07-03 22:11:36 UTC (rev 247110)
@@ -47,7 +47,7 @@
class VariableDeclaration : public Value {
using Base = Value;
public:
- VariableDeclaration(Lexer::Token&& origin, Qualifiers&& qualifiers, Optional<UniqueRef<UnnamedType>>&& type, String&& name, Optional<Semantic>&& semantic, std::unique_ptr<_expression_>&& initializer)
+ VariableDeclaration(Lexer::Token&& origin, Qualifiers&& qualifiers, Optional<UniqueRef<UnnamedType>>&& type, String&& name, std::unique_ptr<Semantic>&& semantic, std::unique_ptr<_expression_>&& initializer)
: Base(WTFMove(origin))
, m_qualifiers(WTFMove(qualifiers))
, m_type(WTFMove(type))
@@ -74,7 +74,7 @@
}
const Optional<UniqueRef<UnnamedType>>& type() const { return m_type; }
UnnamedType* type() { return m_type ? &*m_type : nullptr; }
- Optional<Semantic>& semantic() { return m_semantic; }
+ Semantic* semantic() { return m_semantic.get(); }
_expression_* initializer() { return m_initializer.get(); }
bool isAnonymous() const { return m_name.isNull(); }
std::unique_ptr<_expression_> takeInitializer() { return WTFMove(m_initializer); }
@@ -89,7 +89,7 @@
Qualifiers m_qualifiers;
Optional<UniqueRef<UnnamedType>> m_type;
String m_name;
- Optional<Semantic> m_semantic;
+ std::unique_ptr<Semantic> m_semantic;
std::unique_ptr<_expression_> m_initializer;
};
Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp (247109 => 247110)
--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp 2019-07-03 21:59:07 UTC (rev 247109)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLChecker.cpp 2019-07-03 22:11:36 UTC (rev 247110)
@@ -122,9 +122,9 @@
const bool isOperator = true;
auto returnType = makeUniqueRef<AST::PointerType>(Lexer::Token(origin), firstArgument.addressSpace(), firstArgument.elementType().clone());
AST::VariableDeclarations parameters;
- parameters.append(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(origin), AST::Qualifiers(), firstArgument.clone(), String(), WTF::nullopt, nullptr));
- parameters.append(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(origin), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(origin), intrinsics.uintType())), String(), WTF::nullopt, nullptr));
- return AST::NativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(origin), AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), String("operator&[]", String::ConstructFromLiteral), WTFMove(parameters), WTF::nullopt, isOperator));
+ parameters.append(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(origin), AST::Qualifiers(), firstArgument.clone(), String(), nullptr, nullptr));
+ parameters.append(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(origin), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(origin), intrinsics.uintType())), String(), nullptr, nullptr));
+ return AST::NativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(origin), AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), String("operator&[]", String::ConstructFromLiteral), WTFMove(parameters), nullptr, isOperator));
}
static AST::NativeFunctionDeclaration resolveWithOperatorLength(Lexer::Token origin, AST::UnnamedType& firstArgument, const Intrinsics& intrinsics)
@@ -132,8 +132,8 @@
const bool isOperator = true;
auto returnType = AST::TypeReference::wrap(Lexer::Token(origin), intrinsics.uintType());
AST::VariableDeclarations parameters;
- parameters.append(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(origin), AST::Qualifiers(), firstArgument.clone(), String(), WTF::nullopt, nullptr));
- return AST::NativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(origin), AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), String("operator.length", String::ConstructFromLiteral), WTFMove(parameters), WTF::nullopt, isOperator));
+ parameters.append(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(origin), AST::Qualifiers(), firstArgument.clone(), String(), nullptr, nullptr));
+ return AST::NativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(origin), AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), String("operator.length", String::ConstructFromLiteral), WTFMove(parameters), nullptr, isOperator));
}
static AST::NativeFunctionDeclaration resolveWithReferenceComparator(Lexer::Token origin, ResolvingType& firstArgument, ResolvingType& secondArgument, const Intrinsics& intrinsics)
@@ -153,9 +153,9 @@
}));
}));
AST::VariableDeclarations parameters;
- parameters.append(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(origin), AST::Qualifiers(), argumentType->clone(), String(), WTF::nullopt, nullptr));
- parameters.append(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(origin), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(WTFMove(argumentType)), String(), WTF::nullopt, nullptr));
- return AST::NativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(origin), AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), String("operator==", String::ConstructFromLiteral), WTFMove(parameters), WTF::nullopt, isOperator));
+ parameters.append(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(origin), AST::Qualifiers(), argumentType->clone(), String(), nullptr, nullptr));
+ parameters.append(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(origin), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(WTFMove(argumentType)), String(), nullptr, nullptr));
+ return AST::NativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(origin), AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), String("operator==", String::ConstructFromLiteral), WTFMove(parameters), nullptr, isOperator));
}
enum class Acceptability {
Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.cpp (247109 => 247110)
--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.cpp 2019-07-03 21:59:07 UTC (rev 247109)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.cpp 2019-07-03 22:11:36 UTC (rev 247110)
@@ -97,7 +97,7 @@
for (auto& structureElement : structureDefinition.structureElements()) {
if (structureElement.semantic())
- m_currentSemantic = &*structureElement.semantic();
+ m_currentSemantic = structureElement.semantic();
m_path.append(structureElement.name());
checkErrorAndVisit(structureElement);
m_path.takeLast();
@@ -149,7 +149,7 @@
{
ASSERT(!m_currentSemantic);
if (variableDeclaration.semantic())
- m_currentSemantic = &*variableDeclaration.semantic();
+ m_currentSemantic = variableDeclaration.semantic();
ASSERT(variableDeclaration.type());
m_path.append(variableDeclaration.name());
checkErrorAndVisit(*variableDeclaration.type());
@@ -174,7 +174,7 @@
if (inputGatherer.error())
return WTF::nullopt;
}
- Gatherer outputGatherer(intrinsics, functionDefinition.semantic() ? &*functionDefinition.semantic() : nullptr);
+ Gatherer outputGatherer(intrinsics, functionDefinition.semantic());
if (*functionDefinition.entryPointType() != AST::EntryPointType::Compute)
outputGatherer.checkErrorAndVisit(functionDefinition.type());
if (outputGatherer.error())
Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp (247109 => 247110)
--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp 2019-07-03 21:59:07 UTC (rev 247109)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp 2019-07-03 22:11:36 UTC (rev 247110)
@@ -688,28 +688,28 @@
return AST::StageInOutSemantic(WTFMove(*origin), *index);
}
-auto Parser::parseSemantic() -> Expected<Optional<AST::Semantic>, Error>
+auto Parser::parseSemantic() -> Expected<std::unique_ptr<AST::Semantic>, Error>
{
if (!tryType(Lexer::Token::Type::Colon))
- return { WTF::nullopt };
+ return { nullptr };
PEEK(token);
switch (token->type) {
case Lexer::Token::Type::Attribute: {
PARSE(result, StageInOutSemantic);
- return { AST::Semantic(WTFMove(*result)) };
+ return { std::make_unique<AST::Semantic>(WTFMove(*result)) };
}
case Lexer::Token::Type::Specialized: {
PARSE(result, SpecializationConstantSemantic);
- return { AST::Semantic(WTFMove(*result)) };
+ return { std::make_unique<AST::Semantic>(WTFMove(*result)) };
}
case Lexer::Token::Type::Register: {
PARSE(result, ResourceSemantic);
- return { AST::Semantic(WTFMove(*result)) };
+ return { std::make_unique<AST::Semantic>(WTFMove(*result)) };
}
default: {
PARSE(result, BuiltInSemantic);
- return { AST::Semantic(WTFMove(*result)) };
+ return { std::make_unique<AST::Semantic>(WTFMove(*result)) };
}
}
}
Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.h (247109 => 247110)
--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.h 2019-07-03 21:59:07 UTC (rev 247109)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.h 2019-07-03 22:11:36 UTC (rev 247110)
@@ -174,7 +174,7 @@
Expected<AST::ResourceSemantic, Error> parseResourceSemantic();
Expected<AST::SpecializationConstantSemantic, Error> parseSpecializationConstantSemantic();
Expected<AST::StageInOutSemantic, Error> parseStageInOutSemantic();
- Expected<Optional<AST::Semantic>, Error> parseSemantic();
+ Expected<std::unique_ptr<AST::Semantic>, Error> parseSemantic();
AST::Qualifiers parseQualifiers();
Expected<AST::StructureElement, Error> parseStructureElement();
Expected<AST::StructureDefinition, Error> parseStructureDefinition();
Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp (247109 => 247110)
--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp 2019-07-03 21:59:07 UTC (rev 247109)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp 2019-07-03 22:11:36 UTC (rev 247110)
@@ -135,7 +135,7 @@
bool isEntryPoint = !!functionDefinition.entryPointType();
if (isEntryPoint) {
auto structVariableDeclaration = makeUniqueRef<AST::VariableDeclaration>(functionDefinition.origin(), AST::Qualifiers(),
- m_structType->clone(), String(), WTF::nullopt, nullptr);
+ m_structType->clone(), String(), nullptr, nullptr);
auto structVariableReference = makeUniqueRef<AST::VariableReference>(AST::VariableReference::wrap(structVariableDeclaration));
structVariableReference->setType(m_structType->clone());
@@ -150,7 +150,7 @@
makePointerExpression->setTypeAnnotation(AST::RightValue());
auto pointerDeclaration = makeUniqueRef<AST::VariableDeclaration>(functionDefinition.origin(), AST::Qualifiers(),
- m_pointerToStructType->clone(), "wrapper"_s, WTF::nullopt, WTFMove(makePointerExpression));
+ m_pointerToStructType->clone(), "wrapper"_s, nullptr, WTFMove(makePointerExpression));
m_structVariable = &pointerDeclaration;
AST::VariableDeclarations pointerVariableDeclarations;
@@ -161,7 +161,7 @@
functionDefinition.block().statements().insert(1, WTFMove(pointerDeclarationStatement));
} else {
auto pointerDeclaration = makeUniqueRef<AST::VariableDeclaration>(functionDefinition.origin(), AST::Qualifiers(),
- m_pointerToStructType->clone(), "wrapper"_s, WTF::nullopt, nullptr);
+ m_pointerToStructType->clone(), "wrapper"_s, nullptr, nullptr);
m_structVariable = &pointerDeclaration;
functionDefinition.parameters().append(WTFMove(pointerDeclaration));
}
@@ -256,7 +256,7 @@
for (auto& pair : escapedVariables) {
auto* variable = pair.key;
String name = pair.value;
- elements.append(AST::StructureElement { Lexer::Token(variable->origin()), { }, variable->type()->clone(), WTFMove(name), WTF::nullopt });
+ elements.append(AST::StructureElement { Lexer::Token(variable->origin()), { }, variable->type()->clone(), WTFMove(name), nullptr });
}
// Name of this doesn't matter, since we don't use struct names when
Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp (247109 => 247110)
--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp 2019-07-03 21:59:07 UTC (rev 247109)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp 2019-07-03 22:11:36 UTC (rev 247110)
@@ -109,7 +109,7 @@
}
if (threadAnderFunction) {
auto origin = _expression_->origin();
- auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(origin), AST::Qualifiers(), baseType->clone(), String(), WTF::nullopt, nullptr);
+ auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(origin), AST::Qualifiers(), baseType->clone(), String(), nullptr, nullptr);
auto variableReference1 = makeUniqueRef<AST::VariableReference>(AST::VariableReference::wrap(variableDeclaration));
variableReference1->setType(baseType->clone());
@@ -313,7 +313,7 @@
AST::_expression_& innerLeftExpression = leftExpression;
// Create "p" variable.
- auto pointerVariable = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(leftExpression->origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(makeUniqueRef<AST::PointerType>(Lexer::Token(leftExpression->origin()), *leftExpression->typeAnnotation().leftAddressSpace(), leftExpression->resolvedType().clone())), String(), WTF::nullopt, nullptr);
+ auto pointerVariable = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(leftExpression->origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(makeUniqueRef<AST::PointerType>(Lexer::Token(leftExpression->origin()), *leftExpression->typeAnnotation().leftAddressSpace(), leftExpression->resolvedType().clone())), String(), nullptr, nullptr);
// Create "q" and "r" variables.
Vector<UniqueRef<AST::VariableDeclaration>> intermediateVariables;
@@ -320,7 +320,7 @@
intermediateVariables.reserveInitialCapacity(chain.size() - 1);
for (size_t i = 1; i < chain.size(); ++i) {
auto& propertyAccessExpression = static_cast<AST::PropertyAccessExpression&>(chain[i]);
- intermediateVariables.uncheckedAppend(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(propertyAccessExpression.origin()), AST::Qualifiers(), propertyAccessExpression.resolvedType().clone(), String(), WTF::nullopt, nullptr));
+ intermediateVariables.uncheckedAppend(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(propertyAccessExpression.origin()), AST::Qualifiers(), propertyAccessExpression.resolvedType().clone(), String(), nullptr, nullptr));
}
// Consider a[foo()][b] = c;
@@ -351,7 +351,7 @@
continue;
}
auto& indexExpression = downcast<AST::IndexExpression>(propertyAccessExpression);
- indexVariables.uncheckedAppend(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(propertyAccessExpression.origin()), AST::Qualifiers(), indexExpression.indexExpression().resolvedType().clone(), String(), WTF::nullopt, nullptr));
+ indexVariables.uncheckedAppend(makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(propertyAccessExpression.origin()), AST::Qualifiers(), indexExpression.indexExpression().resolvedType().clone(), String(), nullptr, nullptr));
}
Vector<UniqueRef<AST::_expression_>> expressions;
@@ -563,7 +563,7 @@
auto baseType = readModifyWriteExpression.leftValue().resolvedType().clone();
auto pointerType = makeUniqueRef<AST::PointerType>(Lexer::Token(readModifyWriteExpression.leftValue().origin()), *readModifyWriteExpression.leftValue().typeAnnotation().leftAddressSpace(), baseType->clone());
- auto pointerVariable = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(readModifyWriteExpression.leftValue().origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(pointerType->clone()), String(), WTF::nullopt, nullptr);
+ auto pointerVariable = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(readModifyWriteExpression.leftValue().origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(pointerType->clone()), String(), nullptr, nullptr);
Vector<UniqueRef<AST::_expression_>> expressions;
Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp (247109 => 247110)
--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp 2019-07-03 21:59:07 UTC (rev 247109)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp 2019-07-03 22:11:36 UTC (rev 247110)
@@ -65,10 +65,10 @@
bool isOperator = true;
for (auto& arrayType : arrayTypes) {
- auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(arrayType.get().origin()), AST::Qualifiers(), arrayType.get().clone(), String(), WTF::nullopt, nullptr);
+ auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(arrayType.get().origin()), AST::Qualifiers(), arrayType.get().clone(), String(), nullptr, nullptr);
AST::VariableDeclarations parameters;
parameters.append(WTFMove(variableDeclaration));
- AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(arrayType.get().origin()), AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(Lexer::Token(arrayType.get().origin()), program.intrinsics().uintType()), "operator.length"_str, WTFMove(parameters), WTF::nullopt, isOperator));
+ AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(arrayType.get().origin()), AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(Lexer::Token(arrayType.get().origin()), program.intrinsics().uintType()), "operator.length"_str, WTFMove(parameters), nullptr, isOperator));
if (!program.append(WTFMove(nativeFunctionDeclaration)))
return false;
}
Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp (247109 => 247110)
--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp 2019-07-03 21:59:07 UTC (rev 247109)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp 2019-07-03 22:11:36 UTC (rev 247110)
@@ -157,13 +157,13 @@
for (auto& unnamedTypeKey : unnamedTypes) {
auto& unnamedType = unnamedTypeKey.unnamedType();
- auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(unnamedType.origin()), AST::Qualifiers(), unnamedType.clone(), String(), WTF::nullopt, nullptr);
+ auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(unnamedType.origin()), AST::Qualifiers(), unnamedType.clone(), String(), nullptr, nullptr);
AST::VariableDeclarations parameters;
parameters.append(WTFMove(variableDeclaration));
- AST::NativeFunctionDeclaration copyConstructor(AST::FunctionDeclaration(Lexer::Token(unnamedType.origin()), AST::AttributeBlock(), WTF::nullopt, unnamedType.clone(), "operator cast"_str, WTFMove(parameters), WTF::nullopt, isOperator));
+ AST::NativeFunctionDeclaration copyConstructor(AST::FunctionDeclaration(Lexer::Token(unnamedType.origin()), AST::AttributeBlock(), WTF::nullopt, unnamedType.clone(), "operator cast"_str, WTFMove(parameters), nullptr, isOperator));
program.append(WTFMove(copyConstructor));
- AST::NativeFunctionDeclaration defaultConstructor(AST::FunctionDeclaration(Lexer::Token(unnamedType.origin()), AST::AttributeBlock(), WTF::nullopt, unnamedType.clone(), "operator cast"_str, AST::VariableDeclarations(), WTF::nullopt, isOperator));
+ AST::NativeFunctionDeclaration defaultConstructor(AST::FunctionDeclaration(Lexer::Token(unnamedType.origin()), AST::AttributeBlock(), WTF::nullopt, unnamedType.clone(), "operator cast"_str, AST::VariableDeclarations(), nullptr, isOperator));
if (!program.append(WTFMove(defaultConstructor)))
return false;
}
@@ -174,10 +174,10 @@
if (is<AST::NativeTypeDeclaration>(static_cast<AST::NamedType&>(namedType)) && downcast<AST::NativeTypeDeclaration>(static_cast<AST::NamedType&>(namedType)).isAtomic())
continue;
- auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(namedType.get().origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(namedType.get().origin()), namedType.get())), String(), WTF::nullopt, nullptr);
+ auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(namedType.get().origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(namedType.get().origin()), namedType.get())), String(), nullptr, nullptr);
AST::VariableDeclarations parameters;
parameters.append(WTFMove(variableDeclaration));
- AST::NativeFunctionDeclaration copyConstructor(AST::FunctionDeclaration(Lexer::Token(namedType.get().origin()), AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(Lexer::Token(namedType.get().origin()), namedType.get()), "operator cast"_str, WTFMove(parameters), WTF::nullopt, isOperator));
+ AST::NativeFunctionDeclaration copyConstructor(AST::FunctionDeclaration(Lexer::Token(namedType.get().origin()), AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(Lexer::Token(namedType.get().origin()), namedType.get()), "operator cast"_str, WTFMove(parameters), nullptr, isOperator));
program.append(WTFMove(copyConstructor));
if (is<AST::NativeTypeDeclaration>(static_cast<AST::NamedType&>(namedType))) {
@@ -185,7 +185,7 @@
if (nativeTypeDeclaration.isOpaqueType())
continue;
}
- AST::NativeFunctionDeclaration defaultConstructor(AST::FunctionDeclaration(Lexer::Token(namedType.get().origin()), AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(Lexer::Token(namedType.get().origin()), namedType.get()), "operator cast"_str, AST::VariableDeclarations(), WTF::nullopt, isOperator));
+ AST::NativeFunctionDeclaration defaultConstructor(AST::FunctionDeclaration(Lexer::Token(namedType.get().origin()), AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(Lexer::Token(namedType.get().origin()), namedType.get()), "operator cast"_str, AST::VariableDeclarations(), nullptr, isOperator));
if (!program.append(WTFMove(defaultConstructor)))
return false;
}
Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp (247109 => 247110)
--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp 2019-07-03 21:59:07 UTC (rev 247109)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp 2019-07-03 22:11:36 UTC (rev 247110)
@@ -41,39 +41,39 @@
bool isOperator = true;
for (auto& enumerationDefinition : program.enumerationDefinitions()) {
{
- auto variableDeclaration1 = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(enumerationDefinition->origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), enumerationDefinition)), String(), WTF::nullopt, nullptr);
- auto variableDeclaration2 = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(enumerationDefinition->origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), enumerationDefinition)), String(), WTF::nullopt, nullptr);
+ auto variableDeclaration1 = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(enumerationDefinition->origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), enumerationDefinition)), String(), nullptr, nullptr);
+ auto variableDeclaration2 = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(enumerationDefinition->origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), enumerationDefinition)), String(), nullptr, nullptr);
AST::VariableDeclarations parameters;
parameters.append(WTFMove(variableDeclaration1));
parameters.append(WTFMove(variableDeclaration2));
- AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(enumerationDefinition->origin()), AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), program.intrinsics().boolType()), "operator=="_str, WTFMove(parameters), WTF::nullopt, isOperator));
+ AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(enumerationDefinition->origin()), AST::AttributeBlock(), WTF::nullopt, AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), program.intrinsics().boolType()), "operator=="_str, WTFMove(parameters), nullptr, isOperator));
if (!program.append(WTFMove(nativeFunctionDeclaration)))
return false;
}
{
- auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(enumerationDefinition->origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), enumerationDefinition)), String(), WTF::nullopt, nullptr);
+ auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(enumerationDefinition->origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), enumerationDefinition)), String(), nullptr, nullptr);
AST::VariableDeclarations parameters;
parameters.append(WTFMove(variableDeclaration));
- AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(enumerationDefinition->origin()), AST::AttributeBlock(), WTF::nullopt, enumerationDefinition->type().clone(), "operator.value"_str, WTFMove(parameters), WTF::nullopt, isOperator));
+ AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(enumerationDefinition->origin()), AST::AttributeBlock(), WTF::nullopt, enumerationDefinition->type().clone(), "operator.value"_str, WTFMove(parameters), nullptr, isOperator));
if (!program.append(WTFMove(nativeFunctionDeclaration)))
return false;
}
{
- auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(enumerationDefinition->origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), enumerationDefinition)), String(), WTF::nullopt, nullptr);
+ auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(enumerationDefinition->origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), enumerationDefinition)), String(), nullptr, nullptr);
AST::VariableDeclarations parameters;
parameters.append(WTFMove(variableDeclaration));
- AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(enumerationDefinition->origin()), AST::AttributeBlock(), WTF::nullopt, enumerationDefinition->type().clone(), "operator cast"_str, WTFMove(parameters), WTF::nullopt, isOperator));
+ AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(enumerationDefinition->origin()), AST::AttributeBlock(), WTF::nullopt, enumerationDefinition->type().clone(), "operator cast"_str, WTFMove(parameters), nullptr, isOperator));
if (!program.append(WTFMove(nativeFunctionDeclaration)))
return false;
}
{
- auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(enumerationDefinition->origin()), AST::Qualifiers(), enumerationDefinition->type().clone(), String(), WTF::nullopt, nullptr);
+ auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(enumerationDefinition->origin()), AST::Qualifiers(), enumerationDefinition->type().clone(), String(), nullptr, nullptr);
AST::VariableDeclarations parameters;
parameters.append(WTFMove(variableDeclaration));
- AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(enumerationDefinition->origin()), AST::AttributeBlock(), WTF::nullopt, UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), enumerationDefinition)), "operator cast"_str, WTFMove(parameters), WTF::nullopt, isOperator));
+ AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(enumerationDefinition->origin()), AST::AttributeBlock(), WTF::nullopt, UniqueRef<AST::UnnamedType>(AST::TypeReference::wrap(Lexer::Token(enumerationDefinition->origin()), enumerationDefinition)), "operator cast"_str, WTFMove(parameters), nullptr, isOperator));
if (!program.append(WTFMove(nativeFunctionDeclaration)))
return false;
}
Modified: trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp (247109 => 247110)
--- trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp 2019-07-03 21:59:07 UTC (rev 247109)
+++ trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp 2019-07-03 22:11:36 UTC (rev 247110)
@@ -47,11 +47,11 @@
// The ander: operator&.field
auto createAnder = [&](AST::AddressSpace addressSpace) -> AST::NativeFunctionDeclaration {
auto argumentType = makeUniqueRef<AST::PointerType>(Lexer::Token(structureElement.origin()), addressSpace, AST::TypeReference::wrap(Lexer::Token(structureElement.origin()), structureDefinition));
- auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(structureElement.origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(WTFMove(argumentType)), String(), WTF::nullopt, nullptr);
+ auto variableDeclaration = makeUniqueRef<AST::VariableDeclaration>(Lexer::Token(structureElement.origin()), AST::Qualifiers(), UniqueRef<AST::UnnamedType>(WTFMove(argumentType)), String(), nullptr, nullptr);
AST::VariableDeclarations parameters;
parameters.append(WTFMove(variableDeclaration));
auto returnType = makeUniqueRef<AST::PointerType>(Lexer::Token(structureElement.origin()), addressSpace, structureElement.type().clone());
- AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(structureElement.origin()), AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), makeString("operator&.", structureElement.name()), WTFMove(parameters), WTF::nullopt, isOperator));
+ AST::NativeFunctionDeclaration nativeFunctionDeclaration(AST::FunctionDeclaration(Lexer::Token(structureElement.origin()), AST::AttributeBlock(), WTF::nullopt, WTFMove(returnType), makeString("operator&.", structureElement.name()), WTFMove(parameters), nullptr, isOperator));
return nativeFunctionDeclaration;
};
if (!program.append(createAnder(AST::AddressSpace::Constant))