Changeset 248656 in webkit


Ignore:
Timestamp:
Aug 13, 2019 6:36:26 PM (5 years ago)
Author:
rmorisset@apple.com
Message:

[WHLSL] Move Qualifiers and Semantic from VariableDeclaration to VariableDeclaration::RareData
https://bugs.webkit.org/show_bug.cgi?id=200696

Reviewed by Myles C. Maxfield.

Shrinking VariableDeclaration by 16 bytes in the common case.

No new tests as there is no intended functional change.

  • Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h:
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r248650 r248656  
     12019-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
    1142019-08-13  Robin Morisset  <rmorisset@apple.com>
    215
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h

    r247878 r248656  
    4848// Final because we made the destructor non-virtual.
    4949public:
     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
    5060    VariableDeclaration(CodeLocation codeLocation, Qualifiers&& qualifiers, RefPtr<UnnamedType> type, String&& name, std::unique_ptr<Semantic>&& semantic, std::unique_ptr<Expression>&& initializer)
    5161        : m_codeLocation(codeLocation)
    52         , m_qualifiers(WTFMove(qualifiers))
    5362        , m_type(WTFMove(type))
     63        , m_initializer(WTFMove(initializer))
    5464        , m_name(WTFMove(name))
    55         , m_semantic(WTFMove(semantic))
    56         , m_initializer(WTFMove(initializer))
    5765    {
     66        if (semantic || !qualifiers.isEmpty())
     67            m_rareData = std::make_unique<RareData>(WTFMove(qualifiers), WTFMove(semantic));
    5868    }
    5969
     
    7585    const RefPtr<UnnamedType>& type() const { return m_type; }
    7686    UnnamedType* type() { return m_type ? &*m_type : nullptr; }
    77     Semantic* semantic() { return m_semantic.get(); }
    7887    Expression* initializer() { return m_initializer.get(); }
    7988    bool isAnonymous() const { return m_name.isNull(); }
     
    8796    CodeLocation codeLocation() const { return m_codeLocation; }
    8897
     98    Semantic* semantic() { return m_rareData ? m_rareData->semantic.get() : nullptr; }
     99
    89100private:
    90101    CodeLocation m_codeLocation;
    91     Qualifiers m_qualifiers;
    92102    RefPtr<UnnamedType> m_type;
     103    std::unique_ptr<Expression> m_initializer;
     104    std::unique_ptr<RareData> m_rareData { nullptr };
    93105    String m_name;
    94     std::unique_ptr<Semantic> m_semantic;
    95     std::unique_ptr<Expression> m_initializer;
    96106};
    97107
Note: See TracChangeset for help on using the changeset viewer.