Skip to content
Permalink
Browse files
Unskip JSTests/stress/shadow-realm-import-value.js on ARMv7 and MIPS
https://bugs.webkit.org/show_bug.cgi?id=240662

        Reviewed by Yusuke Suzuki.

        Fix tag and payload being swapped in the resultRegs object.

        Also updated some places that can use JSRInfo::returnValueJSR instead
        of manually writing the GPR order.

        Patch by Geza Lore and Mikhail R. Gadelha.

        * jit/ThunkGenerators.cpp:
        (JSC::boundFunctionCallGenerator):
        (JSC::remoteFunctionCallGenerator):

Canonical link: https://commits.webkit.org/250866@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294642 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
mikhailramalho committed May 23, 2022
1 parent 5fc04f5 commit 42295d788c65d128b2f6cf1aee44ff7437e5117d
Showing 4 changed files with 9 additions and 22 deletions.
@@ -1,4 +1,3 @@
//@ skip if ["mips", "arm"].include?($architecture)
//@ requireOptions("--useShadowRealm=1")

var abort = $vm.abort;
@@ -2150,11 +2150,9 @@ void SpeculativeJIT::compileLoopHint(Node* node)
}

m_jit.popToRestore(GPRInfo::regT0);
#if USE(JSVALUE64)
JSValueRegs resultRegs(GPRInfo::returnValueGPR);
#else
JSValueRegs resultRegs(GPRInfo::returnValueGPR2, GPRInfo::returnValueGPR);
#endif

constexpr JSValueRegs resultRegs = JSRInfo::returnValueJSR;

m_jit.moveValue(baselineCodeBlock->globalObject(), resultRegs);
m_jit.emitRestoreCalleeSaves();
m_jit.emitFunctionEpilogue();
@@ -1296,9 +1296,8 @@ MacroAssemblerCodeRef<JITThunkPtrTag> boundFunctionCallGenerator(VM& vm)
jit.storePtr(CCallHelpers::TrustedImmPtr(nullptr), CCallHelpers::addressFor(CallFrameSlot::codeBlock));
jit.store32(CCallHelpers::TrustedImm32(0), CCallHelpers::tagFor(CallFrameSlot::argumentCountIncludingThis));
unsigned extraStackNeeded = 0;
if (unsigned stackMisalignment = sizeof(CallerFrameAndPC) % stackAlignmentBytes())
extraStackNeeded = stackAlignmentBytes() - stackMisalignment;
constexpr unsigned stackMisalignment = sizeof(CallerFrameAndPC) % stackAlignmentBytes();
constexpr unsigned extraStackNeeded = stackMisalignment ? stackAlignmentBytes() - stackMisalignment : 0;
// We need to forward all of the arguments that we were passed. We aren't allowed to do a tail
// call here as far as I can tell. At least not so long as the generic path doesn't do a tail
@@ -1430,9 +1429,8 @@ MacroAssemblerCodeRef<JITThunkPtrTag> remoteFunctionCallGenerator(VM& vm)
jit.storePtr(CCallHelpers::TrustedImmPtr(nullptr), CCallHelpers::addressFor(CallFrameSlot::codeBlock));
jit.store32(CCallHelpers::TrustedImm32(0), CCallHelpers::tagFor(CallFrameSlot::argumentCountIncludingThis));
unsigned extraStackNeeded = 0;
if (unsigned stackMisalignment = sizeof(CallerFrameAndPC) % stackAlignmentBytes())
extraStackNeeded = stackAlignmentBytes() - stackMisalignment;
constexpr unsigned stackMisalignment = sizeof(CallerFrameAndPC) % stackAlignmentBytes();
constexpr unsigned extraStackNeeded = stackMisalignment ? stackAlignmentBytes() - stackMisalignment : 0;
// We need to forward all of the arguments that we were passed. We aren't allowed to do a tail
// call here as far as I can tell. At least not so long as the generic path doesn't do a tail
@@ -1593,11 +1591,7 @@ MacroAssemblerCodeRef<JITThunkPtrTag> remoteFunctionCallGenerator(VM& vm)
jit.call(GPRInfo::regT2, JSEntryPtrTag);
// Wrap return value
#if USE(JSVALUE64)
JSValueRegs resultRegs(GPRInfo::returnValueGPR);
#else
JSValueRegs resultRegs(GPRInfo::returnValueGPR, GPRInfo::returnValueGPR2);
#endif
constexpr JSValueRegs resultRegs = JSRInfo::returnValueJSR;
CCallHelpers::JumpList resultIsPrimitive;
resultIsPrimitive.append(jit.branchIfNotCell(resultRegs));
@@ -232,11 +232,7 @@ MacroAssemblerCodeRef<JSEntryPtrTag> getHostCallReturnValueThunk()
jit.loadPtr(CCallHelpers::Address(GPRInfo::regT0, PreciseAllocation::offsetOfWeakSet() + WeakSet::offsetOfVM() - PreciseAllocation::headerSize()), GPRInfo::regT0);

loadedCase.link(&jit);
#if USE(JSVALUE64)
jit.loadValue(CCallHelpers::Address(GPRInfo::regT0, VM::offsetOfEncodedHostCallReturnValue()), JSValueRegs { GPRInfo::returnValueGPR });
#else
jit.loadValue(CCallHelpers::Address(GPRInfo::regT0, VM::offsetOfEncodedHostCallReturnValue()), JSValueRegs { GPRInfo::returnValueGPR2, GPRInfo::returnValueGPR });
#endif
jit.loadValue(CCallHelpers::Address(GPRInfo::regT0, VM::offsetOfEncodedHostCallReturnValue()), JSRInfo::returnValueJSR);
jit.emitFunctionEpilogue();
jit.ret();

0 comments on commit 42295d7

Please sign in to comment.