diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-09-10 19:10:20 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-09-10 19:10:20 +0200 |
commit | 284837daa07b29d6a63a748544a90b1f5842ac5c (patch) | |
tree | ecd258180bde91fe741e0cfd2638beb3c6da7e8e /Source/JavaScriptCore/llint/LLIntData.h | |
parent | 2e2ba8ff45915f40ed3e014101269c175f2a89a0 (diff) | |
download | qtwebkit-284837daa07b29d6a63a748544a90b1f5842ac5c.tar.gz |
Imported WebKit commit 68645295d2e3e09af2c942f092556f06aa5f8b0d (http://svn.webkit.org/repository/webkit/trunk@128073)
New snapshot
Diffstat (limited to 'Source/JavaScriptCore/llint/LLIntData.h')
-rw-r--r-- | Source/JavaScriptCore/llint/LLIntData.h | 96 |
1 files changed, 65 insertions, 31 deletions
diff --git a/Source/JavaScriptCore/llint/LLIntData.h b/Source/JavaScriptCore/llint/LLIntData.h index ba8daedf1..3b3b6027f 100644 --- a/Source/JavaScriptCore/llint/LLIntData.h +++ b/Source/JavaScriptCore/llint/LLIntData.h @@ -26,6 +26,7 @@ #ifndef LLIntData_h #define LLIntData_h +#include "JSValue.h" #include "Opcode.h" #include <wtf/Platform.h> @@ -34,30 +35,59 @@ namespace JSC { class JSGlobalData; struct Instruction; +#if ENABLE(LLINT_C_LOOP) +typedef OpcodeID LLIntCode; +#else +typedef void (*LLIntCode)(); +#endif + namespace LLInt { #if ENABLE(LLINT) + class Data { public: - Data(); - ~Data(); - - void performAssertions(JSGlobalData&); - - Instruction* exceptionInstructions() - { - return m_exceptionInstructions; - } - - Opcode* opcodeMap() - { - return m_opcodeMap; - } + static void performAssertions(JSGlobalData&); + private: - Instruction* m_exceptionInstructions; - Opcode* m_opcodeMap; + static Instruction* s_exceptionInstructions; + static Opcode* s_opcodeMap; + + friend void initialize(); + + friend Instruction* exceptionInstructions(); + friend Opcode* opcodeMap(); + friend Opcode getOpcode(OpcodeID); + friend void* getCodePtr(OpcodeID); }; -#else // ENABLE(LLINT) + +void initialize(); + +inline Instruction* exceptionInstructions() +{ + return Data::s_exceptionInstructions; +} + +inline Opcode* opcodeMap() +{ + return Data::s_opcodeMap; +} + +inline Opcode getOpcode(OpcodeID id) +{ +#if ENABLE(COMPUTED_GOTO_OPCODES) + return Data::s_opcodeMap[id]; +#else + return static_cast<Opcode>(id); +#endif +} + +ALWAYS_INLINE void* getCodePtr(OpcodeID id) +{ + return reinterpret_cast<void*>(getOpcode(id)); +} + +#else // !ENABLE(LLINT) #if COMPILER(CLANG) #pragma clang diagnostic push @@ -66,26 +96,30 @@ private: class Data { public: - void performAssertions(JSGlobalData&) { } - - Instruction* exceptionInstructions() - { - ASSERT_NOT_REACHED(); - return 0; - } - - Opcode* opcodeMap() - { - ASSERT_NOT_REACHED(); - return 0; - } + static void performAssertions(JSGlobalData&) { } }; #if COMPILER(CLANG) #pragma clang diagnostic pop #endif -#endif // ENABLE(LLINT) +#endif // !ENABLE(LLINT) + +ALWAYS_INLINE void* getOpcode(void llintOpcode()) +{ + return bitwise_cast<void*>(llintOpcode); +} + +ALWAYS_INLINE void* getCodePtr(void glueHelper()) +{ + return bitwise_cast<void*>(glueHelper); +} + +ALWAYS_INLINE void* getCodePtr(JSC::EncodedJSValue glueHelper()) +{ + return bitwise_cast<void*>(glueHelper); +} + } } // namespace JSC::LLInt |