Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (223812 => 223813)
--- trunk/Source/_javascript_Core/ChangeLog 2017-10-21 14:11:44 UTC (rev 223812)
+++ trunk/Source/_javascript_Core/ChangeLog 2017-10-21 15:34:58 UTC (rev 223813)
@@ -1,3 +1,26 @@
+2017-10-21 Yusuke Suzuki <[email protected]>
+
+ [JSC] Remove per-host-function CTI stub in 32bit environment
+ https://bugs.webkit.org/show_bug.cgi?id=178581
+
+ Reviewed by Saam Barati.
+
+ JIT::privateCompileCTINativeCall only exists in 32bit environment and it is almost the same to native call CTI stub.
+ The only difference is that it embed the address of the host function directly in the generated stub. This means
+ that we have per-host-function CTI stub only in 32bit environment.
+
+ This patch just removes it and use one CTI stub instead. This design is the same to the current 64bit implementation.
+
+ * jit/JIT.cpp:
+ (JSC::JIT::compileCTINativeCall): Deleted.
+ * jit/JIT.h:
+ * jit/JITOpcodes.cpp:
+ (JSC::JIT::privateCompileCTINativeCall): Deleted.
+ * jit/JITOpcodes32_64.cpp:
+ (JSC::JIT::privateCompileCTINativeCall): Deleted.
+ * jit/JITThunks.cpp:
+ (JSC::JITThunks::hostFunctionStub):
+
2017-10-20 Antoine Quint <[email protected]>
[Web Animations] Provide basic timeline and animation interfaces
Modified: trunk/Source/_javascript_Core/jit/JIT.cpp (223812 => 223813)
--- trunk/Source/_javascript_Core/jit/JIT.cpp 2017-10-21 14:11:44 UTC (rev 223812)
+++ trunk/Source/_javascript_Core/jit/JIT.cpp 2017-10-21 15:34:58 UTC (rev 223813)
@@ -71,14 +71,6 @@
newCalleeFunction);
}
-JIT::CodeRef JIT::compileCTINativeCall(VM* vm, NativeFunction func)
-{
- if (!vm->canUseJIT())
- return CodeRef::createLLIntCodeRef(llint_native_call_trampoline);
- JIT jit(vm, 0);
- return jit.privateCompileCTINativeCall(vm, func);
-}
-
JIT::JIT(VM* vm, CodeBlock* codeBlock, unsigned loopOSREntryBytecodeOffset)
: JSInterfaceJIT(vm, codeBlock)
, m_interpreter(vm->interpreter)
Modified: trunk/Source/_javascript_Core/jit/JIT.h (223812 => 223813)
--- trunk/Source/_javascript_Core/jit/JIT.h 2017-10-21 14:11:44 UTC (rev 223812)
+++ trunk/Source/_javascript_Core/jit/JIT.h 2017-10-21 15:34:58 UTC (rev 223813)
@@ -245,8 +245,6 @@
jit.privateCompileHasIndexedProperty(byValInfo, returnAddress, arrayMode);
}
- static CodeRef compileCTINativeCall(VM*, NativeFunction);
-
static unsigned frameRegisterCountFor(CodeBlock*);
static int stackPointerOffsetFor(CodeBlock*);
@@ -265,8 +263,6 @@
void privateCompileHasIndexedProperty(ByValInfo*, ReturnAddressPtr, JITArrayMode);
- Label privateCompileCTINativeCall(VM*, bool isConstruct = false);
- CodeRef privateCompileCTINativeCall(VM*, NativeFunction);
void privateCompilePatchGetArrayLength(ReturnAddressPtr returnAddress);
// Add a call out from JIT code, without an exception check.
Modified: trunk/Source/_javascript_Core/jit/JITOpcodes.cpp (223812 => 223813)
--- trunk/Source/_javascript_Core/jit/JITOpcodes.cpp 2017-10-21 14:11:44 UTC (rev 223812)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes.cpp 2017-10-21 15:34:58 UTC (rev 223813)
@@ -51,11 +51,6 @@
#if USE(JSVALUE64)
-JIT::CodeRef JIT::privateCompileCTINativeCall(VM* vm, NativeFunction)
-{
- return vm->getCTIStub(nativeCallGenerator);
-}
-
void JIT::emit_op_mov(Instruction* currentInstruction)
{
int dst = currentInstruction[1].u.operand;
Modified: trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp (223812 => 223813)
--- trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp 2017-10-21 14:11:44 UTC (rev 223812)
+++ trunk/Source/_javascript_Core/jit/JITOpcodes32_64.cpp 2017-10-21 15:34:58 UTC (rev 223813)
@@ -47,92 +47,6 @@
namespace JSC {
-JIT::CodeRef JIT::privateCompileCTINativeCall(VM* vm, NativeFunction func)
-{
- // FIXME: This should be able to log ShadowChicken prologue packets.
- // https://bugs.webkit.org/show_bug.cgi?id=155689
-
- Call nativeCall;
-
- emitFunctionPrologue();
- emitPutToCallFrameHeader(0, CallFrameSlot::codeBlock);
- storePtr(callFrameRegister, &vm->topCallFrame);
-
-#if CPU(X86)
- // Calling convention: f(ecx, edx, ...);
- // Host function signature: f(ExecState*);
- move(callFrameRegister, X86Registers::ecx);
-
- subPtr(TrustedImm32(8), stackPointerRegister); // Align stack for call.
- storePtr(X86Registers::ecx, Address(stackPointerRegister));
-
- // call the function
- nativeCall = call();
-
- addPtr(TrustedImm32(8), stackPointerRegister);
-
-#elif CPU(ARM) || CPU(MIPS)
-#if CPU(MIPS)
- // Allocate stack space for (unused) 16 bytes (8-byte aligned) for 4 arguments.
- subPtr(TrustedImm32(16), stackPointerRegister);
-#endif
-
- // Calling convention is f(argumentGPR0, argumentGPR1, ...).
- // Host function signature is f(ExecState*).
- move(callFrameRegister, argumentGPR0);
-
- emitGetFromCallFrameHeaderPtr(CallFrameSlot::callee, argumentGPR1);
- loadPtr(Address(argumentGPR1, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2);
-
- // call the function
- nativeCall = call();
-
-#if CPU(MIPS)
- // Restore stack space
- addPtr(TrustedImm32(16), stackPointerRegister);
-#endif
-
- restoreReturnAddressBeforeReturn(regT3);
-#else
-#error "JIT not supported on this platform."
- abortWithReason(JITNotSupported);
-#endif // CPU(X86)
-
- // Check for an exception
- Jump sawException = branch32(NotEqual, AbsoluteAddress(vm->addressOfException()), TrustedImm32(0));
-
- emitFunctionEpilogue();
- // Return.
- ret();
-
- // Handle an exception
- sawException.link(this);
-
- storePtr(callFrameRegister, &vm->topCallFrame);
-
-#if CPU(X86)
- addPtr(TrustedImm32(-4), stackPointerRegister);
- move(callFrameRegister, X86Registers::ecx);
- push(X86Registers::ecx);
-#else
- move(callFrameRegister, argumentGPR0);
-#endif
- move(TrustedImmPtr(FunctionPtr(operationVMHandleException).value()), regT3);
- call(regT3);
-
-#if CPU(X86)
- addPtr(TrustedImm32(8), stackPointerRegister);
-#endif
-
- jumpToExceptionHandler(*vm);
-
- // All trampolines constructed! copy the code, link up calls, and set the pointers on the Machine object.
- LinkBuffer patchBuffer(*this, GLOBAL_THUNK_ID);
-
- patchBuffer.link(nativeCall, FunctionPtr(func));
- return FINALIZE_CODE(patchBuffer, ("JIT CTI native call"));
-}
-
void JIT::emit_op_mov(Instruction* currentInstruction)
{
int dst = currentInstruction[1].u.operand;
Modified: trunk/Source/_javascript_Core/jit/JITThunks.cpp (223812 => 223813)
--- trunk/Source/_javascript_Core/jit/JITThunks.cpp 2017-10-21 14:11:44 UTC (rev 223812)
+++ trunk/Source/_javascript_Core/jit/JITThunks.cpp 2017-10-21 15:34:58 UTC (rev 223813)
@@ -116,7 +116,7 @@
MacroAssemblerCodeRef entry = generator(vm);
forCall = adoptRef(new DirectJITCode(entry, entry.code(), JITCode::HostCallThunk));
} else
- forCall = adoptRef(new NativeJITCode(JIT::compileCTINativeCall(vm, function), JITCode::HostCallThunk));
+ forCall = adoptRef(new NativeJITCode(MacroAssemblerCodeRef::createSelfManagedCodeRef(ctiNativeCall(vm)), JITCode::HostCallThunk));
Ref<JITCode> forConstruct = adoptRef(*new NativeJITCode(MacroAssemblerCodeRef::createSelfManagedCodeRef(ctiNativeConstruct(vm)), JITCode::HostCallThunk));