From 1fc1b8f772462f8971a0c74e9bce23003f060fcf Mon Sep 17 00:00:00 2001 From: "fpizlo@apple.com" Date: Tue, 10 Apr 2012 16:36:45 +0000 Subject: [PATCH] It should be possible to see why a code block was not compiled by the DFG https://bugs.webkit.org/show_bug.cgi?id=83553 Reviewed by Geoff Garen. If DFG_ENABLE(DEBUG_VERBOSE) and a code block is rejected, then print the opcode that caused the rejection. * dfg/DFGCapabilities.cpp: (JSC::DFG::debugFail): (DFG): (JSC::DFG::canHandleOpcodes): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113726 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/JavaScriptCore/ChangeLog | 15 +++++++++++++++ Source/JavaScriptCore/dfg/DFGCapabilities.cpp | 23 ++++++++++++++++++----- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog index 7e2a9d2..2813e02 100644 --- a/Source/JavaScriptCore/ChangeLog +++ b/Source/JavaScriptCore/ChangeLog @@ -1,3 +1,18 @@ +2012-04-10 Filip Pizlo + + It should be possible to see why a code block was not compiled by the DFG + https://bugs.webkit.org/show_bug.cgi?id=83553 + + Reviewed by Geoff Garen. + + If DFG_ENABLE(DEBUG_VERBOSE) and a code block is rejected, then print the + opcode that caused the rejection. + + * dfg/DFGCapabilities.cpp: + (JSC::DFG::debugFail): + (DFG): + (JSC::DFG::canHandleOpcodes): + 2012-04-09 Gavin Barraclough If a callback constructor returns a C++ null, throw a type error. diff --git a/Source/JavaScriptCore/dfg/DFGCapabilities.cpp b/Source/JavaScriptCore/dfg/DFGCapabilities.cpp index 48954da..450a5d8 100644 --- a/Source/JavaScriptCore/dfg/DFGCapabilities.cpp +++ b/Source/JavaScriptCore/dfg/DFGCapabilities.cpp @@ -27,12 +27,23 @@ #include "DFGCapabilities.h" #include "CodeBlock.h" +#include "DFGCommon.h" #include "Interpreter.h" namespace JSC { namespace DFG { #if ENABLE(DFG_JIT) +static inline void debugFail(CodeBlock* codeBlock, OpcodeID opcodeID) +{ +#if DFG_ENABLE(DEBUG_VERBOSE) + dataLog("Cannot handle code block %p because of opcode %s.\n", codeBlock, opcodeNames[opcodeID]); +#else + UNUSED_PARAM(codeBlock); + UNUSED_PARAM(opcodeID); +#endif +} + template bool canHandleOpcodes(CodeBlock* codeBlock) { @@ -42,11 +53,13 @@ bool canHandleOpcodes(CodeBlock* codeBlock) for (unsigned bytecodeOffset = 0; bytecodeOffset < instructionCount; ) { switch (interpreter->getOpcodeID(instructionsBegin[bytecodeOffset].u.opcode)) { -#define DEFINE_OP(opcode, length) \ - case opcode: \ - if (!canHandleOpcode(opcode)) \ - return false; \ - bytecodeOffset += length; \ +#define DEFINE_OP(opcode, length) \ + case opcode: \ + if (!canHandleOpcode(opcode)) { \ + debugFail(codeBlock, opcode); \ + return false; \ + } \ + bytecodeOffset += length; \ break; FOR_EACH_OPCODE_ID(DEFINE_OP) #undef DEFINE_OP -- 2.7.4