Skip to content

Commit

Permalink
[JSC] Redesign DirectCall
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=268499
rdar://122042902

Reviewed by Justin Michaud.

This patch redesigns DirectCall. We decouple DirectCallLinkInfo from CallLinkInfo since they are very different mechanism now.
Right now, we continue using repatching DirectCalls since it seems that it is the fastest form from experiments. But instead,

1. For NativeExecutable, we attempt to inline call thunk into DFG / FTL directly and embed call targets / global objects if possible.
   We do not do it when debugger hook is injected (in this case, debugger hook injection once destroys all CodeBlock. So if we do not see this bool flag
   set when compiling, it is fine to continue).
2. For the other cases, we attempt to fill CodeBlock and CodePtr pair speculatively from compiler thread at link time to avoid repatching in the main thread.
   This can avoid repatching in most of cases. And then, in the main thread, we check whether this speculative values are the right ones, and if not, we repatch them.
   Otherwise, we will continue using them. We will chain DirectCallLinkInfo to CodeBlock in the main thread since this is main thread only operation.
3. We repatch to the newer CodeBlock / CodePtr when unlinkOrUpgradeImpl happens to DirectCall.

* Source/JavaScriptCore/bytecode/CallLinkInfo.cpp:
(JSC::CallLinkInfo::doneLocation):
(JSC::CallLinkInfo::setMonomorphicCallee):
(JSC::CallLinkInfo::clearCallee):
(JSC::CallLinkInfo::callee):
(JSC::CallLinkInfo::setLastSeenCallee):
(JSC::CallLinkInfo::lastSeenCallee const):
(JSC::CallLinkInfo::haveLastSeenCallee const):
(JSC::CallLinkInfo::visitWeak):
(JSC::CallLinkInfo::revertCallToStub):
(JSC::CallLinkInfo::reset):
(JSC::CallLinkInfo::setVirtualCall):
(JSC::DirectCallLinkInfo::reset):
(JSC::DirectCallLinkInfo::unlinkOrUpgradeImpl):
(JSC::DirectCallLinkInfo::visitWeak):
(JSC::CallLinkInfo::emitFastPathImpl):
(JSC::CallLinkInfo::emitDataICFastPath):
(JSC::CallLinkInfo::emitTailCallDataICFastPath):
(JSC::CallLinkInfo::setStub):
(JSC::CallLinkInfo::emitSlowPathImpl):
(JSC::CallLinkInfo::emitDataICSlowPath):
(JSC::CallLinkInfo::emitFastPath):
(JSC::CallLinkInfo::emitTailCallFastPath):
(JSC::CallLinkInfo::emitSlowPath):
(JSC::CallLinkInfo::emitTailCallSlowPath):
(JSC::OptimizingCallLinkInfo::emitFastPath):
(JSC::OptimizingCallLinkInfo::emitTailCallFastPath):
(JSC::OptimizingCallLinkInfo::emitSlowPath):
(JSC::OptimizingCallLinkInfo::emitTailCallSlowPath):
(JSC::OptimizingCallLinkInfo::initializeFromDFGUnlinkedCallLinkInfo):
(JSC::DirectCallLinkInfo::emitDirectFastPath):
(JSC::DirectCallLinkInfo::emitDirectTailCallFastPath):
(JSC::DirectCallLinkInfo::initialize):
(JSC::DirectCallLinkInfo::setCallTarget):
(JSC::DirectCallLinkInfo::setMaxArgumentCountIncludingThis):
(JSC::DirectCallLinkInfo::retrieveCallInfo):
(JSC::DirectCallLinkInfo::repatchSpeculatively):
(JSC::DirectCallLinkInfo::validateSpeculativeRepatchOnMainThread):
(JSC::CallLinkInfo::setCodeBlock): Deleted.
(JSC::CallLinkInfo::clearCodeBlock): Deleted.
(JSC::CallLinkInfo::codeBlock): Deleted.
(JSC::CallLinkInfo::clearLastSeenCallee): Deleted.
(JSC::CallLinkInfo::setExecutableDuringCompilation): Deleted.
(JSC::CallLinkInfo::executable): Deleted.
(JSC::OptimizingCallLinkInfo::slowPathStart): Deleted.
(JSC::OptimizingCallLinkInfo::fastPathStart): Deleted.
(JSC::OptimizingCallLinkInfo::emitDirectFastPath): Deleted.
(JSC::OptimizingCallLinkInfo::emitDirectTailCallFastPath): Deleted.
(JSC::OptimizingCallLinkInfo::initializeDirectCall): Deleted.
(JSC::OptimizingCallLinkInfo::setDirectCallTarget): Deleted.
(JSC::OptimizingCallLinkInfo::initializeDirectCallRepatch): Deleted.
(JSC::OptimizingCallLinkInfo::setDirectCallMaxArgumentCountIncludingThis): Deleted.
* Source/JavaScriptCore/bytecode/CallLinkInfo.h:
(JSC::CallLinkInfo::specializationKind const):
(JSC::CallLinkInfo::offsetOfCallee):
(JSC::CallLinkInfo::forEachDependentCell const):
(JSC::CallLinkInfo::callModeFor): Deleted.
(JSC::CallLinkInfo::isDirect): Deleted.
(JSC::CallLinkInfo::isDirect const): Deleted.
(JSC::CallLinkInfo::callLinkInfoGPR const): Deleted.
* Source/JavaScriptCore/bytecode/CallLinkInfoBase.cpp:
(JSC::CallLinkInfoBase::unlinkOrUpgrade):
* Source/JavaScriptCore/bytecode/CallLinkInfoBase.h:
(JSC::CallLinkInfoBase::callModeFor):
* Source/JavaScriptCore/bytecode/CallLinkStatus.cpp:
(JSC::CallLinkStatus::computeFromCallLinkInfo):
* Source/JavaScriptCore/bytecode/CodeBlock.cpp:
(JSC::CodeBlock::finalizeJITInlineCaches):
(JSC::CodeBlock::addressForCallConcurrently const):
* Source/JavaScriptCore/bytecode/CodeBlock.h:
* Source/JavaScriptCore/bytecode/InlineCacheCompiler.cpp:
(JSC::InlineCacheCompiler::generateImpl):
(JSC::InlineCacheCompiler::emitProxyObjectAccess):
* Source/JavaScriptCore/bytecode/Repatch.cpp:
(JSC::linkDirectCall):
* Source/JavaScriptCore/bytecode/Repatch.h:
* Source/JavaScriptCore/bytecode/RepatchInlines.h:
(JSC::linkFor):
* Source/JavaScriptCore/dfg/DFGCommonData.h:
* Source/JavaScriptCore/dfg/DFGJITCode.h:
* Source/JavaScriptCore/dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::link):
(JSC::DFG::JITCompiler::addCallLinkInfo):
* Source/JavaScriptCore/dfg/DFGJITCompiler.h:
(JSC::DFG::JITCompiler::addJSDirectCall):
(JSC::DFG::JITCompiler::JSDirectCallRecord::JSDirectCallRecord):
* Source/JavaScriptCore/dfg/DFGOperations.cpp:
(JSC::DFG::JSC_DEFINE_JIT_OPERATION):
* Source/JavaScriptCore/dfg/DFGOperations.h:
* Source/JavaScriptCore/dfg/DFGPlan.cpp:
(JSC::DFG::Plan::reallyAdd):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::emitCall):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::emitCall):
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
* Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::InspectorDebuggerAgent::addSymbolicBreakpoint):
* Source/JavaScriptCore/jit/JITCall.cpp:
(JSC::JIT::compileTailCall):
(JSC::JIT::compileOpCall):
* Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm:
* Source/JavaScriptCore/llint/LowLevelInterpreter64.asm:
* Source/JavaScriptCore/runtime/VM.h:
(JSC::VM::notifyDebuggerHookInjected):
(JSC::VM::isDebuggerHookInjected const):
* Source/JavaScriptCore/wasm/js/WasmToJS.cpp:
(JSC::Wasm::wasmToJS):

