Title: [293605] trunk/Source
Revision
293605
Author
[email protected]
Date
2022-04-28 21:12:55 -0700 (Thu, 28 Apr 2022)

Log Message

[JSC] Make DFG::OSRExit data unlinked
https://bugs.webkit.org/show_bug.cgi?id=239828

Reviewed by Saam Barati.

This patch makes DFG::OSRExit unlinked. While generated OSR exit code is linked version,
we no longer put linked data to DFG::OSRExit so that unlinked DFG can use DFG::OSRExit.
Key changes are two things.

1. Now, we always store compiled MacroAssemblerCodeRef in DFG::JITData regardless of whether
   we have linked / unlinked DFG. While linked DFG uses repatching to jump to this code,
   unlinked DFG looks into this vector in JITData and jump to that.
2. MethodOfGettingAValueProfile was including CodeBlock*, ValueProfile* in CodeBlock* etc.,
   so it was linked data structure which unlinked DFG cannot use. Instead, we encode how to
   retrieve these pointers when generating OSR exit code actually, and just storing CodeOrigin,
   type, and Operand to make MethodOfGettingAValueProfile unlinked data structure. While
   CodeOrigin can include InlineCallFrame, but our first version of unlinked DFG will not perform
   inlining thus we will not include it. It also makes sizeof(MethodOfGettingAValueProfile) smaller
   from 32 bytes to 16 bytes (50% reduction).

* Source/_javascript_Core/assembler/MacroAssemblerCodeRef.h:
(JSC::MacroAssemblerCodeRef::offsetOfCodePtr):
* Source/_javascript_Core/bytecode/CodeBlock.cpp:
(JSC::CodeBlock::updateOSRExitCounterAndCheckIfNeedToReoptimize): Deleted.
* Source/_javascript_Core/bytecode/CodeBlock.h:
* Source/_javascript_Core/bytecode/MethodOfGettingAValueProfile.cpp:
(JSC::MethodOfGettingAValueProfile::emitReportValue const):
(JSC::MethodOfGettingAValueProfile::fromLazyOperand): Deleted.
(JSC::MethodOfGettingAValueProfile::reportValue): Deleted.
* Source/_javascript_Core/bytecode/MethodOfGettingAValueProfile.h:
(JSC::MethodOfGettingAValueProfile::unaryArithProfile):
(JSC::MethodOfGettingAValueProfile::binaryArithProfile):
(JSC::MethodOfGettingAValueProfile::argumentValueProfile):
(JSC::MethodOfGettingAValueProfile::bytecodeValueProfile):
(JSC::MethodOfGettingAValueProfile::lazyOperandValueProfile):
(JSC::MethodOfGettingAValueProfile::operator bool const):
(JSC::MethodOfGettingAValueProfile::MethodOfGettingAValueProfile): Deleted.
* Source/_javascript_Core/dfg/DFGGraph.cpp:
(JSC::DFG::Graph::methodOfGettingAValueProfileFor):
* Source/_javascript_Core/dfg/DFGJITCode.cpp:
(JSC::DFG::JITCode::JITCode):
(JSC::DFG::JITCode::findPC):
* Source/_javascript_Core/dfg/DFGJITCode.h:
* Source/_javascript_Core/dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::JITCompiler):
(JSC::DFG::JITCompiler::linkOSRExits):
(JSC::DFG::JITCompiler::link):
* Source/_javascript_Core/dfg/DFGJITFinalizer.cpp:
(JSC::DFG::JITFinalizer::finalize):
* Source/_javascript_Core/dfg/DFGOSRExit.cpp:
(JSC::DFG::JSC_DEFINE_JIT_OPERATION):
(JSC::DFG::OSRExit::compileExit):
(JSC::DFG::OSRExit::codeLocationForRepatch const): Deleted.
* Source/_javascript_Core/dfg/DFGOSRExit.h:
(JSC::DFG::OSRExit::codeLocationForRepatch const):
(JSC::DFG::OSRExitState::OSRExitState): Deleted.
* Source/_javascript_Core/dfg/DFGPlan.cpp:
(JSC::DFG::Plan::finalizeJITData):
* Source/_javascript_Core/dfg/DFGPlan.h:
* Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::lower):
* Source/_javascript_Core/ftl/FTLOSRExitCompiler.cpp:
(JSC::FTL::compileStub):
* Source/WTF/wtf/FixedVector.h:

Canonical link: https://commits.webkit.org/250111@main

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (293604 => 293605)


--- trunk/Source/_javascript_Core/ChangeLog	2022-04-29 02:24:50 UTC (rev 293604)
+++ trunk/Source/_javascript_Core/ChangeLog	2022-04-29 04:12:55 UTC (rev 293605)
@@ -1,3 +1,69 @@
+2022-04-27  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Make DFG::OSRExit data unlinked
+        https://bugs.webkit.org/show_bug.cgi?id=239828
+
+        Reviewed by Saam Barati.
+
+        This patch makes DFG::OSRExit unlinked. While generated OSR exit code is linked version,
+        we no longer put linked data to DFG::OSRExit so that unlinked DFG can use DFG::OSRExit.
+        Key changes are two things.
+
+        1. Now, we always store compiled MacroAssemblerCodeRef in DFG::JITData regardless of whether
+           we have linked / unlinked DFG. While linked DFG uses repatching to jump to this code,
+           unlinked DFG looks into this vector in JITData and jump to that.
+        2. MethodOfGettingAValueProfile was including CodeBlock*, ValueProfile* in CodeBlock* etc.,
+           so it was linked data structure which unlinked DFG cannot use. Instead, we encode how to
+           retrieve these pointers when generating OSR exit code actually, and just storing CodeOrigin,
+           type, and Operand to make MethodOfGettingAValueProfile unlinked data structure. While
+           CodeOrigin can include InlineCallFrame, but our first version of unlinked DFG will not perform
+           inlining thus we will not include it. It also makes sizeof(MethodOfGettingAValueProfile) smaller
+           from 32 bytes to 16 bytes (50% reduction).
+
+        * assembler/MacroAssemblerCodeRef.h:
+        (JSC::MacroAssemblerCodeRef::offsetOfCodePtr):
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::updateOSRExitCounterAndCheckIfNeedToReoptimize): Deleted.
+        * bytecode/CodeBlock.h:
+        * bytecode/MethodOfGettingAValueProfile.cpp:
+        (JSC::MethodOfGettingAValueProfile::emitReportValue const):
+        (JSC::MethodOfGettingAValueProfile::fromLazyOperand): Deleted.
+        (JSC::MethodOfGettingAValueProfile::reportValue): Deleted.
+        * bytecode/MethodOfGettingAValueProfile.h:
+        (JSC::MethodOfGettingAValueProfile::unaryArithProfile):
+        (JSC::MethodOfGettingAValueProfile::binaryArithProfile):
+        (JSC::MethodOfGettingAValueProfile::argumentValueProfile):
+        (JSC::MethodOfGettingAValueProfile::bytecodeValueProfile):
+        (JSC::MethodOfGettingAValueProfile::lazyOperandValueProfile):
+        (JSC::MethodOfGettingAValueProfile::operator bool const):
+        (JSC::MethodOfGettingAValueProfile::MethodOfGettingAValueProfile): Deleted.
+        * dfg/DFGGraph.cpp:
+        (JSC::DFG::Graph::methodOfGettingAValueProfileFor):
+        * dfg/DFGJITCode.cpp:
+        (JSC::DFG::JITCode::JITCode):
+        (JSC::DFG::JITCode::findPC):
+        * dfg/DFGJITCode.h:
+        * dfg/DFGJITCompiler.cpp:
+        (JSC::DFG::JITCompiler::JITCompiler):
+        (JSC::DFG::JITCompiler::linkOSRExits):
+        (JSC::DFG::JITCompiler::link):
+        * dfg/DFGJITFinalizer.cpp:
+        (JSC::DFG::JITFinalizer::finalize):
+        * dfg/DFGOSRExit.cpp:
+        (JSC::DFG::JSC_DEFINE_JIT_OPERATION):
+        (JSC::DFG::OSRExit::compileExit):
+        (JSC::DFG::OSRExit::codeLocationForRepatch const): Deleted.
+        * dfg/DFGOSRExit.h:
+        (JSC::DFG::OSRExit::codeLocationForRepatch const):
+        (JSC::DFG::OSRExitState::OSRExitState): Deleted.
+        * dfg/DFGPlan.cpp:
+        (JSC::DFG::Plan::finalizeJITData):
+        * dfg/DFGPlan.h:
+        * ftl/FTLLowerDFGToB3.cpp:
+        (JSC::FTL::DFG::LowerDFGToB3::lower):
+        * ftl/FTLOSRExitCompiler.cpp:
+        (JSC::FTL::compileStub):
+
 2022-04-28  Yusuke Suzuki  <[email protected]>
 
         Support C files in Unified Builds

