Title: [275626] trunk/Source
Revision
275626
Author
ysuz...@apple.com
Date
2021-04-07 14:14:57 -0700 (Wed, 07 Apr 2021)

Log Message

[JSC] Use FixedVector more in bytecode dir and JumpTable
https://bugs.webkit.org/show_bug.cgi?id=224275

Reviewed by Michael Saboff and Mark Lam.

Source/_javascript_Core:

1. Use FixedVector more in bytecode/ directory's long-living data structures.
2. Use FixedVector in SimpleJumpTable. This involves LLInt changes because we need to access FixedVector data from LLInt.

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::finishCreation):
* bytecode/InlineCallFrame.cpp:
(JSC::InlineCallFrame::dumpInContext const):
* bytecode/InlineCallFrame.h:
* bytecode/JumpTable.h:
(JSC::SimpleJumpTable::clear):
* bytecode/ObjectPropertyConditionSet.cpp:
(JSC::ObjectPropertyConditionSet::mergedWith const):
(JSC::ObjectPropertyConditionSet::dumpInContext const):
(JSC::ObjectPropertyConditionSet::isValidAndWatchable const):
* bytecode/ObjectPropertyConditionSet.h:
(JSC::ObjectPropertyConditionSet::create):
(JSC::ObjectPropertyConditionSet::isValid const):
(JSC::ObjectPropertyConditionSet::size const):
(JSC::ObjectPropertyConditionSet::begin const):
(JSC::ObjectPropertyConditionSet::end const):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::findArgumentPositionForLocal):
(JSC::DFG::ByteCodeParser::flushImpl):
(JSC::DFG::ByteCodeParser::parseBlock):
(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
* dfg/DFGCommonData.cpp:
(JSC::DFG::CommonData::validateReferences):
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::isLiveInBytecode):
* dfg/DFGGraph.h:
* dfg/DFGPreciseLocalClobberize.h:
(JSC::DFG::PreciseLocalClobberizeAdaptor::readTop):
* dfg/DFGStackLayoutPhase.cpp:
(JSC::DFG::StackLayoutPhase::run):
* ftl/FTLCompile.cpp:
(JSC::FTL::compile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileGetMyArgumentByVal):
* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::argumentsStart):
* jit/SetupVarargsFrame.cpp:
(JSC::emitSetupVarargsFrameFastCase):
* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
* runtime/ClonedArguments.cpp:
(JSC::ClonedArguments::createWithInlineFrame):

Source/WTF:

* wtf/FixedVector.h:
(WTF::FixedVector::offsetOfStorage):
* wtf/RefCountedArray.h:
(WTF::RefCountedArray::Header::size):
(WTF::RefCountedArray::Header::offsetOfLength):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (275625 => 275626)


