ResolveGlobalStatus.h [plain text]
#ifndef ResolveGlobalStatus_h
#define ResolveGlobalStatus_h
#include "JSCJSValue.h"
#include "PropertyOffset.h"
#include <wtf/NotFound.h>
namespace JSC {
class CodeBlock;
class Identifier;
struct ResolveOperation;
class Structure;
class ResolveGlobalStatus {
public:
enum State {
NoInformation,
Simple,
TakesSlowPath
};
ResolveGlobalStatus()
: m_state(NoInformation)
, m_structure(0)
, m_offset(invalidOffset)
{
}
ResolveGlobalStatus(
State state, Structure* structure = 0, PropertyOffset offset = invalidOffset,
JSValue specificValue = JSValue())
: m_state(state)
, m_structure(structure)
, m_offset(offset)
, m_specificValue(specificValue)
{
}
static ResolveGlobalStatus computeFor(CodeBlock*, int bytecodeIndex, ResolveOperation*, Identifier&);
State state() const { return m_state; }
bool isSet() const { return m_state != NoInformation; }
bool operator!() const { return !isSet(); }
bool isSimple() const { return m_state == Simple; }
bool takesSlowPath() const { return m_state == TakesSlowPath; }
Structure* structure() const { return m_structure; }
PropertyOffset offset() const { return m_offset; }
JSValue specificValue() const { return m_specificValue; }
private:
State m_state;
Structure* m_structure;
PropertyOffset m_offset;
JSValue m_specificValue;
};
}
#endif // ResolveGlobalStatus_h