Title: [275588] trunk/Source/_javascript_Core
Revision
275588
Author
ysuz...@apple.com
Date
2021-04-06 23:48:02 -0700 (Tue, 06 Apr 2021)

Log Message

[JSC] Use FixedVector more in JSC
https://bugs.webkit.org/show_bug.cgi?id=224255

Reviewed by Mark Lam.

Use FixedVector more aggressively. This reduces sizeof(Holder) since sizeof(FixedVector) is 8
while sizeof(Vector) is 16. And since this allocates just-fit size, this does not waste memory.

* bytecode/BytecodeLivenessAnalysis.cpp:
(JSC::BytecodeLivenessAnalysis::computeFullLiveness):
* bytecode/BytecodeLivenessAnalysis.h:
* bytecode/FullBytecodeLiveness.h:
(JSC::FullBytecodeLiveness::FullBytecodeLiveness):
* bytecode/UnlinkedEvalCodeBlock.h:
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::livenessFor):
* ftl/FTLForOSREntryJITCode.h:
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::lower):
* ftl/FTLOSRExit.cpp:
(JSC::FTL::OSRExitDescriptor::prepareOSRExitHandle):
* ftl/FTLOSRExit.h:
* ftl/FTLOSRExitCompiler.cpp:
(JSC::FTL::compileRecovery):
* heap/MarkedSpace.cpp:
(JSC::MarkedSpace::sweepPreciseAllocations):
* jit/RegisterAtOffsetList.cpp:
(JSC::RegisterAtOffsetList::RegisterAtOffsetList):
* jit/RegisterAtOffsetList.h:
(JSC::RegisterAtOffsetList::begin const):
(JSC::RegisterAtOffsetList::end const):
(JSC::RegisterAtOffsetList::clear): Deleted.
* runtime/JSGlobalObject.h:
* runtime/JSModuleNamespaceObject.cpp:
(JSC::JSModuleNamespaceObject::finishCreation):
* runtime/JSModuleNamespaceObject.h:
* yarr/YarrPattern.h:
(JSC::Yarr::YarrPattern::resetForReparsing):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (275587 => 275588)


--- trunk/Source/_javascript_Core/ChangeLog	2021-04-07 05:56:24 UTC (rev 275587)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-04-07 06:48:02 UTC (rev 275588)
@@ -1,3 +1,46 @@
+2021-04-06  Yusuke Suzuki  <ysuz...@apple.com>
+
+        [JSC] Use FixedVector more in JSC
+        https://bugs.webkit.org/show_bug.cgi?id=224255
+
+        Reviewed by Mark Lam.
+
+        Use FixedVector more aggressively. This reduces sizeof(Holder) since sizeof(FixedVector) is 8
+        while sizeof(Vector) is 16. And since this allocates just-fit size, this does not waste memory.
+
+        * bytecode/BytecodeLivenessAnalysis.cpp:
+        (JSC::BytecodeLivenessAnalysis::computeFullLiveness):
+        * bytecode/BytecodeLivenessAnalysis.h:
+        * bytecode/FullBytecodeLiveness.h:
+        (JSC::FullBytecodeLiveness::FullBytecodeLiveness):
+        * bytecode/UnlinkedEvalCodeBlock.h:
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::BytecodeGenerator):
+        * dfg/DFGGraph.cpp:
+        (JSC::DFG::Graph::livenessFor):
+        * ftl/FTLForOSREntryJITCode.h:
+        * ftl/FTLLowerDFGToB3.cpp:
+        (JSC::FTL::DFG::LowerDFGToB3::lower):
+        * ftl/FTLOSRExit.cpp:
+        (JSC::FTL::OSRExitDescriptor::prepareOSRExitHandle):
+        * ftl/FTLOSRExit.h:
+        * ftl/FTLOSRExitCompiler.cpp:
+        (JSC::FTL::compileRecovery):
+        * heap/MarkedSpace.cpp:
+        (JSC::MarkedSpace::sweepPreciseAllocations):
+        * jit/RegisterAtOffsetList.cpp:
+        (JSC::RegisterAtOffsetList::RegisterAtOffsetList):
+        * jit/RegisterAtOffsetList.h:
+        (JSC::RegisterAtOffsetList::begin const):
+        (JSC::RegisterAtOffsetList::end const):
+        (JSC::RegisterAtOffsetList::clear): Deleted.
+        * runtime/JSGlobalObject.h:
+        * runtime/JSModuleNamespaceObject.cpp:
+        (JSC::JSModuleNamespaceObject::finishCreation):
+        * runtime/JSModuleNamespaceObject.h:
+        * yarr/YarrPattern.h:
+        (JSC::Yarr::YarrPattern::resetForReparsing):
+
 2021-04-06  Alexey Shvayka  <shvaikal...@gmail.com>
 
         Symbol and BigInt wrapper objects should perform OrdinaryToPrimitive

