Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (139495 => 139496)
--- trunk/Source/_javascript_Core/ChangeLog 2013-01-11 22:15:54 UTC (rev 139495)
+++ trunk/Source/_javascript_Core/ChangeLog 2013-01-11 22:18:27 UTC (rev 139496)
@@ -1,3 +1,25 @@
+2013-01-11 Filip Pizlo <fpi...@apple.com>
+
+ It should be possible to enable verbose printing of each OSR exit at run-time (rather than compile-time) and it should print register state
+ https://bugs.webkit.org/show_bug.cgi?id=106700
+
+ Reviewed by Mark Hahnenberg.
+
+ * dfg/DFGAssemblyHelpers.h:
+ (DFG):
+ (JSC::DFG::AssemblyHelpers::debugCall):
+ * dfg/DFGCommon.h:
+ * dfg/DFGOSRExit.h:
+ (DFG):
+ * dfg/DFGOSRExitCompiler32_64.cpp:
+ (JSC::DFG::OSRExitCompiler::compileExit):
+ * dfg/DFGOSRExitCompiler64.cpp:
+ (JSC::DFG::OSRExitCompiler::compileExit):
+ * dfg/DFGOperations.cpp:
+ * dfg/DFGOperations.h:
+ * runtime/Options.h:
+ (JSC):
+
2013-01-11 Geoffrey Garen <gga...@apple.com>
Removed getDirectLocation and offsetForLocation and all their uses
Modified: trunk/Source/_javascript_Core/dfg/DFGAssemblyHelpers.h (139495 => 139496)
--- trunk/Source/_javascript_Core/dfg/DFGAssemblyHelpers.h 2013-01-11 22:15:54 UTC (rev 139495)
+++ trunk/Source/_javascript_Core/dfg/DFGAssemblyHelpers.h 2013-01-11 22:18:27 UTC (rev 139496)
@@ -39,7 +39,7 @@
namespace JSC { namespace DFG {
-typedef void (*V_DFGDebugOperation_EP)(ExecState*, void*);
+typedef void (*V_DFGDebugOperation_EPP)(ExecState*, void*, void*);
class AssemblyHelpers : public MacroAssembler {
public:
@@ -170,7 +170,7 @@
}
// Add a debug call. This call has no effect on JIT code execution state.
- void debugCall(V_DFGDebugOperation_EP function, void* argument)
+ void debugCall(V_DFGDebugOperation_EPP function, void* argument)
{
size_t scratchSize = sizeof(EncodedJSValue) * (GPRInfo::numberOfRegisters + FPRInfo::numberOfRegisters);
ScratchBuffer* scratchBuffer = m_globalData->scratchBufferForSize(scratchSize);
@@ -194,12 +194,14 @@
storePtr(TrustedImmPtr(scratchSize), GPRInfo::regT0);
#if CPU(X86_64) || CPU(ARM)
+ move(TrustedImmPtr(buffer), GPRInfo::argumentGPR2);
move(TrustedImmPtr(argument), GPRInfo::argumentGPR1);
move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
GPRReg scratch = selectScratchGPR(GPRInfo::argumentGPR0, GPRInfo::argumentGPR1);
#elif CPU(X86)
poke(GPRInfo::callFrameRegister, 0);
poke(TrustedImmPtr(argument), 1);
+ poke(TrustedImmPtr(buffer), 2);
GPRReg scratch = GPRInfo::regT0;
#else
#error "DFG JIT not supported on this platform."
Modified: trunk/Source/_javascript_Core/dfg/DFGCommon.h (139495 => 139496)
--- trunk/Source/_javascript_Core/dfg/DFGCommon.h 2013-01-11 22:15:54 UTC (rev 139495)
+++ trunk/Source/_javascript_Core/dfg/DFGCommon.h 2013-01-11 22:18:27 UTC (rev 139496)
@@ -70,8 +70,6 @@
#define DFG_ENABLE_XOR_DEBUG_AID 0
// Emit a breakpoint into the speculation failure code.
#define DFG_ENABLE_JIT_BREAK_ON_SPECULATION_FAILURE 0
-// Log every speculation failure.
-#define DFG_ENABLE_VERBOSE_SPECULATION_FAILURE 0
// Disable the DFG JIT without having to touch Platform.h
#define DFG_DEBUG_LOCAL_DISBALE 0
// Enable OSR entry from baseline JIT.
Modified: trunk/Source/_javascript_Core/dfg/DFGOSRExit.h (139495 => 139496)
--- trunk/Source/_javascript_Core/dfg/DFGOSRExit.h 2013-01-11 22:15:54 UTC (rev 139495)
+++ trunk/Source/_javascript_Core/dfg/DFGOSRExit.h 2013-01-11 22:18:27 UTC (rev 139496)
@@ -122,12 +122,10 @@
bool considerAddingAsFrequentExitSiteSlow(CodeBlock* dfgCodeBlock, CodeBlock* profiledCodeBlock);
};
-#if DFG_ENABLE(VERBOSE_SPECULATION_FAILURE)
struct SpeculationFailureDebugInfo {
CodeBlock* codeBlock;
NodeIndex nodeIndex;
};
-#endif
} } // namespace JSC::DFG
Modified: trunk/Source/_javascript_Core/dfg/DFGOSRExitCompiler32_64.cpp (139495 => 139496)
--- trunk/Source/_javascript_Core/dfg/DFGOSRExitCompiler32_64.cpp 2013-01-11 22:15:54 UTC (rev 139495)
+++ trunk/Source/_javascript_Core/dfg/DFGOSRExitCompiler32_64.cpp 2013-01-11 22:18:27 UTC (rev 139496)
@@ -47,13 +47,14 @@
dataLogF(") at JIT offset 0x%x ", m_jit.debugOffset());
dumpOperands(operands, WTF::dataFile());
#endif
-#if DFG_ENABLE(VERBOSE_SPECULATION_FAILURE)
- SpeculationFailureDebugInfo* debugInfo = new SpeculationFailureDebugInfo;
- debugInfo->codeBlock = m_jit.codeBlock();
- debugInfo->nodeIndex = exit.m_nodeIndex;
- m_jit.debugCall(debugOperationPrintSpeculationFailure, debugInfo);
-#endif
+ if (Options::printEachOSRExit()) {
+ SpeculationFailureDebugInfo* debugInfo = new SpeculationFailureDebugInfo;
+ debugInfo->codeBlock = m_jit.codeBlock();
+ debugInfo->nodeIndex = exit.m_nodeIndex;
+
+ m_jit.debugCall(debugOperationPrintSpeculationFailure, debugInfo);
+ }
#if DFG_ENABLE(JIT_BREAK_ON_SPECULATION_FAILURE)
m_jit.breakpoint();
Modified: trunk/Source/_javascript_Core/dfg/DFGOSRExitCompiler64.cpp (139495 => 139496)
--- trunk/Source/_javascript_Core/dfg/DFGOSRExitCompiler64.cpp 2013-01-11 22:15:54 UTC (rev 139495)
+++ trunk/Source/_javascript_Core/dfg/DFGOSRExitCompiler64.cpp 2013-01-11 22:18:27 UTC (rev 139496)
@@ -47,14 +47,15 @@
dataLogF(") ");
dumpOperands(operands, WTF::dataFile());
#endif
-#if DFG_ENABLE(VERBOSE_SPECULATION_FAILURE)
- SpeculationFailureDebugInfo* debugInfo = new SpeculationFailureDebugInfo;
- debugInfo->codeBlock = m_jit.codeBlock();
- debugInfo->nodeIndex = exit.m_nodeIndex;
+
+ if (Options::printEachOSRExit()) {
+ SpeculationFailureDebugInfo* debugInfo = new SpeculationFailureDebugInfo;
+ debugInfo->codeBlock = m_jit.codeBlock();
+ debugInfo->nodeIndex = exit.m_nodeIndex;
+
+ m_jit.debugCall(debugOperationPrintSpeculationFailure, debugInfo);
+ }
- m_jit.debugCall(debugOperationPrintSpeculationFailure, debugInfo);
-#endif
-
#if DFG_ENABLE(JIT_BREAK_ON_SPECULATION_FAILURE)
m_jit.breakpoint();
#endif
@@ -137,10 +138,6 @@
if (!!exit.m_valueProfile) {
EncodedJSValue* bucket = exit.m_valueProfile.getSpecFailBucket(0);
-#if DFG_ENABLE(VERBOSE_SPECULATION_FAILURE)
- dataLogF(" (have exit profile, bucket %p) ", bucket);
-#endif
-
if (exit.m_jsValueSource.isAddress()) {
// We can't be sure that we have a spare register. So use the tagTypeNumberRegister,
// since we know how to restore it.
Modified: trunk/Source/_javascript_Core/dfg/DFGOperations.cpp (139495 => 139496)
--- trunk/Source/_javascript_Core/dfg/DFGOperations.cpp 2013-01-11 22:15:54 UTC (rev 139495)
+++ trunk/Source/_javascript_Core/dfg/DFGOperations.cpp 2013-01-11 22:18:27 UTC (rev 139496)
@@ -1607,8 +1607,7 @@
return JSValue::decode(encodedOp).toBoolean(exec);
}
-#if DFG_ENABLE(VERBOSE_SPECULATION_FAILURE)
-void DFG_OPERATION debugOperationPrintSpeculationFailure(ExecState* exec, void* debugInfoRaw)
+void DFG_OPERATION debugOperationPrintSpeculationFailure(ExecState* exec, void* debugInfoRaw, void* scratch)
{
JSGlobalData* globalData = &exec->globalData();
NativeCallFrameTracer tracer(globalData, exec);
@@ -1627,8 +1626,25 @@
} else
dataLog("no alternative code block (i.e. we've been jettisoned)");
dataLog(", osrExitCounter = ", codeBlock->osrExitCounter(), "\n");
+ dataLog(" GPRs at time of exit:");
+ char* scratchPointer = static_cast<char*>(scratch);
+ for (unsigned i = 0; i < GPRInfo::numberOfRegisters; ++i) {
+ GPRReg gpr = GPRInfo::toRegister(i);
+ dataLog(" ", GPRInfo::debugName(gpr), ":", RawPointer(*reinterpret_cast<void**>(scratchPointer)));
+ scratchPointer += sizeof(EncodedJSValue);
+ }
+ dataLog("\n");
+ dataLog(" FPRs at time of exit:");
+ for (unsigned i = 0; i < FPRInfo::numberOfRegisters; ++i) {
+ FPRReg fpr = FPRInfo::toRegister(i);
+ dataLog(" ", FPRInfo::debugName(fpr), ":");
+ uint64_t bits = *reinterpret_cast<uint64_t*>(scratchPointer);
+ double value = *reinterpret_cast<double*>(scratchPointer);
+ dataLogF("%llx:%lf", bits, value);
+ scratchPointer += sizeof(EncodedJSValue);
+ }
+ dataLog("\n");
}
-#endif
extern "C" void DFG_OPERATION triggerReoptimizationNow(CodeBlock* codeBlock)
{
Modified: trunk/Source/_javascript_Core/dfg/DFGOperations.h (139495 => 139496)
--- trunk/Source/_javascript_Core/dfg/DFGOperations.h 2013-01-11 22:15:54 UTC (rev 139495)
+++ trunk/Source/_javascript_Core/dfg/DFGOperations.h 2013-01-11 22:18:27 UTC (rev 139496)
@@ -259,9 +259,7 @@
size_t DFG_OPERATION dfgConvertJSValueToInt32(ExecState*, EncodedJSValue) WTF_INTERNAL;
size_t DFG_OPERATION dfgConvertJSValueToBoolean(ExecState*, EncodedJSValue) WTF_INTERNAL;
-#if DFG_ENABLE(VERBOSE_SPECULATION_FAILURE)
-void DFG_OPERATION debugOperationPrintSpeculationFailure(ExecState*, void*) WTF_INTERNAL;
-#endif
+void DFG_OPERATION debugOperationPrintSpeculationFailure(ExecState*, void*, void*) WTF_INTERNAL;
void DFG_OPERATION triggerReoptimizationNow(CodeBlock*) WTF_INTERNAL;
Modified: trunk/Source/_javascript_Core/runtime/Options.h (139495 => 139496)
--- trunk/Source/_javascript_Core/runtime/Options.h 2013-01-11 22:15:54 UTC (rev 139495)
+++ trunk/Source/_javascript_Core/runtime/Options.h 2013-01-11 22:18:27 UTC (rev 139496)
@@ -75,6 +75,8 @@
v(bool, showDFGDisassembly, false) \
v(bool, showAllDFGNodes, false) \
\
+ v(bool, printEachOSRExit, false) \
+ \
v(bool, enableProfiler, false) \
\
v(unsigned, maximumOptimizationCandidateInstructionCount, 10000) \