#include "config.h"
#include "DFGCommon.h"
#include "DFGNode.h"
#include "JSCInlines.h"
#include <wtf/PrintStream.h>
#if ENABLE(DFG_JIT)
namespace JSC { namespace DFG {
static StaticSpinLock crashLock;
void startCrashing()
{
crashLock.lock();
}
bool isCrashing()
{
return crashLock.isLocked();
}
bool stringLessThan(StringImpl& a, StringImpl& b)
{
unsigned minLength = std::min(a.length(), b.length());
for (unsigned i = 0; i < minLength; ++i) {
if (a[i] == b[i])
continue;
return a[i] < b[i];
}
return a.length() < b.length();
}
} }
namespace WTF {
using namespace JSC::DFG;
void printInternal(PrintStream& out, OptimizationFixpointState state)
{
switch (state) {
case BeforeFixpoint:
out.print("BeforeFixpoint");
return;
case FixpointNotConverged:
out.print("FixpointNotConverged");
return;
case FixpointConverged:
out.print("FixpointConverged");
return;
}
RELEASE_ASSERT_NOT_REACHED();
}
void printInternal(PrintStream& out, GraphForm form)
{
switch (form) {
case LoadStore:
out.print("LoadStore");
return;
case ThreadedCPS:
out.print("ThreadedCPS");
return;
case SSA:
out.print("SSA");
return;
}
RELEASE_ASSERT_NOT_REACHED();
}
void printInternal(PrintStream& out, UnificationState state)
{
switch (state) {
case LocallyUnified:
out.print("LocallyUnified");
return;
case GloballyUnified:
out.print("GloballyUnified");
return;
}
RELEASE_ASSERT_NOT_REACHED();
}
void printInternal(PrintStream& out, RefCountState state)
{
switch (state) {
case EverythingIsLive:
out.print("EverythingIsLive");
return;
case ExactRefCount:
out.print("ExactRefCount");
return;
}
RELEASE_ASSERT_NOT_REACHED();
}
void printInternal(PrintStream& out, ProofStatus status)
{
switch (status) {
case IsProved:
out.print("IsProved");
return;
case NeedsCheck:
out.print("NeedsCheck");
return;
}
RELEASE_ASSERT_NOT_REACHED();
}
}
#endif // ENABLE(DFG_JIT)
namespace WTF {
using namespace JSC::DFG;
void printInternal(PrintStream& out, CapabilityLevel capabilityLevel)
{
switch (capabilityLevel) {
case CannotCompile:
out.print("CannotCompile");
return;
case CanCompile:
out.print("CanCompile");
return;
case CanCompileAndInline:
out.print("CanCompileAndInline");
return;
case CapabilityLevelNotSet:
out.print("CapabilityLevelNotSet");
return;
}
RELEASE_ASSERT_NOT_REACHED();
}
}