Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (231159 => 231160)
--- trunk/Source/_javascript_Core/ChangeLog 2018-04-30 17:51:51 UTC (rev 231159)
+++ trunk/Source/_javascript_Core/ChangeLog 2018-04-30 18:02:08 UTC (rev 231160)
@@ -1,5 +1,25 @@
2018-04-30 Yusuke Suzuki <utatane....@gmail.com>
+ [JSC] Remove arity fixup check if the number of parameters is 1
+ https://bugs.webkit.org/show_bug.cgi?id=183984
+
+ Reviewed by Mark Lam.
+
+ If the number of parameters is one (|this|), we never hit arity fixup check.
+ We do not need to emit arity fixup check code.
+
+ * dfg/DFGDriver.cpp:
+ (JSC::DFG::compileImpl):
+ * dfg/DFGJITCompiler.cpp:
+ (JSC::DFG::JITCompiler::compileFunction):
+ * dfg/DFGJITCompiler.h:
+ * ftl/FTLLink.cpp:
+ (JSC::FTL::link):
+ * jit/JIT.cpp:
+ (JSC::JIT::compileWithoutLinking):
+
+2018-04-30 Yusuke Suzuki <utatane....@gmail.com>
+
Use WordLock instead of std::mutex for Threading
https://bugs.webkit.org/show_bug.cgi?id=185121
Modified: trunk/Source/_javascript_Core/dfg/DFGDriver.cpp (231159 => 231160)
--- trunk/Source/_javascript_Core/dfg/DFGDriver.cpp 2018-04-30 17:51:51 UTC (rev 231159)
+++ trunk/Source/_javascript_Core/dfg/DFGDriver.cpp 2018-04-30 18:02:08 UTC (rev 231160)
@@ -89,6 +89,7 @@
// Make sure that any stubs that the DFG is going to use are initialized. We want to
// make sure that all JIT code generation does finalization on the main thread.
+ vm.getCTIStub(arityFixupGenerator);
vm.getCTIStub(osrExitThunkGenerator);
vm.getCTIStub(osrExitGenerationThunkGenerator);
vm.getCTIStub(throwExceptionFromCallSlowPathGenerator);
Modified: trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp (231159 => 231160)
--- trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp 2018-04-30 17:51:51 UTC (rev 231159)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp 2018-04-30 18:02:08 UTC (rev 231160)
@@ -446,6 +446,7 @@
makeCatchOSREntryBuffer();
setStartOfCode();
+ Label entryLabel(this);
compileEntry();
// === Function header code generation ===
@@ -492,22 +493,28 @@
// determine the correct number of arguments have been passed, or have already checked).
// In cases where an arity check is necessary, we enter here.
// FIXME: change this from a cti call to a DFG style operation (normal C calling conventions).
- m_arityCheck = label();
- compileEntry();
+ Call callArityFixup;
+ Label arityCheck;
+ bool requiresArityFixup = m_codeBlock->numParameters() != 1;
+ if (requiresArityFixup) {
+ arityCheck = label();
+ compileEntry();
- load32(AssemblyHelpers::payloadFor((VirtualRegister)CallFrameSlot::argumentCount), GPRInfo::regT1);
- branch32(AboveOrEqual, GPRInfo::regT1, TrustedImm32(m_codeBlock->numParameters())).linkTo(fromArityCheck, this);
- emitStoreCodeOrigin(CodeOrigin(0));
- if (maxFrameExtentForSlowPathCall)
- addPtr(TrustedImm32(-maxFrameExtentForSlowPathCall), stackPointerRegister);
- m_speculative->callOperationWithCallFrameRollbackOnException(m_codeBlock->m_isConstructor ? operationConstructArityCheck : operationCallArityCheck, GPRInfo::regT0);
- if (maxFrameExtentForSlowPathCall)
- addPtr(TrustedImm32(maxFrameExtentForSlowPathCall), stackPointerRegister);
- branchTest32(Zero, GPRInfo::returnValueGPR).linkTo(fromArityCheck, this);
- emitStoreCodeOrigin(CodeOrigin(0));
- move(GPRInfo::returnValueGPR, GPRInfo::argumentGPR0);
- Call callArityFixup = nearCall();
- jump(fromArityCheck);
+ load32(AssemblyHelpers::payloadFor((VirtualRegister)CallFrameSlot::argumentCount), GPRInfo::regT1);
+ branch32(AboveOrEqual, GPRInfo::regT1, TrustedImm32(m_codeBlock->numParameters())).linkTo(fromArityCheck, this);
+ emitStoreCodeOrigin(CodeOrigin(0));
+ if (maxFrameExtentForSlowPathCall)
+ addPtr(TrustedImm32(-maxFrameExtentForSlowPathCall), stackPointerRegister);
+ m_speculative->callOperationWithCallFrameRollbackOnException(m_codeBlock->m_isConstructor ? operationConstructArityCheck : operationCallArityCheck, GPRInfo::regT0);
+ if (maxFrameExtentForSlowPathCall)
+ addPtr(TrustedImm32(maxFrameExtentForSlowPathCall), stackPointerRegister);
+ branchTest32(Zero, GPRInfo::returnValueGPR).linkTo(fromArityCheck, this);
+ emitStoreCodeOrigin(CodeOrigin(0));
+ move(GPRInfo::returnValueGPR, GPRInfo::argumentGPR0);
+ callArityFixup = nearCall();
+ jump(fromArityCheck);
+ } else
+ arityCheck = entryLabel;
// Generate slow path code.
m_speculative->runSlowPathGenerators(m_pcToCodeOriginMapBuilder);
@@ -532,11 +539,12 @@
m_jitCode->shrinkToFit();
codeBlock()->shrinkToFit(CodeBlock::LateShrink);
- linkBuffer->link(callArityFixup, FunctionPtr<JITThunkPtrTag>(vm()->getCTIStub(arityFixupGenerator).code()));
+ if (requiresArityFixup)
+ linkBuffer->link(callArityFixup, FunctionPtr<JITThunkPtrTag>(vm()->getCTIStub(arityFixupGenerator).code()));
disassemble(*linkBuffer);
- MacroAssemblerCodePtr<JSEntryPtrTag> withArityCheck = linkBuffer->locationOf<JSEntryPtrTag>(m_arityCheck);
+ MacroAssemblerCodePtr<JSEntryPtrTag> withArityCheck = linkBuffer->locationOf<JSEntryPtrTag>(arityCheck);
m_graph.m_plan.finalizer = std::make_unique<JITFinalizer>(
m_graph.m_plan, m_jitCode.releaseNonNull(), WTFMove(linkBuffer), withArityCheck);
Modified: trunk/Source/_javascript_Core/dfg/DFGJITCompiler.h (231159 => 231160)
--- trunk/Source/_javascript_Core/dfg/DFGJITCompiler.h 2018-04-30 17:51:51 UTC (rev 231159)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCompiler.h 2018-04-30 18:02:08 UTC (rev 231160)
@@ -368,7 +368,6 @@
};
Vector<ExceptionHandlingOSRExitInfo> m_exceptionHandlerOSRExitCallSites;
- Label m_arityCheck;
std::unique_ptr<SpeculativeJIT> m_speculative;
PCToCodeOriginMapBuilder m_pcToCodeOriginMapBuilder;
};
Modified: trunk/Source/_javascript_Core/ftl/FTLLink.cpp (231159 => 231160)
--- trunk/Source/_javascript_Core/ftl/FTLLink.cpp 2018-04-30 17:51:51 UTC (rev 231159)
+++ trunk/Source/_javascript_Core/ftl/FTLLink.cpp 2018-04-30 18:02:08 UTC (rev 231160)
@@ -128,7 +128,8 @@
switch (graph.m_plan.mode) {
case FTLMode: {
- if (codeBlock->codeType() == FunctionCode) {
+ bool requiresArityFixup = codeBlock->numParameters() != 1;
+ if (codeBlock->codeType() == FunctionCode && requiresArityFixup) {
CCallHelpers::JumpList mainPathJumps;
jit.load32(
Modified: trunk/Source/_javascript_Core/jit/JIT.cpp (231159 => 231160)
--- trunk/Source/_javascript_Core/jit/JIT.cpp 2018-04-30 17:51:51 UTC (rev 231159)
+++ trunk/Source/_javascript_Core/jit/JIT.cpp 2018-04-30 18:02:08 UTC (rev 231160)
@@ -720,7 +720,9 @@
addPtr(TrustedImm32(-maxFrameExtentForSlowPathCall), stackPointerRegister);
callOperationWithCallFrameRollbackOnException(operationThrowStackOverflowError, m_codeBlock);
- if (m_codeBlock->codeType() == FunctionCode) {
+ // If the number of parameters is 1, we never require arity fixup.
+ bool requiresArityFixup = m_codeBlock->m_numParameters != 1;
+ if (m_codeBlock->codeType() == FunctionCode && requiresArityFixup) {
m_arityCheck = label();
store8(TrustedImm32(0), &m_codeBlock->m_shouldAlwaysBeInlined);
emitFunctionPrologue();
@@ -746,7 +748,7 @@
jump(beginLabel);
} else
- m_arityCheck = entryLabel; // Not a function.
+ m_arityCheck = entryLabel; // Never require arity fixup.
ASSERT(m_jmpTable.isEmpty());