--- trunk/Source/_javascript_Core/ChangeLog	2021-04-07 21:02:17 UTC (rev 275625)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-04-07 21:14:57 UTC (rev 275626)
@@ -1,3 +1,58 @@
+2021-04-07  Yusuke Suzuki  <ysuz...@apple.com>
+
+        [JSC] Use FixedVector more in bytecode dir and JumpTable
+        https://bugs.webkit.org/show_bug.cgi?id=224275
+
+        Reviewed by Michael Saboff and Mark Lam.
+
+        1. Use FixedVector more in bytecode/ directory's long-living data structures.
+        2. Use FixedVector in SimpleJumpTable. This involves LLInt changes because we need to access FixedVector data from LLInt.
+
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::finishCreation):
+        * bytecode/InlineCallFrame.cpp:
+        (JSC::InlineCallFrame::dumpInContext const):
+        * bytecode/InlineCallFrame.h:
+        * bytecode/JumpTable.h:
+        (JSC::SimpleJumpTable::clear):
+        * bytecode/ObjectPropertyConditionSet.cpp:
+        (JSC::ObjectPropertyConditionSet::mergedWith const):
+        (JSC::ObjectPropertyConditionSet::dumpInContext const):
+        (JSC::ObjectPropertyConditionSet::isValidAndWatchable const):
+        * bytecode/ObjectPropertyConditionSet.h:
+        (JSC::ObjectPropertyConditionSet::create):
+        (JSC::ObjectPropertyConditionSet::isValid const):
+        (JSC::ObjectPropertyConditionSet::size const):
+        (JSC::ObjectPropertyConditionSet::begin const):
+        (JSC::ObjectPropertyConditionSet::end const):
+        * dfg/DFGByteCodeParser.cpp:
+        (JSC::DFG::ByteCodeParser::findArgumentPositionForLocal):
+        (JSC::DFG::ByteCodeParser::flushImpl):
+        (JSC::DFG::ByteCodeParser::parseBlock):
+        (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
+        * dfg/DFGCommonData.cpp:
+        (JSC::DFG::CommonData::validateReferences):
+        * dfg/DFGGraph.cpp:
+        (JSC::DFG::Graph::isLiveInBytecode):
+        * dfg/DFGGraph.h:
+        * dfg/DFGPreciseLocalClobberize.h:
+        (JSC::DFG::PreciseLocalClobberizeAdaptor::readTop):
+        * dfg/DFGStackLayoutPhase.cpp:
+        (JSC::DFG::StackLayoutPhase::run):
+        * ftl/FTLCompile.cpp:
+        (JSC::FTL::compile):
+        * ftl/FTLLowerDFGToB3.cpp:
+        (JSC::FTL::DFG::LowerDFGToB3::compileGetMyArgumentByVal):
+        * jit/AssemblyHelpers.h:
+        (JSC::AssemblyHelpers::argumentsStart):
+        * jit/SetupVarargsFrame.cpp:
+        (JSC::emitSetupVarargsFrameFastCase):
+        * llint/LowLevelInterpreter.asm:
+        * llint/LowLevelInterpreter32_64.asm:
+        * llint/LowLevelInterpreter64.asm:
+        * runtime/ClonedArguments.cpp:
+        (JSC::ClonedArguments::createWithInlineFrame):
+
 2021-04-07  Mark Lam  <mark....@apple.com>
 
         Fix a typo in JITUncoughtExceptionAfterCall.

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (275625 => 275626)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2021-04-07 21:02:17 UTC (rev 275625)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2021-04-07 21:14:57 UTC (rev 275626)
@@ -454,8 +454,7 @@
             for (size_t i = 0; i < count; i++) {
                 UnlinkedSimpleJumpTable& sourceTable = unlinkedCodeBlock->switchJumpTable(i);
                 SimpleJumpTable& destTable = m_rareData->m_switchJumpTables[i];
-                destTable.branchOffsets.resizeToFit(sourceTable.branchOffsets.size());
-                std::copy(sourceTable.branchOffsets.begin(), sourceTable.branchOffsets.end(), destTable.branchOffsets.begin());
+                destTable.branchOffsets = sourceTable.branchOffsets;
                 destTable.min = sourceTable.min;
             }
         }

Modified: trunk/Source/_javascript_Core/bytecode/InlineCallFrame.cpp (275625 => 275626)


--- trunk/Source/_javascript_Core/bytecode/InlineCallFrame.cpp	2021-04-07 21:02:17 UTC (rev 275625)
+++ trunk/Source/_javascript_Core/bytecode/InlineCallFrame.cpp	2021-04-07 21:14:57 UTC (rev 275626)
@@ -74,7 +74,7 @@
     else
         out.print(", known callee: ", inContext(calleeRecovery.constant(), context));
     out.print(", numArgs+this = ", argumentCountIncludingThis);
-    out.print(", numFixup = ", argumentsWithFixup.size() - argumentCountIncludingThis);
+    out.print(", numFixup = ", m_argumentsWithFixup.size() - argumentCountIncludingThis);
     out.print(", stackOffset = ", stackOffset);
     out.print(" (", virtualRegisterForLocal(0), " maps to ", virtualRegisterForLocal(0) + stackOffset, ")>");
 }

Modified: trunk/Source/_javascript_Core/bytecode/InlineCallFrame.h (275625 => 275626)


--- trunk/Source/_javascript_Core/bytecode/InlineCallFrame.h	2021-04-07 21:02:17 UTC (rev 275625)
+++ trunk/Source/_javascript_Core/bytecode/InlineCallFrame.h	2021-04-07 21:14:57 UTC (rev 275626)
@@ -175,7 +175,7 @@
         return caller ? caller->inlineCallFrame() : nullptr;
     }
     
-    Vector<ValueRecovery> argumentsWithFixup; // Includes 'this' and arity fixups.
+    FixedVector<ValueRecovery> m_argumentsWithFixup; // Includes 'this' and arity fixups.
     WriteBarrier<CodeBlock> baselineCodeBlock;
     CodeOrigin directCaller;
 

Modified: trunk/Source/_javascript_Core/bytecode/JumpTable.h (275625 => 275626)


