#pragma once
#if ENABLE(DFG_JIT)
#include "DFGMinifiedID.h"
#include "DFGNodeType.h"
#include "InlineCallFrame.h"
#include "JSCJSValue.h"
namespace JSC { namespace DFG {
struct Node;
inline bool belongsInMinifiedGraph(NodeType type)
{
switch (type) {
case JSConstant:
case Int52Constant:
case DoubleConstant:
case PhantomDirectArguments:
case PhantomClonedArguments:
return true;
default:
return false;
}
}
class MinifiedNode {
public:
MinifiedNode() { }
static MinifiedNode fromNode(Node*);
MinifiedID id() const { return m_id; }
NodeType op() const { return m_op; }
bool hasConstant() const { return hasConstant(m_op); }
JSValue constant() const
{
return JSValue::decode(bitwise_cast<EncodedJSValue>(m_info));
}
bool hasInlineCallFrame() const { return hasInlineCallFrame(m_op); }
InlineCallFrame* inlineCallFrame() const
{
return bitwise_cast<InlineCallFrame*>(static_cast<uintptr_t>(m_info));
}
static MinifiedID getID(MinifiedNode* node) { return node->id(); }
static bool compareByNodeIndex(const MinifiedNode& a, const MinifiedNode& b)
{
return a.m_id < b.m_id;
}
private:
static bool hasConstant(NodeType type)
{
return type == JSConstant || type == Int52Constant || type == DoubleConstant;
}
static bool hasInlineCallFrame(NodeType type)
{
return type == PhantomDirectArguments || type == PhantomClonedArguments;
}
MinifiedID m_id;
uint64_t m_info;
NodeType m_op;
};
} }
#endif // ENABLE(DFG_JIT)