Modified: trunk/Source/_javascript_Core/assembler/MacroAssemblerCodeRef.h (293604 => 293605)


--- trunk/Source/_javascript_Core/assembler/MacroAssemblerCodeRef.h	2022-04-29 02:24:50 UTC (rev 293604)
+++ trunk/Source/_javascript_Core/assembler/MacroAssemblerCodeRef.h	2022-04-29 04:12:55 UTC (rev 293605)
@@ -526,6 +526,8 @@
         m_codePtr.dumpWithName("CodeRef", out);
     }
 
+    static ptrdiff_t offsetOfCodePtr() { return OBJECT_OFFSETOF(MacroAssemblerCodeRef, m_codePtr); }
+
 private:
     template<PtrTag otherTag>
     MacroAssemblerCodeRef(const MacroAssemblerCodeRef<otherTag>& otherCodeRef)

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (293604 => 293605)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2022-04-29 02:24:50 UTC (rev 293604)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2022-04-29 04:12:55 UTC (rev 293605)
@@ -2610,55 +2610,6 @@
     return m_jitExecuteCounter.checkIfThresholdCrossedAndSet(this);
 }
 
-#if ENABLE(DFG_JIT)
-auto CodeBlock::updateOSRExitCounterAndCheckIfNeedToReoptimize(DFG::OSRExitState& exitState) -> OptimizeAction
-{
-    DFG::OSRExitBase& exit = exitState.exit;
-    if (!exitKindMayJettison(exit.m_kind)) {
-        // FIXME: We may want to notice that we're frequently exiting
-        // at an op_catch that we didn't compile an entrypoint for, and
-        // then trigger a reoptimization of this CodeBlock:
-        // https://bugs.webkit.org/show_bug.cgi?id=175842
-        return OptimizeAction::None;
-    }
-
-    exit.m_count++;
-    m_osrExitCounter++;
-
-    CodeBlock* baselineCodeBlock = exitState.baselineCodeBlock;
-    ASSERT(baselineCodeBlock == baselineAlternative());
-    if (UNLIKELY(baselineCodeBlock->jitExecuteCounter().hasCrossedThreshold()))
-        return OptimizeAction::ReoptimizeNow;
-
-    // We want to figure out if there's a possibility that we're in a loop. For the outermost
-    // code block in the inline stack, we handle this appropriately by having the loop OSR trigger
-    // check the exit count of the replacement of the CodeBlock from which we are OSRing. The
-    // problem is the inlined functions, which might also have loops, but whose baseline versions
-    // don't know where to look for the exit count. Figure out if those loops are severe enough
-    // that we had tried to OSR enter. If so, then we should use the loop reoptimization trigger.
-    // Otherwise, we should use the normal reoptimization trigger.
-
-    bool didTryToEnterInLoop = false;
-    for (InlineCallFrame* inlineCallFrame = exit.m_codeOrigin.inlineCallFrame(); inlineCallFrame; inlineCallFrame = inlineCallFrame->directCaller.inlineCallFrame()) {
-        if (inlineCallFrame->baselineCodeBlock->ownerExecutable()->didTryToEnterInLoop()) {
-            didTryToEnterInLoop = true;
-            break;
-        }
-    }
-
-    uint32_t exitCountThreshold = didTryToEnterInLoop
-        ? exitCountThresholdForReoptimizationFromLoop()
-        : exitCountThresholdForReoptimization();
-
-    if (m_osrExitCounter > exitCountThreshold)
-        return OptimizeAction::ReoptimizeNow;
-
-    // Too few fails. Adjust the execution counter such that the target is to only optimize after a while.
-    baselineCodeBlock->m_jitExecuteCounter.setNewThresholdForOSRExit(exitState.activeThreshold, exitState.memoryUsageAdjustedThreshold);
-    return OptimizeAction::None;
-}
-#endif
-
 void CodeBlock::optimizeNextInvocation()
 {
     dataLogLnIf(Options::verboseOSR(), *this, ": Optimizing next invocation.");

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.h (293604 => 293605)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2022-04-29 02:24:50 UTC (rev 293604)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.h	2022-04-29 04:12:55 UTC (rev 293605)
@@ -80,7 +80,6 @@
 #if ENABLE(DFG_JIT)
 namespace DFG {
 class JITData;
-struct OSRExitState;
 } // namespace DFG
 #endif
 
@@ -706,11 +705,6 @@
 
     void countOSRExit() { m_osrExitCounter++; }
 
-    enum class OptimizeAction { None, ReoptimizeNow };
-#if ENABLE(DFG_JIT)
-    OptimizeAction updateOSRExitCounterAndCheckIfNeedToReoptimize(DFG::OSRExitState&);
-#endif
-
     static ptrdiff_t offsetOfOSRExitCounter() { return OBJECT_OFFSETOF(CodeBlock, m_osrExitCounter); }
 
     uint32_t adjustedExitCountThreshold(uint32_t desiredThreshold);

Modified: trunk/Source/_javascript_Core/bytecode/MethodOfGettingAValueProfile.cpp (293604 => 293605)


--- trunk/Source/_javascript_Core/bytecode/MethodOfGettingAValueProfile.cpp	2022-04-29 02:24:50 UTC (rev 293604)
+++ trunk/Source/_javascript_Core/bytecode/MethodOfGettingAValueProfile.cpp	2022-04-29 04:12:55 UTC (rev 293605)
@@ -35,82 +35,52 @@
 
 namespace JSC {
 
-MethodOfGettingAValueProfile MethodOfGettingAValueProfile::fromLazyOperand(
-    CodeBlock* codeBlock, const LazyOperandValueProfileKey& key)
+void MethodOfGettingAValueProfile::emitReportValue(CCallHelpers& jit, CodeBlock* optimizedCodeBlock, JSValueRegs regs, GPRReg tempGPR, TagRegistersMode mode) const
 {
-    MethodOfGettingAValueProfile result;
-    result.m_kind = LazyOperand;
-    result.u.lazyOperand.codeBlock = codeBlock;
-    result.u.lazyOperand.bytecodeOffset = key.bytecodeIndex();
-    result.u.lazyOperand.operand = key.operand();
-    return result;
-}
+    if (m_kind == Kind::None)
+        return;
 
-void MethodOfGettingAValueProfile::emitReportValue(CCallHelpers& jit, JSValueRegs regs, GPRReg tempGPR, TagRegistersMode mode) const
-{
+    CodeBlock* baselineCodeBlock = optimizedCodeBlock->baselineAlternative();
+    CodeBlock* profiledBlock = baselineCodeBlockForOriginAndBaselineCodeBlock(m_codeOrigin, baselineCodeBlock);
     switch (m_kind) {
-    case None:
+    case Kind::None:
+        RELEASE_ASSERT_NOT_REACHED();
         return;
         
-    case Ready:
-        jit.storeValue(regs, u.profile->specFailBucket(0));
-        return;
+    case Kind::LazyOperandValueProfile: {
+        LazyOperandValueProfileKey key(m_codeOrigin.bytecodeIndex(), Operand::fromBits(m_rawOperand));
         
-    case LazyOperand: {
-        LazyOperandValueProfileKey key(u.lazyOperand.bytecodeOffset, u.lazyOperand.operand);
-        
-        ConcurrentJSLocker locker(u.lazyOperand.codeBlock->m_lock);
-        LazyOperandValueProfile* profile =
-            u.lazyOperand.codeBlock->lazyOperandValueProfiles(locker).add(locker, key);
+        ConcurrentJSLocker locker(profiledBlock->m_lock);
+        LazyOperandValueProfile* profile = "" key);
         jit.storeValue(regs, profile->specFailBucket(0));
         return;
     }
         
-    case UnaryArithProfileReady: {
-        u.unaryArithProfile->emitObserveResult(jit, regs, tempGPR, mode);
+    case Kind::UnaryArithProfile: {
+        if (UnaryArithProfile* result = profiledBlock->unaryArithProfileForBytecodeIndex(m_codeOrigin.bytecodeIndex()))
+            result->emitObserveResult(jit, regs, tempGPR, mode);
         return;
     }
 
-    case BinaryArithProfileReady: {
-        u.binaryArithProfile->emitObserveResult(jit, regs, tempGPR, mode);
+    case Kind::BinaryArithProfile: {
+        if (BinaryArithProfile* result = profiledBlock->binaryArithProfileForBytecodeIndex(m_codeOrigin.bytecodeIndex()))
+            result->emitObserveResult(jit, regs, tempGPR, mode);
         return;
     }
-    }
-    
-    RELEASE_ASSERT_NOT_REACHED();
-}
 
-void MethodOfGettingAValueProfile::reportValue(JSValue value)
-{
-    switch (m_kind) {
-    case None:
+    case Kind::ArgumentValueProfile: {
+        auto& valueProfile = profiledBlock->valueProfileForArgument(Operand::fromBits(m_rawOperand).toArgument());
+        jit.storeValue(regs, valueProfile.specFailBucket(0));
         return;
-
-    case Ready:
-        *u.profile->specFailBucket(0) = JSValue::encode(value);
-        return;
-
-    case LazyOperand: {
-        LazyOperandValueProfileKey key(u.lazyOperand.bytecodeOffset, u.lazyOperand.operand);
-
-        ConcurrentJSLocker locker(u.lazyOperand.codeBlock->m_lock);
-        LazyOperandValueProfile* profile =
-            u.lazyOperand.codeBlock->lazyOperandValueProfiles(locker).add(locker, key);
-        *profile->specFailBucket(0) = JSValue::encode(value);
-        return;
     }
 
-    case UnaryArithProfileReady: {
-        u.unaryArithProfile->observeResult(value);
+    case Kind::BytecodeValueProfile: {
+        auto& valueProfile = profiledBlock->valueProfileForBytecodeIndex(m_codeOrigin.bytecodeIndex());
+        jit.storeValue(regs, valueProfile.specFailBucket(0));
         return;
     }
-
-    case BinaryArithProfileReady: {
-        u.binaryArithProfile->observeResult(value);
-        return;
     }
-    }
-
+    
     RELEASE_ASSERT_NOT_REACHED();
 }
 

Modified: trunk/Source/_javascript_Core/bytecode/MethodOfGettingAValueProfile.h (293604 => 293605)


--- trunk/Source/_javascript_Core/bytecode/MethodOfGettingAValueProfile.h	2022-04-29 02:24:50 UTC (rev 293604)
+++ trunk/Source/_javascript_Core/bytecode/MethodOfGettingAValueProfile.h	2022-04-29 04:12:55 UTC (rev 293605)
@@ -32,6 +32,7 @@
 #if ENABLE(DFG_JIT)
 
 #include "BytecodeIndex.h"
+#include "CodeOrigin.h"
 #include "GPRInfo.h"
 #include "Operands.h"
 #include "TagRegistersMode.h"
@@ -42,76 +43,74 @@
 class BinaryArithProfile;
 class CCallHelpers;
 class CodeBlock;
-class LazyOperandValueProfileKey;
 struct ValueProfile;
 
 class MethodOfGettingAValueProfile {
 public:
-    MethodOfGettingAValueProfile()
-        : m_kind(None)
+    MethodOfGettingAValueProfile() = default;
+
+    static MethodOfGettingAValueProfile unaryArithProfile(CodeOrigin codeOrigin)
     {
+        MethodOfGettingAValueProfile result;
+        result.m_kind = Kind::UnaryArithProfile;
+        result.m_codeOrigin = codeOrigin;
+        return result;
     }
-    
-    MethodOfGettingAValueProfile(ValueProfile* profile)
+
+    static MethodOfGettingAValueProfile binaryArithProfile(CodeOrigin codeOrigin)
     {
-        if (profile) {
-            m_kind = Ready;
-            u.profile = ""
-        } else
-            m_kind = None;
+        MethodOfGettingAValueProfile result;
+        result.m_kind = Kind::BinaryArithProfile;
+        result.m_codeOrigin = codeOrigin;
+        return result;
     }
 
-    MethodOfGettingAValueProfile(UnaryArithProfile* profile)
+    static MethodOfGettingAValueProfile argumentValueProfile(CodeOrigin codeOrigin, Operand operand)
     {
-        if (profile) {
-            m_kind = UnaryArithProfileReady;
-            u.unaryArithProfile = profile;
-        } else
-            m_kind = None;
+        MethodOfGettingAValueProfile result;
+        result.m_kind = Kind::ArgumentValueProfile;
+        result.m_codeOrigin = codeOrigin;
+        result.m_rawOperand = operand.asBits();
+        return result;
     }
 
-    MethodOfGettingAValueProfile(BinaryArithProfile* profile)
+    static MethodOfGettingAValueProfile bytecodeValueProfile(CodeOrigin codeOrigin)
     {
-        if (profile) {
-            m_kind = BinaryArithProfileReady;
-            u.binaryArithProfile = profile;
-        } else
-            m_kind = None;
+        MethodOfGettingAValueProfile result;
+        result.m_kind = Kind::BytecodeValueProfile;
+        result.m_codeOrigin = codeOrigin;
+        return result;
     }
-    
-    static MethodOfGettingAValueProfile fromLazyOperand(
-        CodeBlock*, const LazyOperandValueProfileKey&);
-    
-    explicit operator bool() const { return m_kind != None; }
 
+    static MethodOfGettingAValueProfile lazyOperandValueProfile(CodeOrigin codeOrigin, Operand operand)
+    {
+        MethodOfGettingAValueProfile result;
+        result.m_kind = Kind::LazyOperandValueProfile;
+        result.m_codeOrigin = codeOrigin;
+        result.m_rawOperand = operand.asBits();
+        return result;
+    }
+
+    explicit operator bool() const { return m_kind != Kind::None; }
+
     // The temporary register is only needed on 64-bits builds (for testing BigInt32).
-    void emitReportValue(CCallHelpers&, JSValueRegs, GPRReg tempGPR, TagRegistersMode = HaveTagRegisters) const;
-    void reportValue(JSValue);
+    void emitReportValue(CCallHelpers&, CodeBlock* optimizedCodeBlock, JSValueRegs, GPRReg tempGPR, TagRegistersMode = HaveTagRegisters) const;
 
 private:
-    enum Kind {
+    enum class Kind : uint8_t {
         None,
-        Ready,
-        UnaryArithProfileReady,
-        BinaryArithProfileReady,
-        LazyOperand
+        UnaryArithProfile,
+        BinaryArithProfile,
+        BytecodeValueProfile,
+        ArgumentValueProfile,
+        LazyOperandValueProfile,
     };
-    
-    Kind m_kind;
-    union Data {
-        Data()
-            : profile(nullptr)
-        { }
+    static constexpr unsigned bitsOfKind = 3;
+    static_assert(static_cast<unsigned>(Kind::LazyOperandValueProfile) <= ((1U << bitsOfKind) - 1));
 
-        ValueProfile* profile;
-        UnaryArithProfile* unaryArithProfile;
-        BinaryArithProfile* binaryArithProfile;
-        struct {
-            CodeBlock* codeBlock;
-            BytecodeIndex bytecodeOffset;
-            Operand operand;
-        } lazyOperand;
-    } u;
+    CodeOrigin m_codeOrigin;
+    uint64_t m_rawOperand : Operand::maxBits { 0 };
+    Kind m_kind : bitsOfKind { Kind::None };
 };
 
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/dfg/DFGGraph.cpp (293604 => 293605)


--- trunk/Source/_javascript_Core/dfg/DFGGraph.cpp	2022-04-29 02:24:50 UTC (rev 293604)
+++ trunk/Source/_javascript_Core/dfg/DFGGraph.cpp	2022-04-29 04:12:55 UTC (rev 293605)
@@ -1698,10 +1698,8 @@
                 Node* argumentNode = m_rootToArguments.find(block(0))->value[argument];
                 // FIXME: We should match SetArgumentDefinitely nodes at other entrypoints as well:
                 // https://bugs.webkit.org/show_bug.cgi?id=175841
-                if (argumentNode && node->variableAccessData() == argumentNode->variableAccessData()) {
-                    CodeBlock* profiledBlock = baselineCodeBlockFor(node->origin.semantic);
-                    return &profiledBlock->valueProfileForArgument(argument);
-                }
+                if (argumentNode && node->variableAccessData() == argumentNode->variableAccessData())
+                    return MethodOfGettingAValueProfile::argumentValueProfile(node->origin.semantic, node->operand());
             }
         }
 
@@ -1710,22 +1708,18 @@
             CodeBlock* profiledBlock = baselineCodeBlockFor(node->origin.semantic);
 
             if (node->accessesStack(*this)) {
-                if (node->op() == GetLocal) {
-                    return MethodOfGettingAValueProfile::fromLazyOperand(
-                        profiledBlock,
-                        LazyOperandValueProfileKey(
-                            node->origin.semantic.bytecodeIndex(), node->operand()));
-                }
+                if (node->op() == GetLocal)
+                    return MethodOfGettingAValueProfile::lazyOperandValueProfile(node->origin.semantic, node->operand());
             }
 
             if (node->hasHeapPrediction())
-                return &profiledBlock->valueProfileForBytecodeIndex(node->origin.semantic.bytecodeIndex());
+                return MethodOfGettingAValueProfile::bytecodeValueProfile(node->origin.semantic);
 
             if (profiledBlock->hasBaselineJITProfiling()) {
                 if (BinaryArithProfile* result = profiledBlock->binaryArithProfileForBytecodeIndex(node->origin.semantic.bytecodeIndex()))
-                    return result;
+                    return MethodOfGettingAValueProfile::binaryArithProfile(node->origin.semantic);
                 if (UnaryArithProfile* result = profiledBlock->unaryArithProfileForBytecodeIndex(node->origin.semantic.bytecodeIndex()))
-                    return result;
+                    return MethodOfGettingAValueProfile::unaryArithProfile(node->origin.semantic);
             }
         }
 
@@ -1742,7 +1736,7 @@
         }
     }
     
-    return MethodOfGettingAValueProfile();
+    return { };
 }
 
 bool Graph::getRegExpPrototypeProperty(JSObject* regExpPrototype, Structure* regExpPrototypeStructure, UniquedStringImpl* uid, JSValue& returnJSValue)

Modified: trunk/Source/_javascript_Core/dfg/DFGJITCode.cpp (293604 => 293605)


--- trunk/Source/_javascript_Core/dfg/DFGJITCode.cpp	2022-04-29 02:24:50 UTC (rev 293604)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCode.cpp	2022-04-29 04:12:55 UTC (rev 293605)
@@ -29,17 +29,15 @@
 #if ENABLE(DFG_JIT)
 
 #include "CodeBlock.h"
+#include "DFGThunks.h"
 #include "FTLForOSREntryJITCode.h"
 #include "JumpTable.h"
 
 namespace JSC { namespace DFG {
 
-JITCode::JITCode()
+JITCode::JITCode(bool isUnlinked)
     : DirectJITCode(JITType::DFGJIT)
-#if ENABLE(FTL_JIT)
-    , osrEntryRetry(0)
-    , abandonOSREntry(false)
-#endif // ENABLE(FTL_JIT)
+    , isUnlinked(isUnlinked)
 {
 }
 
@@ -225,12 +223,19 @@
     minifiedDFG.validateReferences(trackedReferences);
 }
 
-std::optional<CodeOrigin> JITCode::findPC(CodeBlock*, void* pc)
+std::optional<CodeOrigin> JITCode::findPC(CodeBlock* codeBlock, void* pc)
 {
-    for (OSRExit& exit : m_osrExit) {
-        if (ExecutableMemoryHandle* handle = exit.m_code.executableMemory()) {
-            if (handle->start().untaggedPtr() <= pc && pc < handle->end().untaggedPtr())
-                return std::optional<CodeOrigin>(exit.m_codeOriginForExitProfile);
+    const auto* jitData = codeBlock->dfgJITData();
+    auto osrExitThunk = codeBlock->vm().getCTIStub(osrExitGenerationThunkGenerator).retagged<OSRExitPtrTag>();
+    for (unsigned exitIndex = 0; exitIndex < m_osrExit.size(); ++exitIndex) {
+        const auto& codeRef = jitData->exitCode(exitIndex);
+        if (ExecutableMemoryHandle* handle = codeRef.executableMemory()) {
+            if (handle != osrExitThunk.executableMemory()) {
+                if (handle->start().untaggedPtr() <= pc && pc < handle->end().untaggedPtr()) {
+                    OSRExit& exit = m_osrExit[exitIndex];
+                    return std::optional<CodeOrigin>(exit.m_codeOriginForExitProfile);
+                }
+            }
         }
     }
 

Modified: trunk/Source/_javascript_Core/dfg/DFGJITCode.h (293604 => 293605)


--- trunk/Source/_javascript_Core/dfg/DFGJITCode.h	2022-04-29 02:24:50 UTC (rev 293604)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCode.h	2022-04-29 04:12:55 UTC (rev 293605)
@@ -54,21 +54,34 @@
     friend class LLIntOffsetsExtractor;
 public:
     using Base = TrailingArray<JITData, void*>;
+    using ExitVector = FixedVector<MacroAssemblerCodeRef<OSRExitPtrTag>>;
 
-    static std::unique_ptr<JITData> create(unsigned poolSize)
+    static ptrdiff_t offsetOfExits() { return OBJECT_OFFSETOF(JITData, m_exits); }
+
+    static std::unique_ptr<JITData> create(unsigned poolSize, ExitVector&& exits)
     {
-        return std::unique_ptr<JITData> { new (NotNull, fastMalloc(Base::allocationSize(poolSize))) JITData(poolSize) };
+        return std::unique_ptr<JITData> { new (NotNull, fastMalloc(Base::allocationSize(poolSize))) JITData(poolSize, WTFMove(exits)) };
     }
 
-    explicit JITData(unsigned size)
+    void setExitCode(unsigned exitIndex, MacroAssemblerCodeRef<OSRExitPtrTag> code)
+    {
+        m_exits[exitIndex] = WTFMove(code);
+    }
+    const MacroAssemblerCodeRef<OSRExitPtrTag>& exitCode(unsigned exitIndex) const { return m_exits[exitIndex]; }
+
+private:
+    explicit JITData(unsigned size, ExitVector&& exits)
         : Base(size)
+        , m_exits(WTFMove(exits))
     {
     }
+
+    ExitVector m_exits;
 };
 
 class JITCode final : public DirectJITCode {
 public:
-    JITCode();
+    JITCode(bool isUnlinked);
     ~JITCode() final;
     
     CommonData* dfgCommon() final;
@@ -164,9 +177,10 @@
     HashMap<BytecodeIndex, TriggerReason> tierUpEntryTriggers;
 
     WriteBarrier<CodeBlock> m_osrEntryBlock;
-    unsigned osrEntryRetry;
-    bool abandonOSREntry;
+    unsigned osrEntryRetry { 0 };
+    bool abandonOSREntry { false };
 #endif // ENABLE(FTL_JIT)
+    bool isUnlinked { false };
 };
 
 } } // namespace JSC::DFG

Modified: trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp (293604 => 293605)


--- trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp	2022-04-29 02:24:50 UTC (rev 293604)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp	2022-04-29 04:12:55 UTC (rev 293605)
@@ -49,7 +49,7 @@
 JITCompiler::JITCompiler(Graph& dfg)
     : CCallHelpers(dfg.m_codeBlock)
     , m_graph(dfg)
-    , m_jitCode(adoptRef(new JITCode()))
+    , m_jitCode(adoptRef(new JITCode(m_graph.m_plan.isUnlinked())))
     , m_blockHeads(dfg.numBlocks())
     , m_pcToCodeOriginMapBuilder(dfg.m_vm)
 {
@@ -88,6 +88,8 @@
         }
     }
     
+    JumpList dispatchCases;
+    JumpList dispatchCasesWithoutLinkedFailures;
     for (unsigned i = 0; i < m_osrExit.size(); ++i) {
         OSRExitCompilationInfo& info = m_exitCompilationInfo[i];
         JumpList& failureJumps = info.m_failureJumps;
@@ -97,9 +99,47 @@
             info.m_replacementDestination = label();
 
         jitAssertHasValidCallFrame();
+#if USE(JSVALUE64)
+        if (m_graph.m_plan.isUnlinked()) {
+            move(TrustedImm32(i), GPRInfo::numberTagRegister);
+            if (info.m_replacementDestination.isSet())
+                dispatchCasesWithoutLinkedFailures.append(jump());
+            else
+                dispatchCases.append(jump());
+            continue;
+        }
+#endif
+        UNUSED_VARIABLE(dispatchCases);
+        UNUSED_VARIABLE(dispatchCasesWithoutLinkedFailures);
         store32(TrustedImm32(i), &vm().osrExitIndex);
         info.m_patchableJump = patchableJump();
     }
+
+#if USE(JSVALUE64)
+    if (m_graph.m_plan.isUnlinked()) {
+        // When jumping to OSR exit handler via exception, we do not have proper callFrameRegister and constantsRegister.
+        // We should reload appropriate callFrameRegister from VM::callFrameForCatch to materialize constants buffer register.
+        // FIXME: The following code can be a DFG Thunk.
+        if (!dispatchCasesWithoutLinkedFailures.empty()) {
+            dispatchCasesWithoutLinkedFailures.link(this);
+            loadPtr(vm().addressOfCallFrameForCatch(), GPRInfo::notCellMaskRegister);
+            MacroAssembler::Jump didNotHaveException = branchTestPtr(MacroAssembler::Zero, GPRInfo::notCellMaskRegister);
+            move(GPRInfo::notCellMaskRegister, GPRInfo::constantsRegister);
+            emitGetFromCallFrameHeaderPtr(CallFrameSlot::codeBlock, GPRInfo::constantsRegister, GPRInfo::constantsRegister);
+            loadPtr(Address(GPRInfo::constantsRegister, CodeBlock::offsetOfJITData()), GPRInfo::constantsRegister);
+            didNotHaveException.link(this);
+        }
+        dispatchCases.link(this);
+        store32(GPRInfo::numberTagRegister, &vm().osrExitIndex);
+        loadPtr(Address(GPRInfo::constantsRegister, JITData::offsetOfExits()), GPRInfo::constantsRegister);
+        static_assert(sizeof(JITData::ExitVector::value_type) == 16);
+        ASSERT(!JITData::ExitVector::value_type::offsetOfCodePtr());
+        lshiftPtr(TrustedImm32(4), GPRInfo::numberTagRegister);
+        addPtr(GPRInfo::numberTagRegister, GPRInfo::constantsRegister);
+        emitMaterializeTagCheckRegisters();
+        farJump(Address(GPRInfo::constantsRegister, JITData::ExitVector::Storage::offsetOfData()), OSRExitPtrTag);
+    }
+#endif
 }
 
 void JITCompiler::compileEntry()
