Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (153267 => 153268)
--- trunk/Source/_javascript_Core/ChangeLog 2013-07-25 04:04:27 UTC (rev 153267)
+++ trunk/Source/_javascript_Core/ChangeLog 2013-07-25 04:04:29 UTC (rev 153268)
@@ -1,5 +1,34 @@
2013-07-04 Filip Pizlo <[email protected]>
+ 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 <[email protected]>
+
fourthTier: DFG should refer to BasicBlocks by BasicBlock* and not BlockIndex
https://bugs.webkit.org/show_bug.cgi?id=118339
Modified: trunk/Source/_javascript_Core/dfg/DFGPlan.cpp (153267 => 153268)
--- trunk/Source/_javascript_Core/dfg/DFGPlan.cpp 2013-07-25 04:04:27 UTC (rev 153267)
+++ trunk/Source/_javascript_Core/dfg/DFGPlan.cpp 2013-07-25 04:04:29 UTC (rev 153268)
@@ -116,7 +116,11 @@
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 @@
FTL::State state(dfg);
FTL::lowerDFGToLLVM(state);
+
+ if (Options::reportCompileTimes())
+ beforeFTL = currentTimeMS();
+
FTL::compile(state);
FTL::link(state);
return FTLPath;
Modified: trunk/Source/_javascript_Core/dfg/DFGPlan.h (153267 => 153268)
--- trunk/Source/_javascript_Core/dfg/DFGPlan.h 2013-07-25 04:04:27 UTC (rev 153267)
+++ trunk/Source/_javascript_Core/dfg/DFGPlan.h 2013-07-25 04:04:29 UTC (rev 153268)
@@ -76,6 +76,8 @@
DesiredIdentifiers identifiers;
DesiredStructureChains chains;
+ double beforeFTL;
+
bool isCompiled;
private:
Modified: trunk/Source/_javascript_Core/ftl/FTLIntrinsicRepository.h (153267 => 153268)
--- trunk/Source/_javascript_Core/ftl/FTLIntrinsicRepository.h 2013-07-25 04:04:27 UTC (rev 153267)
+++ trunk/Source/_javascript_Core/ftl/FTLIntrinsicRepository.h 2013-07-25 04:04:29 UTC (rev 153268)
@@ -38,9 +38,10 @@
#define FOR_EACH_FTL_INTRINSIC(macro) \
macro(addWithOverflow32, "llvm.sadd.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(subWithOverflow32, "llvm.ssub.with.overflow.i32", functionType(structType(m_context, int32, boolean), int32, int32)) \
- macro(mulWithOverflow32, "llvm.smul.with.overflow.i32", functionType(structType(m_context, int32, boolean), int32, int32)) \
- macro(doubleAbs, "llvm.fabs.f64", functionType(doubleType, doubleType))
+ macro(trap, "llvm.trap", functionType(voidType))
#define FOR_EACH_FUNCTION_TYPE(macro) \
macro(I_DFGOperation_EJss, functionType(intPtr, intPtr, intPtr)) \
Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp (153267 => 153268)
--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp 2013-07-25 04:04:27 UTC (rev 153267)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp 2013-07-25 04:04:29 UTC (rev 153268)
@@ -2526,6 +2526,20 @@
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 @@
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 @@
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(
Modified: trunk/Source/_javascript_Core/ftl/FTLOutput.h (153267 => 153268)
--- trunk/Source/_javascript_Core/ftl/FTLOutput.h 2013-07-25 04:04:27 UTC (rev 153267)
+++ trunk/Source/_javascript_Core/ftl/FTLOutput.h 2013-07-25 04:04:29 UTC (rev 153268)
@@ -347,6 +347,10 @@
void unreachable() { buildUnreachable(m_builder); }
+ void trap()
+ {
+ call(trapIntrinsic());
+ }
void crash()
{
call(intToPtr(constIntPtr(abort), pointerType(functionType(voidType))));
Modified: trunk/Source/_javascript_Core/runtime/Options.h (153267 => 153268)
--- trunk/Source/_javascript_Core/runtime/Options.h 2013-07-25 04:04:27 UTC (rev 153267)
+++ trunk/Source/_javascript_Core/runtime/Options.h 2013-07-25 04:04:29 UTC (rev 153268)
@@ -120,6 +120,8 @@
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) \