From 6d17e93756e872eb2c3a3ddbccb80ad94c5bbed9 Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Thu, 4 Jan 2024 22:54:14 +0000 Subject: [PATCH] Bug 1871089 - Load ICStub from the frame instead of storing it separately. r=iain Differential Revision: https://phabricator.services.mozilla.com/D197608 --- js/src/jit/BaselineCacheIRCompiler.cpp | 3 ++- js/src/jit/JitScript.cpp | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/js/src/jit/BaselineCacheIRCompiler.cpp b/js/src/jit/BaselineCacheIRCompiler.cpp index 27f36af4f3e7..2b98ed0801bc 100644 --- a/js/src/jit/BaselineCacheIRCompiler.cpp +++ b/js/src/jit/BaselineCacheIRCompiler.cpp @@ -3386,7 +3386,6 @@ void BaselineCacheIRCompiler::createThis(Register argcReg, Register calleeReg, // Save live registers that don't have to be traced. LiveGeneralRegisterSet liveNonGCRegs; liveNonGCRegs.add(argcReg); - liveNonGCRegs.add(ICStubReg); masm.PushRegsInMask(liveNonGCRegs); // CreateThis takes two arguments: callee, and newTarget. @@ -3423,6 +3422,8 @@ void BaselineCacheIRCompiler::createThis(Register argcReg, Register calleeReg, // Restore saved registers. masm.PopRegsInMask(liveNonGCRegs); + Address stubAddr(FramePointer, BaselineStubFrameLayout::ICStubOffsetFromFP); + masm.loadPtr(stubAddr, ICStubReg); // Save |this| value back into pushed arguments on stack. MOZ_ASSERT(!liveNonGCRegs.aliases(JSReturnOperand)); diff --git a/js/src/jit/JitScript.cpp b/js/src/jit/JitScript.cpp index a9b3c1e290fb..f2f6ee2c25c3 100644 --- a/js/src/jit/JitScript.cpp +++ b/js/src/jit/JitScript.cpp @@ -717,6 +717,16 @@ static void MarkActiveICScriptsAndCopyStubs( ICCacheIRStub* stub = layout->maybeStubPtr()->toCacheIRStub(); ICCacheIRStub* newStub = stub->clone(cx->runtime(), newStubSpace); layout->setStubPtr(newStub); + + JSJitFrameIter parentFrame(frame); + ++parentFrame; + BaselineFrame* blFrame = parentFrame.baselineFrame(); + jsbytecode* pc; + parentFrame.baselineScriptAndPc(nullptr, &pc); + uint32_t pcOffset = blFrame->script()->pcToOffset(pc); + if (blFrame->icScript()->hasInlinedChild(pcOffset)) { + blFrame->icScript()->findInlinedChild(pcOffset)->setActive(); + } } break; }