]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - assembler/MacroAssemblerCodeRef.h
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / assembler / MacroAssemblerCodeRef.h
index 57951262d9a25d26c8f24c1f0e2dace25b36b657..b4d6c0bfb447308a8ea42d40be026576ceb04a2a 100644 (file)
@@ -132,6 +132,12 @@ public:
         ASSERT_VALID_CODE_POINTER(m_value);
     }
 
         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)
 // 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)
@@ -312,11 +318,7 @@ public:
     void* dataLocation() const { ASSERT_VALID_CODE_POINTER(m_value); return m_value; }
 #endif
 
     void* dataLocation() const { ASSERT_VALID_CODE_POINTER(m_value); return m_value; }
 #endif
 
-    typedef void* (MacroAssemblerCodePtr::*UnspecifiedBoolType);
-    operator UnspecifiedBoolType*() const
-    {
-        return !!m_value ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0;
-    }
+    explicit operator bool() const { return m_value; }
     
     bool operator==(const MacroAssemblerCodePtr& other) const
     {
     
     bool operator==(const MacroAssemblerCodePtr& other) const
     {
@@ -436,11 +438,7 @@ public:
         return JSC::tryToDisassemble(m_codePtr, size(), prefix, WTF::dataFile());
     }
     
         return JSC::tryToDisassemble(m_codePtr, size(), prefix, WTF::dataFile());
     }
     
-    typedef void* (MacroAssemblerCodeRef::*UnspecifiedBoolType);
-    operator UnspecifiedBoolType*() const
-    {
-        return !!m_codePtr ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0;
-    }
+    explicit operator bool() const { return !!m_codePtr; }
     
     void dump(PrintStream& out) const
     {
     
     void dump(PrintStream& out) const
     {