Commit 99e3760b authored by commit-queue@webkit.org's avatar commit-queue@webkit.org
Browse files

Merge arm and sh4 paths in nativeForGenerator and privateCompileCTINativeCall functions.

https://bugs.webkit.org/show_bug.cgi?id=124892

Patch by Julien Brianceau <jbriance@cisco.com> on 2013-11-29
Reviewed by Zoltan Herczeg.

* assembler/MacroAssemblerSH4.h:
(JSC::MacroAssemblerSH4::call): Pick a scratch register instead of getting it as a
parameter. The sh4 port was the only one to have this call(Address, RegisterID) prototype.
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::privateCompileCTINativeCall): Use argumentGPRx and merge arm and sh4 paths.
* jit/ThunkGenerators.cpp:
(JSC::nativeForGenerator): Use argumentGPRx and merge arm and sh4 paths.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159871 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 72af06f4
2013-11-29 Julien Brianceau <jbriance@cisco.com>
Merge arm and sh4 paths in nativeForGenerator and privateCompileCTINativeCall functions.
https://bugs.webkit.org/show_bug.cgi?id=124892
Reviewed by Zoltan Herczeg.
* assembler/MacroAssemblerSH4.h:
(JSC::MacroAssemblerSH4::call): Pick a scratch register instead of getting it as a
parameter. The sh4 port was the only one to have this call(Address, RegisterID) prototype.
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::privateCompileCTINativeCall): Use argumentGPRx and merge arm and sh4 paths.
* jit/ThunkGenerators.cpp:
(JSC::nativeForGenerator): Use argumentGPRx and merge arm and sh4 paths.
2013-11-28 Nadav Rotem <nrotem@apple.com>
Revert the X86 assembler peephole changes
......
......@@ -2360,12 +2360,14 @@ public:
return Call(m_assembler.call(target), Call::None);
}
void call(Address address, RegisterID target)
void call(Address address)
{
RegisterID target = claimScratch();
load32(address.base, address.offset, target);
m_assembler.ensureSpace(m_assembler.maxInstructionSize + 2);
m_assembler.branch(JSR_OPCODE, target);
m_assembler.nop();
releaseScratch(target);
}
void breakpoint()
......
......@@ -74,9 +74,8 @@ JIT::CodeRef JIT::privateCompileCTINativeCall(VM* vm, NativeFunction func)
addPtr(TrustedImm32(16 - sizeof(void*)), stackPointerRegister);
#elif CPU(ARM)
// Load caller frame's scope chain into this callframe so that whatever we call can
// get to its global data.
#elif CPU(ARM) || CPU(SH4)
// Load caller frame's scope chain into this callframe so that whatever we call can get to its global data.
emitGetCallerFrameFromCallFrameHeaderPtr(regT2);
emitGetFromCallFrameHeaderPtr(JSStack::ScopeChain, regT1, regT2);
emitPutCellToCallFrameHeader(regT1, JSStack::ScopeChain);
......@@ -84,19 +83,18 @@ JIT::CodeRef JIT::privateCompileCTINativeCall(VM* vm, NativeFunction func)
preserveReturnAddressAfterCall(regT3); // Callee preserved
emitPutReturnPCToCallFrameHeader(regT3);
// Calling convention: f(r0 == regT0, r1 == regT1, ...);
// Host function signature: f(ExecState*);
move(callFrameRegister, ARMRegisters::r0);
// Calling convention is f(argumentGPR0, argumentGPR1, ...).
// Host function signature is f(ExecState*).
move(callFrameRegister, argumentGPR0);
emitGetFromCallFrameHeaderPtr(JSStack::Callee, ARMRegisters::r1);
emitGetFromCallFrameHeaderPtr(JSStack::Callee, argumentGPR1);
move(regT2, callFrameRegister); // Eagerly restore caller frame register to avoid loading from stack.
loadPtr(Address(ARMRegisters::r1, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
loadPtr(Address(argumentGPR1, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
// call the function
nativeCall = call();
restoreReturnAddressBeforeReturn(regT3);
#elif CPU(MIPS)
// Load caller frame's scope chain into this callframe so that whatever we call can
// get to its global data.
......@@ -128,28 +126,6 @@ JIT::CodeRef JIT::privateCompileCTINativeCall(VM* vm, NativeFunction func)
// Restore stack space
addPtr(TrustedImm32(16), stackPointerRegister);
restoreReturnAddressBeforeReturn(regT3);
#elif CPU(SH4)
// Load caller frame's scope chain into this callframe so that whatever we call can
// get to its global data.
emitGetCallerFrameFromCallFrameHeaderPtr(regT2);
emitGetFromCallFrameHeaderPtr(JSStack::ScopeChain, regT1, regT2);
emitPutCellToCallFrameHeader(regT1, JSStack::ScopeChain);
preserveReturnAddressAfterCall(regT3); // Callee preserved
emitPutReturnPCToCallFrameHeader(regT3);
// Calling convention: f(r0 == regT4, r1 == regT5, ...);
// Host function signature: f(ExecState*);
move(callFrameRegister, regT4);
emitGetFromCallFrameHeaderPtr(JSStack::Callee, regT5);
move(regT2, callFrameRegister); // Eagerly restore caller frame register to avoid loading from stack.
loadPtr(Address(regT5, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
// call the function
nativeCall = call();
restoreReturnAddressBeforeReturn(regT3);
#else
#error "JIT not supported on this platform."
......
......@@ -343,9 +343,8 @@ static MacroAssemblerCodeRef nativeForGenerator(VM* vm, CodeSpecializationKind k
jit.restoreReturnAddressBeforeReturn(JSInterfaceJIT::regT3);
#elif CPU(ARM)
// Load caller frame's scope chain into this callframe so that whatever we call can
// get to its global data.
#elif CPU(ARM) || CPU(SH4)
// Load caller frame's scope chain into this callframe so that whatever we call can get to its global data.
jit.emitGetCallerFrameFromCallFrameHeaderPtr(JSInterfaceJIT::regT2);
jit.emitGetFromCallFrameHeaderPtr(JSStack::ScopeChain, JSInterfaceJIT::regT1, JSInterfaceJIT::regT2);
jit.emitPutCellToCallFrameHeader(JSInterfaceJIT::regT1, JSStack::ScopeChain);
......@@ -353,38 +352,16 @@ static MacroAssemblerCodeRef nativeForGenerator(VM* vm, CodeSpecializationKind k
jit.preserveReturnAddressAfterCall(JSInterfaceJIT::regT3); // Callee preserved
jit.emitPutReturnPCToCallFrameHeader(JSInterfaceJIT::regT3);
// Calling convention: f(r0 == regT0, r1 == regT1, ...);
// Host function signature: f(ExecState*);
jit.move(JSInterfaceJIT::callFrameRegister, ARMRegisters::r0);
// Calling convention is f(argumentGPR0, argumentGPR1, ...).
// Host function signature is f(ExecState*).
jit.move(JSInterfaceJIT::callFrameRegister, JSInterfaceJIT::argumentGPR0);
jit.emitGetFromCallFrameHeaderPtr(JSStack::Callee, ARMRegisters::r1);
jit.emitGetFromCallFrameHeaderPtr(JSStack::Callee, JSInterfaceJIT::argumentGPR1);
jit.move(JSInterfaceJIT::regT2, JSInterfaceJIT::callFrameRegister); // Eagerly restore caller frame register to avoid loading from stack.
jit.loadPtr(JSInterfaceJIT::Address(ARMRegisters::r1, JSFunction::offsetOfExecutable()), JSInterfaceJIT::regT2);
jit.loadPtr(JSInterfaceJIT::Address(JSInterfaceJIT::argumentGPR1, JSFunction::offsetOfExecutable()), JSInterfaceJIT::regT2);
jit.call(JSInterfaceJIT::Address(JSInterfaceJIT::regT2, executableOffsetToFunction));
jit.restoreReturnAddressBeforeReturn(JSInterfaceJIT::regT3);
#elif CPU(SH4)
// Load caller frame's scope chain into this callframe so that whatever we call can
// get to its global data.
jit.emitGetCallerFrameFromCallFrameHeaderPtr(JSInterfaceJIT::regT2);
jit.emitGetFromCallFrameHeaderPtr(JSStack::ScopeChain, JSInterfaceJIT::regT1, JSInterfaceJIT::regT2);
jit.emitPutCellToCallFrameHeader(JSInterfaceJIT::regT1, JSStack::ScopeChain);
jit.preserveReturnAddressAfterCall(JSInterfaceJIT::regT3); // Callee preserved
jit.emitPutReturnPCToCallFrameHeader(JSInterfaceJIT::regT3);
// Calling convention: f(r0 == regT4, r1 == regT5, ...);
// Host function signature: f(ExecState*);
jit.move(JSInterfaceJIT::callFrameRegister, JSInterfaceJIT::regT4);
jit.emitGetFromCallFrameHeaderPtr(JSStack::Callee, JSInterfaceJIT::regT5);
jit.move(JSInterfaceJIT::regT2, JSInterfaceJIT::callFrameRegister); // Eagerly restore caller frame register to avoid loading from stack.
jit.loadPtr(JSInterfaceJIT::Address(JSInterfaceJIT::regT5, JSFunction::offsetOfExecutable()), JSInterfaceJIT::regT2);
jit.call(JSInterfaceJIT::Address(JSInterfaceJIT::regT2, executableOffsetToFunction), JSInterfaceJIT::regT0);
jit.restoreReturnAddressBeforeReturn(JSInterfaceJIT::regT3);
#elif CPU(MIPS)
// Load caller frame's scope chain into this callframe so that whatever we call can
// get to its global data.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment