Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (286768 => 286769)
--- trunk/Source/_javascript_Core/ChangeLog 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/ChangeLog 2021-12-09 08:47:07 UTC (rev 286769)
@@ -1,3 +1,103 @@
+2021-12-09 Yusuke Suzuki <[email protected]>
+
+ [JSC] Introduce BaselineCallLinkInfo and OptimizingCallLinkInfo to shrink sizeof(BaselineCallLinkInfo)
+ https://bugs.webkit.org/show_bug.cgi?id=233985
+
+ Reviewed by Mark Lam.
+
+ This patch introduces BaselineCallLinkInfo and OptimizingCallLinkInfo to shrink sizeof(BaselineCallLinkInfo).
+ BaselineCallLinkInfo is included in metadata, and allocated for LLInt and Baseline. So shrinking it can make
+ metadata small for LLInt and Baseline, which exists for all live functions.
+
+ We also reorder OpIteratorOpen::Metadata and OpIteratorNext::Metadata to shrink sizes.
+
+ sizeof(BaselineCallLinkInfo) becomes 88, while the old sizeof(CallLinkInfo) was 120.
+
+ * bytecode/AccessCase.cpp:
+ (JSC::AccessCase::generateImpl):
+ * bytecode/BytecodeList.rb:
+ * bytecode/CallLinkInfo.cpp:
+ (JSC::CallLinkInfo::setMonomorphicCallee):
+ (JSC::CallLinkInfo::emitFastPathImpl):
+ (JSC::OptimizingCallLinkInfo::emitFastPath):
+ (JSC::OptimizingCallLinkInfo::emitTailCallFastPath):
+ (JSC::OptimizingCallLinkInfo::emitSlowPath):
+ (JSC::CallLinkInfo::emitDataICSlowPath):
+ (JSC::OptimizingCallLinkInfo::slowPathStart):
+ (JSC::OptimizingCallLinkInfo::fastPathStart):
+ (JSC::OptimizingCallLinkInfo::emitDirectFastPath):
+ (JSC::OptimizingCallLinkInfo::emitDirectTailCallFastPath):
+ (JSC::OptimizingCallLinkInfo::initializeDirectCall):
+ (JSC::OptimizingCallLinkInfo::setDirectCallTarget):
+ (JSC::BaselineCallLinkInfo::initialize):
+ (JSC::CallLinkInfo::slowPathStart): Deleted.
+ (JSC::CallLinkInfo::fastPathStart): Deleted.
+ (JSC::CallLinkInfo::emitFastPath): Deleted.
+ (JSC::CallLinkInfo::emitTailCallFastPath): Deleted.
+ (JSC::CallLinkInfo::emitSlowPath): Deleted.
+ (JSC::CallLinkInfo::initializeDataIC): Deleted.
+ (JSC::CallLinkInfo::emitDirectFastPath): Deleted.
+ (JSC::CallLinkInfo::emitDirectTailCallFastPath): Deleted.
+ (JSC::CallLinkInfo::initializeDirectCall): Deleted.
+ (JSC::CallLinkInfo::setDirectCallTarget): Deleted.
+ * bytecode/CallLinkInfo.h:
+ (JSC::CallLinkInfo::type const):
+ (JSC::CallLinkInfo::CallLinkInfo):
+ (JSC::CallLinkInfo::calleeGPR const):
+ (JSC::CallLinkInfo::callLinkInfoGPR const):
+ (JSC::CallLinkInfo::setCallLinkInfoGPR):
+ (JSC::CallLinkInfo::setUpCall): Deleted.
+ (JSC::CallLinkInfo::setCodeLocations): Deleted.
+ (JSC::CallLinkInfo::calleeGPR): Deleted.
+ * bytecode/CallLinkStatus.cpp:
+ (JSC::CallLinkStatus::computeFor):
+ * bytecode/CodeBlock.cpp:
+ (JSC::CodeBlock::finishCreation):
+ (JSC::CodeBlock::setupWithUnlinkedBaselineCode):
+ (JSC::CodeBlock::finalizeUnconditionally):
+ (JSC::CodeBlock::getICStatusMap):
+ (JSC::CodeBlock::jettison):
+ * bytecode/GetterSetterAccessCase.h:
+ * bytecode/PolymorphicAccess.h:
+ * bytecode/Repatch.cpp:
+ (JSC::revertCall):
+ (JSC::linkDirectCall):
+ * bytecode/Repatch.h:
+ * dfg/DFGCommonData.h:
+ (JSC::DFG::CommonData::addCallLinkInfo):
+ * dfg/DFGJITCompiler.cpp:
+ (JSC::DFG::JITCompiler::link):
+ * dfg/DFGJITCompiler.h:
+ (JSC::DFG::JITCompiler::addJSCall):
+ (JSC::DFG::JITCompiler::addJSDirectCall):
+ (JSC::DFG::JITCompiler::JSCallRecord::JSCallRecord):
+ (JSC::DFG::JITCompiler::JSDirectCallRecord::JSDirectCallRecord):
+ * dfg/DFGOperations.cpp:
+ (JSC::DFG::JSC_DEFINE_JIT_OPERATION):
+ * dfg/DFGOperations.h:
+ * dfg/DFGSpeculativeJIT32_64.cpp:
+ (JSC::DFG::SpeculativeJIT::emitCall):
+ * dfg/DFGSpeculativeJIT64.cpp:
+ (JSC::DFG::SpeculativeJIT::emitCall):
+ * ftl/FTLLowerDFGToB3.cpp:
+ (JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
+ * jit/CallFrameShuffleData.cpp:
+ (JSC::CallFrameShuffleData::createForBaselineOrLLIntTailCall):
+ * jit/GCAwareJITStubRoutine.cpp:
+ (JSC::MarkingGCAwareJITStubRoutine::MarkingGCAwareJITStubRoutine):
+ (JSC::GCAwareJITStubRoutineWithExceptionHandler::GCAwareJITStubRoutineWithExceptionHandler):
+ (JSC::createICJITStubRoutine):
+ * jit/GCAwareJITStubRoutine.h:
+ * jit/JITCall.cpp:
+ (JSC::JIT::compileCallEvalSlowCase):
+ (JSC::JIT::compileTailCall):
+ (JSC::JIT::compileOpCall):
+ (): Deleted.
+ * wasm/js/JSWebAssemblyCodeBlock.h:
+ * wasm/js/WasmToJS.cpp:
+ (JSC::Wasm::wasmToJS):
+ * wasm/js/WasmToJS.h:
+
2021-12-08 Asumu Takikawa <[email protected]>
Support WebAssembly.Memory imports in Wasm/ESM modules.
Modified: trunk/Source/_javascript_Core/bytecode/AccessCase.cpp (286768 => 286769)
--- trunk/Source/_javascript_Core/bytecode/AccessCase.cpp 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/bytecode/AccessCase.cpp 2021-12-09 08:47:07 UTC (rev 286769)
@@ -1997,7 +1997,7 @@
state.setSpillStateForJSGetterSetter(spillState);
RELEASE_ASSERT(!access.callLinkInfo());
- CallLinkInfo* callLinkInfo = state.m_callLinkInfos.add(stubInfo.codeOrigin);
+ auto* callLinkInfo = state.m_callLinkInfos.add(stubInfo.codeOrigin);
access.m_callLinkInfo = callLinkInfo;
// FIXME: If we generated a polymorphic call stub that jumped back to the getter
Modified: trunk/Source/_javascript_Core/bytecode/BytecodeList.rb (286768 => 286769)
--- trunk/Source/_javascript_Core/bytecode/BytecodeList.rb 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeList.rb 2021-12-09 08:47:07 UTC (rev 286769)
@@ -26,7 +26,7 @@
:BasicBlockLocation,
:BoundLabel,
- :CallLinkInfo,
+ :BaselineCallLinkInfo,
:DebugHookType,
:ECMAMode,
:ErrorTypeWithExtension,
@@ -842,7 +842,7 @@
argv: unsigned,
},
metadata: {
- callLinkInfo: CallLinkInfo,
+ callLinkInfo: BaselineCallLinkInfo,
arrayProfile: ArrayProfile,
profile: ValueProfile,
}
@@ -855,7 +855,7 @@
argv: unsigned,
},
metadata: {
- callLinkInfo: CallLinkInfo,
+ callLinkInfo: BaselineCallLinkInfo,
arrayProfile: ArrayProfile,
profile: ValueProfile,
}
@@ -869,7 +869,7 @@
ecmaMode: ECMAMode,
},
metadata: {
- callLinkInfo: CallLinkInfo,
+ callLinkInfo: BaselineCallLinkInfo,
arrayProfile: ArrayProfile,
profile: ValueProfile,
}
@@ -884,7 +884,7 @@
firstVarArg: int,
},
metadata: {
- callLinkInfo: CallLinkInfo,
+ callLinkInfo: BaselineCallLinkInfo,
arrayProfile: ArrayProfile,
profile: ValueProfile,
},
@@ -906,7 +906,7 @@
firstVarArg: int,
},
metadata: {
- callLinkInfo: CallLinkInfo,
+ callLinkInfo: BaselineCallLinkInfo,
arrayProfile: ArrayProfile,
profile: ValueProfile,
},
@@ -928,7 +928,7 @@
firstVarArg: int,
},
metadata: {
- callLinkInfo: CallLinkInfo,
+ callLinkInfo: BaselineCallLinkInfo,
arrayProfile: ArrayProfile,
profile: ValueProfile,
}
@@ -941,7 +941,7 @@
argv: unsigned,
},
metadata: {
- callLinkInfo: CallLinkInfo,
+ callLinkInfo: BaselineCallLinkInfo,
arrayProfile: ArrayProfile,
profile: ValueProfile,
}
@@ -956,7 +956,7 @@
firstVarArg: int,
},
metadata: {
- callLinkInfo: CallLinkInfo,
+ callLinkInfo: BaselineCallLinkInfo,
arrayProfile: ArrayProfile,
profile: ValueProfile,
},
@@ -1257,13 +1257,13 @@
stackOffset: unsigned,
},
metadata: {
- iterationMetadata: IterationModeMetadata,
iterableProfile: ValueProfile,
- callLinkInfo: CallLinkInfo,
- arrayProfile: ArrayProfile,
+ callLinkInfo: BaselineCallLinkInfo,
iteratorProfile: ValueProfile,
modeMetadata: GetByIdModeMetadata,
nextProfile: ValueProfile,
+ arrayProfile: ArrayProfile,
+ iterationMetadata: IterationModeMetadata,
},
checkpoints: {
symbolCall: nil,
@@ -1281,15 +1281,15 @@
stackOffset: unsigned,
},
metadata: {
- iterationMetadata: IterationModeMetadata,
- iterableProfile: ArrayProfile,
- callLinkInfo: CallLinkInfo,
- arrayProfile: ArrayProfile,
+ callLinkInfo: BaselineCallLinkInfo,
nextResultProfile: ValueProfile,
doneModeMetadata: GetByIdModeMetadata,
doneProfile: ValueProfile,
valueModeMetadata: GetByIdModeMetadata,
valueProfile: ValueProfile,
+ arrayProfile: ArrayProfile,
+ iterableProfile: ArrayProfile,
+ iterationMetadata: IterationModeMetadata,
},
tmps: {
nextResult: JSValue,
Modified: trunk/Source/_javascript_Core/bytecode/CallLinkInfo.cpp (286768 => 286769)
--- trunk/Source/_javascript_Core/bytecode/CallLinkInfo.cpp 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/bytecode/CallLinkInfo.cpp 2021-12-09 08:47:07 UTC (rev 286769)
@@ -102,12 +102,6 @@
RELEASE_ASSERT(!isOnList());
}
-CodeLocationLabel<JSInternalPtrTag> CallLinkInfo::slowPathStart()
-{
- RELEASE_ASSERT(!isDataIC());
- return u.codeIC.m_slowPathStart;
-}
-
CodeLocationLabel<JSInternalPtrTag> CallLinkInfo::doneLocation()
{
RELEASE_ASSERT(!isDirect());
@@ -124,7 +118,7 @@
u.dataIC.m_monomorphicCallDestination = codePtr;
else {
#if ENABLE(JIT)
- MacroAssembler::repatchNearCall(u.codeIC.m_callLocation, CodeLocationLabel<JSEntryPtrTag>(codePtr));
+ MacroAssembler::repatchNearCall(static_cast<OptimizingCallLinkInfo*>(this)->m_callLocation, CodeLocationLabel<JSEntryPtrTag>(codePtr));
MacroAssembler::repatchPointer(u.codeIC.m_calleeLocation, callee);
#else
RELEASE_ASSERT_NOT_REACHED();
@@ -215,12 +209,6 @@
m_maxArgumentCountIncludingThis = value;
}
-CodeLocationLabel<JSInternalPtrTag> CallLinkInfo::fastPathStart()
-{
- RELEASE_ASSERT(isDirect() && isTailCall());
- return CodeLocationDataLabelPtr<JSInternalPtrTag>(u.codeIC.m_fastPathStart);
-}
-
void CallLinkInfo::visitWeak(VM& vm)
{
auto handleSpecificCallee = [&] (JSFunction* callee) {
@@ -292,7 +280,57 @@
}
}
+void CallLinkInfo::setSlowPathCallDestination(MacroAssemblerCodePtr<JSEntryPtrTag> codePtr)
+{
+ m_slowPathCallDestination = codePtr;
+}
+
+void CallLinkInfo::revertCallToStub()
+{
+ RELEASE_ASSERT(stub());
+ // The start of our JIT code is now a jump to the polymorphic stub. Rewrite the first instruction
+ // to be what we need for non stub ICs.
+
+ // this runs into some branch compaction crap I'd like to avoid for now. Essentially, the branch
+ // doesn't know if it can be compacted or not. So we end up with 28 bytes of machine code, for
+ // what in all likelihood fits in 24. So we just splat out the first instruction. Long term, we
+ // need something cleaner. But this works on arm64 for now.
+
+ if (isDataIC()) {
+ m_calleeOrCodeBlock.clear();
+ u.dataIC.m_monomorphicCallDestination = nullptr;
+ } else {
#if ENABLE(JIT)
+ CCallHelpers::revertJumpReplacementToBranchPtrWithPatch(
+ CCallHelpers::startOfBranchPtrWithPatchOnRegister(u.codeIC.m_calleeLocation), calleeGPR(), nullptr);
+#else
+ RELEASE_ASSERT_NOT_REACHED();
+#endif
+ }
+}
+
+void BaselineCallLinkInfo::initialize(VM& vm, CallType callType, BytecodeIndex bytecodeIndex, CallFrameShuffleData* frameShuffleData)
+{
+ UNUSED_PARAM(frameShuffleData);
+ m_type = static_cast<unsigned>(Type::Baseline);
+ ASSERT(Type::Baseline == type());
+ m_codeOrigin = CodeOrigin(bytecodeIndex);
+ m_callType = callType;
+#if ENABLE(JIT)
+ if (frameShuffleData) {
+ // FIXME: It'd be nice if this were a refcounted data structure.
+ m_frameShuffleData = makeUnique<CallFrameShuffleData>(*frameShuffleData);
+ }
+#endif
+ setUsesDataICs(UseDataIC::Yes);
+ setSlowPathCallDestination(vm.getCTILinkCall().code());
+ // If JIT is disabled, we should not support dynamically generated call IC.
+ if (!Options::useJIT())
+ disallowStubs();
+}
+
+#if ENABLE(JIT)
+
void CallLinkInfo::setFrameShuffleData(const CallFrameShuffleData& shuffleData)
{
m_frameShuffleData = makeUnique<CallFrameShuffleData>(shuffleData);
@@ -336,7 +374,7 @@
RELEASE_ASSERT(callLinkInfo);
jit.addLinkTask([=] (LinkBuffer& linkBuffer) {
- callLinkInfo->u.codeIC.m_callLocation = linkBuffer.locationOfNearCall<JSInternalPtrTag>(call);
+ static_cast<OptimizingCallLinkInfo*>(callLinkInfo)->m_callLocation = linkBuffer.locationOfNearCall<JSInternalPtrTag>(call);
callLinkInfo->u.codeIC.m_calleeLocation = linkBuffer.locationOf<JSInternalPtrTag>(calleeCheck);
});
}
@@ -344,8 +382,43 @@
return slowPath;
}
-CCallHelpers::JumpList CallLinkInfo::emitFastPath(CCallHelpers& jit, GPRReg calleeGPR, GPRReg callLinkInfoGPR, UseDataIC useDataIC)
+MacroAssembler::JumpList CallLinkInfo::emitDataICFastPath(CCallHelpers& jit, GPRReg calleeGPR, GPRReg callLinkInfoGPR)
{
+ RELEASE_ASSERT(callLinkInfoGPR != InvalidGPRReg);
+ return emitFastPathImpl(nullptr, jit, calleeGPR, callLinkInfoGPR, UseDataIC::Yes, false, nullptr);
+}
+
+MacroAssembler::JumpList CallLinkInfo::emitTailCallDataICFastPath(CCallHelpers& jit, GPRReg calleeGPR, GPRReg callLinkInfoGPR, ScopedLambda<void()>&& prepareForTailCall)
+{
+ RELEASE_ASSERT(callLinkInfoGPR != InvalidGPRReg);
+ return emitFastPathImpl(nullptr, jit, calleeGPR, callLinkInfoGPR, UseDataIC::Yes, true, WTFMove(prepareForTailCall));
+}
+
+void CallLinkInfo::setStub(Ref<PolymorphicCallStubRoutine>&& newStub)
+{
+ clearStub();
+ m_stub = WTFMove(newStub);
+
+ m_calleeOrCodeBlock.clear();
+
+ if (isDataIC()) {
+ *bitwise_cast<uintptr_t*>(m_calleeOrCodeBlock.slot()) = polymorphicCalleeMask;
+ u.dataIC.m_monomorphicCallDestination = m_stub->code().code().retagged<JSEntryPtrTag>();
+ } else {
+ MacroAssembler::replaceWithJump(
+ MacroAssembler::startOfBranchPtrWithPatchOnRegister(u.codeIC.m_calleeLocation),
+ CodeLocationLabel<JITStubRoutinePtrTag>(m_stub->code().code()));
+ }
+}
+
+void CallLinkInfo::emitDataICSlowPath(VM&, CCallHelpers& jit, GPRReg callLinkInfoGPR)
+{
+ jit.move(callLinkInfoGPR, GPRInfo::regT2);
+ jit.call(CCallHelpers::Address(GPRInfo::regT2, offsetOfSlowPathCallDestination()), JSEntryPtrTag);
+}
+
+CCallHelpers::JumpList OptimizingCallLinkInfo::emitFastPath(CCallHelpers& jit, GPRReg calleeGPR, GPRReg callLinkInfoGPR, UseDataIC useDataIC)
+{
RELEASE_ASSERT(!isTailCall());
setUsesDataICs(useDataIC);
@@ -352,69 +425,38 @@
if (isDataIC()) {
RELEASE_ASSERT(callLinkInfoGPR != GPRReg::InvalidGPRReg);
jit.move(CCallHelpers::TrustedImmPtr(this), callLinkInfoGPR);
- u.dataIC.m_callLinkInfoGPR = callLinkInfoGPR;
+ setCallLinkInfoGPR(callLinkInfoGPR);
}
return emitFastPathImpl(this, jit, calleeGPR, callLinkInfoGPR, useDataIC, isTailCall(), nullptr);
}
-MacroAssembler::JumpList CallLinkInfo::emitTailCallFastPath(CCallHelpers& jit, GPRReg calleeGPR, ScopedLambda<void()>&& prepareForTailCall)
+MacroAssembler::JumpList OptimizingCallLinkInfo::emitTailCallFastPath(CCallHelpers& jit, GPRReg calleeGPR, ScopedLambda<void()>&& prepareForTailCall)
{
RELEASE_ASSERT(isTailCall());
setUsesDataICs(UseDataIC::No);
return emitFastPathImpl(this, jit, calleeGPR, InvalidGPRReg, UseDataIC::No, isTailCall(), WTFMove(prepareForTailCall));
}
-
-MacroAssembler::JumpList CallLinkInfo::emitDataICFastPath(CCallHelpers& jit, GPRReg calleeGPR, GPRReg callLinkInfoGPR)
+void OptimizingCallLinkInfo::emitSlowPath(VM& vm, CCallHelpers& jit)
{
- RELEASE_ASSERT(callLinkInfoGPR != InvalidGPRReg);
- return emitFastPathImpl(nullptr, jit, calleeGPR, callLinkInfoGPR, UseDataIC::Yes, false, nullptr);
-}
-
-MacroAssembler::JumpList CallLinkInfo::emitTailCallDataICFastPath(CCallHelpers& jit, GPRReg calleeGPR, GPRReg callLinkInfoGPR, ScopedLambda<void()>&& prepareForTailCall)
-{
- RELEASE_ASSERT(callLinkInfoGPR != InvalidGPRReg);
- return emitFastPathImpl(nullptr, jit, calleeGPR, callLinkInfoGPR, UseDataIC::Yes, true, WTFMove(prepareForTailCall));
-}
-
-void CallLinkInfo::emitSlowPath(VM& vm, CCallHelpers& jit)
-{
setSlowPathCallDestination(vm.getCTILinkCall().code());
jit.move(CCallHelpers::TrustedImmPtr(this), GPRInfo::regT2);
jit.call(CCallHelpers::Address(GPRInfo::regT2, offsetOfSlowPathCallDestination()), JSEntryPtrTag);
}
-void CallLinkInfo::emitDataICSlowPath(VM&, CCallHelpers& jit, GPRReg callLinkInfoGPR)
+CodeLocationLabel<JSInternalPtrTag> OptimizingCallLinkInfo::slowPathStart()
{
- jit.move(callLinkInfoGPR, GPRInfo::regT2);
- jit.call(CCallHelpers::Address(GPRInfo::regT2, offsetOfSlowPathCallDestination()), JSEntryPtrTag);
+ RELEASE_ASSERT(!isDataIC());
+ return m_slowPathStart;
}
-#endif
-void CallLinkInfo::initializeDataIC(VM& vm, CallType callType, BytecodeIndex bytecodeIndex, CallFrameShuffleData* frameShuffleData)
+CodeLocationLabel<JSInternalPtrTag> OptimizingCallLinkInfo::fastPathStart()
{
- UNUSED_PARAM(frameShuffleData);
- m_codeOrigin = CodeOrigin(bytecodeIndex);
- m_callType = callType;
-#if ENABLE(JIT)
- GPRReg calleeGPR = GPRInfo::regT0;
- GPRReg callLinkInfoGPR = GPRInfo::regT2;
- m_calleeGPR = calleeGPR;
- if (frameShuffleData) {
- // FIXME: It'd be nice if this were a refcounted data structure.
- m_frameShuffleData = makeUnique<CallFrameShuffleData>(*frameShuffleData);
- }
- u.dataIC.m_callLinkInfoGPR = callLinkInfoGPR;
-#endif
- setUsesDataICs(UseDataIC::Yes);
- setSlowPathCallDestination(vm.getCTILinkCall().code());
- // If JIT is disabled, we should not support dynamically generated call IC.
- if (!Options::useJIT())
- disallowStubs();
+ RELEASE_ASSERT(isDirect() && isTailCall());
+ return CodeLocationDataLabelPtr<JSInternalPtrTag>(m_fastPathStart);
}
-#if ENABLE(JIT)
-void CallLinkInfo::emitDirectFastPath(CCallHelpers& jit)
+void OptimizingCallLinkInfo::emitDirectFastPath(CCallHelpers& jit)
{
RELEASE_ASSERT(!isTailCall());
@@ -422,7 +464,7 @@
auto call = jit.nearCall();
jit.addLinkTask([=] (LinkBuffer& linkBuffer) {
- u.codeIC.m_callLocation = linkBuffer.locationOfNearCall<JSInternalPtrTag>(call);
+ m_callLocation = linkBuffer.locationOfNearCall<JSInternalPtrTag>(call);
});
jit.addLateLinkTask([this] (LinkBuffer&) {
initializeDirectCall();
@@ -429,7 +471,7 @@
});
}
-void CallLinkInfo::emitDirectTailCallFastPath(CCallHelpers& jit, ScopedLambda<void()>&& prepareForTailCall)
+void OptimizingCallLinkInfo::emitDirectTailCallFastPath(CCallHelpers& jit, ScopedLambda<void()>&& prepareForTailCall)
{
RELEASE_ASSERT(isTailCall());
@@ -437,7 +479,7 @@
auto fastPathStart = jit.label();
jit.addLinkTask([=] (LinkBuffer& linkBuffer) {
- u.codeIC.m_fastPathStart = linkBuffer.locationOf<JSInternalPtrTag>(fastPathStart);
+ m_fastPathStart = linkBuffer.locationOf<JSInternalPtrTag>(fastPathStart);
});
// - If we're not yet linked, this is a jump to the slow path.
@@ -447,7 +489,7 @@
prepareForTailCall();
auto call = jit.nearTailCall();
jit.addLinkTask([=] (LinkBuffer& linkBuffer) {
- u.codeIC.m_callLocation = linkBuffer.locationOfNearCall<JSInternalPtrTag>(call);
+ m_callLocation = linkBuffer.locationOfNearCall<JSInternalPtrTag>(call);
});
jit.addLateLinkTask([this] (LinkBuffer&) {
initializeDirectCall();
@@ -454,10 +496,10 @@
});
}
-void CallLinkInfo::initializeDirectCall()
+void OptimizingCallLinkInfo::initializeDirectCall()
{
RELEASE_ASSERT(isDirect());
- ASSERT(u.codeIC.m_callLocation);
+ ASSERT(m_callLocation);
if (isTailCall()) {
RELEASE_ASSERT(fastPathStart());
CCallHelpers::emitJITCodeOver(fastPathStart(), scopedLambda<void(CCallHelpers&)>([&](CCallHelpers& jit) {
@@ -467,10 +509,10 @@
});
}), "initialize direct call");
} else
- MacroAssembler::repatchNearCall(u.codeIC.m_callLocation, slowPathStart());
+ MacroAssembler::repatchNearCall(m_callLocation, slowPathStart());
}
-void CallLinkInfo::setDirectCallTarget(CodeLocationLabel<JSEntryPtrTag> target)
+void OptimizingCallLinkInfo::setDirectCallTarget(CodeLocationLabel<JSEntryPtrTag> target)
{
RELEASE_ASSERT(isDirect());
@@ -483,56 +525,9 @@
}), "Setting direct call target");
}
- MacroAssembler::repatchNearCall(u.codeIC.m_callLocation, target);
+ MacroAssembler::repatchNearCall(m_callLocation, target);
}
-#endif
-void CallLinkInfo::setSlowPathCallDestination(MacroAssemblerCodePtr<JSEntryPtrTag> codePtr)
-{
- m_slowPathCallDestination = codePtr;
-}
-
-void CallLinkInfo::revertCallToStub()
-{
- RELEASE_ASSERT(stub());
- // The start of our JIT code is now a jump to the polymorphic stub. Rewrite the first instruction
- // to be what we need for non stub ICs.
-
- // this runs into some branch compaction crap I'd like to avoid for now. Essentially, the branch
- // doesn't know if it can be compacted or not. So we end up with 28 bytes of machine code, for
- // what in all likelihood fits in 24. So we just splat out the first instruction. Long term, we
- // need something cleaner. But this works on arm64 for now.
-
- if (isDataIC()) {
- m_calleeOrCodeBlock.clear();
- u.dataIC.m_monomorphicCallDestination = nullptr;
- } else {
-#if ENABLE(JIT)
- CCallHelpers::revertJumpReplacementToBranchPtrWithPatch(
- CCallHelpers::startOfBranchPtrWithPatchOnRegister(u.codeIC.m_calleeLocation), calleeGPR(), nullptr);
-#else
- RELEASE_ASSERT_NOT_REACHED();
#endif
- }
-}
-#if ENABLE(JIT)
-void CallLinkInfo::setStub(Ref<PolymorphicCallStubRoutine>&& newStub)
-{
- clearStub();
- m_stub = WTFMove(newStub);
-
- m_calleeOrCodeBlock.clear();
-
- if (isDataIC()) {
- *bitwise_cast<uintptr_t*>(m_calleeOrCodeBlock.slot()) = polymorphicCalleeMask;
- u.dataIC.m_monomorphicCallDestination = m_stub->code().code().retagged<JSEntryPtrTag>();
- } else {
- MacroAssembler::replaceWithJump(
- MacroAssembler::startOfBranchPtrWithPatchOnRegister(u.codeIC.m_calleeLocation),
- CodeLocationLabel<JITStubRoutinePtrTag>(m_stub->code().code()));
- }
-}
-#endif
-
} // namespace JSC
Modified: trunk/Source/_javascript_Core/bytecode/CallLinkInfo.h (286768 => 286769)
--- trunk/Source/_javascript_Core/bytecode/CallLinkInfo.h 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/bytecode/CallLinkInfo.h 2021-12-09 08:47:07 UTC (rev 286769)
@@ -47,10 +47,23 @@
struct CallFrameShuffleData;
struct UnlinkedCallLinkInfo;
+#if ENABLE(JIT)
+namespace BaselineCallRegisters {
+constexpr JSValueRegs calleeJSR { JSRInfo::jsRegT10 };
+constexpr GPRReg calleeGPR { GPRInfo::regT0 };
+constexpr GPRReg callLinkInfoGPR { GPRInfo::regT2 };
+}
+#endif
+
class CallLinkInfo : public PackedRawSentinelNode<CallLinkInfo> {
public:
friend class LLIntOffsetsExtractor;
+ enum class Type : uint8_t {
+ Baseline,
+ Optimizing,
+ };
+
enum CallType : uint8_t {
None,
Call,
@@ -81,24 +94,6 @@
}
}
- CallLinkInfo(CodeOrigin codeOrigin)
- : m_codeOrigin(codeOrigin)
- , m_hasSeenShouldRepatch(false)
- , m_hasSeenClosure(false)
- , m_clearedByGC(false)
- , m_clearedByVirtual(false)
- , m_allowStubs(true)
- , m_clearedByJettison(false)
- , m_callType(None)
- , m_useDataIC(static_cast<unsigned>(UseDataIC::Yes))
- {
- }
-
- CallLinkInfo()
- : CallLinkInfo(CodeOrigin { })
- {
- }
-
~CallLinkInfo();
static CodeSpecializationKind specializationKindFor(CallType callType)
@@ -183,18 +178,6 @@
bool isLinked() const { return stub() || m_calleeOrCodeBlock; }
void unlink(VM&);
-#if ENABLE(JIT)
- void setUpCall(CallType callType, GPRReg calleeGPR)
- {
- m_callType = callType;
- m_calleeGPR = calleeGPR;
- }
-
- GPRReg calleeGPR() const { return m_calleeGPR; }
-#endif
-
- void initializeDataIC(VM&, CallType, BytecodeIndex, CallFrameShuffleData*);
-
enum class UseDataIC : uint8_t {
Yes,
No
@@ -201,20 +184,12 @@
};
#if ENABLE(JIT)
-private:
+protected:
static MacroAssembler::JumpList emitFastPathImpl(CallLinkInfo*, CCallHelpers&, GPRReg calleeGPR, GPRReg callLinkInfoGPR, UseDataIC, bool isTailCall, ScopedLambda<void()>&& prepareForTailCall) WARN_UNUSED_RETURN;
public:
static MacroAssembler::JumpList emitDataICFastPath(CCallHelpers&, GPRReg calleeGPR, GPRReg callLinkInfoGPR) WARN_UNUSED_RETURN;
static MacroAssembler::JumpList emitTailCallDataICFastPath(CCallHelpers&, GPRReg calleeGPR, GPRReg callLinkInfoGPR, ScopedLambda<void()>&& prepareForTailCall) WARN_UNUSED_RETURN;
- MacroAssembler::JumpList emitFastPath(CCallHelpers&, GPRReg calleeGPR, GPRReg callLinkInfoGPR, UseDataIC) WARN_UNUSED_RETURN;
- MacroAssembler::JumpList emitTailCallFastPath(CCallHelpers&, GPRReg calleeGPR, ScopedLambda<void()>&& prepareForTailCall) WARN_UNUSED_RETURN;
- void emitDirectFastPath(CCallHelpers&);
- void emitDirectTailCallFastPath(CCallHelpers&, ScopedLambda<void()>&& prepareForTailCall);
- void emitSlowPath(VM&, CCallHelpers&);
static void emitDataICSlowPath(VM&, CCallHelpers&, GPRReg callLinkInfoGPR);
-
- void initializeDirectCall();
- void setDirectCallTarget(CodeLocationLabel<JSEntryPtrTag>);
#endif
void revertCallToStub();
@@ -222,16 +197,6 @@
bool isDataIC() const { return static_cast<UseDataIC>(m_useDataIC) == UseDataIC::Yes; }
void setUsesDataICs(UseDataIC useDataIC) { m_useDataIC = static_cast<unsigned>(useDataIC); }
- void setCodeLocations(
- CodeLocationLabel<JSInternalPtrTag> slowPathStart,
- CodeLocationLabel<JSInternalPtrTag> doneLocation)
- {
- if (!isDataIC())
- u.codeIC.m_slowPathStart = slowPathStart;
- m_doneLocation = doneLocation;
- }
-
-
bool allowStubs() const { return m_allowStubs; }
void disallowStubs()
@@ -239,7 +204,6 @@
m_allowStubs = false;
}
- CodeLocationLabel<JSInternalPtrTag> slowPathStart();
CodeLocationLabel<JSInternalPtrTag> doneLocation();
void setMonomorphicCallee(VM&, JSCell*, JSObject* callee, MacroAssemblerCodePtr<JSEntryPtrTag>);
@@ -371,10 +335,8 @@
}
#if ENABLE(JIT)
- GPRReg calleeGPR()
- {
- return m_calleeGPR;
- }
+ GPRReg calleeGPR() const;
+ GPRReg callLinkInfoGPR() const;
#endif
uint32_t slowPathCount()
@@ -418,33 +380,47 @@
}
#endif
-private:
+ Type type() const { return static_cast<Type>(m_type); }
- CodeLocationLabel<JSInternalPtrTag> fastPathStart();
+protected:
+ CallLinkInfo(Type type, CodeOrigin codeOrigin)
+ : m_codeOrigin(codeOrigin)
+ , m_hasSeenShouldRepatch(false)
+ , m_hasSeenClosure(false)
+ , m_clearedByGC(false)
+ , m_clearedByVirtual(false)
+ , m_allowStubs(true)
+ , m_clearedByJettison(false)
+ , m_callType(None)
+ , m_useDataIC(static_cast<unsigned>(UseDataIC::Yes))
+ , m_type(static_cast<unsigned>(type))
+ {
+ ASSERT(type == this->type());
+ }
+ CallLinkInfo(Type type)
+ : CallLinkInfo(type, CodeOrigin { })
+ {
+ }
+
+#if ENABLE(JIT)
+ void setCallLinkInfoGPR(GPRReg);
+#endif
+
uint32_t m_maxArgumentCountIncludingThis { 0 }; // For varargs: the profiled maximum number of arguments. For direct: the number of stack slots allocated for arguments.
CodeLocationLabel<JSInternalPtrTag> m_doneLocation;
MacroAssemblerCodePtr<JSEntryPtrTag> m_slowPathCallDestination;
union UnionType {
- UnionType()
-#if ENABLE(JIT)
- : dataIC { nullptr, InvalidGPRReg }
-#else
+ UnionType()
: dataIC { nullptr }
-#endif
{ }
+
struct DataIC {
MacroAssemblerCodePtr<JSEntryPtrTag> m_monomorphicCallDestination;
-#if ENABLE(JIT)
- GPRReg m_callLinkInfoGPR;
-#endif
} dataIC;
struct {
- CodeLocationNearCall<JSInternalPtrTag> m_callLocation;
CodeLocationDataLabelPtr<JSInternalPtrTag> m_calleeLocation;
- CodeLocationLabel<JSInternalPtrTag> m_slowPathStart;
- CodeLocationLabel<JSInternalPtrTag> m_fastPathStart;
} codeIC;
} u;
@@ -463,12 +439,35 @@
bool m_clearedByJettison : 1;
unsigned m_callType : 4; // CallType
unsigned m_useDataIC : 1; // UseDataIC
+ unsigned m_type : 1; // Type
#if ENABLE(JIT)
GPRReg m_calleeGPR { InvalidGPRReg };
+ GPRReg m_callLinkInfoGPR { InvalidGPRReg };
#endif
uint32_t m_slowPathCount { 0 };
};
+class BaselineCallLinkInfo final : public CallLinkInfo {
+public:
+ BaselineCallLinkInfo()
+ : CallLinkInfo(Type::Baseline)
+ {
+ }
+
+ void initialize(VM&, CallType, BytecodeIndex, CallFrameShuffleData*);
+
+ void setCodeLocations(CodeLocationLabel<JSInternalPtrTag> doneLocation)
+ {
+ m_doneLocation = doneLocation;
+ }
+
+#if ENABLE(JIT)
+ static constexpr GPRReg calleeGPR() { return BaselineCallRegisters::calleeGPR; }
+ static constexpr GPRReg callLinkInfoGPR() { return BaselineCallRegisters::callLinkInfoGPR; }
+ void setCallLinkInfoGPR(GPRReg callLinkInfoGPR) { RELEASE_ASSERT(callLinkInfoGPR == BaselineCallRegisters::callLinkInfoGPR); }
+#endif
+};
+
inline CodeOrigin getCallLinkInfoCodeOrigin(CallLinkInfo& callLinkInfo)
{
return callLinkInfo.codeOrigin();
@@ -479,4 +478,86 @@
CodeLocationLabel<JSInternalPtrTag> doneLocation;
};
+#if ENABLE(JIT)
+
+class OptimizingCallLinkInfo final : public CallLinkInfo {
+public:
+ friend class CallLinkInfo;
+
+ OptimizingCallLinkInfo(CodeOrigin codeOrigin)
+ : CallLinkInfo(Type::Optimizing, codeOrigin)
+ {
+ }
+
+ void setUpCall(CallType callType, GPRReg calleeGPR)
+ {
+ m_callType = callType;
+ m_calleeGPR = calleeGPR;
+ }
+
+ void setCodeLocations(
+ CodeLocationLabel<JSInternalPtrTag> slowPathStart,
+ CodeLocationLabel<JSInternalPtrTag> doneLocation)
+ {
+ if (!isDataIC())
+ m_slowPathStart = slowPathStart;
+ m_doneLocation = doneLocation;
+ }
+
+ CodeLocationLabel<JSInternalPtrTag> fastPathStart();
+ CodeLocationLabel<JSInternalPtrTag> slowPathStart();
+
+ GPRReg calleeGPR() const { return m_calleeGPR; }
+ 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(CodeLocationLabel<JSEntryPtrTag>);
+ void emitSlowPath(VM&, CCallHelpers&);
+
+ MacroAssembler::JumpList emitFastPath(CCallHelpers&, GPRReg calleeGPR, GPRReg callLinkInfoGPR, UseDataIC) WARN_UNUSED_RETURN;
+ MacroAssembler::JumpList emitTailCallFastPath(CCallHelpers&, GPRReg calleeGPR, ScopedLambda<void()>&& prepareForTailCall) WARN_UNUSED_RETURN;
+
+private:
+ CodeLocationNearCall<JSInternalPtrTag> m_callLocation;
+ CodeLocationLabel<JSInternalPtrTag> m_slowPathStart;
+ CodeLocationLabel<JSInternalPtrTag> m_fastPathStart;
+};
+
+inline GPRReg CallLinkInfo::calleeGPR() const
+{
+ switch (type()) {
+ case Type::Baseline:
+ return static_cast<const BaselineCallLinkInfo*>(this)->calleeGPR();
+ case Type::Optimizing:
+ return static_cast<const OptimizingCallLinkInfo*>(this)->calleeGPR();
+ }
+ return InvalidGPRReg;
+}
+
+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;
+}
+
+inline void CallLinkInfo::setCallLinkInfoGPR(GPRReg callLinkInfoGPR)
+{
+ switch (type()) {
+ case Type::Baseline:
+ return static_cast<BaselineCallLinkInfo*>(this)->setCallLinkInfoGPR(callLinkInfoGPR);
+ case Type::Optimizing:
+ return static_cast<OptimizingCallLinkInfo*>(this)->setCallLinkInfoGPR(callLinkInfoGPR);
+ }
+}
+
+#endif
+
} // namespace JSC
Modified: trunk/Source/_javascript_Core/bytecode/CallLinkStatus.cpp (286768 => 286769)
--- trunk/Source/_javascript_Core/bytecode/CallLinkStatus.cpp 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/bytecode/CallLinkStatus.cpp 2021-12-09 08:47:07 UTC (rev 286769)
@@ -324,8 +324,7 @@
if (!status.callLinkInfo)
return CallLinkStatus();
- if (CallLinkStatusInternal::verbose)
- dataLog("Have CallLinkInfo with CodeOrigin = ", status.callLinkInfo->codeOrigin(), "\n");
+ dataLogLnIf(CallLinkStatusInternal::verbose, "Have CallLinkInfo with CodeOrigin = ", codeOrigin, "\n");
CallLinkStatus result;
{
ConcurrentJSLocker locker(context->optimizedCodeBlock->m_lock);
Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (286768 => 286769)
--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp 2021-12-09 08:47:07 UTC (rev 286769)
@@ -445,11 +445,11 @@
#if ENABLE(JIT)
if constexpr (decltype(bytecode)::opcodeID == op_tail_call) {
CallFrameShuffleData shuffleData = CallFrameShuffleData::createForBaselineOrLLIntTailCall(bytecode, numParameters());
- metadata.m_callLinkInfo.initializeDataIC(vm, CallLinkInfo::callTypeFor(decltype(bytecode)::opcodeID), instruction.index(), &shuffleData);
+ metadata.m_callLinkInfo.initialize(vm, CallLinkInfo::callTypeFor(decltype(bytecode)::opcodeID), instruction.index(), &shuffleData);
return;
}
#endif
- metadata.m_callLinkInfo.initializeDataIC(vm, CallLinkInfo::callTypeFor(decltype(bytecode)::opcodeID), instruction.index(), nullptr);
+ metadata.m_callLinkInfo.initialize(vm, CallLinkInfo::callTypeFor(decltype(bytecode)::opcodeID), instruction.index(), nullptr);
};
#define LINK_FIELD(__field) \
@@ -792,7 +792,7 @@
for (auto& unlinkedCallLinkInfo : jitCode->m_unlinkedCalls) {
CallLinkInfo* callLinkInfo = getCallLinkInfoForBytecodeIndex(locker, unlinkedCallLinkInfo.bytecodeIndex);
ASSERT(callLinkInfo);
- callLinkInfo->setCodeLocations({ }, unlinkedCallLinkInfo.doneLocation);
+ static_cast<BaselineCallLinkInfo*>(callLinkInfo)->setCodeLocations(unlinkedCallLinkInfo.doneLocation);
}
for (size_t i = 0; i < jitCode->m_constantPool.size(); ++i) {
@@ -1625,7 +1625,7 @@
if (JITCode::couldBeInterpreted(jitType())) {
finalizeLLIntInlineCaches();
// If the CodeBlock is DFG or FTL, CallLinkInfo in metadata is not related.
- forEachLLIntOrBaselineCallLinkInfo([&](CallLinkInfo& callLinkInfo) {
+ forEachLLIntOrBaselineCallLinkInfo([&](BaselineCallLinkInfo& callLinkInfo) {
callLinkInfo.visitWeak(vm);
});
}
@@ -1693,7 +1693,7 @@
void CodeBlock::getICStatusMap(const ConcurrentJSLocker&, ICStatusMap& result)
{
if (JITCode::couldBeInterpreted(jitType())) {
- forEachLLIntOrBaselineCallLinkInfo([&](CallLinkInfo& callLinkInfo) {
+ forEachLLIntOrBaselineCallLinkInfo([&](BaselineCallLinkInfo& callLinkInfo) {
result.add(callLinkInfo.codeOrigin(), ICStatus()).iterator->value.callLinkInfo = &callLinkInfo;
});
}
@@ -2324,7 +2324,7 @@
callLinkInfo->setClearedByJettison();
#endif
} else {
- forEachLLIntOrBaselineCallLinkInfo([&](CallLinkInfo& callLinkInfo) {
+ forEachLLIntOrBaselineCallLinkInfo([&](BaselineCallLinkInfo& callLinkInfo) {
callLinkInfo.setClearedByJettison();
});
}
Modified: trunk/Source/_javascript_Core/bytecode/GetterSetterAccessCase.h (286768 => 286769)
--- trunk/Source/_javascript_Core/bytecode/GetterSetterAccessCase.h 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/bytecode/GetterSetterAccessCase.h 2021-12-09 08:47:07 UTC (rev 286769)
@@ -44,7 +44,7 @@
// PolymorphicAccess can be destroyed while GCAwareJITStubRoutine is alive if we are destroying PolymorphicAccess
// while we are executing GCAwareJITStubRoutine. It is not possible that GetterSetterAccessCase is alive while
// GCAwareJITStubRoutine is destroyed.
- CallLinkInfo* callLinkInfo() const { return m_callLinkInfo; }
+ OptimizingCallLinkInfo* callLinkInfo() const { return m_callLinkInfo; }
JSObject* customSlotBase() const { return m_customSlotBase.get(); }
std::optional<DOMAttributeAnnotation> domAttribute() const { return m_domAttribute; }
@@ -75,7 +75,7 @@
GetterSetterAccessCase(const GetterSetterAccessCase&);
WriteBarrier<JSObject> m_customSlotBase;
- CallLinkInfo* m_callLinkInfo { nullptr };
+ OptimizingCallLinkInfo* m_callLinkInfo { nullptr };
FunctionPtr<CustomAccessorPtrTag> m_customAccessor;
std::optional<DOMAttributeAnnotation> m_domAttribute;
};
Modified: trunk/Source/_javascript_Core/bytecode/PolymorphicAccess.h (286768 => 286769)
--- trunk/Source/_javascript_Core/bytecode/PolymorphicAccess.h 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/bytecode/PolymorphicAccess.h 2021-12-09 08:47:07 UTC (rev 286769)
@@ -224,7 +224,7 @@
ECMAMode m_ecmaMode { ECMAMode::sloppy() };
std::unique_ptr<WatchpointsOnStructureStubInfo> watchpoints;
Vector<StructureID> weakStructures;
- Bag<CallLinkInfo> m_callLinkInfos;
+ Bag<OptimizingCallLinkInfo> m_callLinkInfos;
bool m_doesJSGetterSetterCalls : 1;
bool m_doesCalls : 1;
Modified: trunk/Source/_javascript_Core/bytecode/Repatch.cpp (286768 => 286769)
--- trunk/Source/_javascript_Core/bytecode/Repatch.cpp 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/bytecode/Repatch.cpp 2021-12-09 08:47:07 UTC (rev 286769)
@@ -142,7 +142,7 @@
#if ENABLE(JIT)
callLinkInfo.clearCodeBlock();
if (!callLinkInfo.clearedByJettison())
- callLinkInfo.initializeDirectCall();
+ static_cast<OptimizingCallLinkInfo&>(callLinkInfo).initializeDirectCall();
#endif
} else {
if (!callLinkInfo.clearedByJettison()) {
@@ -1550,7 +1550,7 @@
}
void linkDirectCall(
- CallFrame* callFrame, CallLinkInfo& callLinkInfo, CodeBlock* calleeCodeBlock,
+ CallFrame* callFrame, OptimizingCallLinkInfo& callLinkInfo, CodeBlock* calleeCodeBlock,
MacroAssemblerCodePtr<JSEntryPtrTag> codePtr)
{
ASSERT(!callLinkInfo.stub());
Modified: trunk/Source/_javascript_Core/bytecode/Repatch.h (286768 => 286769)
--- trunk/Source/_javascript_Core/bytecode/Repatch.h 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/bytecode/Repatch.h 2021-12-09 08:47:07 UTC (rev 286769)
@@ -32,6 +32,7 @@
namespace JSC {
class CallLinkInfo;
+class OptimizingCallLinkInfo;
class StructureStubInfo;
enum class GetByKind {
@@ -71,7 +72,7 @@
void repatchSetPrivateBrand(JSGlobalObject*, CodeBlock*, JSObject*, Structure*, CacheableIdentifier, StructureStubInfo&);
void repatchInstanceOf(JSGlobalObject*, CodeBlock*, JSValue, JSValue prototype, StructureStubInfo&, bool wasFound);
void linkMonomorphicCall(VM&, CallFrame*, CallLinkInfo&, CodeBlock*, JSObject* callee, MacroAssemblerCodePtr<JSEntryPtrTag>);
-void linkDirectCall(CallFrame*, CallLinkInfo&, CodeBlock*, MacroAssemblerCodePtr<JSEntryPtrTag>);
+void linkDirectCall(CallFrame*, OptimizingCallLinkInfo&, CodeBlock*, MacroAssemblerCodePtr<JSEntryPtrTag>);
void linkSlowFor(CallFrame*, CallLinkInfo&);
void unlinkCall(VM&, CallLinkInfo&);
void linkPolymorphicCall(JSGlobalObject*, CallFrame*, CallLinkInfo&, CallVariant);
Modified: trunk/Source/_javascript_Core/dfg/DFGCommonData.h (286768 => 286769)
--- trunk/Source/_javascript_Core/dfg/DFGCommonData.h 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/dfg/DFGCommonData.h 2021-12-09 08:47:07 UTC (rev 286769)
@@ -111,7 +111,7 @@
void clearWatchpoints();
- CallLinkInfo* addCallLinkInfo(CodeOrigin codeOrigin)
+ OptimizingCallLinkInfo* addCallLinkInfo(CodeOrigin codeOrigin)
{
return m_callLinkInfos.add(codeOrigin);
}
@@ -131,7 +131,7 @@
RecordedStatuses recordedStatuses;
Vector<JumpReplacement> m_jumpReplacements;
Bag<StructureStubInfo> m_stubInfos;
- Bag<CallLinkInfo> m_callLinkInfos;
+ Bag<OptimizingCallLinkInfo> m_callLinkInfos;
Yarr::YarrBoyerMoyerData m_boyerMooreData;
ScratchBuffer* catchOSREntryBuffer;
Modified: trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp (286768 => 286769)
--- trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp 2021-12-09 08:47:07 UTC (rev 286769)
@@ -260,7 +260,7 @@
finalizeInlineCaches(m_privateBrandAccesses, linkBuffer);
for (auto& record : m_jsCalls) {
- CallLinkInfo& info = *record.info;
+ auto& info = *record.info;
info.setCodeLocations(
linkBuffer.locationOf<JSInternalPtrTag>(record.slowPathStart),
linkBuffer.locationOf<JSInternalPtrTag>(record.doneLocation));
@@ -267,7 +267,7 @@
}
for (auto& record : m_jsDirectCalls) {
- CallLinkInfo& info = *record.info;
+ auto& info = *record.info;
info.setCodeLocations(
linkBuffer.locationOf<JSInternalPtrTag>(record.slowPath),
CodeLocationLabel<JSInternalPtrTag>());
Modified: trunk/Source/_javascript_Core/dfg/DFGJITCompiler.h (286768 => 286769)
--- trunk/Source/_javascript_Core/dfg/DFGJITCompiler.h 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCompiler.h 2021-12-09 08:47:07 UTC (rev 286769)
@@ -234,12 +234,12 @@
m_privateBrandAccesses.append(InlineCacheWrapper<JITPrivateBrandAccessGenerator>(gen, slowPath));
}
- void addJSCall(Label slowPathStart, Label doneLocation, CallLinkInfo* info)
+ void addJSCall(Label slowPathStart, Label doneLocation, OptimizingCallLinkInfo* info)
{
m_jsCalls.append(JSCallRecord(slowPathStart, doneLocation, info));
}
- void addJSDirectCall(Label slowPath, CallLinkInfo* info)
+ void addJSDirectCall(Label slowPath, OptimizingCallLinkInfo* info)
{
m_jsDirectCalls.append(JSDirectCallRecord(slowPath, info));
}
@@ -338,7 +338,7 @@
struct JSCallRecord {
- JSCallRecord(Label slowPathStart, Label doneLocation, CallLinkInfo* info)
+ JSCallRecord(Label slowPathStart, Label doneLocation, OptimizingCallLinkInfo* info)
: slowPathStart(slowPathStart)
, doneLocation(doneLocation)
, info(info)
@@ -347,11 +347,11 @@
Label slowPathStart;
Label doneLocation;
- CallLinkInfo* info;
+ OptimizingCallLinkInfo* info;
};
struct JSDirectCallRecord {
- JSDirectCallRecord(Label slowPath, CallLinkInfo* info)
+ JSDirectCallRecord(Label slowPath, OptimizingCallLinkInfo* info)
: slowPath(slowPath)
, info(info)
{
@@ -358,7 +358,7 @@
}
Label slowPath;
- CallLinkInfo* info;
+ OptimizingCallLinkInfo* info;
};
Vector<InlineCacheWrapper<JITGetByIdGenerator>, 4> m_getByIds;
Modified: trunk/Source/_javascript_Core/dfg/DFGOperations.cpp (286768 => 286769)
--- trunk/Source/_javascript_Core/dfg/DFGOperations.cpp 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/dfg/DFGOperations.cpp 2021-12-09 08:47:07 UTC (rev 286769)
@@ -3679,7 +3679,7 @@
scope.throwException(globalObject, createError(globalObject, static_cast<ErrorTypeWithExtension>(errorType), errorMessage));
}
-JSC_DEFINE_JIT_OPERATION(operationLinkDirectCall, void, (CallLinkInfo* callLinkInfo, JSFunction* callee))
+JSC_DEFINE_JIT_OPERATION(operationLinkDirectCall, void, (OptimizingCallLinkInfo* callLinkInfo, JSFunction* callee))
{
JSGlobalObject* globalObject = callee->globalObject();
VM& vm = globalObject->vm();
Modified: trunk/Source/_javascript_Core/dfg/DFGOperations.h (286768 => 286769)
--- trunk/Source/_javascript_Core/dfg/DFGOperations.h 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/dfg/DFGOperations.h 2021-12-09 08:47:07 UTC (rev 286769)
@@ -35,8 +35,9 @@
class DateInstance;
class JSBigInt;
+class JSPropertyNameEnumerator;
+class OptimizingCallLinkInfo;
struct UnlinkedStringJumpTable;
-class JSPropertyNameEnumerator;
namespace DFG {
@@ -314,7 +315,7 @@
JSC_DECLARE_JIT_OPERATION(operationNewObjectWithButterfly, JSCell*, (VM*, Structure*, Butterfly*));
JSC_DECLARE_JIT_OPERATION(operationNewObjectWithButterflyWithIndexingHeaderAndVectorLength, JSCell*, (VM*, Structure*, unsigned length, Butterfly*));
-JSC_DECLARE_JIT_OPERATION(operationLinkDirectCall, void, (CallLinkInfo*, JSFunction*));
+JSC_DECLARE_JIT_OPERATION(operationLinkDirectCall, void, (OptimizingCallLinkInfo*, JSFunction*));
JSC_DECLARE_JIT_OPERATION(operationDateGetFullYear, EncodedJSValue, (VM*, DateInstance*));
JSC_DECLARE_JIT_OPERATION(operationDateGetUTCFullYear, EncodedJSValue, (VM*, DateInstance*));
Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp (286768 => 286769)
--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp 2021-12-09 08:47:07 UTC (rev 286769)
@@ -786,7 +786,7 @@
isEmulatedTail ? *staticInlineCallFrame->getCallerSkippingTailCalls() : staticOrigin;
CallSiteIndex callSite = m_jit.recordCallSiteAndGenerateExceptionHandlingOSRExitIfNeeded(dynamicOrigin, m_stream->size());
- CallLinkInfo* info = m_jit.jitCode()->common.addCallLinkInfo(node->origin.semantic);
+ auto* info = m_jit.jitCode()->common.addCallLinkInfo(node->origin.semantic);
info->setUpCall(callType, calleePayloadGPR);
auto setResultAndResetStack = [&] () {
Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp (286768 => 286769)
--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp 2021-12-09 08:47:07 UTC (rev 286769)
@@ -890,7 +890,7 @@
m_jit.addPtr(TrustedImm32(m_jit.graph().stackPointerOffset() * sizeof(Register)), GPRInfo::callFrameRegister, JITCompiler::stackPointerRegister);
};
- CallLinkInfo* callLinkInfo = m_jit.jitCode()->common.addCallLinkInfo(m_currentNode->origin.semantic);
+ auto* callLinkInfo = m_jit.jitCode()->common.addCallLinkInfo(m_currentNode->origin.semantic);
callLinkInfo->setUpCall(callType, calleeGPR);
if (node->op() == CallEval) {
Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp (286768 => 286769)
--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp 2021-12-09 08:47:07 UTC (rev 286769)
@@ -10265,7 +10265,7 @@
CCallHelpers::TrustedImm32(callSiteIndex.bits()),
CCallHelpers::tagFor(VirtualRegister(CallFrameSlot::argumentCountIncludingThis)));
- CallLinkInfo* callLinkInfo = state->jitCode->common.addCallLinkInfo(nodeSemanticOrigin);
+ auto* callLinkInfo = state->jitCode->common.addCallLinkInfo(nodeSemanticOrigin);
callLinkInfo->setUpCall(
nodeOp == Construct ? CallLinkInfo::Construct : CallLinkInfo::Call, GPRInfo::regT0);
@@ -10399,7 +10399,7 @@
shuffleData.numParameters = jit.codeBlock()->numParameters();
shuffleData.setupCalleeSaveRegisters(jit.codeBlock());
- CallLinkInfo* callLinkInfo = state->jitCode->common.addCallLinkInfo(semanticNodeOrigin);
+ auto* callLinkInfo = state->jitCode->common.addCallLinkInfo(semanticNodeOrigin);
callLinkInfo->setUpCall(CallLinkInfo::DirectTailCall, InvalidGPRReg);
CCallHelpers::Label mainPath = jit.label();
@@ -10431,7 +10431,7 @@
return;
}
- CallLinkInfo* callLinkInfo = state->jitCode->common.addCallLinkInfo(semanticNodeOrigin);
+ auto* callLinkInfo = state->jitCode->common.addCallLinkInfo(semanticNodeOrigin);
callLinkInfo->setUpCall(
isConstruct ? CallLinkInfo::DirectConstruct : CallLinkInfo::DirectCall, InvalidGPRReg);
@@ -10559,7 +10559,7 @@
shuffleData.setupCalleeSaveRegisters(jit.codeBlock());
- CallLinkInfo* callLinkInfo = state->jitCode->common.addCallLinkInfo(codeOrigin);
+ auto* callLinkInfo = state->jitCode->common.addCallLinkInfo(codeOrigin);
callLinkInfo->setUpCall(CallLinkInfo::TailCall, GPRInfo::regT0);
auto slowPath = callLinkInfo->emitTailCallFastPath(jit, GPRInfo::regT0, scopedLambda<void()>([&]{
@@ -10764,7 +10764,7 @@
CCallHelpers::TrustedImm32(callSiteIndex.bits()),
CCallHelpers::tagFor(VirtualRegister(CallFrameSlot::argumentCountIncludingThis)));
- CallLinkInfo* callLinkInfo = state->jitCode->common.addCallLinkInfo(semanticNodeOrigin);
+ auto* callLinkInfo = state->jitCode->common.addCallLinkInfo(semanticNodeOrigin);
RegisterSet usedRegisters = RegisterSet::allRegisters();
usedRegisters.exclude(RegisterSet::volatileRegistersForJSCall());
@@ -11048,7 +11048,7 @@
CCallHelpers::TrustedImm32(callSiteIndex.bits()),
CCallHelpers::tagFor(VirtualRegister(CallFrameSlot::argumentCountIncludingThis)));
- CallLinkInfo* callLinkInfo = state->jitCode->common.addCallLinkInfo(semanticNodeOrigin);
+ auto* callLinkInfo = state->jitCode->common.addCallLinkInfo(semanticNodeOrigin);
unsigned argIndex = 1;
GPRReg calleeGPR = params[argIndex++].gpr();
@@ -11290,7 +11290,7 @@
CCallHelpers::TrustedImm32(callSiteIndex.bits()),
CCallHelpers::tagFor(VirtualRegister(CallFrameSlot::argumentCountIncludingThis)));
- CallLinkInfo* callLinkInfo = state->jitCode->common.addCallLinkInfo(semanticNodeOrigin);
+ auto* callLinkInfo = state->jitCode->common.addCallLinkInfo(semanticNodeOrigin);
callLinkInfo->setUpCall(CallLinkInfo::Call, GPRInfo::regT0);
jit.addPtr(CCallHelpers::TrustedImm32(-static_cast<ptrdiff_t>(sizeof(CallerFrameAndPC))), CCallHelpers::stackPointerRegister, GPRInfo::regT1);
Modified: trunk/Source/_javascript_Core/jit/CallFrameShuffleData.cpp (286768 => 286769)
--- trunk/Source/_javascript_Core/jit/CallFrameShuffleData.cpp 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/jit/CallFrameShuffleData.cpp 2021-12-09 08:47:07 UTC (rev 286769)
@@ -85,11 +85,6 @@
CallFrameShuffleData CallFrameShuffleData::createForBaselineOrLLIntTailCall(const OpTailCall& bytecode, unsigned numParameters)
{
-#if USE(JSVALUE64)
- constexpr JSValueRegs calleeJSR { GPRInfo::regT0 };
-#elif USE(JSVALUE32_64)
- constexpr JSValueRegs calleeJSR { GPRInfo::regT1, GPRInfo::regT0 };
-#endif
CallFrameShuffleData shuffleData;
shuffleData.numPassedArgs = bytecode.m_argc;
shuffleData.numParameters = numParameters;
@@ -105,9 +100,9 @@
DataFormatJS);
}
#if USE(JSVALUE64)
- shuffleData.callee = ValueRecovery::inGPR(calleeJSR.payloadGPR(), DataFormatJS);
+ shuffleData.callee = ValueRecovery::inGPR(BaselineCallRegisters::calleeJSR.payloadGPR(), DataFormatJS);
#elif USE(JSVALUE32_64)
- shuffleData.callee = ValueRecovery::inPair(calleeJSR.tagGPR(), calleeJSR.payloadGPR());
+ shuffleData.callee = ValueRecovery::inPair(BaselineCallRegisters::calleeJSR.tagGPR(), BaselineCallRegisters::calleeJSR.payloadGPR());
#endif
shuffleData.setupCalleeSaveRegisters(&RegisterAtOffsetList::llintBaselineCalleeSaveRegisters());
shuffleData.shrinkToFit();
Modified: trunk/Source/_javascript_Core/jit/GCAwareJITStubRoutine.cpp (286768 => 286769)
--- trunk/Source/_javascript_Core/jit/GCAwareJITStubRoutine.cpp 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/jit/GCAwareJITStubRoutine.cpp 2021-12-09 08:47:07 UTC (rev 286769)
@@ -105,7 +105,7 @@
MarkingGCAwareJITStubRoutine::MarkingGCAwareJITStubRoutine(
const MacroAssemblerCodeRef<JITStubRoutinePtrTag>& code, VM& vm, FixedVector<RefPtr<AccessCase>>&& cases, FixedVector<StructureID>&& weakStructures, const JSCell* owner,
- const Vector<JSCell*>& cells, Bag<CallLinkInfo>&& callLinkInfos)
+ const Vector<JSCell*>& cells, Bag<OptimizingCallLinkInfo>&& callLinkInfos)
: PolymorphicAccessJITStubRoutine(code, vm, WTFMove(cases), WTFMove(weakStructures))
, m_cells(cells.size())
, m_callLinkInfos(WTFMove(callLinkInfos))
@@ -135,7 +135,7 @@
}
GCAwareJITStubRoutineWithExceptionHandler::GCAwareJITStubRoutineWithExceptionHandler(
- const MacroAssemblerCodeRef<JITStubRoutinePtrTag>& code, VM& vm, FixedVector<RefPtr<AccessCase>>&& cases, FixedVector<StructureID>&& weakStructures, const JSCell* owner, const Vector<JSCell*>& cells, Bag<CallLinkInfo>&& callLinkInfos,
+ const MacroAssemblerCodeRef<JITStubRoutinePtrTag>& code, VM& vm, FixedVector<RefPtr<AccessCase>>&& cases, FixedVector<StructureID>&& weakStructures, const JSCell* owner, const Vector<JSCell*>& cells, Bag<OptimizingCallLinkInfo>&& callLinkInfos,
CodeBlock* codeBlockForExceptionHandlers, DisposableCallSiteIndex exceptionHandlerCallSiteIndex)
: MarkingGCAwareJITStubRoutine(code, vm, WTFMove(cases), WTFMove(weakStructures), owner, cells, WTFMove(callLinkInfos))
, m_codeBlockWithExceptionHandler(codeBlockForExceptionHandlers)
@@ -189,7 +189,7 @@
const JSCell* owner,
bool makesCalls,
const Vector<JSCell*>& cells,
- Bag<CallLinkInfo>&& callLinkInfos,
+ Bag<OptimizingCallLinkInfo>&& callLinkInfos,
CodeBlock* codeBlockForExceptionHandlers,
DisposableCallSiteIndex exceptionHandlerCallSiteIndex)
{
Modified: trunk/Source/_javascript_Core/jit/GCAwareJITStubRoutine.h (286768 => 286769)
--- trunk/Source/_javascript_Core/jit/GCAwareJITStubRoutine.h 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/jit/GCAwareJITStubRoutine.h 2021-12-09 08:47:07 UTC (rev 286769)
@@ -42,6 +42,7 @@
class AccessCase;
class CallLinkInfo;
class JITStubRoutineSet;
+class OptimizingCallLinkInfo;
// Use this stub routine if you know that your code might be on stack when
// either GC or other kinds of stub deletion happen. Basicaly, if your stub
@@ -124,7 +125,7 @@
using Base = PolymorphicAccessJITStubRoutine;
MarkingGCAwareJITStubRoutine(
- const MacroAssemblerCodeRef<JITStubRoutinePtrTag>&, VM&, FixedVector<RefPtr<AccessCase>>&&, FixedVector<StructureID>&&, const JSCell* owner, const Vector<JSCell*>&, Bag<CallLinkInfo>&&);
+ const MacroAssemblerCodeRef<JITStubRoutinePtrTag>&, VM&, FixedVector<RefPtr<AccessCase>>&&, FixedVector<StructureID>&&, const JSCell* owner, const Vector<JSCell*>&, Bag<OptimizingCallLinkInfo>&&);
~MarkingGCAwareJITStubRoutine() override;
protected:
@@ -134,7 +135,7 @@
private:
FixedVector<WriteBarrier<JSCell>> m_cells;
- Bag<CallLinkInfo> m_callLinkInfos;
+ Bag<OptimizingCallLinkInfo> m_callLinkInfos;
};
@@ -145,7 +146,7 @@
public:
using Base = MarkingGCAwareJITStubRoutine;
- GCAwareJITStubRoutineWithExceptionHandler(const MacroAssemblerCodeRef<JITStubRoutinePtrTag>&, VM&, FixedVector<RefPtr<AccessCase>>&&, FixedVector<StructureID>&&, const JSCell* owner, const Vector<JSCell*>&, Bag<CallLinkInfo>&&, CodeBlock*, DisposableCallSiteIndex);
+ GCAwareJITStubRoutineWithExceptionHandler(const MacroAssemblerCodeRef<JITStubRoutinePtrTag>&, VM&, FixedVector<RefPtr<AccessCase>>&&, FixedVector<StructureID>&&, const JSCell* owner, const Vector<JSCell*>&, Bag<OptimizingCallLinkInfo>&&, CodeBlock*, DisposableCallSiteIndex);
~GCAwareJITStubRoutineWithExceptionHandler() final;
void aboutToDie() final;
@@ -181,7 +182,7 @@
Ref<PolymorphicAccessJITStubRoutine> createICJITStubRoutine(
const MacroAssemblerCodeRef<JITStubRoutinePtrTag>&, FixedVector<RefPtr<AccessCase>>&& cases, FixedVector<StructureID>&& weakStructures, VM&, const JSCell* owner, bool makesCalls,
- const Vector<JSCell*>&, Bag<CallLinkInfo>&& callLinkInfos,
+ const Vector<JSCell*>&, Bag<OptimizingCallLinkInfo>&& callLinkInfos,
CodeBlock* codeBlockForExceptionHandlers, DisposableCallSiteIndex exceptionHandlingCallSiteIndex);
} // namespace JSC
Modified: trunk/Source/_javascript_Core/jit/JITCall.cpp (286768 => 286769)
--- trunk/Source/_javascript_Core/jit/JITCall.cpp 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/jit/JITCall.cpp 2021-12-09 08:47:07 UTC (rev 286769)
@@ -42,10 +42,6 @@
namespace JSC {
-namespace {
- constexpr JSValueRegs calleeJSR = JSRInfo::jsRegT10;
-}
-
void JIT::emit_op_ret(const Instruction* currentInstruction)
{
static_assert(noOverlap(returnValueJSR, callFrameRegister));
@@ -200,11 +196,11 @@
addPtr(TrustedImm32(registerOffset * sizeof(Register) + sizeof(CallerFrameAndPC)), callFrameRegister, stackPointerRegister);
- loadValue(Address(stackPointerRegister, sizeof(Register) * CallFrameSlot::callee - sizeof(CallerFrameAndPC)), calleeJSR);
+ static_assert(noOverlap(BaselineCallRegisters::calleeJSR, BaselineCallRegisters::callLinkInfoGPR, regT3));
+ loadValue(Address(stackPointerRegister, sizeof(Register) * CallFrameSlot::callee - sizeof(CallerFrameAndPC)), BaselineCallRegisters::calleeJSR);
loadGlobalObject(regT3);
- constexpr GPRReg callLinkInfoGPR = regT2;
- materializePointerIntoMetadata(bytecode, OpCallEval::Metadata::offsetOfCallLinkInfo(), callLinkInfoGPR);
- emitVirtualCallWithoutMovingGlobalObject(*m_vm, callLinkInfoGPR, CallMode::Regular);
+ materializePointerIntoMetadata(bytecode, OpCallEval::Metadata::offsetOfCallLinkInfo(), BaselineCallRegisters::callLinkInfoGPR);
+ emitVirtualCallWithoutMovingGlobalObject(*m_vm, BaselineCallRegisters::callLinkInfoGPR, CallMode::Regular);
resetSP();
}
@@ -217,12 +213,11 @@
template<>
bool JIT::compileTailCall(const OpTailCall& bytecode, UnlinkedCallLinkInfo*, unsigned callLinkInfoIndex)
{
- constexpr GPRReg callLinkInfoGPR = regT2;
- materializePointerIntoMetadata(bytecode, OpTailCall::Metadata::offsetOfCallLinkInfo(), callLinkInfoGPR);
- JumpList slowPaths = CallLinkInfo::emitTailCallDataICFastPath(*this, calleeJSR.payloadGPR(), callLinkInfoGPR, scopedLambda<void()>([&]{
+ materializePointerIntoMetadata(bytecode, OpTailCall::Metadata::offsetOfCallLinkInfo(), BaselineCallRegisters::callLinkInfoGPR);
+ JumpList slowPaths = CallLinkInfo::emitTailCallDataICFastPath(*this, BaselineCallRegisters::calleeJSR.payloadGPR(), BaselineCallRegisters::callLinkInfoGPR, scopedLambda<void()>([&] {
CallFrameShuffleData shuffleData = CallFrameShuffleData::createForBaselineOrLLIntTailCall(bytecode, m_unlinkedCodeBlock->numParameters());
CallFrameShuffler shuffler { *this, shuffleData };
- shuffler.lockGPR(callLinkInfoGPR);
+ shuffler.lockGPR(BaselineCallRegisters::callLinkInfoGPR);
shuffler.prepareForTailCall();
}));
addSlowCase(slowPaths);
@@ -267,8 +262,8 @@
uint32_t locationBits = CallSiteIndex(m_bytecodeIndex).bits();
store32(TrustedImm32(locationBits), Address(callFrameRegister, CallFrameSlot::argumentCountIncludingThis * static_cast<int>(sizeof(Register)) + TagOffset));
- emitGetVirtualRegister(callee, calleeJSR);
- storeValue(calleeJSR, Address(stackPointerRegister, CallFrameSlot::callee * static_cast<int>(sizeof(Register)) - sizeof(CallerFrameAndPC)));
+ emitGetVirtualRegister(callee, BaselineCallRegisters::calleeJSR);
+ storeValue(BaselineCallRegisters::calleeJSR, Address(stackPointerRegister, CallFrameSlot::callee * static_cast<int>(sizeof(Register)) - sizeof(CallerFrameAndPC)));
if (compileCallEval(bytecode))
return;
@@ -276,18 +271,17 @@
#if USE(JSVALUE32_64)
// We need this on JSVALUE32_64 only as on JSVALUE64 a pointer comparison in the DataIC fast
// path catches this.
- addSlowCase(branchIfNotCell(calleeJSR));
+ addSlowCase(branchIfNotCell(BaselineCallRegisters::calleeJSR));
#endif
if (compileTailCall(bytecode, info, callLinkInfoIndex))
return;
- constexpr GPRReg callLinkInfoGPR = regT2;
- materializePointerIntoMetadata(bytecode, Op::Metadata::offsetOfCallLinkInfo(), callLinkInfoGPR);
+ materializePointerIntoMetadata(bytecode, Op::Metadata::offsetOfCallLinkInfo(), BaselineCallRegisters::callLinkInfoGPR);
if (opcodeID == op_tail_call_varargs || opcodeID == op_tail_call_forward_arguments) {
- auto slowPaths = CallLinkInfo::emitTailCallDataICFastPath(*this, calleeJSR.payloadGPR(), callLinkInfoGPR, scopedLambda<void()>([&]{
+ auto slowPaths = CallLinkInfo::emitTailCallDataICFastPath(*this, BaselineCallRegisters::calleeJSR.payloadGPR(), BaselineCallRegisters::callLinkInfoGPR, scopedLambda<void()>([&] {
emitRestoreCalleeSaves();
- prepareForTailCallSlow(callLinkInfoGPR);
+ prepareForTailCallSlow(BaselineCallRegisters::callLinkInfoGPR);
}));
addSlowCase(slowPaths);
auto doneLocation = label();
@@ -295,7 +289,7 @@
return;
}
- auto slowPaths = CallLinkInfo::emitDataICFastPath(*this, calleeJSR.payloadGPR(), callLinkInfoGPR);
+ auto slowPaths = CallLinkInfo::emitDataICFastPath(*this, BaselineCallRegisters::calleeJSR.payloadGPR(), BaselineCallRegisters::callLinkInfoGPR);
auto doneLocation = label();
addSlowCase(slowPaths);
Modified: trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyCodeBlock.h (286768 => 286769)
--- trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyCodeBlock.h 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/wasm/js/JSWebAssemblyCodeBlock.h 2021-12-09 08:47:07 UTC (rev 286769)
@@ -90,7 +90,7 @@
Ref<Wasm::CodeBlock> m_codeBlock;
Vector<MacroAssemblerCodeRef<WasmEntryPtrTag>> m_wasmToJSExitStubs;
- Bag<CallLinkInfo> m_callLinkInfos;
+ Bag<OptimizingCallLinkInfo> m_callLinkInfos;
String m_errorMessage;
};
Modified: trunk/Source/_javascript_Core/wasm/js/WasmToJS.cpp (286768 => 286769)
--- trunk/Source/_javascript_Core/wasm/js/WasmToJS.cpp 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/wasm/js/WasmToJS.cpp 2021-12-09 08:47:07 UTC (rev 286769)
@@ -51,7 +51,7 @@
jit.loadPtr(JIT::Address(result, Instance::offsetOfImportFunction(importIndex)), result);
}
-Expected<MacroAssemblerCodeRef<WasmEntryPtrTag>, BindingFailure> wasmToJS(VM& vm, Bag<CallLinkInfo>& callLinkInfos, SignatureIndex signatureIndex, unsigned importIndex)
+Expected<MacroAssemblerCodeRef<WasmEntryPtrTag>, BindingFailure> wasmToJS(VM& vm, Bag<OptimizingCallLinkInfo>& callLinkInfos, SignatureIndex signatureIndex, unsigned importIndex)
{
// FIXME: This function doesn't properly abstract away the calling convention.
// It'd be super easy to do so: https://bugs.webkit.org/show_bug.cgi?id=169401
@@ -261,7 +261,7 @@
// FIXME Tail call if the wasm return type is void and no registers were spilled. https://bugs.webkit.org/show_bug.cgi?id=165488
- CallLinkInfo* callLinkInfo = callLinkInfos.add(CodeOrigin());
+ auto* callLinkInfo = callLinkInfos.add(CodeOrigin());
callLinkInfo->setUpCall(CallLinkInfo::Call, importJSCellGPRReg);
auto slowPath = callLinkInfo->emitFastPath(jit, importJSCellGPRReg, InvalidGPRReg, CallLinkInfo::UseDataIC::No);
Modified: trunk/Source/_javascript_Core/wasm/js/WasmToJS.h (286768 => 286769)
--- trunk/Source/_javascript_Core/wasm/js/WasmToJS.h 2021-12-09 08:37:59 UTC (rev 286768)
+++ trunk/Source/_javascript_Core/wasm/js/WasmToJS.h 2021-12-09 08:47:07 UTC (rev 286769)
@@ -42,7 +42,7 @@
class Instance;
-Expected<MacroAssemblerCodeRef<WasmEntryPtrTag>, BindingFailure> wasmToJS(VM&, Bag<CallLinkInfo>& callLinkInfos, SignatureIndex, unsigned importIndex);
+Expected<MacroAssemblerCodeRef<WasmEntryPtrTag>, BindingFailure> wasmToJS(VM&, Bag<OptimizingCallLinkInfo>& callLinkInfos, SignatureIndex, unsigned importIndex);
void emitThrowWasmToJSException(CCallHelpers&, GPRReg wasmInstance, Wasm::ExceptionType);