diff options
Diffstat (limited to 'Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h')
-rw-r--r-- | Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h b/Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h index 5f8ba8a92..2d9738478 100644 --- a/Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h +++ b/Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h @@ -36,7 +36,7 @@ // ASSERT_VALID_CODE_POINTER checks that ptr is a non-null pointer, and that it is a valid // instruction address on the platform (for example, check any alignment requirements). -#if CPU(ARM_THUMB2) && !ENABLE(LLINT_C_LOOP) +#if CPU(ARM_THUMB2) && ENABLE(JIT) // ARM instructions must be 16-bit aligned. Thumb2 code pointers to be loaded into // into the processor are decorated with the bottom bit set, while traditional ARM has // the lower bit clear. Since we don't know what kind of pointer, we check for both @@ -132,6 +132,12 @@ public: ASSERT_VALID_CODE_POINTER(m_value); } + template<typename returnType, typename argType1, typename argType2, typename argType3, typename argType4, typename argType5, typename argType6> + FunctionPtr(returnType(*value)(argType1, argType2, argType3, argType4, argType5, argType6)) + : m_value((void*)value) + { + ASSERT_VALID_CODE_POINTER(m_value); + } // MSVC doesn't seem to treat functions with different calling conventions as // different types; these methods already defined for fastcall, below. #if CALLING_CONVENTION_IS_STDCALL && !OS(WINDOWS) @@ -254,6 +260,11 @@ public: } void* value() const { return m_value; } + + void dump(PrintStream& out) const + { + out.print(RawPointer(m_value)); + } private: void* m_value; @@ -288,12 +299,10 @@ public: return result; } -#if ENABLE(LLINT) - static MacroAssemblerCodePtr createLLIntCodePtr(LLIntCode codeId) + static MacroAssemblerCodePtr createLLIntCodePtr(OpcodeID codeId) { return createFromExecutableAddress(LLInt::getCodePtr(codeId)); } -#endif explicit MacroAssemblerCodePtr(ReturnAddressPtr ra) : m_value(ra.value()) @@ -309,10 +318,7 @@ public: void* dataLocation() const { ASSERT_VALID_CODE_POINTER(m_value); return m_value; } #endif - bool operator!() const - { - return !m_value; - } + explicit operator bool() const { return m_value; } bool operator==(const MacroAssemblerCodePtr& other) const { @@ -321,6 +327,10 @@ public: void dumpWithName(const char* name, PrintStream& out) const { + if (!m_value) { + out.print(name, "(null)"); + return; + } if (executableAddress() == dataLocation()) { out.print(name, "(", RawPointer(executableAddress()), ")"); return; @@ -404,13 +414,11 @@ public: return MacroAssemblerCodeRef(codePtr); } -#if ENABLE(LLINT) // Helper for creating self-managed code refs from LLInt. - static MacroAssemblerCodeRef createLLIntCodeRef(LLIntCode codeId) + static MacroAssemblerCodeRef createLLIntCodeRef(OpcodeID codeId) { return createSelfManagedCodeRef(MacroAssemblerCodePtr::createFromExecutableAddress(LLInt::getCodePtr(codeId))); } -#endif ExecutableMemoryHandle* executableMemory() const { @@ -434,7 +442,7 @@ public: return JSC::tryToDisassemble(m_codePtr, size(), prefix, WTF::dataFile()); } - bool operator!() const { return !m_codePtr; } + explicit operator bool() const { return !!m_codePtr; } void dump(PrintStream& out) const { |