Modified: trunk/Source/_javascript_Core/bytecode/BytecodeLivenessAnalysis.cpp (275587 => 275588)


--- trunk/Source/_javascript_Core/bytecode/BytecodeLivenessAnalysis.cpp	2021-04-07 05:56:24 UTC (rev 275587)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeLivenessAnalysis.cpp	2021-04-07 06:48:02 UTC (rev 275588)
@@ -43,14 +43,13 @@
         dumpResults(codeBlock);
 }
 
-void BytecodeLivenessAnalysis::computeFullLiveness(CodeBlock* codeBlock, FullBytecodeLiveness& result)
+std::unique_ptr<FullBytecodeLiveness> BytecodeLivenessAnalysis::computeFullLiveness(CodeBlock* codeBlock)
 {
     FastBitVector out;
 
     size_t size = codeBlock->instructions().size();
-    result.m_usesBefore.resize(size);
-    result.m_usesAfter.resize(size);
-    
+    auto result = makeUnique<FullBytecodeLiveness>(size);
+
     for (BytecodeBasicBlock& block : m_graph.basicBlocksInReverseOrder()) {
         if (block.isEntryBlock() || block.isExitBlock())
             continue;
@@ -79,12 +78,14 @@
 
                 stepOverBytecodeIndexDef(codeBlock, instructions, m_graph, bytecodeIndex, def);
                 stepOverBytecodeIndexUseInExceptionHandler(codeBlock, instructions, m_graph, bytecodeIndex, use);
-                result.m_usesAfter[result.toIndex(bytecodeIndex)] = out; // AfterUse point.
+                result->m_usesAfter[result->toIndex(bytecodeIndex)] = out; // AfterUse point.
                 stepOverBytecodeIndexUse(codeBlock, instructions, m_graph, bytecodeIndex, use);
-                result.m_usesBefore[result.toIndex(bytecodeIndex)] = out; // BeforeUse point.
+                result->m_usesBefore[result->toIndex(bytecodeIndex)] = out; // BeforeUse point.
             }
         }
     }
+
+    return result;
 }
 
 void BytecodeLivenessAnalysis::dumpResults(CodeBlock* codeBlock)

Modified: trunk/Source/_javascript_Core/bytecode/BytecodeLivenessAnalysis.h (275587 => 275588)


--- trunk/Source/_javascript_Core/bytecode/BytecodeLivenessAnalysis.h	2021-04-07 05:56:24 UTC (rev 275587)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeLivenessAnalysis.h	2021-04-07 06:48:02 UTC (rev 275588)
@@ -85,7 +85,7 @@
     
     FastBitVector getLivenessInfoAtInstruction(CodeBlock* codeBlock, BytecodeIndex bytecodeIndex) { return BytecodeLivenessPropagation::getLivenessInfoAtInstruction(codeBlock, codeBlock->instructions(), m_graph, bytecodeIndex); }
     