--- trunk/Source/_javascript_Core/bytecode/JumpTable.h	2021-04-07 21:02:17 UTC (rev 275625)
+++ trunk/Source/_javascript_Core/bytecode/JumpTable.h	2021-04-07 21:14:57 UTC (rev 275626)
@@ -78,7 +78,7 @@
 
     struct SimpleJumpTable {
         // FIXME: The two Vectors can be combined into one Vector<OffsetLocation>
-        Vector<int32_t> branchOffsets;
+        FixedVector<int32_t> branchOffsets;
         int32_t min { INT32_MIN };
 #if ENABLE(JIT)
         Vector<CodeLocationLabel<JSSwitchPtrTag>> ctiOffsets;
@@ -115,7 +115,7 @@
 #if ENABLE(DFG_JIT)
         void clear()
         {
-            branchOffsets.clear();
+            branchOffsets = FixedVector<int32_t>();
             ctiOffsets.clear();
         }
 #endif

Modified: trunk/Source/_javascript_Core/bytecode/ObjectPropertyConditionSet.cpp (275625 => 275626)


--- trunk/Source/_javascript_Core/bytecode/ObjectPropertyConditionSet.cpp	2021-04-07 21:02:17 UTC (rev 275625)
+++ trunk/Source/_javascript_Core/bytecode/ObjectPropertyConditionSet.cpp	2021-04-07 21:14:57 UTC (rev 275626)
@@ -105,7 +105,7 @@
     Vector<ObjectPropertyCondition> result;
     
     if (!isEmpty())
-        result.appendVector(m_data->vector);
+        result.append(m_data->m_vector.begin(), m_data->m_vector.size());
     
     for (const ObjectPropertyCondition& newCondition : other) {
         bool foundMatch = false;
@@ -121,7 +121,7 @@
             result.append(newCondition);
     }
 
-    return create(result);
+    return create(WTFMove(result));
 }
 
 bool ObjectPropertyConditionSet::structuresEnsureValidity() const
@@ -175,7 +175,7 @@
     
     out.print("[");
     if (m_data)
-        out.print(listDumpInContext(m_data->vector, context));
+        out.print(listDumpInContext(m_data->m_vector, context));
     out.print("]");
 }
 
@@ -189,7 +189,7 @@
     if (!isValid())
         return false;
 
-    for (ObjectPropertyCondition condition : m_data->vector) {
+    for (auto& condition : m_data->m_vector) {
         if (!condition.isWatchable())
             return false;
     }
@@ -329,7 +329,7 @@
 
     if (ObjectPropertyConditionSetInternal::verbose)
         dataLog("Returning conditions: ", listDump(conditions), "\n");
-    return ObjectPropertyConditionSet::create(conditions);
+    return ObjectPropertyConditionSet::create(WTFMove(conditions));
 }
 
 } // anonymous namespace

Modified: trunk/Source/_javascript_Core/bytecode/ObjectPropertyConditionSet.h (275625 => 275626)


--- trunk/Source/_javascript_Core/bytecode/ObjectPropertyConditionSet.h	2021-04-07 21:02:17 UTC (rev 275625)
+++ trunk/Source/_javascript_Core/bytecode/ObjectPropertyConditionSet.h	2021-04-07 21:14:57 UTC (rev 275626)
@@ -27,6 +27,7 @@
 
 #include "ObjectPropertyCondition.h"
 #include <wtf/FastMalloc.h>
+#include <wtf/FixedVector.h>
 #include <wtf/Vector.h>
 
 namespace JSC {
@@ -50,7 +51,7 @@
         return result;
     }
     
-    static ObjectPropertyConditionSet create(const Vector<ObjectPropertyCondition>& vector)
+    static ObjectPropertyConditionSet create(Vector<ObjectPropertyCondition>&& vector)
     {
         if (vector.isEmpty())
             return ObjectPropertyConditionSet();
@@ -57,18 +58,18 @@
         
         ObjectPropertyConditionSet result;
         result.m_data = adoptRef(new Data());
-        result.m_data->vector = vector;
+        result.m_data->m_vector = FixedVector<ObjectPropertyCondition>(WTFMove(vector));
         return result;
     }
     
     bool isValid() const
     {
-        return !m_data || !m_data->vector.isEmpty();
+        return !m_data || !m_data->m_vector.isEmpty();
     }
 
     bool isValidAndWatchable() const;
 
