Changeset 275542 in webkit


Ignore:
Timestamp:
Apr 6, 2021 12:47:47 PM (3 years ago)
Author:
ysuzuki@apple.com
Message:

[WTF] Introduce FixedVector and use it for FixedOperands
https://bugs.webkit.org/show_bug.cgi?id=224171

Reviewed by Mark Lam.

Source/JavaScriptCore:

Define FixedOperands<T> which uses FixedVector for its storage. We use FixedOperands in FTL::OSRExitDescriptor.
We also replace RefCountedArray<T> with FixedVector<T> if they are not requiring RefCountedArray<T>'s ref-counting
semantics.

  • bytecode/BytecodeGeneratorification.cpp:

(JSC::BytecodeGeneratorification::run):

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::finishCreation):
(JSC::CodeBlock::setConstantRegisters):
(JSC::CodeBlock::setNumParameters):
(JSC::CodeBlock::setRareCaseProfiles):
(JSC::CodeBlock::insertBasicBlockBoundariesForControlFlowProfiler):

  • bytecode/CodeBlock.h:
  • bytecode/Operands.h:

(JSC::Operands::Operands):

  • bytecode/OperandsInlines.h:

(JSC::U>::dumpInContext const):
(JSC::U>::dump const):
(JSC::Operands<T>::dumpInContext const): Deleted.
(JSC::Operands<T>::dump const): Deleted.

  • bytecode/PolyProtoAccessChain.h:
  • bytecode/PolymorphicAccess.cpp:

(JSC::PolymorphicAccess::regenerate):

  • bytecode/PolymorphicAccess.h:
  • bytecode/UnlinkedCodeBlock.cpp:

(JSC::UnlinkedCodeBlock::dumpExpressionRangeInfo):
(JSC::UnlinkedCodeBlock::expressionRangeForBytecodeIndex const):

  • bytecode/UnlinkedCodeBlock.h:

(JSC::UnlinkedCodeBlock::expressionInfo):
(JSC::UnlinkedCodeBlock::identifiers const):
(JSC::UnlinkedCodeBlock::constantRegisters):
(JSC::UnlinkedCodeBlock::constantsSourceCodeRepresentation):
(JSC::UnlinkedCodeBlock::constantIdentifierSets):
(JSC::UnlinkedCodeBlock::opProfileControlFlowBytecodeOffsets const):

  • bytecode/UnlinkedFunctionExecutable.h:
  • bytecompiler/BytecodeGenerator.cpp:

(JSC::prepareJumpTableForSwitch):

  • dfg/DFGJITCode.h:
  • dfg/DFGPlan.h:

(JSC::DFG::Plan::tierUpInLoopHierarchy):

  • ftl/FTLOSRExit.h:
  • jit/GCAwareJITStubRoutine.h:
  • jit/JIT.cpp:

(JSC::JIT::privateCompileSlowCases):

  • jit/PolymorphicCallStubRoutine.h:
  • llint/LLIntOffsetsExtractor.cpp:
  • llint/LowLevelInterpreter.asm:
  • parser/Parser.cpp:

(JSC::Parser<LexerType>::parseInner):
(JSC::Parser<LexerType>::parseClassFieldInitializerSourceElements):

  • parser/Parser.h:

(JSC::Parser<LexerType>::parse):
(JSC::parse):

  • runtime/CachedTypes.cpp:

(JSC::CachedVector::encode):
(JSC::CachedVector::decode const):

  • wasm/js/JSWebAssemblyInstance.h:

Source/WTF:

This FixedVector<T> is a wrapper around RefCountedArray<T>, but this offers Vector-like copy / move semantics,
so that we can use this FixedVector<T> as a drop-in-replacement for fixed-sized Vector fields. The purpose
of that is saving memory by removing unnecessary storage (FixedVector is fixed-sized allocated) and putting size
into the allocated memory.

  • WTF.xcodeproj/project.pbxproj:
  • wtf/CMakeLists.txt:
  • wtf/FastBitVector.h:

(WTF::FastBitVector::FastBitVector):

  • wtf/FixedVector.h: Added.

(WTF::FixedVector::FixedVector):
(WTF::FixedVector::operator=):
(WTF::FixedVector::size const):
(WTF::FixedVector::isEmpty const):
(WTF::FixedVector::byteSize const):
(WTF::FixedVector::data):
(WTF::FixedVector::begin):
(WTF::FixedVector::end):
(WTF::FixedVector::data const):
(WTF::FixedVector::begin const):
(WTF::FixedVector::end const):
(WTF::FixedVector::rbegin):
(WTF::FixedVector::rend):
(WTF::FixedVector::rbegin const):
(WTF::FixedVector::rend const):
(WTF::FixedVector::at):
(WTF::FixedVector::at const):
(WTF::FixedVector::operator[]):
(WTF::FixedVector::operator[] const):
(WTF::FixedVector::first):
(WTF::FixedVector::first const):
(WTF::FixedVector::last):
(WTF::FixedVector::last const):
(WTF::FixedVector::fill):
(WTF::FixedVector::operator== const):
(WTF::FixedVector::swap):
(WTF::swap):

  • wtf/RefCountedArray.h:

(WTF::RefCountedArray::RefCountedArray):
(WTF::RefCountedArray::fill):
(WTF::RefCountedArray::swap):

Tools:

  • TestWebKitAPI/CMakeLists.txt:
  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WTF/FixedVector.cpp: Added.

(TestWebKitAPI::TEST):
(TestWebKitAPI::DestructorObserver::DestructorObserver):
(TestWebKitAPI::DestructorObserver::~DestructorObserver):
(TestWebKitAPI::DestructorObserver::operator=):