-    void computeFullLiveness(CodeBlock*, FullBytecodeLiveness& result);
+    std::unique_ptr<FullBytecodeLiveness> computeFullLiveness(CodeBlock*);
 
     BytecodeGraph& graph() { return m_graph; }
 

Modified: trunk/Source/_javascript_Core/bytecode/FullBytecodeLiveness.h (275587 => 275588)


--- trunk/Source/_javascript_Core/bytecode/FullBytecodeLiveness.h	2021-04-07 05:56:24 UTC (rev 275587)
+++ trunk/Source/_javascript_Core/bytecode/FullBytecodeLiveness.h	2021-04-07 06:48:02 UTC (rev 275588)
@@ -28,6 +28,7 @@
 #include "BytecodeLivenessAnalysis.h"
 #include "Operands.h"
 #include <wtf/FastBitVector.h>
+#include <wtf/FixedVector.h>
 
 namespace JSC {
 
@@ -39,6 +40,11 @@
 class FullBytecodeLiveness {
     WTF_MAKE_FAST_ALLOCATED;
 public:
+    explicit FullBytecodeLiveness(size_t size)
+        : m_usesBefore(size)
+        , m_usesAfter(size)
+    { }
+
     const FastBitVector& getLiveness(BytecodeIndex bytecodeIndex, LivenessCalculationPoint point) const
     {
         // We don't have to worry about overflowing into the next bytecodeoffset in our vectors because we
@@ -64,8 +70,8 @@
 
     // FIXME: Use FastBitVector's view mechanism to make them compact.
     // https://bugs.webkit.org/show_bug.cgi?id=204427
-    Vector<FastBitVector, 0, UnsafeVectorOverflow> m_usesBefore;
-    Vector<FastBitVector, 0, UnsafeVectorOverflow> m_usesAfter;
+    FixedVector<FastBitVector> m_usesBefore;
+    FixedVector<FastBitVector> m_usesAfter;
 };
 
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/bytecode/UnlinkedEvalCodeBlock.h (275587 => 275588)


--- trunk/Source/_javascript_Core/bytecode/UnlinkedEvalCodeBlock.h	2021-04-07 05:56:24 UTC (rev 275587)
+++ trunk/Source/_javascript_Core/bytecode/UnlinkedEvalCodeBlock.h	2021-04-07 06:48:02 UTC (rev 275588)
@@ -26,6 +26,7 @@
 #pragma once
 
 #include "UnlinkedGlobalCodeBlock.h"
+#include <wtf/FixedVector.h>
 
 namespace JSC {
 
@@ -53,10 +54,10 @@
 
     const Identifier& variable(unsigned index) { return m_variables[index]; }
     unsigned numVariables() { return m_variables.size(); }
-    void adoptVariables(Vector<Identifier, 0, UnsafeVectorOverflow>& variables)
+    void adoptVariables(Vector<Identifier, 0, UnsafeVectorOverflow>&& variables)
     {
         ASSERT(m_variables.isEmpty());
-        m_variables.swap(variables);
+        m_variables = FixedVector<Identifier>(WTFMove(variables));
     }
 
     const Identifier& functionHoistingCandidate(unsigned index) { return m_functionHoistingCandidates[index]; }
@@ -64,7 +65,7 @@
     void adoptFunctionHoistingCandidates(Vector<Identifier, 0, UnsafeVectorOverflow>&& functionHoistingCandidates)
     {
         ASSERT(m_functionHoistingCandidates.isEmpty());
-        m_functionHoistingCandidates = WTFMove(functionHoistingCandidates);
+        m_functionHoistingCandidates = FixedVector<Identifier>(WTFMove(functionHoistingCandidates));
     }
 private:
     friend CachedEvalCodeBlock;
@@ -76,8 +77,8 @@
 
     UnlinkedEvalCodeBlock(Decoder&, const CachedEvalCodeBlock&);
 
-    Vector<Identifier, 0, UnsafeVectorOverflow> m_variables;
-    Vector<Identifier, 0, UnsafeVectorOverflow> m_functionHoistingCandidates;
+    FixedVector<Identifier> m_variables;
+    FixedVector<Identifier> m_functionHoistingCandidates;
 
 public:
     static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto)

Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (275587 => 275588)


--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2021-04-07 05:56:24 UTC (rev 275587)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2021-04-07 06:48:02 UTC (rev 275588)
@@ -889,7 +889,7 @@
         else
             variables.append(Identifier::fromUid(m_vm, entry.key.get()));
     }
-    codeBlock->adoptVariables(variables);
+    codeBlock->adoptVariables(WTFMove(variables));
     codeBlock->adoptFunctionHoistingCandidates(WTFMove(hoistedFunctions));
     
     if (evalNode->needsNewTargetRegisterForThisScope())

Modified: trunk/Source/_javascript_Core/dfg/DFGGraph.cpp (275587 => 275588)


--- trunk/Source/_javascript_Core/dfg/DFGGraph.cpp	2021-04-07 05:56:24 UTC (rev 275587)
+++ trunk/Source/_javascript_Core/dfg/DFGGraph.cpp	2021-04-07 06:48:02 UTC (rev 275588)
@@ -1114,8 +1114,7 @@
     if (iter != m_bytecodeLiveness.end())
         return *iter->value;
     
-    std::unique_ptr<FullBytecodeLiveness> liveness = makeUnique<FullBytecodeLiveness>();
-    codeBlock->livenessAnalysis().computeFullLiveness(codeBlock, *liveness);
+    std::unique_ptr<FullBytecodeLiveness> liveness = codeBlock->livenessAnalysis().computeFullLiveness(codeBlock);
     FullBytecodeLiveness& result = *liveness;
     m_bytecodeLiveness.add(codeBlock, WTFMove(liveness));
     return result;

Modified: trunk/Source/_javascript_Core/ftl/FTLForOSREntryJITCode.h (275587 => 275588)


--- trunk/Source/_javascript_Core/ftl/FTLForOSREntryJITCode.h	2021-04-07 05:56:24 UTC (rev 275587)
+++ trunk/Source/_javascript_Core/ftl/FTLForOSREntryJITCode.h	2021-04-07 06:48:02 UTC (rev 275588)
@@ -28,6 +28,7 @@
 #if ENABLE(FTL_JIT)
 
 #include "FTLJITCode.h"
+#include <wtf/FixedVector.h>
 
 namespace JSC { namespace FTL {
 
@@ -55,10 +56,15 @@
     unsigned entryFailureCount() const { return m_entryFailureCount; }
     
     ForOSREntryJITCode* ftlForOSREntry() final;
-    Vector<DFG::FlushFormat>& argumentFlushFormats() { return m_argumentFlushFormats; }
 
+    void setArgumentFlushFormats(FixedVector<DFG::FlushFormat>&& argumentFlushFormats)
+    {
+        m_argumentFlushFormats = WTFMove(argumentFlushFormats);
+    }
+    const FixedVector<DFG::FlushFormat>& argumentFlushFormats() { return m_argumentFlushFormats; }
+
 private:
-    Vector<DFG::FlushFormat> m_argumentFlushFormats;
+    FixedVector<DFG::FlushFormat> m_argumentFlushFormats;
     ScratchBuffer* m_entryBuffer; // Only for OSR entry code blocks.
     BytecodeIndex m_bytecodeIndex;
     unsigned m_entryFailureCount;

Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp (275587 => 275588)


--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp	2021-04-07 05:56:24 UTC (rev 275587)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp	2021-04-07 06:48:02 UTC (rev 275588)
@@ -361,9 +361,10 @@
 
             if (m_graph.m_plan.mode() == FTLForOSREntryMode) {
                 auto* jitCode = m_ftlState.jitCode->ftlForOSREntry();
-                jitCode->argumentFlushFormats().reserveInitialCapacity(codeBlock()->numParameters());
+                FixedVector<DFG::FlushFormat> argumentFlushFormats(codeBlock()->numParameters());
                 for (int i = 0; i < codeBlock()->numParameters(); ++i)
-                    jitCode->argumentFlushFormats().uncheckedAppend(m_graph.m_argumentFormats[0][i]);
+                    argumentFlushFormats[i] = m_graph.m_argumentFormats[0][i];
+                jitCode->setArgumentFlushFormats(WTFMove(argumentFlushFormats));
             } else {
                 for (unsigned i = codeBlock()->numParameters(); i--;) {
                     MethodOfGettingAValueProfile profile(&m_graph.m_profiledBlock->valueProfileForArgument(i));

Modified: trunk/Source/_javascript_Core/ftl/FTLOSRExit.cpp (275587 => 275588)


--- trunk/Source/_javascript_Core/ftl/FTLOSRExit.cpp	2021-04-07 05:56:24 UTC (rev 275587)
+++ trunk/Source/_javascript_Core/ftl/FTLOSRExit.cpp	2021-04-07 06:48:02 UTC (rev 275588)
@@ -86,9 +86,9 @@
     OSRExit& exit = state.jitCode->osrExit.alloc(
         this, exitKind, nodeOrigin.forExit, nodeOrigin.semantic, nodeOrigin.wasHoisted, dfgNodeIndex);
     Ref<OSRExitHandle> handle = adoptRef(*new OSRExitHandle(index, exit));
-    for (unsigned i = offset; i < params.size(); ++i)
-        exit.m_valueReps.append(params[i]);
-    exit.m_valueReps.shrinkToFit();
+    exit.m_valueReps = FixedVector<B3::ValueRep>(params.size() - offset);
+    for (unsigned i = offset, indexInValueReps = 0; i < params.size(); ++i, ++indexInValueReps)
+        exit.m_valueReps[indexInValueReps] = params[i];
     return handle;
 }
 

Modified: trunk/Source/_javascript_Core/ftl/FTLOSRExit.h (275587 => 275588)


--- trunk/Source/_javascript_Core/ftl/FTLOSRExit.h	2021-04-07 05:56:24 UTC (rev 275587)
+++ trunk/Source/_javascript_Core/ftl/FTLOSRExit.h	2021-04-07 06:48:02 UTC (rev 275588)
@@ -44,6 +44,7 @@
 #include "Reg.h"
 #include "ValueProfile.h"
 #include "VirtualRegister.h"
+#include <wtf/FixedVector.h>
 
 namespace JSC {
 
@@ -125,7 +126,7 @@
     MacroAssemblerCodeRef<OSRExitPtrTag> m_code;
     // This tells us where to place a jump.
     CodeLocationJump<JSInternalPtrTag> m_patchableJump;
-    Vector<B3::ValueRep> m_valueReps;
+    FixedVector<B3::ValueRep> m_valueReps;
 
     CodeLocationJump<JSInternalPtrTag> codeLocationForRepatch(CodeBlock* ftlCodeBlock) const;
     void considerAddingAsFrequentExitSite(CodeBlock* profiledCodeBlock)

Modified: trunk/Source/_javascript_Core/ftl/FTLOSRExitCompiler.cpp (275587 => 275588)


--- trunk/Source/_javascript_Core/ftl/FTLOSRExitCompiler.cpp	2021-04-07 05:56:24 UTC (rev 275587)
+++ trunk/Source/_javascript_Core/ftl/FTLOSRExitCompiler.cpp	2021-04-07 06:48:02 UTC (rev 275588)
@@ -102,7 +102,7 @@
 
 static void compileRecovery(
     CCallHelpers& jit, const ExitValue& value,
-    Vector<B3::ValueRep>& valueReps,
+    const FixedVector<B3::ValueRep>& valueReps,
     char* registerScratch,
     const HashMap<ExitTimeObjectMaterialization*, EncodedJSValue*>& materializationToPointer)
 {

Modified: trunk/Source/_javascript_Core/heap/MarkedSpace.cpp (275587 => 275588)


--- trunk/Source/_javascript_Core/heap/MarkedSpace.cpp	2021-04-07 05:56:24 UTC (rev 275587)
+++ trunk/Source/_javascript_Core/heap/MarkedSpace.cpp	2021-04-07 06:48:02 UTC (rev 275588)
@@ -246,7 +246,7 @@
         allocation->setIndexInSpace(dstIndex);
         m_preciseAllocations[dstIndex++] = allocation;
     }
-    m_preciseAllocations.shrink(dstIndex);
+    m_preciseAllocations.shrinkCapacity(dstIndex);
     m_preciseAllocationsNurseryOffset = m_preciseAllocations.size();
 }
 

Modified: trunk/Source/_javascript_Core/jit/RegisterAtOffsetList.cpp (275587 => 275588)


--- trunk/Source/_javascript_Core/jit/RegisterAtOffsetList.cpp	2021-04-07 05:56:24 UTC (rev 275587)
+++ trunk/Source/_javascript_Core/jit/RegisterAtOffsetList.cpp	2021-04-07 06:48:02 UTC (rev 275588)
@@ -37,6 +37,7 @@
 RegisterAtOffsetList::RegisterAtOffsetList() { }
 
 RegisterAtOffsetList::RegisterAtOffsetList(RegisterSet registerSet, OffsetBaseType offsetBaseType)
+    : m_registers(registerSet.numberOfSetRegisters())
 {
     size_t numberOfRegisters = registerSet.numberOfSetRegisters();
     ptrdiff_t offset = 0;
@@ -44,10 +45,11 @@
     if (offsetBaseType == FramePointerBased)
         offset = -(static_cast<ptrdiff_t>(numberOfRegisters) * sizeof(CPURegister));
 
-    m_registers.reserveInitialCapacity(numberOfRegisters);
+    unsigned index = 0;
     registerSet.forEach([&] (Reg reg) {
-        m_registers.append(RegisterAtOffset(reg, offset));
+        m_registers[index] = RegisterAtOffset(reg, offset);
         offset += sizeof(CPURegister);
+        ++index;
     });
 }
 

Modified: trunk/Source/_javascript_Core/jit/RegisterAtOffsetList.h (275587 => 275588)


--- trunk/Source/_javascript_Core/jit/RegisterAtOffsetList.h	2021-04-07 05:56:24 UTC (rev 275587)
+++ trunk/Source/_javascript_Core/jit/RegisterAtOffsetList.h	2021-04-07 06:48:02 UTC (rev 275588)
@@ -29,6 +29,7 @@
 
 #include "RegisterAtOffset.h"
 #include "RegisterSet.h"
+#include <wtf/FixedVector.h>
 
 namespace JSC {
 
@@ -43,11 +44,6 @@
 
     void dump(PrintStream&) const;
 
-    void clear()
-    {
-        m_registers.clear();
-    }
-
     size_t size() const
     {
         return m_registers.size();
@@ -66,13 +62,13 @@
     RegisterAtOffset* find(Reg) const;
     unsigned indexOf(Reg) const; // Returns UINT_MAX if not found.
 
-    Vector<RegisterAtOffset>::const_iterator begin() const { return m_registers.begin(); }
-    Vector<RegisterAtOffset>::const_iterator end() const { return m_registers.end(); }
+    FixedVector<RegisterAtOffset>::const_iterator begin() const { return m_registers.begin(); }
+    FixedVector<RegisterAtOffset>::const_iterator end() const { return m_registers.end(); }
 
     static const RegisterAtOffsetList& llintBaselineCalleeSaveRegisters(); // Registers and Offsets saved and used by the LLInt.
 
 private:
-    Vector<RegisterAtOffset> m_registers;
+    FixedVector<RegisterAtOffset> m_registers;
 };
 
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.h (275587 => 275588)


--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.h	2021-04-07 05:56:24 UTC (rev 275587)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.h	2021-04-07 06:48:02 UTC (rev 275588)
@@ -48,6 +48,7 @@
 #include "WeakGCSet.h"
 #include <_javascript_Core/JSBase.h>
 #include <array>
+#include <wtf/FixedVector.h>
 #include <wtf/HashSet.h>
 #include <wtf/RetainPtr.h>
 
@@ -459,7 +460,7 @@
     FOR_EACH_TYPED_ARRAY_TYPE(DECLARE_TYPED_ARRAY_TYPE_STRUCTURE)
 #undef DECLARE_TYPED_ARRAY_TYPE_STRUCTURE
 
-    Vector<LazyProperty<JSGlobalObject, JSCell>> m_linkTimeConstants;
+    FixedVector<LazyProperty<JSGlobalObject, JSCell>> m_linkTimeConstants;
 
     String m_name;
 

Modified: trunk/Source/_javascript_Core/runtime/JSModuleNamespaceObject.cpp (275587 => 275588)


--- trunk/Source/_javascript_Core/runtime/JSModuleNamespaceObject.cpp	2021-04-07 05:56:24 UTC (rev 275587)
+++ trunk/Source/_javascript_Core/runtime/JSModuleNamespaceObject.cpp	2021-04-07 06:48:02 UTC (rev 275588)
@@ -58,14 +58,16 @@
     });
 
     m_moduleRecord.set(vm, this, moduleRecord);
-    m_names.reserveCapacity(resolutions.size());
+    m_names = FixedVector<Identifier>(resolutions.size());
     {
         auto locker = holdLock(cellLock());
+        unsigned index = 0;
         for (const auto& pair : resolutions) {
-            m_names.append(pair.first);
+            m_names[index] = pair.first;
             auto addResult = m_exports.add(pair.first.impl(), ExportEntry());
             addResult.iterator->value.localName = pair.second.localName;
             addResult.iterator->value.moduleRecord.set(vm, this, pair.second.moduleRecord);
+            ++index;
         }
     }
 

Modified: trunk/Source/_javascript_Core/runtime/JSModuleNamespaceObject.h (275587 => 275588)


--- trunk/Source/_javascript_Core/runtime/JSModuleNamespaceObject.h	2021-04-07 05:56:24 UTC (rev 275587)
+++ trunk/Source/_javascript_Core/runtime/JSModuleNamespaceObject.h	2021-04-07 06:48:02 UTC (rev 275588)
@@ -27,6 +27,7 @@
 
 #include "AbstractModuleRecord.h"
 #include "JSDestructibleObject.h"
+#include <wtf/FixedVector.h>
 
 namespace JSC {
 
@@ -84,7 +85,7 @@
     typedef HashMap<RefPtr<UniquedStringImpl>, ExportEntry, IdentifierRepHash, HashTraits<RefPtr<UniquedStringImpl>>> ExportMap;
 
     ExportMap m_exports;
-    Vector<Identifier> m_names;
+    FixedVector<Identifier> m_names;
     WriteBarrier<AbstractModuleRecord> m_moduleRecord;
 
     friend size_t cellSize(VM&, JSCell*);

Modified: trunk/Source/_javascript_Core/yarr/YarrPattern.h (275587 => 275588)


--- trunk/Source/_javascript_Core/yarr/YarrPattern.h	2021-04-07 05:56:24 UTC (rev 275587)
+++ trunk/Source/_javascript_Core/yarr/YarrPattern.h	2021-04-07 06:48:02 UTC (rev 275588)
@@ -413,7 +413,7 @@
 
         m_disjunctions.clear();
         m_userCharacterClasses.clear();
-        m_captureGroupNames.shrink(0);
+        m_captureGroupNames.clear();
     }
 
     bool containsUnsignedLengthPattern()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to