X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/6fe7ccc865dc7d7541b93c5bcaf6368d2c98a174..refs/heads/master:/llint/LLIntData.h?ds=sidebyside diff --git a/llint/LLIntData.h b/llint/LLIntData.h index ba8daed..7e7794b 100644 --- a/llint/LLIntData.h +++ b/llint/LLIntData.h @@ -26,66 +26,76 @@ #ifndef LLIntData_h #define LLIntData_h +#include "JSCJSValue.h" #include "Opcode.h" -#include namespace JSC { -class JSGlobalData; +class VM; struct Instruction; +#if !ENABLE(JIT) +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(VM&); + private: - Instruction* m_exceptionInstructions; - Opcode* m_opcodeMap; -}; -#else // ENABLE(LLINT) + static Instruction* s_exceptionInstructions; + static Opcode s_opcodeMap[numOpcodeIDs]; -#if COMPILER(CLANG) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wmissing-noreturn" -#endif + friend void initialize(); -class Data { -public: - void performAssertions(JSGlobalData&) { } + friend Instruction* exceptionInstructions(); + friend Opcode* opcodeMap(); + friend Opcode getOpcode(OpcodeID); + friend void* getCodePtr(OpcodeID); +}; - Instruction* exceptionInstructions() - { - ASSERT_NOT_REACHED(); - return 0; - } +void initialize(); + +inline Instruction* exceptionInstructions() +{ + return Data::s_exceptionInstructions; +} - Opcode* opcodeMap() - { - ASSERT_NOT_REACHED(); - return 0; - } -}; +inline Opcode* opcodeMap() +{ + return Data::s_opcodeMap; +} -#if COMPILER(CLANG) -#pragma clang diagnostic pop +inline Opcode getOpcode(OpcodeID id) +{ +#if ENABLE(COMPUTED_GOTO_OPCODES) + return Data::s_opcodeMap[id]; +#else + return static_cast(id); #endif +} + +ALWAYS_INLINE void* getCodePtr(OpcodeID id) +{ + return reinterpret_cast(getOpcode(id)); +} + +#if ENABLE(JIT) +ALWAYS_INLINE LLIntCode getCodeFunctionPtr(OpcodeID codeId) +{ + return reinterpret_cast(getCodePtr(codeId)); +} +#endif + +ALWAYS_INLINE void* getCodePtr(JSC::EncodedJSValue glueHelper()) +{ + return bitwise_cast(glueHelper); +} -#endif // ENABLE(LLINT) } } // namespace JSC::LLInt