@@ -256,9 +296,11 @@
     for (unsigned i = 0; i < m_osrExit.size(); ++i) {
         OSRExitCompilationInfo& info = m_exitCompilationInfo[i];
 
-        linkBuffer.link(info.m_patchableJump.m_jump, target);
-        OSRExit& exit = m_osrExit[i];
-        exit.m_patchableJumpLocation = linkBuffer.locationOf<JSInternalPtrTag>(info.m_patchableJump);
+        if (!m_graph.m_plan.isUnlinked()) {
+            linkBuffer.link(info.m_patchableJump.m_jump, target);
+            OSRExit& exit = m_osrExit[i];
+            exit.m_patchableJumpLocation = linkBuffer.locationOf<JSInternalPtrTag>(info.m_patchableJump);
+        }
 
         if (info.m_replacementSource.isSet()) {
             m_jitCode->common.m_jumpReplacements.append(JumpReplacement(

Modified: trunk/Source/_javascript_Core/dfg/DFGJITFinalizer.cpp (293604 => 293605)


--- trunk/Source/_javascript_Core/dfg/DFGJITFinalizer.cpp	2022-04-29 02:24:50 UTC (rev 293604)
+++ trunk/Source/_javascript_Core/dfg/DFGJITFinalizer.cpp	2022-04-29 04:12:55 UTC (rev 293605)
@@ -64,7 +64,7 @@
     CodeBlock* codeBlock = m_plan.codeBlock();
 
     codeBlock->setJITCode(m_jitCode.copyRef());
-    codeBlock->setDFGJITData(m_plan.finalizeJITData());
+    codeBlock->setDFGJITData(m_plan.finalizeJITData(m_jitCode.get()));
 
 #if ENABLE(FTL_JIT)
     m_jitCode->optimizeAfterWarmUp(codeBlock);

Modified: trunk/Source/_javascript_Core/dfg/DFGOSRExit.cpp (293604 => 293605)


--- trunk/Source/_javascript_Core/dfg/DFGOSRExit.cpp	2022-04-29 02:24:50 UTC (rev 293604)
+++ trunk/Source/_javascript_Core/dfg/DFGOSRExit.cpp	2022-04-29 04:12:55 UTC (rev 293605)
@@ -62,11 +62,6 @@
     DFG_ASSERT(jit->m_graph, jit->m_currentNode, canExit);
 }
 
-CodeLocationJump<JSInternalPtrTag> OSRExit::codeLocationForRepatch() const
-{
-    return CodeLocationJump<JSInternalPtrTag>(m_patchableJumpLocation);
-}
-
 void OSRExit::emitRestoreArguments(CCallHelpers& jit, VM& vm, const Operands<ValueRecovery>& operands)
 {
     HashMap<MinifiedID, VirtualRegister> alreadyAllocatedArguments; // Maps phantom arguments node ID to operand.
@@ -178,6 +173,7 @@
     if (exit.m_recoveryIndex != UINT_MAX)
         recovery = &codeBlock->jitCode()->dfg()->m_speculationRecovery[exit.m_recoveryIndex];
 
+    MacroAssemblerCodeRef<OSRExitPtrTag> exitCode;
     {
         CCallHelpers jit(codeBlock);
 
@@ -206,7 +202,7 @@
         OSRExit::compileExit(jit, vm, exit, operands, recovery);
 
         LinkBuffer patchBuffer(jit, codeBlock, LinkBuffer::Profile::DFGOSRExit);
-        exit.m_code = FINALIZE_CODE_IF(
+        exitCode = FINALIZE_CODE_IF(
             shouldDumpDisassembly() || Options::verboseOSR() || Options::verboseDFGOSRExit(),
             patchBuffer, OSRExitPtrTag,
             "DFG OSR exit #%u (D@%u, %s, %s) from %s, with operands = %s",
@@ -213,11 +209,13 @@
                 exitIndex, exit.m_dfgNodeIndex, toCString(exit.m_codeOrigin).data(),
                 exitKindToString(exit.m_kind), toCString(*codeBlock).data(),
                 toCString(ignoringContext<DumpContext>(operands)).data());
+        codeBlock->dfgJITData()->setExitCode(exitIndex, exitCode);
     }
 
-    MacroAssembler::repatchJump(exit.codeLocationForRepatch(), CodeLocationLabel<OSRExitPtrTag>(exit.m_code.code()));
+    if (exit.codeLocationForRepatch())
+        MacroAssembler::repatchJump(exit.codeLocationForRepatch(), CodeLocationLabel<OSRExitPtrTag>(exitCode.code()));
 
-    vm.osrExitJumpDestination = exit.m_code.code().executableAddress();
+    vm.osrExitJumpDestination = exitCode.code().executableAddress();
 }
 
 IGNORE_WARNINGS_BEGIN("frame-address")
@@ -429,10 +427,10 @@
                 jit.load64(AssemblyHelpers::Address(exit.m_jsValueSource.asAddress()), GPRInfo::numberTagRegister);
                 // We also use the notCellMaskRegister as the scratch register, for the same reason.
                 // FIXME: find a less gross way of doing this, maybe through delaying these operations until we actually have some spare registers around?
-                profile.emitReportValue(jit, JSValueRegs(GPRInfo::numberTagRegister), GPRInfo::notCellMaskRegister, DoNotHaveTagRegisters);
+                profile.emitReportValue(jit, jit.codeBlock(), JSValueRegs(GPRInfo::numberTagRegister), GPRInfo::notCellMaskRegister, DoNotHaveTagRegisters);
                 jit.emitMaterializeTagCheckRegisters();
             } else {
-                profile.emitReportValue(jit, JSValueRegs(exit.m_jsValueSource.gpr()), GPRInfo::notCellMaskRegister, DoNotHaveTagRegisters);
+                profile.emitReportValue(jit, jit.codeBlock(), JSValueRegs(exit.m_jsValueSource.gpr()), GPRInfo::notCellMaskRegister, DoNotHaveTagRegisters);
                 jit.move(AssemblyHelpers::TrustedImm64(JSValue::NotCellMask), GPRInfo::notCellMaskRegister);
             }
 #else // not USE(JSVALUE64)
@@ -446,7 +444,7 @@
                 JSValueRegs scratch(scratchTag, scratchPayload);
                 
                 jit.loadValue(exit.m_jsValueSource.asAddress(), scratch);
-                profile.emitReportValue(jit, scratch, InvalidGPRReg);
+                profile.emitReportValue(jit, jit.codeBlock(), scratch, InvalidGPRReg);
                 
                 jit.popToRestore(scratchTag);
                 jit.popToRestore(scratchPayload);
@@ -455,10 +453,10 @@
                 jit.pushToSave(scratchTag);
                 jit.move(AssemblyHelpers::TrustedImm32(exit.m_jsValueSource.tag()), scratchTag);
                 JSValueRegs value(scratchTag, exit.m_jsValueSource.payloadGPR());
-                profile.emitReportValue(jit, value, InvalidGPRReg);
+                profile.emitReportValue(jit, jit.codeBlock(), value, InvalidGPRReg);
                 jit.popToRestore(scratchTag);
             } else
-                profile.emitReportValue(jit, exit.m_jsValueSource.regs(), InvalidGPRReg);
+                profile.emitReportValue(jit, jit.codeBlock(), exit.m_jsValueSource.regs(), InvalidGPRReg);
 #endif // USE(JSVALUE64)
         }
     }