Canonical link: https://commits.webkit.org/273947@main
  • Loading branch information
Constellation committed Feb 1, 2024
1 parent d29efac commit ef37e64
Show file tree
Hide file tree
Showing 27 changed files with 742 additions and 590 deletions.
455 changes: 232 additions & 223 deletions Source/JavaScriptCore/bytecode/CallLinkInfo.cpp

Large diffs are not rendered by default.

248 changes: 114 additions & 134 deletions Source/JavaScriptCore/bytecode/CallLinkInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,11 @@ class CallLinkInfo : public CallLinkInfoBase {
Optimizing,
};

enum CallType : uint8_t {
None,
Call,
CallVarargs,
Construct,
ConstructVarargs,
TailCall,
TailCallVarargs,
DirectCall,
DirectConstruct,
DirectTailCall
};

enum class Mode : uint8_t {
Init,
Monomorphic,
Polymorphic,
Virtual,
LinkedDirect,
};

static constexpr uintptr_t polymorphicCalleeMask = 1;
Expand Down Expand Up @@ -117,62 +103,12 @@ class CallLinkInfo : public CallLinkInfoBase {
{
return specializationKindFor(static_cast<CallType>(m_callType));
}

static CallMode callModeFor(CallType callType)
{
switch (callType) {
case Call:
case CallVarargs:
case DirectCall:
return CallMode::Regular;
case TailCall:
case TailCallVarargs:
case DirectTailCall:
return CallMode::Tail;
case Construct:
case ConstructVarargs:
case DirectConstruct:
return CallMode::Construct;
case None:
RELEASE_ASSERT_NOT_REACHED();
}

RELEASE_ASSERT_NOT_REACHED();
}

static bool isDirect(CallType callType)
{
switch (callType) {
case DirectCall:
case DirectTailCall:
case DirectConstruct:
return true;
case Call:
case CallVarargs:
case TailCall:
case TailCallVarargs:
case Construct:
case ConstructVarargs:
return false;
case None:
RELEASE_ASSERT_NOT_REACHED();
return false;
}

RELEASE_ASSERT_NOT_REACHED();
return false;
}

CallMode callMode() const
{
return callModeFor(static_cast<CallType>(m_callType));
}

bool isDirect() const
{
return isDirect(static_cast<CallType>(m_callType));
}

bool isTailCall() const
{
return callMode() == CallMode::Tail;
Expand All @@ -191,22 +127,20 @@ class CallLinkInfo : public CallLinkInfoBase {
bool isLinked() const { return mode() != Mode::Init && mode() != Mode::Virtual; }
void unlinkOrUpgradeImpl(VM&, CodeBlock* oldCodeBlock, CodeBlock* newCodeBlock);

enum class UseDataIC : bool { No, Yes };

#if ENABLE(JIT)
protected:
static std::tuple<MacroAssembler::JumpList, MacroAssembler::Label> emitFastPathImpl(CallLinkInfo*, CCallHelpers&, GPRReg callLinkInfoGPR, UseDataIC, bool isTailCall, ScopedLambda<void()>&& prepareForTailCall) WARN_UNUSED_RETURN;
static std::tuple<MacroAssembler::JumpList, MacroAssembler::Label> emitDataICFastPath(CCallHelpers&, GPRReg callLinkInfoGPR) WARN_UNUSED_RETURN;
static std::tuple<MacroAssembler::JumpList, MacroAssembler::Label> emitTailCallDataICFastPath(CCallHelpers&, GPRReg callLinkInfoGPR, ScopedLambda<void()>&& prepareForTailCall) WARN_UNUSED_RETURN;
static std::tuple<MacroAssembler::JumpList, MacroAssembler::Label> emitFastPathImpl(CallLinkInfo*, CCallHelpers&, UseDataIC, bool isTailCall, ScopedLambda<void()>&& prepareForTailCall) WARN_UNUSED_RETURN;
static std::tuple<MacroAssembler::JumpList, MacroAssembler::Label> emitDataICFastPath(CCallHelpers&) WARN_UNUSED_RETURN;
static std::tuple<MacroAssembler::JumpList, MacroAssembler::Label> emitTailCallDataICFastPath(CCallHelpers&, ScopedLambda<void()>&& prepareForTailCall) WARN_UNUSED_RETURN;

static void emitSlowPathImpl(VM&, CCallHelpers&, GPRReg callLinkInfoGPR, UseDataIC, bool isTailCall, MacroAssembler::Label);
static void emitDataICSlowPath(VM&, CCallHelpers&, GPRReg callLinkInfoGPR, bool isTailCall, MacroAssembler::Label);
static void emitSlowPathImpl(VM&, CCallHelpers&, UseDataIC, bool isTailCall, MacroAssembler::Label);
static void emitDataICSlowPath(VM&, CCallHelpers&, bool isTailCall, MacroAssembler::Label);

public:
static std::tuple<MacroAssembler::JumpList, MacroAssembler::Label> emitFastPath(CCallHelpers&, CompileTimeCallLinkInfo, GPRReg callLinkInfoGPR) WARN_UNUSED_RETURN;
static std::tuple<MacroAssembler::JumpList, MacroAssembler::Label> emitTailCallFastPath(CCallHelpers&, CompileTimeCallLinkInfo, GPRReg callLinkInfoGPR, ScopedLambda<void()>&& prepareForTailCall) WARN_UNUSED_RETURN;
static void emitSlowPath(VM&, CCallHelpers&, CompileTimeCallLinkInfo, GPRReg callLinkInfoGPR);
static void emitTailCallSlowPath(VM&, CCallHelpers&, CompileTimeCallLinkInfo, GPRReg callLinkInfoGPR, MacroAssembler::Label);
static std::tuple<MacroAssembler::JumpList, MacroAssembler::Label> emitFastPath(CCallHelpers&, CompileTimeCallLinkInfo) WARN_UNUSED_RETURN;
static std::tuple<MacroAssembler::JumpList, MacroAssembler::Label> emitTailCallFastPath(CCallHelpers&, CompileTimeCallLinkInfo, ScopedLambda<void()>&& prepareForTailCall) WARN_UNUSED_RETURN;
static void emitSlowPath(VM&, CCallHelpers&, CompileTimeCallLinkInfo);
static void emitTailCallSlowPath(VM&, CCallHelpers&, CompileTimeCallLinkInfo, MacroAssembler::Label);
#endif

void revertCallToStub();
Expand All @@ -227,12 +161,7 @@ class CallLinkInfo : public CallLinkInfoBase {
void clearCallee();
JSObject* callee();

void setCodeBlock(VM&, JSCell*, FunctionCodeBlock*);
void clearCodeBlock();
FunctionCodeBlock* codeBlock();

void setLastSeenCallee(VM&, const JSCell* owner, JSObject* callee);
void clearLastSeenCallee();
JSObject* lastSeenCallee() const;
bool haveLastSeenCallee() const;

Expand Down Expand Up @@ -330,7 +259,7 @@ class CallLinkInfo : public CallLinkInfoBase {

static ptrdiff_t offsetOfCallee()
{
return OBJECT_OFFSETOF(CallLinkInfo, m_calleeOrCodeBlock);
return OBJECT_OFFSETOF(CallLinkInfo, m_callee);
}

static ptrdiff_t offsetOfCodeBlock()
Expand All @@ -344,8 +273,6 @@ class CallLinkInfo : public CallLinkInfoBase {
}

#if ENABLE(JIT)
GPRReg callLinkInfoGPR() const;

static ptrdiff_t offsetOfStub()
{
return OBJECT_OFFSETOF(CallLinkInfo, m_stub);
Expand All @@ -369,13 +296,10 @@ class CallLinkInfo : public CallLinkInfoBase {
#else
RELEASE_ASSERT_NOT_REACHED();
#endif
} else {
functor(m_calleeOrCodeBlock.get());
if (isDirect())
functor(m_lastSeenCalleeOrExecutable.get());
}
} else
functor(m_callee.get());
}
if (!isDirect() && haveLastSeenCallee())
if (haveLastSeenCallee())
functor(lastSeenCallee());
}

Expand Down Expand Up @@ -435,8 +359,8 @@ class CallLinkInfo : public CallLinkInfoBase {
} codeIC;
} u;

WriteBarrier<JSCell> m_calleeOrCodeBlock;
WriteBarrier<JSCell> m_lastSeenCalleeOrExecutable;
WriteBarrier<JSObject> m_callee;
WriteBarrier<JSObject> m_lastSeenCallee;
#if ENABLE(JIT)
RefPtr<PolymorphicCallStubRoutine> m_stub;
#endif
Expand All @@ -459,10 +383,6 @@ class BaselineCallLinkInfo final : public CallLinkInfo {

CodeOrigin codeOrigin() const { return CodeOrigin { m_bytecodeIndex }; }

#if ENABLE(JIT)
static constexpr GPRReg callLinkInfoGPR() { return BaselineJITRegisters::Call::callLinkInfoGPR; }
#endif

private:
BytecodeIndex m_bytecodeIndex { };
};
Expand All @@ -475,7 +395,7 @@ inline CodeOrigin getCallLinkInfoCodeOrigin(CallLinkInfo& callLinkInfo)
struct UnlinkedCallLinkInfo {
CodeLocationLabel<JSInternalPtrTag> doneLocation;

void setCodeLocations(CodeLocationLabel<JSInternalPtrTag>, CodeLocationLabel<JSInternalPtrTag> doneLocation)
void setCodeLocations(CodeLocationLabel<JSInternalPtrTag> doneLocation)
{
this->doneLocation = doneLocation;
}
Expand All @@ -491,6 +411,99 @@ struct BaselineUnlinkedCallLinkInfo : public JSC::UnlinkedCallLinkInfo {

#if ENABLE(JIT)

class DirectCallLinkInfo final : public CallLinkInfoBase {
WTF_MAKE_NONCOPYABLE(DirectCallLinkInfo);
public:
DirectCallLinkInfo(CodeOrigin codeOrigin, UseDataIC useDataIC, JSCell* owner, ExecutableBase* executable)
: CallLinkInfoBase(CallSiteType::DirectCall)
, m_useDataIC(useDataIC)
, m_codeOrigin(codeOrigin)
, m_owner(owner)
, m_executable(executable)
{ }

~DirectCallLinkInfo()
{
m_target = { };
m_codeBlock = nullptr;
}

void setCallType(CallType callType)
{
m_callType = callType;
}

CallType callType()
{
return static_cast<CallType>(m_callType);
}

CallMode callMode() const
{
return callModeFor(static_cast<CallType>(m_callType));
}

bool isTailCall() const
{
return callMode() == CallMode::Tail;
}

CodeSpecializationKind specializationKind() const
{
auto callType = static_cast<CallType>(m_callType);
return specializationFromIsConstruct(callType == DirectConstruct);
}

void setCodeLocations(CodeLocationLabel<JSInternalPtrTag> slowPathStart)
{
m_slowPathStart = slowPathStart;
}

static ptrdiff_t offsetOfTarget() { return OBJECT_OFFSETOF(DirectCallLinkInfo, m_target); };
static ptrdiff_t offsetOfCodeBlock() { return OBJECT_OFFSETOF(DirectCallLinkInfo, m_codeBlock); };

JSCell* owner() const { return m_owner; }

void unlinkOrUpgradeImpl(VM&, CodeBlock* oldCodeBlock, CodeBlock* newCodeBlock);

void visitWeak(VM&);

CodeOrigin codeOrigin() const { return m_codeOrigin; }
bool isDataIC() const { return m_useDataIC == UseDataIC::Yes; }

MacroAssembler::JumpList emitDirectFastPath(CCallHelpers&);
MacroAssembler::JumpList emitDirectTailCallFastPath(CCallHelpers&, ScopedLambda<void()>&& prepareForTailCall);
void setCallTarget(CodeBlock*, CodeLocationLabel<JSEntryPtrTag>);
void setMaxArgumentCountIncludingThis(unsigned);
unsigned maxArgumentCountIncludingThis() const { return m_maxArgumentCountIncludingThis; }

void reset();

void validateSpeculativeRepatchOnMainThread(VM&);

private:
CodeLocationLabel<JSInternalPtrTag> slowPathStart() const { return m_slowPathStart; }
CodeLocationLabel<JSInternalPtrTag> fastPathStart() const { return m_fastPathStart; }

void initialize();
void repatchSpeculatively();

std::tuple<CodeBlock*, CodePtr<JSEntryPtrTag>> retrieveCallInfo(FunctionExecutable*);

CallType m_callType : 4;
UseDataIC m_useDataIC : 1;
unsigned m_maxArgumentCountIncludingThis { 0 };
CodePtr<JSEntryPtrTag> m_target;
CodeBlock* m_codeBlock { nullptr }; // This is weakly held. And cleared whenever m_target is changed.
CodeOrigin m_codeOrigin { };
CodeLocationLabel<JSInternalPtrTag> m_slowPathStart;
CodeLocationLabel<JSInternalPtrTag> m_fastPathStart;
CodeLocationDataLabelPtr<JSInternalPtrTag> m_codeBlockLocation;
CodeLocationNearCall<JSInternalPtrTag> m_callLocation NO_UNIQUE_ADDRESS;
JSCell* m_owner;
ExecutableBase* m_executable { nullptr }; // This is weakly held. DFG / FTL CommonData already ensures this.
};

class OptimizingCallLinkInfo final : public CallLinkInfo {
public:
friend class CallLinkInfo;
Expand All @@ -511,28 +524,11 @@ class OptimizingCallLinkInfo final : public CallLinkInfo {
m_callType = callType;
}

void setCodeLocations(
CodeLocationLabel<JSInternalPtrTag> slowPathStart,
CodeLocationLabel<JSInternalPtrTag> doneLocation)
void setCodeLocations(CodeLocationLabel<JSInternalPtrTag> doneLocation)
{
if (!isDataIC())
m_slowPathStart = slowPathStart;
m_doneLocation = doneLocation;
}

CodeLocationLabel<JSInternalPtrTag> fastPathStart();
CodeLocationLabel<JSInternalPtrTag> slowPathStart();

GPRReg callLinkInfoGPR() const { return m_callLinkInfoGPR; }
void setCallLinkInfoGPR(GPRReg callLinkInfoGPR) { m_callLinkInfoGPR = callLinkInfoGPR; }

void emitDirectFastPath(CCallHelpers&);
void emitDirectTailCallFastPath(CCallHelpers&, ScopedLambda<void()>&& prepareForTailCall);
void initializeDirectCall();
void setDirectCallTarget(CodeBlock*, CodeLocationLabel<JSEntryPtrTag>);
void setDirectCallMaxArgumentCountIncludingThis(unsigned);
unsigned maxArgumentCountIncludingThisForDirectCall() const { return m_maxArgumentCountIncludingThisForDirectCall; }

void setSlowPathCallDestination(CodePtr<JSEntryPtrTag>);

CodeOrigin codeOrigin() const { return m_codeOrigin; }
Expand All @@ -545,32 +541,16 @@ class OptimizingCallLinkInfo final : public CallLinkInfo {
}

private:
void initializeDirectCallRepatch(CCallHelpers&);
std::tuple<MacroAssembler::JumpList, MacroAssembler::Label> emitFastPath(CCallHelpers&, GPRReg callLinkInfoGPR) WARN_UNUSED_RETURN;
std::tuple<MacroAssembler::JumpList, MacroAssembler::Label> emitTailCallFastPath(CCallHelpers&, GPRReg callLinkInfoGPR, ScopedLambda<void()>&& prepareForTailCall) WARN_UNUSED_RETURN;
void emitSlowPath(VM&, CCallHelpers&, GPRReg callLinkInfoGPR);
void emitTailCallSlowPath(VM&, CCallHelpers&, GPRReg callLinkInfoGPR, MacroAssembler::Label);
std::tuple<MacroAssembler::JumpList, MacroAssembler::Label> emitFastPath(CCallHelpers&) WARN_UNUSED_RETURN;
std::tuple<MacroAssembler::JumpList, MacroAssembler::Label> emitTailCallFastPath(CCallHelpers&, ScopedLambda<void()>&& prepareForTailCall) WARN_UNUSED_RETURN;
void emitSlowPath(VM&, CCallHelpers&);
void emitTailCallSlowPath(VM&, CCallHelpers&, MacroAssembler::Label);

CodeOrigin m_codeOrigin;
CodePtr<JSEntryPtrTag> m_slowPathCallDestination;
CodeLocationNearCall<JSInternalPtrTag> m_callLocation NO_UNIQUE_ADDRESS;
GPRReg m_callLinkInfoGPR { InvalidGPRReg };
unsigned m_maxArgumentCountIncludingThisForDirectCall { 0 };
CodeLocationLabel<JSInternalPtrTag> m_slowPathStart;
CodeLocationLabel<JSInternalPtrTag> m_fastPathStart;
};

inline GPRReg CallLinkInfo::callLinkInfoGPR() const
{
switch (type()) {
case Type::Baseline:
return static_cast<const BaselineCallLinkInfo*>(this)->callLinkInfoGPR();
case Type::Optimizing:
return static_cast<const OptimizingCallLinkInfo*>(this)->callLinkInfoGPR();
}
return InvalidGPRReg;
}

#endif

inline CodeOrigin CallLinkInfo::codeOrigin() const
Expand Down
3 changes: 3 additions & 0 deletions Source/JavaScriptCore/bytecode/CallLinkInfoBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ void CallLinkInfoBase::unlinkOrUpgrade(VM& vm, CodeBlock* oldCodeBlock, CodeBloc
case CallSiteType::PolymorphicCallNode:
static_cast<PolymorphicCallNode*>(this)->unlinkOrUpgradeImpl(vm, oldCodeBlock, newCodeBlock);
break;
case CallSiteType::DirectCall:
static_cast<DirectCallLinkInfo*>(this)->unlinkOrUpgradeImpl(vm, oldCodeBlock, newCodeBlock);
break;
#endif
case CallSiteType::CachedCall:
static_cast<CachedCall*>(this)->unlinkOrUpgradeImpl(vm, oldCodeBlock, newCodeBlock);
Expand Down
Loading

0 comments on commit ef37e64

Please sign in to comment.