* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
#ifndef Register_h
#define Register_h
-#include "JSValue.h"
+#include "JSCJSValue.h"
#include <wtf/Assertions.h>
#include <wtf/VectorTraits.h>
class JSActivation;
class JSObject;
class JSPropertyNameIterator;
- class ScopeChainNode;
-
- struct Instruction;
+ class JSScope;
typedef ExecState CallFrame;
Register& operator=(CallFrame*);
Register& operator=(CodeBlock*);
- Register& operator=(ScopeChainNode*);
- Register& operator=(Instruction*);
+ Register& operator=(JSScope*);
int32_t i() const;
JSActivation* activation() const;
CodeBlock* codeBlock() const;
JSObject* function() const;
JSPropertyNameIterator* propertyNameIterator() const;
- ScopeChainNode* scopeChain() const;
- Instruction* vPC() const;
+ JSScope* scope() const;
+ int32_t unboxedInt32() const;
+ int64_t unboxedInt52() const;
+ int64_t unboxedStrictInt52() const;
+ bool unboxedBoolean() const;
+ double unboxedDouble() const;
+ JSCell* unboxedCell() const;
+ int32_t payload() const;
+ int32_t tag() const;
+ int32_t& payload();
+ int32_t& tag();
static Register withInt(int32_t i)
{
return r;
}
- static inline Register withCallee(JSObject* callee);
+ static Register withCallee(JSObject* callee);
private:
union {
EncodedJSValue value;
CallFrame* callFrame;
CodeBlock* codeBlock;
- Instruction* vPC;
+ EncodedValueDescriptor encodedValue;
+ double number;
+ int64_t integer;
} u;
};
ALWAYS_INLINE Register::Register(const JSValue& v)
{
-#if ENABLE(JSC_ZOMBIES)
- ASSERT(!v.isZombie());
-#endif
u.value = JSValue::encode(v);
}
ALWAYS_INLINE Register& Register::operator=(const JSValue& v)
{
-#if ENABLE(JSC_ZOMBIES)
- ASSERT(!v.isZombie());
-#endif
u.value = JSValue::encode(v);
return *this;
}
return *this;
}
- ALWAYS_INLINE Register& Register::operator=(Instruction* vPC)
- {
- u.vPC = vPC;
- return *this;
- }
-
ALWAYS_INLINE int32_t Register::i() const
{
return jsValue().asInt32();
return u.codeBlock;
}
- ALWAYS_INLINE Instruction* Register::vPC() const
+ ALWAYS_INLINE int32_t Register::unboxedInt32() const
+ {
+ return payload();
+ }
+
+ ALWAYS_INLINE int64_t Register::unboxedInt52() const
+ {
+ return u.integer >> JSValue::int52ShiftAmount;
+ }
+
+ ALWAYS_INLINE int64_t Register::unboxedStrictInt52() const
+ {
+ return u.integer;
+ }
+
+ ALWAYS_INLINE bool Register::unboxedBoolean() const
+ {
+ return !!payload();
+ }
+
+ ALWAYS_INLINE double Register::unboxedDouble() const
+ {
+ return u.number;
+ }
+
+ ALWAYS_INLINE JSCell* Register::unboxedCell() const
+ {
+#if USE(JSVALUE64)
+ return u.encodedValue.ptr;
+#else
+ return bitwise_cast<JSCell*>(payload());
+#endif
+ }
+
+ ALWAYS_INLINE int32_t Register::payload() const
+ {
+ return u.encodedValue.asBits.payload;
+ }
+
+ ALWAYS_INLINE int32_t Register::tag() const
+ {
+ return u.encodedValue.asBits.tag;
+ }
+
+ ALWAYS_INLINE int32_t& Register::payload()
+ {
+ return u.encodedValue.asBits.payload;
+ }
+
+ ALWAYS_INLINE int32_t& Register::tag()
{
- return u.vPC;
+ return u.encodedValue.asBits.tag;
}
} // namespace JSC