Modified: trunk/Source/_javascript_Core/dfg/DFGOSRExit.h (293604 => 293605)


--- trunk/Source/_javascript_Core/dfg/DFGOSRExit.h	2022-04-29 02:24:50 UTC (rev 293604)
+++ trunk/Source/_javascript_Core/dfg/DFGOSRExit.h	2022-04-29 04:12:55 UTC (rev 293605)
@@ -103,41 +103,6 @@
     SpeculationRecoveryType m_type;
 };
 
-enum class ExtraInitializationLevel;
-
-struct OSRExitState : RefCounted<OSRExitState> {
-    OSRExitState(OSRExitBase& exit, CodeBlock* codeBlock, CodeBlock* baselineCodeBlock, Operands<ValueRecovery>& operands, Vector<UndefinedOperandSpan>&& undefinedOperandSpans, SpeculationRecovery* recovery, ptrdiff_t stackPointerOffset, int32_t activeThreshold, double memoryUsageAdjustedThreshold, void* jumpTarget, ArrayProfile* arrayProfile, bool isJumpToLLInt)
-        : exit(exit)
-        , codeBlock(codeBlock)
-        , baselineCodeBlock(baselineCodeBlock)
-        , operands(operands)
-        , undefinedOperandSpans(undefinedOperandSpans)
-        , recovery(recovery)
-        , stackPointerOffset(stackPointerOffset)
-        , activeThreshold(activeThreshold)
-        , memoryUsageAdjustedThreshold(memoryUsageAdjustedThreshold)
-        , jumpTarget(jumpTarget)
-        , arrayProfile(arrayProfile)
-        , isJumpToLLInt(isJumpToLLInt)
-    { }
-
-    OSRExitBase& exit;
-    CodeBlock* codeBlock;
-    CodeBlock* baselineCodeBlock;
-    Operands<ValueRecovery> operands;
-    Vector<UndefinedOperandSpan> undefinedOperandSpans;
-    SpeculationRecovery* recovery;
-    ptrdiff_t stackPointerOffset;
-    uint32_t activeThreshold;
-    double memoryUsageAdjustedThreshold;
-    void* jumpTarget;
-    ArrayProfile* arrayProfile;
-    bool isJumpToLLInt;
-
-    ExtraInitializationLevel extraInitializationLevel;
-    Profiler::OSRExit* profilerExit { nullptr };
-};
-
 JSC_DECLARE_JIT_OPERATION(operationCompileOSRExit, void, (CallFrame*, void*));
 JSC_DECLARE_JIT_OPERATION(operationDebugPrintSpeculationFailure, void, (CallFrame*, void*, void*));
 JSC_DECLARE_JIT_OPERATION(operationMaterializeOSRExitSideState, void, (VM*, const OSRExitBase*, EncodedJSValue*));