-    size_t size() const { return m_data ? m_data->vector.size() : 0; }
+    size_t size() const { return m_data ? m_data->m_vector.size() : 0; }
     bool isEmpty() const
     {
         return !m_data;
@@ -80,13 +81,13 @@
     {
         if (!m_data)
             return nullptr;
-        return m_data->vector.begin();
+        return m_data->m_vector.begin();
     }
     iterator end() const
     {
         if (!m_data)
             return nullptr;
-        return m_data->vector.end();
+        return m_data->m_vector.end();
     }
     
     ObjectPropertyCondition forObject(JSObject*) const;
@@ -157,7 +158,7 @@
     public:
         Data() { }
         
-        Vector<ObjectPropertyCondition> vector;
+        FixedVector<ObjectPropertyCondition> m_vector;
     };
     
 private:

Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (275625 => 275626)


--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2021-04-07 21:02:17 UTC (rev 275625)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2021-04-07 21:14:57 UTC (rev 275626)
@@ -575,7 +575,7 @@
                 break;
             if (operand.offset() < static_cast<int>(inlineCallFrame->stackOffset + CallFrame::headerSizeInRegisters))
                 continue;
-            if (operand.offset() >= static_cast<int>(inlineCallFrame->stackOffset + CallFrame::thisArgumentOffset() + inlineCallFrame->argumentsWithFixup.size()))
+            if (operand.offset() >= static_cast<int>(inlineCallFrame->stackOffset + CallFrame::thisArgumentOffset() + inlineCallFrame->m_argumentsWithFixup.size()))
                 continue;
             int argument = VirtualRegister(operand.offset() - inlineCallFrame->stackOffset).toArgument();
             return stack->m_argumentPositions[argument];
