summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/JavaScriptCore/interpreter/Register.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2009-06-15 09:06:43 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-06-15 09:31:31 (GMT)
commitc411f16870f112c3407c28c22b617f613a82cff4 (patch)
tree29a1bcd590c8b31af2aab445bfe8a978dc5bf582 /src/3rdparty/webkit/JavaScriptCore/interpreter/Register.h
parent3d77b56b32a0c53ec0bbfaa07236fedb900ff336 (diff)
downloadQt-c411f16870f112c3407c28c22b617f613a82cff4.zip
Qt-c411f16870f112c3407c28c22b617f613a82cff4.tar.gz
Qt-c411f16870f112c3407c28c22b617f613a82cff4.tar.bz2
Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit-4.6-snapshot-15062009 ( 65232bf00dc494ebfd978f998c88f58d18ecce1e )
Diffstat (limited to 'src/3rdparty/webkit/JavaScriptCore/interpreter/Register.h')
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/interpreter/Register.h102
1 files changed, 22 insertions, 80 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/interpreter/Register.h b/src/3rdparty/webkit/JavaScriptCore/interpreter/Register.h
index 9ad1815..cceac74 100644
--- a/src/3rdparty/webkit/JavaScriptCore/interpreter/Register.h
+++ b/src/3rdparty/webkit/JavaScriptCore/interpreter/Register.h
@@ -30,6 +30,7 @@
#define Register_h
#include "JSValue.h"
+#include <wtf/Assertions.h>
#include <wtf/VectorTraits.h>
namespace JSC {
@@ -49,24 +50,26 @@ namespace JSC {
class Register {
public:
Register();
- Register(JSValuePtr);
+ Register(JSValue);
+ Register(Arguments*);
- JSValuePtr jsValue(CallFrame*) const;
- JSValuePtr getJSValue() const;
+ JSValue jsValue() const;
bool marked() const;
void mark();
+ int32_t i() const;
+ void* v() const;
+
private:
friend class ExecState;
friend class Interpreter;
- // Only CallFrame and Interpreter should use these functions.
+ // Only CallFrame, Interpreter, and JITStubs should use these functions.
Register(intptr_t);
Register(JSActivation*);
- Register(Arguments*);
Register(CallFrame*);
Register(CodeBlock*);
Register(JSFunction*);
@@ -74,9 +77,6 @@ namespace JSC {
Register(ScopeChainNode*);
Register(Instruction*);
- intptr_t i() const;
- void* v() const;
-
JSActivation* activation() const;
Arguments* arguments() const;
CallFrame* callFrame() const;
@@ -89,7 +89,7 @@ namespace JSC {
union {
intptr_t i;
void* v;
- JSValueEncodedAsPointer* value;
+ EncodedJSValue value;
JSActivation* activation;
Arguments* arguments;
@@ -100,136 +100,89 @@ namespace JSC {
ScopeChainNode* scopeChain;
Instruction* vPC;
} u;
-
-#ifndef NDEBUG
- enum {
- EmptyType,
-
- IntType,
- ValueType,
-
- ActivationType,
- ArgumentsType,
- CallFrameType,
- CodeBlockType,
- FunctionType,
- InstructionType,
- PropertyNameIteratorType,
- RegisterType,
- ScopeChainNodeType
- } m_type;
-#endif
};
-#ifndef NDEBUG
- #define SET_TYPE(type) m_type = (type)
- // FIXME: The CTI code to put value into registers doesn't set m_type.
- // Once it does, we can turn this assertion back on.
- #define ASSERT_TYPE(type)
-#else
- #define SET_TYPE(type)
- #define ASSERT_TYPE(type)
-#endif
-
ALWAYS_INLINE Register::Register()
{
#ifndef NDEBUG
- SET_TYPE(EmptyType);
- u.value = JSValuePtr::encode(noValue());
+ u.value = JSValue::encode(JSValue());
#endif
}
- ALWAYS_INLINE Register::Register(JSValuePtr v)
+ ALWAYS_INLINE Register::Register(JSValue v)
{
- SET_TYPE(ValueType);
- u.value = JSValuePtr::encode(v);
+ u.value = JSValue::encode(v);
}
- // This function is scaffolding for legacy clients. It will eventually go away.
- ALWAYS_INLINE JSValuePtr Register::jsValue(CallFrame*) const
+ ALWAYS_INLINE JSValue Register::jsValue() const
{
- // Once registers hold doubles, this function will allocate a JSValue*
- // if the register doesn't hold one already.
- ASSERT_TYPE(ValueType);
- return JSValuePtr::decode(u.value);
- }
-
- ALWAYS_INLINE JSValuePtr Register::getJSValue() const
- {
- ASSERT_TYPE(JSValueType);
- return JSValuePtr::decode(u.value);
+ return JSValue::decode(u.value);
}
ALWAYS_INLINE bool Register::marked() const
{
- return getJSValue()->marked();
+ return jsValue().marked();
}
ALWAYS_INLINE void Register::mark()
{
- getJSValue()->mark();
+ jsValue().mark();
}
// Interpreter functions
ALWAYS_INLINE Register::Register(Arguments* arguments)
{
- SET_TYPE(ArgumentsType);
u.arguments = arguments;
}
ALWAYS_INLINE Register::Register(JSActivation* activation)
{
- SET_TYPE(ActivationType);
u.activation = activation;
}
ALWAYS_INLINE Register::Register(CallFrame* callFrame)
{
- SET_TYPE(CallFrameType);
u.callFrame = callFrame;
}
ALWAYS_INLINE Register::Register(CodeBlock* codeBlock)
{
- SET_TYPE(CodeBlockType);
u.codeBlock = codeBlock;
}
ALWAYS_INLINE Register::Register(JSFunction* function)
{
- SET_TYPE(FunctionType);
u.function = function;
}
ALWAYS_INLINE Register::Register(Instruction* vPC)
{
- SET_TYPE(InstructionType);
u.vPC = vPC;
}
ALWAYS_INLINE Register::Register(ScopeChainNode* scopeChain)
{
- SET_TYPE(ScopeChainNodeType);
u.scopeChain = scopeChain;
}
ALWAYS_INLINE Register::Register(JSPropertyNameIterator* propertyNameIterator)
{
- SET_TYPE(PropertyNameIteratorType);
u.propertyNameIterator = propertyNameIterator;
}
ALWAYS_INLINE Register::Register(intptr_t i)
{
- SET_TYPE(IntType);
+ // See comment on 'i()' below.
+ ASSERT(i == static_cast<int32_t>(i));
u.i = i;
}
- ALWAYS_INLINE intptr_t Register::i() const
+ // Read 'i' as a 32-bit integer; we only use it to hold 32-bit values,
+ // and we only write 32-bits when writing the arg count from JIT code.
+ ALWAYS_INLINE int32_t Register::i() const
{
- ASSERT_TYPE(IntType);
- return u.i;
+ return static_cast<int32_t>(u.i);
}
ALWAYS_INLINE void* Register::v() const
@@ -239,55 +192,44 @@ namespace JSC {
ALWAYS_INLINE JSActivation* Register::activation() const
{
- ASSERT_TYPE(ActivationType);
return u.activation;
}
ALWAYS_INLINE Arguments* Register::arguments() const
{
- ASSERT_TYPE(ArgumentsType);
return u.arguments;
}
ALWAYS_INLINE CallFrame* Register::callFrame() const
{
- ASSERT_TYPE(CallFrameType);
return u.callFrame;
}
ALWAYS_INLINE CodeBlock* Register::codeBlock() const
{
- ASSERT_TYPE(CodeBlockType);
return u.codeBlock;
}
ALWAYS_INLINE JSFunction* Register::function() const
{
- ASSERT_TYPE(FunctionType);
return u.function;
}
ALWAYS_INLINE JSPropertyNameIterator* Register::propertyNameIterator() const
{
- ASSERT_TYPE(PropertyNameIteratorType);
return u.propertyNameIterator;
}
ALWAYS_INLINE ScopeChainNode* Register::scopeChain() const
{
- ASSERT_TYPE(ScopeChainNodeType);
return u.scopeChain;
}
ALWAYS_INLINE Instruction* Register::vPC() const
{
- ASSERT_TYPE(InstructionType);
return u.vPC;
}
- #undef SET_TYPE
- #undef ASSERT_TYPE
-
} // namespace JSC
namespace WTF {