@@ -150,16 +115,13 @@
     OSRExit(ExitKind, JSValueSource, MethodOfGettingAValueProfile, SpeculativeJIT*, unsigned streamIndex, unsigned recoveryIndex = UINT_MAX);
 
     CodeLocationLabel<JSInternalPtrTag> m_patchableJumpLocation;
-    MacroAssemblerCodeRef<OSRExitPtrTag> m_code;
 
-    RefPtr<OSRExitState> exitState;
-    
     JSValueSource m_jsValueSource;
     MethodOfGettingAValueProfile m_valueProfile;
     
     unsigned m_recoveryIndex;
 
-    CodeLocationJump<JSInternalPtrTag> codeLocationForRepatch() const;
+    CodeLocationJump<JSInternalPtrTag> codeLocationForRepatch() const { return CodeLocationJump<JSInternalPtrTag>(m_patchableJumpLocation); }
 
     unsigned m_streamIndex;
     void considerAddingAsFrequentExitSite(CodeBlock* profiledCodeBlock)

Modified: trunk/Source/_javascript_Core/dfg/DFGPlan.cpp (293604 => 293605)


--- trunk/Source/_javascript_Core/dfg/DFGPlan.cpp	2022-04-29 02:24:50 UTC (rev 293604)
+++ trunk/Source/_javascript_Core/dfg/DFGPlan.cpp	2022-04-29 04:12:55 UTC (rev 293605)
@@ -64,6 +64,7 @@
 #include "DFGStoreBarrierClusteringPhase.h"
 #include "DFGStoreBarrierInsertionPhase.h"
 #include "DFGStrengthReductionPhase.h"
