Commit 62242ce4 authored by oliver@apple.com's avatar oliver@apple.com

fourthTier: FTL should better report its compile-times and it should be able...

fourthTier: FTL should better report its compile-times and it should be able to run in a mode where it doesn't spend time generating OSR exits
https://bugs.webkit.org/show_bug.cgi?id=118401

Reviewed by Sam Weinig.

Add two new OSR exit modes, which are useful only for playing with compile times:

- All OSR exits are llvm.trap().

- OSR exits don't take arguments and have no exit value marshaling.

* dfg/DFGPlan.cpp:
(JSC::DFG::Plan::compileInThread):
(JSC::DFG::Plan::compileInThreadImpl):
* dfg/DFGPlan.h:
(Plan):
* ftl/FTLIntrinsicRepository.h:
(FTL):
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::appendOSRExit):
(LowerDFGToLLVM):
(JSC::FTL::LowerDFGToLLVM::emitOSRExitCall):
* ftl/FTLOutput.h:
(JSC::FTL::Output::trap):
* runtime/Options.h:
(JSC):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153268 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 426f5b02
2013-07-04 Filip Pizlo <fpizlo@apple.com>
fourthTier: FTL should better report its compile-times and it should be able to run in a mode where it doesn't spend time generating OSR exits
https://bugs.webkit.org/show_bug.cgi?id=118401
Reviewed by Sam Weinig.
Add two new OSR exit modes, which are useful only for playing with compile times:
- All OSR exits are llvm.trap().
- OSR exits don't take arguments and have no exit value marshaling.
* dfg/DFGPlan.cpp:
(JSC::DFG::Plan::compileInThread):
(JSC::DFG::Plan::compileInThreadImpl):
* dfg/DFGPlan.h:
(Plan):
* ftl/FTLIntrinsicRepository.h:
(FTL):
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::appendOSRExit):
(LowerDFGToLLVM):
(JSC::FTL::LowerDFGToLLVM::emitOSRExitCall):
* ftl/FTLOutput.h:
(JSC::FTL::Output::trap):
* runtime/Options.h:
(JSC):
2013-07-04 Filip Pizlo <fpizlo@apple.com>
fourthTier: DFG should refer to BasicBlocks by BasicBlock* and not BlockIndex
......
......@@ -116,7 +116,11 @@ void Plan::compileInThread(LongLivedState& longLivedState)
pathName = "FTL";
break;
}
dataLog("Optimized ", *codeBlock->alternative(), " with ", pathName, " in ", currentTimeMS() - before, " ms.\n");
double now = currentTimeMS();
dataLog("Optimized ", *codeBlock->alternative(), " with ", pathName, " in ", now - before, " ms");
if (path == FTLPath)
dataLog(" (DFG: ", beforeFTL - before, ", LLVM: ", now - beforeFTL, ")");
dataLog(".\n");
}
}
......@@ -201,6 +205,10 @@ Plan::CompilationPath Plan::compileInThreadImpl(LongLivedState& longLivedState)
FTL::State state(dfg);
FTL::lowerDFGToLLVM(state);
if (Options::reportCompileTimes())
beforeFTL = currentTimeMS();
FTL::compile(state);
FTL::link(state);
return FTLPath;
......
......@@ -76,6 +76,8 @@ struct Plan : public ThreadSafeRefCounted<Plan> {
DesiredIdentifiers identifiers;
DesiredStructureChains chains;
double beforeFTL;
bool isCompiled;
private:
......
......@@ -38,9 +38,10 @@ namespace JSC { namespace FTL {
#define FOR_EACH_FTL_INTRINSIC(macro) \
macro(addWithOverflow32, "llvm.sadd.with.overflow.i32", functionType(structType(m_context, int32, boolean), int32, int32)) \
macro(subWithOverflow32, "llvm.ssub.with.overflow.i32", functionType(structType(m_context, int32, boolean), int32, int32)) \
macro(doubleAbs, "llvm.fabs.f64", functionType(doubleType, doubleType)) \
macro(mulWithOverflow32, "llvm.smul.with.overflow.i32", functionType(structType(m_context, int32, boolean), int32, int32)) \
macro(doubleAbs, "llvm.fabs.f64", functionType(doubleType, doubleType))
macro(subWithOverflow32, "llvm.ssub.with.overflow.i32", functionType(structType(m_context, int32, boolean), int32, int32)) \
macro(trap, "llvm.trap", functionType(voidType))
#define FOR_EACH_FUNCTION_TYPE(macro) \
macro(I_DFGOperation_EJss, functionType(intPtr, intPtr, intPtr)) \
......
......@@ -2526,6 +2526,20 @@ private:
ExitKind kind, FormattedValue lowValue, Node* highValue, LValue failCondition,
SpeculationDirection direction, FormattedValue recovery)
{
if (Options::ftlTrapsOnOSRExit()) {
LBasicBlock failCase = FTL_NEW_BLOCK(m_out, ("OSR exit failCase"));
LBasicBlock continuation = FTL_NEW_BLOCK(m_out, ("OSR exit continuation"));
m_out.branch(failCondition, failCase, continuation);
LBasicBlock lastNext = m_out.appendTo(failCase, continuation);
m_out.trap();
m_out.unreachable();
m_out.appendTo(continuation, lastNext);
return;
}
if (verboseCompilationEnabled())
dataLog(" OSR exit with value sources: ", m_valueSources, "\n");
......@@ -2551,7 +2565,25 @@ private:
info.m_thunkAddress = buildAlloca(m_out.m_builder, m_out.intPtr);
LBasicBlock lastNext = m_out.appendTo(failCase, continuation);
if (Options::ftlOSRExitOmitsMarshalling()) {
m_out.call(
m_out.intToPtr(
m_out.get(info.m_thunkAddress),
pointerType(functionType(m_out.voidType))));
} else
emitOSRExitCall(exit, info, lowValue, direction, recovery);
m_out.unreachable();
m_out.appendTo(continuation, lastNext);
m_exitThunkGenerator.emitThunk(index);
}
void emitOSRExitCall(
OSRExit& exit, OSRExitCompilationInfo& info, FormattedValue lowValue,
SpeculationDirection direction, FormattedValue recovery)
{
ExitArgumentList arguments;
arguments.append(m_callFrame);
if (!!lowValue)
......@@ -2622,11 +2654,6 @@ private:
m_out.get(info.m_thunkAddress),
pointerType(functionType(m_out.voidType, argumentTypes))),
arguments);
m_out.unreachable();
m_out.appendTo(continuation, lastNext);
m_exitThunkGenerator.emitThunk(index);
}
void addExitArgumentForNode(
......
......@@ -347,6 +347,10 @@ public:
void unreachable() { buildUnreachable(m_builder); }
void trap()
{
call(trapIntrinsic());
}
void crash()
{
call(intToPtr(constIntPtr(abort), pointerType(functionType(voidType))));
......
......@@ -120,6 +120,8 @@ typedef OptionRange optionRange;
v(bool, useFTLTBAA, true) \
v(bool, enableLLVMFastISel, false) \
v(bool, useLLVMSmallCodeModel, false) \
v(bool, ftlTrapsOnOSRExit, false) \
v(bool, ftlOSRExitOmitsMarshalling, false) \
v(unsigned, llvmBackendOptimizationLevel, 2) \
v(unsigned, llvmOptimizationLevel, 2) \
v(unsigned, llvmSizeLevel, 0) \
......
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