Changeset 248656 in webkit
- Timestamp:
- Aug 13, 2019 6:36:26 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r248650 r248656 1 2019-08-13 Robin Morisset <rmorisset@apple.com> 2 3 [WHLSL] Move Qualifiers and Semantic from VariableDeclaration to VariableDeclaration::RareData 4 https://bugs.webkit.org/show_bug.cgi?id=200696 5 6 Reviewed by Myles C. Maxfield. 7 8 Shrinking VariableDeclaration by 16 bytes in the common case. 9 10 No new tests as there is no intended functional change. 11 12 * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h: 13 1 14 2019-08-13 Robin Morisset <rmorisset@apple.com> 2 15 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h
r247878 r248656 48 48 // Final because we made the destructor non-virtual. 49 49 public: 50 struct RareData { 51 RareData(Qualifiers&& qualifiersArgument, std::unique_ptr<Semantic>&& semanticArgument) 52 : qualifiers(WTFMove(qualifiersArgument)) 53 , semantic(WTFMove(semanticArgument)) 54 { 55 } 56 Qualifiers qualifiers; 57 std::unique_ptr<Semantic> semantic; 58 }; 59 50 60 VariableDeclaration(CodeLocation codeLocation, Qualifiers&& qualifiers, RefPtr<UnnamedType> type, String&& name, std::unique_ptr<Semantic>&& semantic, std::unique_ptr<Expression>&& initializer) 51 61 : m_codeLocation(codeLocation) 52 , m_qualifiers(WTFMove(qualifiers))53 62 , m_type(WTFMove(type)) 63 , m_initializer(WTFMove(initializer)) 54 64 , m_name(WTFMove(name)) 55 , m_semantic(WTFMove(semantic))56 , m_initializer(WTFMove(initializer))57 65 { 66 if (semantic || !qualifiers.isEmpty()) 67 m_rareData = std::make_unique<RareData>(WTFMove(qualifiers), WTFMove(semantic)); 58 68 } 59 69 … … 75 85 const RefPtr<UnnamedType>& type() const { return m_type; } 76 86 UnnamedType* type() { return m_type ? &*m_type : nullptr; } 77 Semantic* semantic() { return m_semantic.get(); }78 87 Expression* initializer() { return m_initializer.get(); } 79 88 bool isAnonymous() const { return m_name.isNull(); } … … 87 96 CodeLocation codeLocation() const { return m_codeLocation; } 88 97 98 Semantic* semantic() { return m_rareData ? m_rareData->semantic.get() : nullptr; } 99 89 100 private: 90 101 CodeLocation m_codeLocation; 91 Qualifiers m_qualifiers;92 102 RefPtr<UnnamedType> m_type; 103 std::unique_ptr<Expression> m_initializer; 104 std::unique_ptr<RareData> m_rareData { nullptr }; 93 105 String m_name; 94 std::unique_ptr<Semantic> m_semantic;95 std::unique_ptr<Expression> m_initializer;96 106 }; 97 107
Note: See TracChangeset
for help on using the changeset viewer.