+#include "DFGThunks.h"
 #include "DFGTierUpCheckInjectionPhase.h"
 #include "DFGTypeCheckHoistingPhase.h"
 #include "DFGUnificationPhase.h"
@@ -687,12 +688,11 @@
     return m_constantPool.add(ptr, m_constantPool.size()).iterator->value;
 }
 
-std::unique_ptr<JITData> Plan::finalizeJITData()
+std::unique_ptr<JITData> Plan::finalizeJITData(const JITCode& jitCode)
 {
-    if (m_constantPool.isEmpty())
-        return nullptr;
-    ASSERT(isUnlinked());
-    auto jitData = JITData::create(m_constantPool.size());
+    auto osrExitThunk = m_vm->getCTIStub(osrExitGenerationThunkGenerator).retagged<OSRExitPtrTag>();
+    auto exits = JITData::ExitVector::createWithSizeAndConstructorArguments(jitCode.m_osrExit.size(), osrExitThunk);
+    auto jitData = JITData::create(m_constantPool.size(), WTFMove(exits));
     for (auto& pair : m_constantPool)
         jitData->at(pair.value) = pair.key;
     return jitData;

Modified: trunk/Source/_javascript_Core/dfg/DFGPlan.h (293604 => 293605)


--- trunk/Source/_javascript_Core/dfg/DFGPlan.h	2022-04-29 02:24:50 UTC (rev 293604)
+++ trunk/Source/_javascript_Core/dfg/DFGPlan.h	2022-04-29 04:12:55 UTC (rev 293605)
@@ -103,7 +103,7 @@
     void setCallback(Ref<DeferredCompilationCallback>&& callback) { m_callback = WTFMove(callback); }
 
     unsigned addLinkableConstant(void*);
-    std::unique_ptr<JITData> finalizeJITData();
+    std::unique_ptr<JITData> finalizeJITData(const JITCode&);
 
 private:
     CompilationPath compileInThreadImpl() override;

Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp (293604 => 293605)


--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp	2022-04-29 02:24:50 UTC (rev 293604)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp	2022-04-29 04:12:55 UTC (rev 293605)
@@ -369,8 +369,8 @@
                 jitCode->setArgumentFlushFormats(WTFMove(argumentFlushFormats));
             } else {
                 for (unsigned i = codeBlock()->numParameters(); i--;) {
-                    MethodOfGettingAValueProfile profile(&m_graph.m_profiledBlock->valueProfileForArgument(i));
                     VirtualRegister operand = virtualRegisterForArgumentIncludingThis(i);
+                    MethodOfGettingAValueProfile profile = "" operand);
                     LValue jsValue = m_out.load64(addressFor(operand));
                     
                     switch (m_graph.m_argumentFormats[0][i]) {

Modified: trunk/Source/_javascript_Core/ftl/FTLOSRExitCompiler.cpp (293604 => 293605)


--- trunk/Source/_javascript_Core/ftl/FTLOSRExitCompiler.cpp	2022-04-29 02:24:50 UTC (rev 293604)
+++ trunk/Source/_javascript_Core/ftl/FTLOSRExitCompiler.cpp	2022-04-29 04:12:55 UTC (rev 293605)
@@ -285,7 +285,7 @@
         }
 
         if (exit.m_descriptor->m_valueProfile)
-            exit.m_descriptor->m_valueProfile.emitReportValue(jit, JSValueRegs(GPRInfo::regT0), GPRInfo::regT1);
+            exit.m_descriptor->m_valueProfile.emitReportValue(jit, jit.codeBlock(), JSValueRegs(GPRInfo::regT0), GPRInfo::regT1);
     }
 
     // Materialize all objects. Don't materialize an object until all