Location:
trunk
Files:
2 added
33 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r275490 r275542  
     12021-04-06  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [WTF] Introduce FixedVector and use it for FixedOperands
     4        https://bugs.webkit.org/show_bug.cgi?id=224171
     5
     6        Reviewed by Mark Lam.
     7
     8        Define FixedOperands<T> which uses FixedVector for its storage. We use FixedOperands in FTL::OSRExitDescriptor.
     9        We also replace RefCountedArray<T> with FixedVector<T> if they are not requiring RefCountedArray<T>'s ref-counting
     10        semantics.
     11
     12        * bytecode/BytecodeGeneratorification.cpp:
     13        (JSC::BytecodeGeneratorification::run):
     14        * bytecode/CodeBlock.cpp:
     15        (JSC::CodeBlock::finishCreation):
     16        (JSC::CodeBlock::setConstantRegisters):
     17        (JSC::CodeBlock::setNumParameters):
     18        (JSC::CodeBlock::setRareCaseProfiles):
     19        (JSC::CodeBlock::insertBasicBlockBoundariesForControlFlowProfiler):
     20        * bytecode/CodeBlock.h:
     21        * bytecode/Operands.h:
     22        (JSC::Operands::Operands):
     23        * bytecode/OperandsInlines.h:
     24        (JSC::U>::dumpInContext const):
     25        (JSC::U>::dump const):
     26        (JSC::Operands<T>::dumpInContext const): Deleted.
     27        (JSC::Operands<T>::dump const): Deleted.
     28        * bytecode/PolyProtoAccessChain.h:
     29        * bytecode/PolymorphicAccess.cpp:
     30        (JSC::PolymorphicAccess::regenerate):
     31        * bytecode/PolymorphicAccess.h:
     32        * bytecode/UnlinkedCodeBlock.cpp:
     33        (JSC::UnlinkedCodeBlock::dumpExpressionRangeInfo):
     34        (JSC::UnlinkedCodeBlock::expressionRangeForBytecodeIndex const):
     35        * bytecode/UnlinkedCodeBlock.h:
     36        (JSC::UnlinkedCodeBlock::expressionInfo):
     37        (JSC::UnlinkedCodeBlock::identifiers const):
     38        (JSC::UnlinkedCodeBlock::constantRegisters):
     39        (JSC::UnlinkedCodeBlock::constantsSourceCodeRepresentation):
     40        (JSC::UnlinkedCodeBlock::constantIdentifierSets):
     41        (JSC::UnlinkedCodeBlock::opProfileControlFlowBytecodeOffsets const):
     42        * bytecode/UnlinkedFunctionExecutable.h:
     43        * bytecompiler/BytecodeGenerator.cpp:
     44        (JSC::prepareJumpTableForSwitch):
     45        * dfg/DFGJITCode.h:
     46        * dfg/DFGPlan.h:
     47        (JSC::DFG::Plan::tierUpInLoopHierarchy):
     48        * ftl/FTLOSRExit.h:
     49        * jit/GCAwareJITStubRoutine.h:
     50        * jit/JIT.cpp:
     51        (JSC::JIT::privateCompileSlowCases):
     52        * jit/PolymorphicCallStubRoutine.h:
     53        * llint/LLIntOffsetsExtractor.cpp:
     54        * llint/LowLevelInterpreter.asm:
     55        * parser/Parser.cpp:
     56        (JSC::Parser<LexerType>::parseInner):
     57        (JSC::Parser<LexerType>::parseClassFieldInitializerSourceElements):
     58        * parser/Parser.h:
     59        (JSC::Parser<LexerType>::parse):
     60        (JSC::parse):
     61        * runtime/CachedTypes.cpp:
     62        (JSC::CachedVector::encode):
     63        (JSC::CachedVector::decode const):
     64        * wasm/js/JSWebAssemblyInstance.h:
     65
    1662021-04-05  Yusuke Suzuki  <ysuzuki@apple.com>
    267
  • trunk/Source/JavaScriptCore/bytecode/BytecodeGeneratorification.cpp

    r273225 r275542  
    221221        auto& jumpTable = m_codeBlock->addSwitchJumpTable();
    222222        jumpTable.min = 0;
    223         jumpTable.branchOffsets = RefCountedArray<int32_t>(m_yields.size() + 1);
     223        jumpTable.branchOffsets = FixedVector<int32_t>(m_yields.size() + 1);
    224224        std::fill(jumpTable.branchOffsets.begin(), jumpTable.branchOffsets.end(), 0);
    225225        jumpTable.add(0, nextToEnterPoint.offset());
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r275490 r275542  
    404404
    405405    bool shouldUpdateFunctionHasExecutedCache = m_unlinkedCode->wasCompiledWithTypeProfilerOpcodes() || m_unlinkedCode->wasCompiledWithControlFlowProfilerOpcodes();
    406     m_functionDecls = RefCountedArray<WriteBarrier<FunctionExecutable>>(unlinkedCodeBlock->numberOfFunctionDecls());
     406    m_functionDecls = FixedVector<WriteBarrier<FunctionExecutable>>(unlinkedCodeBlock->numberOfFunctionDecls());
    407407    for (size_t count = unlinkedCodeBlock->numberOfFunctionDecls(), i = 0; i < count; ++i) {
    408408        UnlinkedFunctionExecutable* unlinkedExecutable = unlinkedCodeBlock->functionDecl(i);
     
    412412    }
    413413
    414     m_functionExprs = RefCountedArray<WriteBarrier<FunctionExecutable>>(unlinkedCodeBlock->numberOfFunctionExprs());
     414    m_functionExprs = FixedVector<WriteBarrier<FunctionExecutable>>(unlinkedCodeBlock->numberOfFunctionExprs());
    415415    for (size_t count = unlinkedCodeBlock->numberOfFunctionExprs(), i = 0; i < count; ++i) {
    416416        UnlinkedFunctionExecutable* unlinkedExecutable = unlinkedCodeBlock->functionExpr(i);
     
    888888}
    889889
    890 void CodeBlock::setConstantRegisters(const RefCountedArray<WriteBarrier<Unknown>>& constants, const RefCountedArray<SourceCodeRepresentation>& constantsSourceCodeRepresentation, ScriptExecutable* topLevelExecutable)
     890void CodeBlock::setConstantRegisters(const FixedVector<WriteBarrier<Unknown>>& constants, const FixedVector<SourceCodeRepresentation>& constantsSourceCodeRepresentation, ScriptExecutable* topLevelExecutable)
    891891{
    892892    VM& vm = *m_vm;
     
    950950    m_numParameters = newValue;
    951951
    952     m_argumentValueProfiles = RefCountedArray<ValueProfile>(Options::useJIT() ? newValue : 0);
     952    m_argumentValueProfiles = FixedVector<ValueProfile>(Options::useJIT() ? newValue : 0);
    953953}
    954954
     
    17551755}
    17561756
    1757 void CodeBlock::setRareCaseProfiles(RefCountedArray<RareCaseProfile>&& rareCaseProfiles)
     1757void CodeBlock::setRareCaseProfiles(FixedVector<RareCaseProfile>&& rareCaseProfiles)
    17581758{
    17591759    ConcurrentJSLocker locker(m_lock);
     
    33823382    if (!unlinkedCodeBlock()->hasOpProfileControlFlowBytecodeOffsets())
    33833383        return;
    3384     const RefCountedArray<InstructionStream::Offset>& bytecodeOffsets = unlinkedCodeBlock()->opProfileControlFlowBytecodeOffsets();
     3384    const FixedVector<InstructionStream::Offset>& bytecodeOffsets = unlinkedCodeBlock()->opProfileControlFlowBytecodeOffsets();
    33853385    for (size_t i = 0, offsetsLength = bytecodeOffsets.size(); i < offsetsLength; i++) {
    33863386        // Because op_profile_control_flow is emitted at the beginning of every basic block, finding
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.h

    r273931 r275542  
    7070#include <wtf/Bag.h>
    7171#include <wtf/FastMalloc.h>
    72 #include <wtf/RefCountedArray.h>
     72#include <wtf/FixedVector.h>
    7373#include <wtf/RefPtr.h>
    7474#include <wtf/SegmentedVector.h>
     
    278278        SentinelLinkedList<CallLinkInfo, PackedRawSentinelNode<CallLinkInfo>> m_incomingCalls;
    279279        SentinelLinkedList<PolymorphicCallNode, PackedRawSentinelNode<PolymorphicCallNode>> m_incomingPolymorphicCalls;
    280         RefCountedArray<RareCaseProfile> m_rareCaseProfiles;
     280        FixedVector<RareCaseProfile> m_rareCaseProfiles;
    281281        std::unique_ptr<PCToCodeOriginMap> m_pcToCodeOriginMap;
    282282        std::unique_ptr<RegisterAtOffsetList> m_calleeSaveRegisters;
     
    342342    void setCalleeSaveRegisters(std::unique_ptr<RegisterAtOffsetList>);
    343343
    344     void setRareCaseProfiles(RefCountedArray<RareCaseProfile>&&);
     344    void setRareCaseProfiles(FixedVector<RareCaseProfile>&&);
    345345    RareCaseProfile* rareCaseProfileForBytecodeIndex(const ConcurrentJSLocker&, BytecodeIndex);
    346346    unsigned rareCaseProfileCountForBytecodeIndex(const ConcurrentJSLocker&, BytecodeIndex);
     
    957957    void updateAllValueProfilePredictionsAndCountLiveness(unsigned& numberOfLiveNonArgumentValueProfiles, unsigned& numberOfSamplesInProfiles);
    958958
    959     void setConstantRegisters(const RefCountedArray<WriteBarrier<Unknown>>& constants, const RefCountedArray<SourceCodeRepresentation>& constantsSourceCodeRepresentation, ScriptExecutable* topLevelExecutable);
     959    void setConstantRegisters(const FixedVector<WriteBarrier<Unknown>>& constants, const FixedVector<SourceCodeRepresentation>& constantsSourceCodeRepresentation, ScriptExecutable* topLevelExecutable);
    960960
    961961    void replaceConstant(VirtualRegister reg, JSValue value)
     
    10331033    CompressedLazyOperandValueProfileHolder m_lazyOperandValueProfiles;
    10341034#endif
    1035     RefCountedArray<ValueProfile> m_argumentValueProfiles;
     1035    FixedVector<ValueProfile> m_argumentValueProfiles;
    10361036
    10371037    // Constant Pool
     
    10411041    Vector<WriteBarrier<Unknown>> m_constantRegisters;
    10421042    Vector<SourceCodeRepresentation> m_constantsSourceCodeRepresentation;
    1043     RefCountedArray<WriteBarrier<FunctionExecutable>> m_functionDecls;
    1044     RefCountedArray<WriteBarrier<FunctionExecutable>> m_functionExprs;
     1043    FixedVector<WriteBarrier<FunctionExecutable>> m_functionDecls;
     1044    FixedVector<WriteBarrier<FunctionExecutable>> m_functionExprs;
    10451045
    10461046    WriteBarrier<CodeBlock> m_alternative;
  • trunk/Source/JavaScriptCore/bytecode/Operands.h

    r254975 r275542  
    2929#include "VirtualRegister.h"
    3030
     31#include <wtf/FixedVector.h>
    3132#include <wtf/PrintStream.h>
    3233#include <wtf/Vector.h>
     
    135136enum OperandsLikeTag { OperandsLike };
    136137
    137 template<typename T>
     138template<typename T, typename StorageArg = std::conditional_t<std::is_same_v<T, bool>, FastBitVector, Vector<T, 0, UnsafeVectorOverflow>>>
    138139class Operands {
    139140public:
    140     using Storage = std::conditional_t<std::is_same_v<T, bool>, FastBitVector, Vector<T, 0, UnsafeVectorOverflow>>;
     141    using Storage = StorageArg;
    141142    using RefType = std::conditional_t<std::is_same_v<T, bool>, FastBitReference, T&>;
    142143    using ConstRefType = std::conditional_t<std::is_same_v<T, bool>, bool, const T&>;
     
    145146
    146147    explicit Operands(size_t numArguments, size_t numLocals, size_t numTmps)
    147         : m_numArguments(numArguments)
     148        : m_values(numArguments + numLocals + numTmps)
     149        , m_numArguments(numArguments)
    148150        , m_numLocals(numLocals)
    149151    {
    150         size_t size = numArguments + numLocals + numTmps;
    151         m_values.grow(size);
    152152        if (!WTF::VectorTraits<T>::needsInitialization)
    153153            m_values.fill(T());
     
    155155
    156156    explicit Operands(size_t numArguments, size_t numLocals, size_t numTmps, const T& initialValue)
    157         : m_numArguments(numArguments)
     157        : m_values(numArguments + numLocals + numTmps)
     158        , m_numArguments(numArguments)
    158159        , m_numLocals(numLocals)
    159160    {
    160         m_values.grow(numArguments + numLocals + numTmps);
    161161        m_values.fill(initialValue);
    162162    }
    163163   
    164     template<typename U>
    165     explicit Operands(OperandsLikeTag, const Operands<U>& other, const T& initialValue = T())
    166         : m_numArguments(other.numberOfArguments())
     164    template<typename U, typename V>
     165    explicit Operands(OperandsLikeTag, const Operands<U, V>& other, const T& initialValue = T())
     166        : m_values(other.size())
     167        , m_numArguments(other.numberOfArguments())
    167168        , m_numLocals(other.numberOfLocals())
    168169    {
    169         m_values.grow(other.size());
    170170        m_values.fill(initialValue);
    171171    }
     
    400400};
    401401
     402template<typename T>
     403using FixedOperands = Operands<T, std::conditional_t<std::is_same_v<T, bool>, FastBitVector, FixedVector<T>>>;
     404
    402405} // namespace JSC
  • trunk/Source/JavaScriptCore/bytecode/OperandsInlines.h

    r254735 r275542  
    3939}
    4040
    41 template<typename T>
    42 void Operands<T>::dumpInContext(PrintStream& out, DumpContext* context) const
     41template<typename T, typename U>
     42void Operands<T, U>::dumpInContext(PrintStream& out, DumpContext* context) const
    4343{
    4444    CommaPrinter comma(" ");
     
    6060}
    6161
    62 template<typename T>
    63 void Operands<T>::dump(PrintStream& out) const
     62template<typename T, typename U>
     63void Operands<T, U>::dump(PrintStream& out) const
    6464{
    6565    CommaPrinter comma(" ");
  • trunk/Source/JavaScriptCore/bytecode/PolyProtoAccessChain.h

    r275490 r275542  
    2828#include "StructureIDTable.h"
    2929#include "VM.h"
    30 #include <wtf/RefCountedArray.h>
     30#include <wtf/FixedVector.h>
    3131#include <wtf/Vector.h>
    3232
     
    4545    static RefPtr<PolyProtoAccessChain> tryCreate(JSGlobalObject*, JSCell* base, JSObject* target);
    4646
    47     const RefCountedArray<StructureID>& chain() const { return m_chain; }
     47    const FixedVector<StructureID>& chain() const { return m_chain; }
    4848
    4949    void dump(Structure* baseStructure, PrintStream& out) const;
     
    8383    // This does not include the base. We rely on AccessCase providing it for us. That said, this data
    8484    // structure is tied to the base that it was created with.
    85     RefCountedArray<StructureID> m_chain;
     85    FixedVector<StructureID> m_chain;
    8686};
    8787
  • trunk/Source/JavaScriptCore/bytecode/PolymorphicAccess.cpp

    r275490 r275542  
    749749    m_watchpoints = WTFMove(state.watchpoints);
    750750    if (!state.weakReferences.isEmpty())
    751         m_weakReferences = RefCountedArray<WriteBarrier<JSCell>>(WTFMove(state.weakReferences));
     751        m_weakReferences = FixedVector<WriteBarrier<JSCell>>(WTFMove(state.weakReferences));
    752752    if (PolymorphicAccessInternal::verbose)
    753753        dataLog("Returning: ", code.code(), "\n");
  • trunk/Source/JavaScriptCore/bytecode/PolymorphicAccess.h

    r275490 r275542  
    3333#include "MacroAssembler.h"
    3434#include "ScratchRegisterAllocator.h"
    35 #include <wtf/RefCountedArray.h>
     35#include <wtf/FixedVector.h>
    3636#include <wtf/Vector.h>
    3737
     
    189189    RefPtr<JITStubRoutine> m_stubRoutine;
    190190    std::unique_ptr<WatchpointsOnStructureStubInfo> m_watchpoints;
    191     RefCountedArray<WriteBarrier<JSCell>> m_weakReferences;
     191    FixedVector<WriteBarrier<JSCell>> m_weakReferences;
    192192};
    193193
  • trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp

    r273931 r275542  
    160160void UnlinkedCodeBlock::dumpExpressionRangeInfo()
    161161{
    162     RefCountedArray<ExpressionRangeInfo>& expressionInfo = m_expressionInfo;
     162    FixedVector<ExpressionRangeInfo>& expressionInfo = m_expressionInfo;
    163163
    164164    size_t size = m_expressionInfo.size();
     
    189189    }
    190190
    191     const RefCountedArray<ExpressionRangeInfo>& expressionInfo = m_expressionInfo;
     191    const FixedVector<ExpressionRangeInfo>& expressionInfo = m_expressionInfo;
    192192
    193193    int low = 0;
  • trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h

    r275490 r275542  
    4343#include <algorithm>
    4444#include <wtf/BitVector.h>
    45 #include <wtf/RefCountedArray.h>
     45#include <wtf/FixedVector.h>
    4646#include <wtf/RobinHoodHashMap.h>
    4747#include <wtf/TriState.h>
     
    9696
    9797struct UnlinkedSimpleJumpTable {
    98     RefCountedArray<int32_t> branchOffsets;
     98    FixedVector<int32_t> branchOffsets;
    9999    int32_t min;
    100100
     
    136136
    137137    bool hasExpressionInfo() { return m_expressionInfo.size(); }
    138     const RefCountedArray<ExpressionRangeInfo>& expressionInfo() { return m_expressionInfo; }
     138    const FixedVector<ExpressionRangeInfo>& expressionInfo() { return m_expressionInfo; }
    139139
    140140    bool hasCheckpoints() const { return m_hasCheckpoints; }
     
    153153    size_t numberOfIdentifiers() const { return m_identifiers.size(); }
    154154    const Identifier& identifier(int index) const { return m_identifiers[index]; }
    155     const RefCountedArray<Identifier>& identifiers() const { return m_identifiers; }
     155    const FixedVector<Identifier>& identifiers() const { return m_identifiers; }
    156156
    157157    BitVector& bitVector(size_t i) { ASSERT(m_rareData); return m_rareData->m_bitVectors[i]; }
    158158
    159     const RefCountedArray<WriteBarrier<Unknown>>& constantRegisters() { return m_constantRegisters; }
     159    const FixedVector<WriteBarrier<Unknown>>& constantRegisters() { return m_constantRegisters; }
    160160    const WriteBarrier<Unknown>& constantRegister(VirtualRegister reg) const { return m_constantRegisters[reg.toConstantIndex()]; }
    161161    ALWAYS_INLINE JSValue getConstant(VirtualRegister reg) const { return m_constantRegisters[reg.toConstantIndex()].get(); }
    162     const RefCountedArray<SourceCodeRepresentation>& constantsSourceCodeRepresentation() { return m_constantsSourceCodeRepresentation; }
     162    const FixedVector<SourceCodeRepresentation>& constantsSourceCodeRepresentation() { return m_constantsSourceCodeRepresentation; }
    163163
    164164    unsigned numberOfConstantIdentifierSets() const { return m_rareData ? m_rareData->m_constantIdentifierSets.size() : 0; }
    165     const RefCountedArray<IdentifierSet>& constantIdentifierSets() { ASSERT(m_rareData); return m_rareData->m_constantIdentifierSets; }
     165    const FixedVector<IdentifierSet>& constantIdentifierSets() { ASSERT(m_rareData); return m_rareData->m_constantIdentifierSets; }
    166166
    167167    // Jumps
     
    235235    unsigned endColumn() const { return m_endColumn; }
    236236
    237     const RefCountedArray<InstructionStream::Offset>& opProfileControlFlowBytecodeOffsets() const
     237    const FixedVector<InstructionStream::Offset>& opProfileControlFlowBytecodeOffsets() const
    238238    {
    239239        ASSERT(m_rareData);
     
    375375    PackedRefPtr<StringImpl> m_sourceMappingURLDirective;
    376376
    377     RefCountedArray<InstructionStream::Offset> m_jumpTargets;
     377    FixedVector<InstructionStream::Offset> m_jumpTargets;
    378378    Ref<UnlinkedMetadataTable> m_metadata;
    379379    std::unique_ptr<InstructionStream> m_instructions;
     
    386386
    387387    // Constant Pools
    388     RefCountedArray<Identifier> m_identifiers;
    389     RefCountedArray<WriteBarrier<Unknown>> m_constantRegisters;
    390     RefCountedArray<SourceCodeRepresentation> m_constantsSourceCodeRepresentation;
    391     using FunctionExpressionVector = RefCountedArray<WriteBarrier<UnlinkedFunctionExecutable>>;
     388    FixedVector<Identifier> m_identifiers;
     389    FixedVector<WriteBarrier<Unknown>> m_constantRegisters;
     390    FixedVector<SourceCodeRepresentation> m_constantsSourceCodeRepresentation;
     391    using FunctionExpressionVector = FixedVector<WriteBarrier<UnlinkedFunctionExecutable>>;
    392392    FunctionExpressionVector m_functionDecls;
    393393    FunctionExpressionVector m_functionExprs;
     
    397397        WTF_MAKE_STRUCT_FAST_ALLOCATED;
    398398
    399         RefCountedArray<UnlinkedHandlerInfo> m_exceptionHandlers;
     399        FixedVector<UnlinkedHandlerInfo> m_exceptionHandlers;
    400400
    401401        // Jump Tables
    402         RefCountedArray<UnlinkedSimpleJumpTable> m_switchJumpTables;
    403         RefCountedArray<UnlinkedStringJumpTable> m_stringSwitchJumpTables;
    404 
    405         RefCountedArray<ExpressionRangeInfo::FatPosition> m_expressionInfoFatPositions;
     402        FixedVector<UnlinkedSimpleJumpTable> m_switchJumpTables;
     403        FixedVector<UnlinkedStringJumpTable> m_stringSwitchJumpTables;
     404
     405        FixedVector<ExpressionRangeInfo::FatPosition> m_expressionInfoFatPositions;
    406406
    407407        struct TypeProfilerExpressionRange {
     
    410410        };
    411411        HashMap<unsigned, TypeProfilerExpressionRange> m_typeProfilerInfoMap;
    412         RefCountedArray<InstructionStream::Offset> m_opProfileControlFlowBytecodeOffsets;
    413         RefCountedArray<BitVector> m_bitVectors;
    414         RefCountedArray<IdentifierSet> m_constantIdentifierSets;
     412        FixedVector<InstructionStream::Offset> m_opProfileControlFlowBytecodeOffsets;
     413        FixedVector<BitVector> m_bitVectors;
     414        FixedVector<IdentifierSet> m_constantIdentifierSets;
    415415
    416416        unsigned m_needsClassFieldInitializer : 1;
     
    429429    OutOfLineJumpTargets m_outOfLineJumpTargets;
    430430    std::unique_ptr<RareData> m_rareData;
    431     RefCountedArray<ExpressionRangeInfo> m_expressionInfo;
     431    FixedVector<ExpressionRangeInfo> m_expressionInfo;
    432432
    433433protected:
  • trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h

    r275490 r275542  
    3939#include "SourceCode.h"
    4040#include "VariableEnvironment.h"
     41#include <wtf/FixedVector.h>
    4142#include <wtf/Optional.h>
    42 #include <wtf/RefCountedArray.h>
    4343
    4444namespace JSC {
     
    220220        String m_sourceMappingURLDirective;
    221221        RefPtr<TDZEnvironmentLink> m_parentScopeTDZVariables;
    222         RefCountedArray<JSTextPosition> m_classFieldLocations;
     222        FixedVector<JSTextPosition> m_classFieldLocations;
    223223        PrivateNameEnvironment m_parentPrivateNameEnvironment;
    224224    };
     
    226226    NeedsClassFieldInitializer needsClassFieldInitializer() const { return static_cast<NeedsClassFieldInitializer>(m_needsClassFieldInitializer); }
    227227
    228     RefCountedArray<JSTextPosition>* classFieldLocations() const
     228    const FixedVector<JSTextPosition>* classFieldLocations() const
    229229    {
    230230        if (m_rareData)
     
    237237        if (classFieldLocations.isEmpty())
    238238            return;
    239         ensureRareData().m_classFieldLocations = RefCountedArray<JSTextPosition>(WTFMove(classFieldLocations));
     239        ensureRareData().m_classFieldLocations = FixedVector<JSTextPosition>(WTFMove(classFieldLocations));
    240240    }
    241241
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp

    r275439 r275542  
    40934093{
    40944094    jumpTable.min = min;
    4095     jumpTable.branchOffsets = RefCountedArray<int32_t>(max - min + 1);
     4095    jumpTable.branchOffsets = FixedVector<int32_t>(max - min + 1);
    40964096    std::fill(jumpTable.branchOffsets.begin(), jumpTable.branchOffsets.end(), 0);
    40974097    for (uint32_t i = 0; i < clauseCount; ++i) {
  • trunk/Source/JavaScriptCore/dfg/DFGJITCode.h

    r275490 r275542  
    152152    // The key may not always be a target for OSR Entry but the list in the value is guaranteed
    153153    // to be usable for OSR Entry.
    154     HashMap<BytecodeIndex, RefCountedArray<BytecodeIndex>> tierUpInLoopHierarchy;
     154    HashMap<BytecodeIndex, FixedVector<BytecodeIndex>> tierUpInLoopHierarchy;
    155155
    156156    // Map each bytecode of CheckTierUpAndOSREnter to its stream index.
  • trunk/Source/JavaScriptCore/dfg/DFGPlan.h

    r275490 r275542  
    107107    void setWillTryToTierUp(bool willTryToTierUp) { m_willTryToTierUp = willTryToTierUp; }
    108108
    109     HashMap<BytecodeIndex, RefCountedArray<BytecodeIndex>>& tierUpInLoopHierarchy() { return m_tierUpInLoopHierarchy; }
     109    HashMap<BytecodeIndex, FixedVector<BytecodeIndex>>& tierUpInLoopHierarchy() { return m_tierUpInLoopHierarchy; }
    110110    Vector<BytecodeIndex>& tierUpAndOSREnterBytecodes() { return m_tierUpAndOSREnterBytecodes; }
    111111
     
    160160    RecordedStatuses m_recordedStatuses;
    161161
    162     HashMap<BytecodeIndex, RefCountedArray<BytecodeIndex>> m_tierUpInLoopHierarchy;
     162    HashMap<BytecodeIndex, FixedVector<BytecodeIndex>> m_tierUpInLoopHierarchy;
    163163    Vector<BytecodeIndex> m_tierUpAndOSREnterBytecodes;
    164164
  • trunk/Source/JavaScriptCore/ftl/FTLOSRExit.h

    r260803 r275542  
    6868
    6969struct OSRExitDescriptor {
     70private:
     71    WTF_MAKE_NONCOPYABLE(OSRExitDescriptor);
     72public:
    7073    OSRExitDescriptor(
    7174        DataFormat profileDataFormat, MethodOfGettingAValueProfile,
     
    8083    MethodOfGettingAValueProfile m_valueProfile;
    8184   
    82     Operands<ExitValue> m_values;
     85    FixedOperands<ExitValue> m_values;
    8386    Bag<ExitTimeObjectMaterialization> m_materializations;
    8487
  • trunk/Source/JavaScriptCore/jit/GCAwareJITStubRoutine.h

    r275490 r275542  
    3131#include "JSObject.h"
    3232#include "WriteBarrier.h"
    33 #include <wtf/RefCountedArray.h>
     33#include <wtf/FixedVector.h>
    3434#include <wtf/Vector.h>
    3535
     
    9898
    9999private:
    100     RefCountedArray<WriteBarrier<JSCell>> m_cells;
     100    FixedVector<WriteBarrier<JSCell>> m_cells;
    101101    Bag<CallLinkInfo> m_callLinkInfos;
    102102};
  • trunk/Source/JavaScriptCore/jit/JIT.cpp

    r274308 r275542  
    521521    m_callLinkInfoIndex = 0;
    522522
    523     RefCountedArray<RareCaseProfile> rareCaseProfiles;
     523    FixedVector<RareCaseProfile> rareCaseProfiles;
    524524    if (shouldEmitProfiling())
    525         rareCaseProfiles = RefCountedArray<RareCaseProfile>(m_bytecodeCountHavingSlowCase);
     525        rareCaseProfiles = FixedVector<RareCaseProfile>(m_bytecodeCountHavingSlowCase);
    526526   
    527527    unsigned bytecodeCountHavingSlowCase = 0;
  • trunk/Source/JavaScriptCore/jit/PolymorphicCallStubRoutine.h

    r275490 r275542  
    110110    void markRequiredObjectsInternal(SlotVisitor&) final;
    111111
    112     RefCountedArray<WriteBarrier<JSCell>> m_variants;
     112    FixedVector<WriteBarrier<JSCell>> m_variants;
    113113    UniqueArray<uint32_t> m_fastCounts;
    114114    Bag<PolymorphicCallNode> m_callNodes;
  • trunk/Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp

    r267489 r275542  
    8787    using Vector = WTF::Vector<int>;
    8888    using JSInternalFieldObjectImpl = JSC::JSInternalFieldObjectImpl<>;
     89    using FixedVector = WTF::FixedVector<int>;
    8990    using RefCountedArray = WTF::RefCountedArray<int>;
    9091
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm

    r275392 r275542  
    15511551    assert(macro (ok) bpgteq t0, 0, ok end)
    15521552    btpz t0, .argumentProfileDone
    1553     loadp CodeBlock::m_argumentValueProfiles + RefCountedArray::m_data[t1], t3
     1553    loadp CodeBlock::m_argumentValueProfiles + FixedVector::m_storage + RefCountedArray::m_data[t1], t3
    15541554    btpz t3, .argumentProfileDone # When we can't JIT, we don't allocate any argument value profiles.
    15551555    mulp sizeof ValueProfile, t0, t2 # Aaaaahhhh! Need strength reduction!
  • trunk/Source/JavaScriptCore/parser/Parser.cpp

    r275490 r275542  
    216216
    217217template <typename LexerType>
    218 Expected<typename Parser<LexerType>::ParseInnerResult, String> Parser<LexerType>::parseInner(const Identifier& calleeName, ParsingContext parsingContext, Optional<int> functionConstructorParametersEndPosition, const RefCountedArray<JSTextPosition>* classFieldLocations, const PrivateNameEnvironment* parentScopePrivateNames)
     218Expected<typename Parser<LexerType>::ParseInnerResult, String> Parser<LexerType>::parseInner(const Identifier& calleeName, ParsingContext parsingContext, Optional<int> functionConstructorParametersEndPosition, const FixedVector<JSTextPosition>* classFieldLocations, const PrivateNameEnvironment* parentScopePrivateNames)
    219219{
    220220    ASTBuilder context(const_cast<VM&>(m_vm), m_parserArena, const_cast<SourceCode*>(m_source));
     
    31813181
    31823182template <typename LexerType>
    3183 template <class TreeBuilder> TreeSourceElements Parser<LexerType>::parseClassFieldInitializerSourceElements(TreeBuilder& context, const RefCountedArray<JSTextPosition>& classFieldLocations)
     3183template <class TreeBuilder> TreeSourceElements Parser<LexerType>::parseClassFieldInitializerSourceElements(TreeBuilder& context, const FixedVector<JSTextPosition>& classFieldLocations)
    31843184{
    31853185    TreeSourceElements sourceElements = context.createSourceElements();
  • trunk/Source/JavaScriptCore/parser/Parser.h

    r275490 r275542  
    3636#include "SourceProviderCacheItem.h"
    3737#include "VariableEnvironment.h"
     38#include <wtf/FixedVector.h>
    3839#include <wtf/Forward.h>
    3940#include <wtf/Noncopyable.h>
    40 #include <wtf/RefCountedArray.h>
    4141#include <wtf/RefPtr.h>
    4242
     
    993993
    994994    template <class ParsedNode>
    995     std::unique_ptr<ParsedNode> parse(ParserError&, const Identifier&, ParsingContext, Optional<int> functionConstructorParametersEndPosition = WTF::nullopt, const PrivateNameEnvironment* = nullptr, const RefCountedArray<JSTextPosition>* = nullptr);
     995    std::unique_ptr<ParsedNode> parse(ParserError&, const Identifier&, ParsingContext, Optional<int> functionConstructorParametersEndPosition = WTF::nullopt, const PrivateNameEnvironment* = nullptr, const FixedVector<JSTextPosition>* = nullptr);
    996996
    997997    JSTextPosition positionBeforeLastNewline() const { return m_lexer->positionBeforeLastNewline(); }
     
    15131513        int numConstants;
    15141514    };
    1515     Expected<ParseInnerResult, String> parseInner(const Identifier&, ParsingContext, Optional<int> functionConstructorParametersEndPosition, const RefCountedArray<JSTextPosition>*, const PrivateNameEnvironment* parentScopePrivateNames);
     1515    Expected<ParseInnerResult, String> parseInner(const Identifier&, ParsingContext, Optional<int> functionConstructorParametersEndPosition, const FixedVector<JSTextPosition>*, const PrivateNameEnvironment* parentScopePrivateNames);
    15161516
    15171517    // Used to determine type of error to report.
     
    17441744    template <class TreeBuilder> TreeSourceElements parseAsyncGeneratorFunctionSourceElements(TreeBuilder&, bool isArrowFunctionBodyExpression, SourceElementsMode);
    17451745    template <class TreeBuilder> TreeSourceElements parseSingleFunction(TreeBuilder&, Optional<int> functionConstructorParametersEndPosition);
    1746     template <class TreeBuilder> TreeSourceElements parseClassFieldInitializerSourceElements(TreeBuilder&, const RefCountedArray<JSTextPosition>&);
     1746    template <class TreeBuilder> TreeSourceElements parseClassFieldInitializerSourceElements(TreeBuilder&, const FixedVector<JSTextPosition>&);
    17471747    template <class TreeBuilder> TreeStatement parseStatementListItem(TreeBuilder&, const Identifier*& directive, unsigned* directiveLiteralLength);
    17481748    template <class TreeBuilder> TreeStatement parseStatement(TreeBuilder&, const Identifier*& directive, unsigned* directiveLiteralLength = nullptr);
     
    21292129template <typename LexerType>
    21302130template <class ParsedNode>
    2131 std::unique_ptr<ParsedNode> Parser<LexerType>::parse(ParserError& error, const Identifier& calleeName, ParsingContext parsingContext, Optional<int> functionConstructorParametersEndPosition, const PrivateNameEnvironment* parentScopePrivateNames, const RefCountedArray<JSTextPosition>* classFieldLocations)
     2131std::unique_ptr<ParsedNode> Parser<LexerType>::parse(ParserError& error, const Identifier& calleeName, ParsingContext parsingContext, Optional<int> functionConstructorParametersEndPosition, const PrivateNameEnvironment* parentScopePrivateNames, const FixedVector<JSTextPosition>* classFieldLocations)
    21322132{
    21332133    int errLine;
     
    22302230    DebuggerParseData* debuggerParseData = nullptr,
    22312231    const PrivateNameEnvironment* parentScopePrivateNames = nullptr,
    2232     const RefCountedArray<JSTextPosition>* classFieldLocations = nullptr,
     2232    const FixedVector<JSTextPosition>* classFieldLocations = nullptr,
    22332233    bool isInsideOrdinaryFunction = false)
    22342234{
  • trunk/Source/JavaScriptCore/runtime/CachedTypes.cpp

    r275490 r275542  
    604604class CachedVector : public VariableLengthObject<Vector<SourceType<T>, InlineCapacity, OverflowHandler, 16, Malloc>> {
    605605public:
    606     void encode(Encoder& encoder, const Vector<SourceType<T>, InlineCapacity, OverflowHandler, 16, Malloc>& vector)
     606    template<typename VectorContainer>
     607    void encode(Encoder& encoder, const VectorContainer& vector)
    607608    {
    608609        m_size = vector.size();
     
    614615    }
    615616
    616     void encode(Encoder& encoder, const RefCountedArray<SourceType<T>>& vector)
    617     {
    618         m_size = vector.size();
     617    template<typename... Args, typename VectorContainer>
     618    void decode(Decoder& decoder, VectorContainer& vector, Args... args) const
     619    {
    619620        if (!m_size)
    620621            return;
    621         T* buffer = this->template allocate<T>(encoder, m_size);
    622         for (unsigned i = 0; i < m_size; ++i)
    623             ::JSC::encode(encoder, buffer[i], vector[i]);
    624     }
    625 
    626     template<typename... Args>
    627     void decode(Decoder& decoder, Vector<SourceType<T>, InlineCapacity, OverflowHandler, 16, Malloc>& vector, Args... args) const
    628     {
    629         if (!m_size)
    630             return;
    631         vector.resizeToFit(m_size);
     622        vector = VectorContainer(m_size);
    632623        const T* buffer = this->template buffer<T>();
    633624        for (unsigned i = 0; i < m_size; ++i)
    634625            ::JSC::decode(decoder, buffer[i], vector[i], args...);
    635626    }
    636 
    637     template<typename... Args>
    638     void decode(Decoder& decoder, RefCountedArray<SourceType<T>>& vector, Args... args) const
    639     {
    640         if (!m_size)
    641             return;
    642         vector = RefCountedArray<SourceType<T>>(m_size);
    643         const T* buffer = this->template buffer<T>();
    644         for (unsigned i = 0; i < m_size; ++i)
    645             ::JSC::decode(decoder, buffer[i], vector[i], args...);
    646     }
    647 
    648627
    649628private:
  • trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyInstance.h

    r275490 r275542  
    3535#include "WasmCreationMode.h"
    3636#include "WasmInstance.h"
     37#include <wtf/FixedVector.h>
    3738#include <wtf/Ref.h>
    38 #include <wtf/RefCountedArray.h>
    3939
    4040namespace JSC {
     
    117117    WriteBarrier<WebAssemblyModuleRecord> m_moduleRecord;
    118118    WriteBarrier<JSWebAssemblyMemory> m_memory;
    119     RefCountedArray<WriteBarrier<JSWebAssemblyTable>> m_tables;
     119    FixedVector<WriteBarrier<JSWebAssemblyTable>> m_tables;
    120120};
    121121
  • trunk/Source/WTF/ChangeLog

    r275496 r275542  
     12021-04-06  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [WTF] Introduce FixedVector and use it for FixedOperands
     4        https://bugs.webkit.org/show_bug.cgi?id=224171
     5
     6        Reviewed by Mark Lam.
     7
     8        This FixedVector<T> is a wrapper around RefCountedArray<T>, but this offers Vector-like copy / move semantics,
     9        so that we can use this FixedVector<T> as a drop-in-replacement for fixed-sized Vector fields. The purpose
     10        of that is saving memory by removing unnecessary storage (FixedVector is fixed-sized allocated) and putting size
     11        into the allocated memory.
     12
     13        * WTF.xcodeproj/project.pbxproj:
     14        * wtf/CMakeLists.txt:
     15        * wtf/FastBitVector.h:
     16        (WTF::FastBitVector::FastBitVector):
     17        * wtf/FixedVector.h: Added.
     18        (WTF::FixedVector::FixedVector):
     19        (WTF::FixedVector::operator=):
     20        (WTF::FixedVector::size const):
     21        (WTF::FixedVector::isEmpty const):
     22        (WTF::FixedVector::byteSize const):
     23        (WTF::FixedVector::data):
     24        (WTF::FixedVector::begin):
     25        (WTF::FixedVector::end):
     26        (WTF::FixedVector::data const):
     27        (WTF::FixedVector::begin const):
     28        (WTF::FixedVector::end const):
     29        (WTF::FixedVector::rbegin):
     30        (WTF::FixedVector::rend):
     31        (WTF::FixedVector::rbegin const):
     32        (WTF::FixedVector::rend const):
     33        (WTF::FixedVector::at):
     34        (WTF::FixedVector::at const):
     35        (WTF::FixedVector::operator[]):
     36        (WTF::FixedVector::operator[] const):
     37        (WTF::FixedVector::first):
     38        (WTF::FixedVector::first const):
     39        (WTF::FixedVector::last):
     40        (WTF::FixedVector::last const):
     41        (WTF::FixedVector::fill):
     42        (WTF::FixedVector::operator== const):
     43        (WTF::FixedVector::swap):
     44        (WTF::swap):
     45        * wtf/RefCountedArray.h:
     46        (WTF::RefCountedArray::RefCountedArray):
     47        (WTF::RefCountedArray::fill):
     48        (WTF::RefCountedArray::swap):
     49
    1502021-04-06  Youenn Fablet  <youenn@apple.com>
    251
  • trunk/Source/WTF/WTF.xcodeproj/project.pbxproj

    r275410 r275542  
    743743                E3C583C826127ADD00C57568 /* RobinHoodHashMap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RobinHoodHashMap.h; sourceTree = "<group>"; };
    744744                E3CF76902115D6BA0091DE48 /* CompactPointerTuple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompactPointerTuple.h; sourceTree = "<group>"; };
     745                E3E0F04F26197157004640FC /* FixedVector.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FixedVector.h; sourceTree = "<group>"; };
    745746                E3E158251EADA53C004A079D /* SystemFree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SystemFree.h; sourceTree = "<group>"; };
    746747                E3E64F0B22813428001E55B4 /* Nonmovable.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Nonmovable.h; sourceTree = "<group>"; };
     
    10391040                                A331D95A21F24992009F02AA /* FileSystem.cpp */,
    10401041                                A331D95921F24992009F02AA /* FileSystem.h */,
     1042                                E3E0F04F26197157004640FC /* FixedVector.h */,
    10411043                                0F2B66A517B6B4F700A7AE3F /* FlipBytes.h */,
    10421044                                FE86A8741E59440200111BBF /* ForbidHeapAllocation.h */,
  • trunk/Source/WTF/wtf/CMakeLists.txt

    r275410 r275542  
    7070    FilePrintStream.h
    7171    FileSystem.h
     72    FixedVector.h
    7273    FlipBytes.h
    7374    ForbidHeapAllocation.h
  • trunk/Source/WTF/wtf/FastBitVector.h

    r254735 r275542  
    480480public:
    481481    FastBitVector() { }
     482    explicit FastBitVector(size_t numBits)
     483    {
     484        grow(numBits);
     485    }
    482486   
    483487    FastBitVector(const FastBitVector&) = default;
  • trunk/Source/WTF/wtf/RefCountedArray.h

    r275490 r275542  
    6767    { }
    6868
     69    RefCountedArray(RefCountedArray&& other)
     70        : m_data(PtrTraits::exchange(other.m_data, nullptr))
     71    { }
     72
    6973    explicit RefCountedArray(size_t size)
    7074    {
     
    212216    T& last() { return (*this)[size() - 1]; }
    213217    const T& last() const { return (*this)[size() - 1]; }
     218
     219    void fill(const T& val)
     220    {
     221        std::fill(begin(), end(), val);
     222    }
     223
     224    void swap(RefCountedArray& other)
     225    {
     226        PtrTraits::swap(m_data, other.m_data);
     227    }
    214228
    215229    template<typename OtherTraits = PtrTraits>
  • trunk/Tools/ChangeLog

    r275537 r275542  
     12021-04-06  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [WTF] Introduce FixedVector and use it for FixedOperands
     4        https://bugs.webkit.org/show_bug.cgi?id=224171
     5
     6        Reviewed by Mark Lam.
     7
     8        * TestWebKitAPI/CMakeLists.txt:
     9        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     10        * TestWebKitAPI/Tests/WTF/FixedVector.cpp: Added.
     11        (TestWebKitAPI::TEST):
     12        (TestWebKitAPI::DestructorObserver::DestructorObserver):
     13        (TestWebKitAPI::DestructorObserver::~DestructorObserver):
     14        (TestWebKitAPI::DestructorObserver::operator=):
     15
    1162021-04-06  Eric Carlson  <eric.carlson@apple.com>
    217
  • trunk/Tools/TestWebKitAPI/CMakeLists.txt

    r275410 r275542  
    4545    Tests/WTF/Expected.cpp
    4646    Tests/WTF/FileSystem.cpp
     47    Tests/WTF/FixedVector.cpp
    4748    Tests/WTF/Function.cpp
    4849    Tests/WTF/HashCountedSet.cpp
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r275537 r275542  
    11111111                E194E1BD177E53C7009C4D4E /* StopLoadingFromDidReceiveResponse.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E194E1BC177E534A009C4D4E /* StopLoadingFromDidReceiveResponse.html */; };
    11121112                E302BDAA2404B92400865277 /* CompactRefPtrTuple.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E302BDA92404B92300865277 /* CompactRefPtrTuple.cpp */; };
     1113                E3210519261979F300157C67 /* FixedVector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3210518261979F300157C67 /* FixedVector.cpp */; };
    11131114                E324A6F02041C82000A76593 /* UniqueArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E398BC0F2041C76300387136 /* UniqueArray.cpp */; };
    11141115                E325C90723E3870200BC7D3B /* PictureInPictureSupport.mm in Sources */ = {isa = PBXBuildFile; fileRef = E325C90623E3870200BC7D3B /* PictureInPictureSupport.mm */; };
     
    29052906                E194E1BC177E534A009C4D4E /* StopLoadingFromDidReceiveResponse.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = StopLoadingFromDidReceiveResponse.html; sourceTree = "<group>"; };
    29062907                E302BDA92404B92300865277 /* CompactRefPtrTuple.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CompactRefPtrTuple.cpp; sourceTree = "<group>"; };
     2908                E3210518261979F300157C67 /* FixedVector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FixedVector.cpp; sourceTree = "<group>"; };
    29072909                E325C90623E3870200BC7D3B /* PictureInPictureSupport.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PictureInPictureSupport.mm; sourceTree = "<group>"; };
    29082910                E32B549122810AC0008AD702 /* Packed.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Packed.cpp; sourceTree = "<group>"; };
     
    43744376                                AD7C434C1DD2A5470026888B /* Expected.cpp */,
    43754377                                A310827121F296EC00C28B97 /* FileSystem.cpp */,
     4378                                E3210518261979F300157C67 /* FixedVector.cpp */,
    43764379                                9310CD361EF708FB0050FFE0 /* Function.cpp */,
    43774380                                83DB79671EF63B3C00BFA5E5 /* Function.cpp */,
     
    51255128                                AD7C434D1DD2A54E0026888B /* Expected.cpp in Sources */,
    51265129                                A310827221F296FF00C28B97 /* FileSystem.cpp in Sources */,
     5130                                E3210519261979F300157C67 /* FixedVector.cpp in Sources */,
    51275131                                9310CD381EF708FB0050FFE0 /* Function.cpp in Sources */,
    51285132                                6BFD294C1D5E6C1D008EC968 /* HashCountedSet.cpp in Sources */,
Note: See TracChangeset for help on using the changeset viewer.