@@ -598,7 +598,7 @@
         int numArguments;
         if (inlineCallFrame) {
             ASSERT(!m_graph.hasDebuggerEnabled());
-            numArguments = inlineCallFrame->argumentsWithFixup.size();
+            numArguments = inlineCallFrame->m_argumentsWithFixup.size();
             if (inlineCallFrame->isClosureCall)
                 addFlushDirect(inlineCallFrame, remapOperand(inlineCallFrame, CallFrameSlot::callee));
             if (inlineCallFrame->isVarargs())
@@ -8146,7 +8146,7 @@
             Node* argument;
             int32_t argumentIndexIncludingThis = bytecode.m_index;
             if (inlineCallFrame && !inlineCallFrame->isVarargs()) {
-                int32_t argumentCountIncludingThisWithFixup = inlineCallFrame->argumentsWithFixup.size();
+                int32_t argumentCountIncludingThisWithFixup = inlineCallFrame->m_argumentsWithFixup.size();
                 if (argumentIndexIncludingThis < argumentCountIncludingThisWithFixup)
                     argument = get(virtualRegisterForArgumentIncludingThis(argumentIndexIncludingThis));
                 else
@@ -8524,7 +8524,7 @@
         } else
             m_inlineCallFrame->isClosureCall = true;
         m_inlineCallFrame->directCaller = byteCodeParser->currentCodeOrigin();
-        m_inlineCallFrame->argumentsWithFixup.resizeToFit(argumentCountIncludingThisWithFixup); // Set the number of arguments including this, but don't configure the value recoveries, yet.
+        m_inlineCallFrame->m_argumentsWithFixup = FixedVector<ValueRecovery>(argumentCountIncludingThisWithFixup); // Set the number of arguments including this, but don't configure the value recoveries, yet.
         m_inlineCallFrame->kind = kind;
         
         m_identifierRemap.resize(codeBlock->numberOfIdentifiers());

Modified: trunk/Source/_javascript_Core/dfg/DFGCommonData.cpp (275625 => 275626)


--- trunk/Source/_javascript_Core/dfg/DFGCommonData.cpp	2021-04-07 21:02:17 UTC (rev 275625)
+++ trunk/Source/_javascript_Core/dfg/DFGCommonData.cpp	2021-04-07 21:14:57 UTC (rev 275626)
@@ -149,7 +149,7 @@
 {
     if (InlineCallFrameSet* set = inlineCallFrames.get()) {
         for (InlineCallFrame* inlineCallFrame : *set) {
-            for (ValueRecovery& recovery : inlineCallFrame->argumentsWithFixup) {
+            for (ValueRecovery& recovery : inlineCallFrame->m_argumentsWithFixup) {
                 if (recovery.isConstant())
                     trackedReferences.check(recovery.constant());
             }

Modified: trunk/Source/_javascript_Core/dfg/DFGGraph.cpp (275625 => 275626)


--- trunk/Source/_javascript_Core/dfg/DFGGraph.cpp	2021-04-07 21:02:17 UTC (rev 275625)
+++ trunk/Source/_javascript_Core/dfg/DFGGraph.cpp	2021-04-07 21:14:57 UTC (rev 275626)
@@ -1194,7 +1194,7 @@
         // Arguments are always live. This would be redundant if it wasn't for our
         // op_call_varargs inlining.
         if (inlineCallFrame && reg.isArgument()
-            && static_cast<size_t>(reg.toArgument()) < inlineCallFrame->argumentsWithFixup.size()) {
+            && static_cast<size_t>(reg.toArgument()) < inlineCallFrame->m_argumentsWithFixup.size()) {
             if (verbose)
                 dataLog("Argument is live.\n");
             return true;

Modified: trunk/Source/_javascript_Core/dfg/DFGGraph.h (275625 => 275626)


--- trunk/Source/_javascript_Core/dfg/DFGGraph.h	2021-04-07 21:02:17 UTC (rev 275625)
+++ trunk/Source/_javascript_Core/dfg/DFGGraph.h	2021-04-07 21:14:57 UTC (rev 275626)
@@ -916,7 +916,7 @@
             // Arguments are always live. This would be redundant if it wasn't for our
             // op_call_varargs inlining. See the comment above.
             exclusionStart = stackOffset + CallFrame::argumentOffsetIncludingThis(0);
-            exclusionEnd = stackOffset + CallFrame::argumentOffsetIncludingThis(inlineCallFrame->argumentsWithFixup.size());
+            exclusionEnd = stackOffset + CallFrame::argumentOffsetIncludingThis(inlineCallFrame->m_argumentsWithFixup.size());
             
             // We will always have a "this" argument and exclusionStart should be a smaller stack
             // offset than exclusionEnd.

Modified: trunk/Source/_javascript_Core/dfg/DFGPreciseLocalClobberize.h (275625 => 275626)


--- trunk/Source/_javascript_Core/dfg/DFGPreciseLocalClobberize.h	2021-04-07 21:02:17 UTC (rev 275625)
+++ trunk/Source/_javascript_Core/dfg/DFGPreciseLocalClobberize.h	2021-04-07 21:14:57 UTC (rev 275626)
@@ -119,7 +119,7 @@
             // Read all of the inline arguments and call frame headers that we didn't already capture.
             for (InlineCallFrame* inlineCallFrame = node->origin.semantic.inlineCallFrame(); inlineCallFrame; inlineCallFrame = inlineCallFrame->getCallerInlineFrameSkippingTailCalls()) {
                 if (!inlineCallFrame->isInStrictContext()) {
-                    for (unsigned i = inlineCallFrame->argumentsWithFixup.size(); i--;)
+                    for (unsigned i = inlineCallFrame->m_argumentsWithFixup.size(); i--;)
                         m_read(VirtualRegister(inlineCallFrame->stackOffset + virtualRegisterForArgumentIncludingThis(i).offset()));
                 }
                 if (inlineCallFrame->isClosureCall)
@@ -138,7 +138,7 @@
                 return;
             }
             
-            for (unsigned i = numberOfArgumentsToSkip; i < inlineCallFrame->argumentsWithFixup.size(); i++)
+            for (unsigned i = numberOfArgumentsToSkip; i < inlineCallFrame->m_argumentsWithFixup.size(); i++)
                 m_read(VirtualRegister(inlineCallFrame->stackOffset + virtualRegisterForArgumentIncludingThis(i).offset()));
             if (inlineCallFrame->isVarargs())
                 m_read(VirtualRegister(inlineCallFrame->stackOffset + CallFrameSlot::argumentCountIncludingThis));
@@ -257,7 +257,7 @@
             }
 
             ASSERT_WITH_MESSAGE(inlineCallFrame->isVarargs(), "GetArgument is only used for InlineCallFrame if the call frame is varargs.");
-            if (indexIncludingThis < inlineCallFrame->argumentsWithFixup.size())
+            if (indexIncludingThis < inlineCallFrame->m_argumentsWithFixup.size())
                 m_read(VirtualRegister(inlineCallFrame->stackOffset + virtualRegisterForArgumentIncludingThis(indexIncludingThis).offset()));
             m_read(VirtualRegister(inlineCallFrame->stackOffset + CallFrameSlot::argumentCountIncludingThis));
             break;

Modified: trunk/Source/_javascript_Core/dfg/DFGStackLayoutPhase.cpp (275625 => 275626)


--- trunk/Source/_javascript_Core/dfg/DFGStackLayoutPhase.cpp	2021-04-07 21:02:17 UTC (rev 275625)
+++ trunk/Source/_javascript_Core/dfg/DFGStackLayoutPhase.cpp	2021-04-07 21:14:57 UTC (rev 275626)
@@ -111,7 +111,7 @@
                     CallFrameSlot::argumentCountIncludingThis + inlineCallFrame->stackOffset), true);
             }
             
-            for (unsigned argument = inlineCallFrame->argumentsWithFixup.size(); argument--;) {
+            for (unsigned argument = inlineCallFrame->m_argumentsWithFixup.size(); argument--;) {
                 usedOperands.setOperand(VirtualRegister(
                     virtualRegisterForArgumentIncludingThis(argument).offset() +
                     inlineCallFrame->stackOffset), true);
@@ -178,7 +178,7 @@
             if (inlineCallFrame->isVarargs())
                 inlineCallFrame->argumentCountRegister = assign(usedOperands, allocation, VirtualRegister(inlineCallFrame->stackOffset + CallFrameSlot::argumentCountIncludingThis));
 
-            for (unsigned argument = inlineCallFrame->argumentsWithFixup.size(); argument--;) {
+            for (unsigned argument = inlineCallFrame->m_argumentsWithFixup.size(); argument--;) {
                 ArgumentPosition& position = m_graph.m_argumentPositions[
                     data.argumentPositionStart + argument];
                 VariableAccessData* variable = position.someVariable();
@@ -189,7 +189,7 @@
                     source = ValueSource::forFlushFormat(
                         variable->machineLocal(), variable->flushFormat());
                 }
-                inlineCallFrame->argumentsWithFixup[argument] = source.valueRecovery();
+                inlineCallFrame->m_argumentsWithFixup[argument] = source.valueRecovery();
             }
             
             RELEASE_ASSERT(inlineCallFrame->isClosureCall == !!data.calleeVariable);

Modified: trunk/Source/_javascript_Core/ftl/FTLCompile.cpp (275625 => 275626)


--- trunk/Source/_javascript_Core/ftl/FTLCompile.cpp	2021-04-07 21:02:17 UTC (rev 275625)
+++ trunk/Source/_javascript_Core/ftl/FTLCompile.cpp	2021-04-07 21:14:57 UTC (rev 275626)
@@ -92,9 +92,9 @@
         if (inlineCallFrame->argumentCountRegister.isValid())
             inlineCallFrame->argumentCountRegister += localsOffset;
         
-        for (unsigned argument = inlineCallFrame->argumentsWithFixup.size(); argument-- > 1;) {
-            inlineCallFrame->argumentsWithFixup[argument] =
-                inlineCallFrame->argumentsWithFixup[argument].withLocalsOffset(localsOffset);
+        for (unsigned argument = inlineCallFrame->m_argumentsWithFixup.size(); argument-- > 1;) {
+            inlineCallFrame->m_argumentsWithFixup[argument] =
+                inlineCallFrame->m_argumentsWithFixup[argument].withLocalsOffset(localsOffset);
         }
         
         if (inlineCallFrame->isClosureCall) {

Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp (275625 => 275626)


--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp	2021-04-07 21:02:17 UTC (rev 275625)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp	2021-04-07 21:14:57 UTC (rev 275626)
@@ -5447,7 +5447,7 @@
         TypedPointer base;
         if (inlineCallFrame) {
             if (inlineCallFrame->argumentCountIncludingThis > 1)
-                base = addressFor(inlineCallFrame->argumentsWithFixup[0].virtualRegister());
+                base = addressFor(inlineCallFrame->m_argumentsWithFixup[0].virtualRegister());
         } else
             base = addressFor(virtualRegisterForArgumentIncludingThis(0));
         

Modified: trunk/Source/_javascript_Core/jit/AssemblyHelpers.h (275625 => 275626)


--- trunk/Source/_javascript_Core/jit/AssemblyHelpers.h	2021-04-07 21:02:17 UTC (rev 275625)
+++ trunk/Source/_javascript_Core/jit/AssemblyHelpers.h	2021-04-07 21:14:57 UTC (rev 275626)
@@ -1595,9 +1595,9 @@
     {
         if (!inlineCallFrame)
             return VirtualRegister(CallFrame::argumentOffset(0));
-        if (inlineCallFrame->argumentsWithFixup.size() <= 1)
+        if (inlineCallFrame->m_argumentsWithFixup.size() <= 1)
             return virtualRegisterForLocal(0);
-        ValueRecovery recovery = inlineCallFrame->argumentsWithFixup[1];
+        ValueRecovery recovery = inlineCallFrame->m_argumentsWithFixup[1];
         RELEASE_ASSERT(recovery.technique() == DisplacedInJSStack);
         return recovery.virtualRegister();
     }

Modified: trunk/Source/_javascript_Core/jit/SetupVarargsFrame.cpp (275625 => 275626)


--- trunk/Source/_javascript_Core/jit/SetupVarargsFrame.cpp	2021-04-07 21:02:17 UTC (rev 275625)
+++ trunk/Source/_javascript_Core/jit/SetupVarargsFrame.cpp	2021-04-07 21:14:57 UTC (rev 275626)
@@ -122,8 +122,8 @@
         } else {
             argumentCountRecovery = ValueRecovery::constant(jsNumber(inlineCallFrame->argumentCountIncludingThis));
         }
-        if (inlineCallFrame->argumentsWithFixup.size() > 1)
-            firstArgumentReg = inlineCallFrame->argumentsWithFixup[1].virtualRegister();
+        if (inlineCallFrame->m_argumentsWithFixup.size() > 1)
+            firstArgumentReg = inlineCallFrame->m_argumentsWithFixup[1].virtualRegister();
         else
             firstArgumentReg = VirtualRegister(0);
     } else {

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm (275625 => 275626)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2021-04-07 21:02:17 UTC (rev 275625)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2021-04-07 21:14:57 UTC (rev 275626)
@@ -613,6 +613,8 @@
 const VectorBufferOffset = Vector::m_buffer
 const VectorSizeOffset = Vector::m_size
 
+const RefCountedArrayStorageNonNullSizeOffset = -(constexpr (RefCountedArray::Header::size())) + RefCountedArray::Header::length
+
 # Some common utilities.
 macro crash()
     if C_LOOP or C_LOOP_WIN

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm (275625 => 275626)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm	2021-04-07 21:02:17 UTC (rev 275625)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm	2021-04-07 21:14:57 UTC (rev 275626)
@@ -2039,9 +2039,10 @@
     addp t3, t2
     bineq t1, Int32Tag, .opSwitchImmNotInt
     subi SimpleJumpTable::min[t2], t0
-    biaeq t0, SimpleJumpTable::branchOffsets + VectorSizeOffset[t2], .opSwitchImmFallThrough
-    loadp SimpleJumpTable::branchOffsets + VectorBufferOffset[t2], t3
-    loadi [t3, t0, 4], t1
+    loadp SimpleJumpTable::branchOffsets + FixedVector::m_storage + RefCountedArray::m_data[t2], t2
+    btpz t2, .opSwitchImmFallThrough
+    biaeq t0, RefCountedArrayStorageNonNullSizeOffset[t2], .opSwitchImmFallThrough
+    loadi [t2, t0, 4], t1
     btiz t1, .opSwitchImmFallThrough
     dispatchIndirect(t1)
 
@@ -2078,8 +2079,9 @@
     loadb [t0], t0
 .opSwitchCharReady:
     subi SimpleJumpTable::min[t2], t0
-    biaeq t0, SimpleJumpTable::branchOffsets + VectorSizeOffset[t2], .opSwitchCharFallThrough
-    loadp SimpleJumpTable::branchOffsets + VectorBufferOffset[t2], t2
+    loadp SimpleJumpTable::branchOffsets + FixedVector::m_storage + RefCountedArray::m_data[t2], t2
+    btpz t2, .opSwitchCharFallThrough
+    biaeq t0, RefCountedArrayStorageNonNullSizeOffset[t2], .opSwitchCharFallThrough
     loadi [t2, t0, 4], t1
     btiz t1, .opSwitchCharFallThrough
     dispatchIndirect(t1)

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm (275625 => 275626)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm	2021-04-07 21:02:17 UTC (rev 275625)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm	2021-04-07 21:14:57 UTC (rev 275626)
@@ -2184,9 +2184,10 @@
     addp t3, t2
     bqb t1, numberTag, .opSwitchImmNotInt
     subi SimpleJumpTable::min[t2], t1
-    biaeq t1, SimpleJumpTable::branchOffsets + VectorSizeOffset[t2], .opSwitchImmFallThrough
-    loadp SimpleJumpTable::branchOffsets + VectorBufferOffset[t2], t3
-    loadis [t3, t1, 4], t1
+    loadp SimpleJumpTable::branchOffsets + FixedVector::m_storage + RefCountedArray::m_data[t2], t2
+    btpz t2, .opSwitchImmFallThrough
+    biaeq t1, RefCountedArrayStorageNonNullSizeOffset[t2], .opSwitchImmFallThrough
+    loadis [t2, t1, 4], t1
     btiz t1, .opSwitchImmFallThrough
     dispatchIndirect(t1)
 
@@ -2223,8 +2224,9 @@
     loadb [t1], t0
 .opSwitchCharReady:
     subi SimpleJumpTable::min[t2], t0
-    biaeq t0, SimpleJumpTable::branchOffsets + VectorSizeOffset[t2], .opSwitchCharFallThrough
-    loadp SimpleJumpTable::branchOffsets + VectorBufferOffset[t2], t2
+    loadp SimpleJumpTable::branchOffsets + FixedVector::m_storage + RefCountedArray::m_data[t2], t2
+    btpz t2, .opSwitchCharFallThrough
+    biaeq t0, RefCountedArrayStorageNonNullSizeOffset[t2], .opSwitchCharFallThrough
     loadis [t2, t0, 4], t1
     btiz t1, .opSwitchCharFallThrough
     dispatchIndirect(t1)

Modified: trunk/Source/_javascript_Core/runtime/ClonedArguments.cpp (275625 => 275626)


--- trunk/Source/_javascript_Core/runtime/ClonedArguments.cpp	2021-04-07 21:02:17 UTC (rev 275625)
+++ trunk/Source/_javascript_Core/runtime/ClonedArguments.cpp	2021-04-07 21:14:57 UTC (rev 275626)
@@ -106,7 +106,7 @@
             result = createEmpty(globalObject, callee, length);
 
             for (unsigned i = length; i--;)
-                result->putDirectIndex(globalObject, i, inlineCallFrame->argumentsWithFixup[i + 1].recover(targetFrame));
+                result->putDirectIndex(globalObject, i, inlineCallFrame->m_argumentsWithFixup[i + 1].recover(targetFrame));
         } else {
             length = targetFrame->argumentCount();
             result = createEmpty(globalObject, callee, length);

Modified: trunk/Source/WTF/ChangeLog (275625 => 275626)


--- trunk/Source/WTF/ChangeLog	2021-04-07 21:02:17 UTC (rev 275625)
+++ trunk/Source/WTF/ChangeLog	2021-04-07 21:14:57 UTC (rev 275626)
@@ -1,3 +1,16 @@
+2021-04-07  Yusuke Suzuki  <ysuz...@apple.com>
+
+        [JSC] Use FixedVector more in bytecode dir and JumpTable
+        https://bugs.webkit.org/show_bug.cgi?id=224275
+
+        Reviewed by Michael Saboff and Mark Lam.
+
+        * wtf/FixedVector.h:
+        (WTF::FixedVector::offsetOfStorage):
+        * wtf/RefCountedArray.h:
+        (WTF::RefCountedArray::Header::size):
+        (WTF::RefCountedArray::Header::offsetOfLength):
+
 2021-04-07  Alex Christensen  <achristen...@webkit.org>
 
         Use os_transaction_create instead of deprecated xpc_transaction_begin/end

Modified: trunk/Source/WTF/wtf/FixedVector.h (275625 => 275626)


--- trunk/Source/WTF/wtf/FixedVector.h	2021-04-07 21:02:17 UTC (rev 275625)
+++ trunk/Source/WTF/wtf/FixedVector.h	2021-04-07 21:14:57 UTC (rev 275626)
@@ -112,6 +112,8 @@
         m_storage.swap(other.m_storage);
     }
 
+    static ptrdiff_t offsetOfStorage() { return OBJECT_OFFSETOF(FixedVector, m_storage); }
+
 private:
     friend class JSC::LLIntOffsetsExtractor;
 

Modified: trunk/Source/WTF/wtf/RefCountedArray.h (275625 => 275626)


--- trunk/Source/WTF/wtf/RefCountedArray.h	2021-04-07 21:02:17 UTC (rev 275625)
+++ trunk/Source/WTF/wtf/RefCountedArray.h	2021-04-07 21:14:57 UTC (rev 275626)
@@ -271,10 +271,12 @@
         unsigned refCount;
         unsigned length;
         
-        static size_t size()
+        static constexpr size_t size()
         {
             return (sizeof(Header) + 7) & ~7;
         }
+
+        static ptrdiff_t offsetOfLength() { return OBJECT_OFFSETOF(Header, length); }
         
         T* payload()
         {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to