Modified: trunk/Source/WTF/ChangeLog (293604 => 293605)


--- trunk/Source/WTF/ChangeLog	2022-04-29 02:24:50 UTC (rev 293604)
+++ trunk/Source/WTF/ChangeLog	2022-04-29 04:12:55 UTC (rev 293605)
@@ -1,3 +1,12 @@
+2022-04-27  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Make DFG::OSRExit data unlinked
+        https://bugs.webkit.org/show_bug.cgi?id=239828
+
+        Reviewed by Saam Barati.
+
+        * wtf/FixedVector.h:
+
 2022-04-28  Brent Fulgham  <[email protected]>
 
         Remove the AVFoundationNSURLSessionEnabled preference

Modified: trunk/Source/WTF/wtf/FixedVector.h (293604 => 293605)


--- trunk/Source/WTF/wtf/FixedVector.h	2022-04-29 02:24:50 UTC (rev 293604)
+++ trunk/Source/WTF/wtf/FixedVector.h	2022-04-29 04:12:55 UTC (rev 293605)
@@ -33,10 +33,17 @@
 class FixedVector {
 public:
     using Storage = EmbeddedFixedVector<T>;
-    using iterator = T*;
-    using const_iterator = const T*;
-    using reverse_iterator = std::reverse_iterator<iterator>;
-    using const_reverse_iterator = std::reverse_iterator<const_iterator>;
+    using value_type = typename Storage::value_type;
+    using pointer = typename Storage::pointer;
+    using reference = typename Storage::reference;
+    using const_reference = typename Storage::const_reference;
+    using const_pointer = typename Storage::const_pointer;
+    using size_type = typename Storage::size_type;
+    using difference_type = typename Storage::difference_type;
+    using iterator = typename Storage::iterator;
+    using const_iterator = typename Storage::const_iterator;
+    using reverse_iterator = typename Storage::reverse_iterator;
+    using const_reverse_iterator = typename Storage::const_reverse_iterator;
 
     FixedVector() = default;
     FixedVector(const FixedVector& other)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to