+ class IndexedForInContext : public ForInContext {
+ public:
+ IndexedForInContext(RegisterID* localRegister, RegisterID* indexRegister)
+ : ForInContext(localRegister)
+ , m_indexRegister(indexRegister)
+ {
+ }
+
+ virtual ForInContextType type() const
+ {
+ return IndexedForInContextType;
+ }
+
+ RegisterID* index() const { return m_indexRegister.get(); }
+
+ private:
+ RefPtr<RegisterID> m_indexRegister;
+ };
+
+ struct TryData {
+ RefPtr<Label> target;
+ unsigned targetScopeDepth;
+ HandlerType handlerType;
+ };
+
+ struct TryContext {
+ RefPtr<Label> start;
+ TryData* tryData;
+ };
+
+ class Variable {
+ public:
+ enum VariableKind { NormalVariable, SpecialVariable };
+
+ Variable()
+ : m_offset()
+ , m_local(nullptr)
+ , m_attributes(0)
+ , m_kind(NormalVariable)
+ {
+ }
+
+ Variable(const Identifier& ident)
+ : m_ident(ident)
+ , m_local(nullptr)
+ , m_attributes(0)
+ , m_kind(NormalVariable) // This is somewhat meaningless here for this kind of Variable.
+ {
+ }
+
+ Variable(const Identifier& ident, VarOffset offset, RegisterID* local, unsigned attributes, VariableKind kind)
+ : m_ident(ident)
+ , m_offset(offset)
+ , m_local(local)
+ , m_attributes(attributes)
+ , m_kind(kind)
+ {
+ }
+
+ // If it's unset, then it is a non-locally-scoped variable. If it is set, then it could be
+ // a stack variable, a scoped variable in the local scope, or a variable captured in the
+ // direct arguments object.
+ bool isResolved() const { return !!m_offset; }
+
+ const Identifier& ident() const { return m_ident; }
+
+ VarOffset offset() const { return m_offset; }
+ bool isLocal() const { return m_offset.isStack(); }
+ RegisterID* local() const { return m_local; }
+
+ bool isReadOnly() const { return m_attributes & ReadOnly; }
+ bool isSpecial() const { return m_kind != NormalVariable; }
+
+ private:
+ Identifier m_ident;
+ VarOffset m_offset;
+ RegisterID* m_local;
+ unsigned m_attributes;
+ VariableKind m_kind;
+ };
+
+ struct TryRange {
+ RefPtr<Label> start;
+ RefPtr<Label> end;
+ TryData* tryData;
+ };
+
+ enum ProfileTypeBytecodeFlag {
+ ProfileTypeBytecodePutToScope,
+ ProfileTypeBytecodeGetFromScope,
+ ProfileTypeBytecodePutToLocalScope,
+ ProfileTypeBytecodeGetFromLocalScope,
+ ProfileTypeBytecodeHasGlobalID,
+ ProfileTypeBytecodeDoesNotHaveGlobalID,
+ ProfileTypeBytecodeFunctionArgument,
+ ProfileTypeBytecodeFunctionReturnStatement
+ };
+
+ class BytecodeGenerator {
+ WTF_MAKE_FAST_ALLOCATED;
+ WTF_MAKE_NONCOPYABLE(BytecodeGenerator);