Changeset 247124 in webkit
- Timestamp:
- Jul 3, 2019 6:06:35 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r247123 r247124 1 2019-07-03 Robin Morisset <rmorisset@apple.com> 2 3 [WHLSL] Make the destructor of VariableDeclaration non-virtual 4 https://bugs.webkit.org/show_bug.cgi?id=199460 5 6 Reviewed by Myles C. Maxfield. 7 8 Three steps: 9 - Remove WHLSL::AST::Value, inlining it into its children (it is trivial, it just has one field m_origin with a getter and nothing else) 10 - Mark WHLSL::AST::VariableDeclaration final 11 - Now that it inherits from nothing and nothing can inherit from it, there is no reason for it to have any virtual method, including its destructor. 12 13 This not only saves 8 bytes from every variable declaration (for the virtual table pointer), it also should make destructing the AST at the end of compilation a bit faster by removing the virtual destructor call. 14 15 No new tests as there is no intended functional change. 16 17 * Modules/webgpu/WHLSL/AST/WHLSLAST.h: 18 * Modules/webgpu/WHLSL/AST/WHLSLExpression.h: 19 (WebCore::WHLSL::AST::Expression::Expression): 20 (WebCore::WHLSL::AST::Expression::origin const): 21 * Modules/webgpu/WHLSL/AST/WHLSLStatement.h: 22 (WebCore::WHLSL::AST::Statement::Statement): 23 (WebCore::WHLSL::AST::Statement::origin const): 24 * Modules/webgpu/WHLSL/AST/WHLSLValue.h: Removed. 25 * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h: 26 * Modules/webgpu/WHLSL/WHLSLParser.h: 27 * WebCore.xcodeproj/project.pbxproj: 28 1 29 2019-07-03 Sihui Liu <sihui_liu@apple.com> 2 30 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLAST.h
r247105 r247124 99 99 #include "WHLSLUnsignedIntegerLiteral.h" 100 100 #include "WHLSLUnsignedIntegerLiteralType.h" 101 #include "WHLSLValue.h"102 101 #include "WHLSLVariableDeclaration.h" 103 102 #include "WHLSLVariableDeclarationsStatement.h" -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLExpression.h
r246550 r247124 31 31 #include "WHLSLLexer.h" 32 32 #include "WHLSLUnnamedType.h" 33 #include "WHLSLValue.h"34 33 #include <wtf/Optional.h> 35 34 #include <wtf/UniqueRef.h> … … 41 40 namespace AST { 42 41 43 class Expression : public Value { 44 using Base = Value; 42 class Expression { 45 43 public: 46 44 Expression(Lexer::Token&& origin) 47 : Base(WTFMove(origin))45 : m_origin(WTFMove(origin)) 48 46 { 49 47 } … … 115 113 virtual bool isEnumerationMemberLiteral() const { return false; } 116 114 115 Lexer::Token origin() const { return m_origin; } 116 117 117 private: 118 Lexer::Token m_origin; 118 119 Optional<UniqueRef<UnnamedType>> m_type; 119 120 Optional<TypeAnnotation> m_typeAnnotation; -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLStatement.h
r245945 r247124 29 29 30 30 #include "WHLSLLexer.h" 31 #include "WHLSLValue.h"32 31 #include <wtf/UniqueRef.h> 33 32 … … 38 37 namespace AST { 39 38 40 class Statement : public Value { 41 using Base = Value; 39 class Statement { 42 40 public: 43 41 Statement(Lexer::Token&& origin) 44 : Base(WTFMove(origin))42 : m_origin(WTFMove(origin)) 45 43 { 46 44 } … … 66 64 virtual bool isVariableDeclarationsStatement() const { return false; } 67 65 virtual bool isWhileLoop() const { return false; } 66 67 Lexer::Token origin() const { return m_origin; } 68 69 private: 70 Lexer::Token m_origin; 68 71 }; 69 72 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h
r247110 r247124 33 33 #include "WHLSLSemantic.h" 34 34 #include "WHLSLType.h" 35 #include "WHLSLValue.h"36 35 #include <memory> 37 36 #include <wtf/UniqueRef.h> … … 45 44 namespace AST { 46 45 47 class VariableDeclaration : public Value{48 using Base = Value; 46 class VariableDeclaration final { 47 // Final because we made the destructor non-virtual. 49 48 public: 50 49 VariableDeclaration(Lexer::Token&& origin, Qualifiers&& qualifiers, Optional<UniqueRef<UnnamedType>>&& type, String&& name, std::unique_ptr<Semantic>&& semantic, std::unique_ptr<Expression>&& initializer) 51 : Base(WTFMove(origin))50 : m_origin(WTFMove(origin)) 52 51 , m_qualifiers(WTFMove(qualifiers)) 53 52 , m_type(WTFMove(type)) … … 58 57 } 59 58 60 virtual~VariableDeclaration() = default;59 ~VariableDeclaration() = default; 61 60 62 61 VariableDeclaration(const VariableDeclaration&) = delete; … … 85 84 m_initializer = WTFMove(expression); 86 85 } 86 Lexer::Token origin() const { return m_origin; } 87 87 88 88 private: 89 Lexer::Token m_origin; 89 90 Qualifiers m_qualifiers; 90 91 Optional<UniqueRef<UnnamedType>> m_type; -
trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.h
r247110 r247124 89 89 #include "WHLSLTypeReference.h" 90 90 #include "WHLSLUnsignedIntegerLiteral.h" 91 #include "WHLSLValue.h"92 91 #include "WHLSLVariableDeclaration.h" 93 92 #include "WHLSLVariableDeclarationsStatement.h" -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r247115 r247124 13297 13297 C21BF6FA21CD89BE00227979 /* WHLSLBaseSemantic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLBaseSemantic.h; sourceTree = "<group>"; }; 13298 13298 C21BF6FB21CD89BE00227979 /* WHLSLDoWhileLoop.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLDoWhileLoop.h; sourceTree = "<group>"; }; 13299 C21BF6FC21CD89BF00227979 /* WHLSLValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLValue.h; sourceTree = "<group>"; };13300 13299 C21BF6FD21CD89C000227979 /* WHLSLFunctionDeclaration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLFunctionDeclaration.h; sourceTree = "<group>"; }; 13301 13300 C21BF6FE21CD89C100227979 /* WHLSLStructureElement.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WHLSLStructureElement.h; sourceTree = "<group>"; }; … … 17177 17176 1CB69B3B21DF041E006E846A /* WHLSLUnsignedIntegerLiteralType.cpp */, 17178 17177 1CB69B3721DED66B006E846A /* WHLSLUnsignedIntegerLiteralType.h */, 17179 C21BF6FC21CD89BF00227979 /* WHLSLValue.h */,17180 17178 C21BF71021CD89D000227979 /* WHLSLVariableDeclaration.h */, 17181 17179 C21BF71421CD89D300227979 /* WHLSLVariableDeclarationsStatement.h */,
Note: See TracChangeset
for help on using the changeset viewer.