Title: [229367] trunk/Source/_javascript_Core
Revision
229367
Author
mark....@apple.com
Date
2018-03-07 10:21:41 -0800 (Wed, 07 Mar 2018)

Log Message

Simplify the variants of FunctionPtr constructors.
https://bugs.webkit.org/show_bug.cgi?id=183399
<rdar://problem/38212980>

Reviewed by Yusuke Suzuki.

* assembler/MacroAssemblerCodeRef.h:
(JSC::FunctionPtr::FunctionPtr):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (229366 => 229367)


--- trunk/Source/_javascript_Core/ChangeLog	2018-03-07 18:14:02 UTC (rev 229366)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-03-07 18:21:41 UTC (rev 229367)
@@ -1,3 +1,14 @@
+2018-03-07  Mark Lam  <mark....@apple.com>
+
+        Simplify the variants of FunctionPtr constructors.
+        https://bugs.webkit.org/show_bug.cgi?id=183399
+        <rdar://problem/38212980>
+
+        Reviewed by Yusuke Suzuki.
+
+        * assembler/MacroAssemblerCodeRef.h:
+        (JSC::FunctionPtr::FunctionPtr):
+
 2018-03-06  Filip Pizlo  <fpi...@apple.com>
 
         MarkedArgumentsBuffer should allocate from the JSValue Gigacage

Modified: trunk/Source/_javascript_Core/assembler/MacroAssemblerCodeRef.h (229366 => 229367)


--- trunk/Source/_javascript_Core/assembler/MacroAssemblerCodeRef.h	2018-03-07 18:14:02 UTC (rev 229366)
+++ trunk/Source/_javascript_Core/assembler/MacroAssemblerCodeRef.h	2018-03-07 18:21:41 UTC (rev 229367)
@@ -63,149 +63,40 @@
 public:
     FunctionPtr() { }
 
-    template<typename returnType>
-    FunctionPtr(returnType(*value)())
-        : m_value((void*)value)
+    template<typename returnType, typename... Arguments>
+    FunctionPtr(returnType(*value)(Arguments...))
+        : m_value(reinterpret_cast<void*>(value))
     {
         PoisonedMasmPtr::assertIsNotPoisoned(m_value);
         ASSERT_VALID_CODE_POINTER(m_value);
     }
 
-    template<typename returnType, typename argType1>
-    FunctionPtr(returnType(*value)(argType1))
-        : m_value((void*)value)
-    {
-        PoisonedMasmPtr::assertIsNotPoisoned(m_value);
-        ASSERT_VALID_CODE_POINTER(m_value);
-    }
-
-    template<typename returnType, typename argType1, typename argType2>
-    FunctionPtr(returnType(*value)(argType1, argType2))
-        : m_value((void*)value)
-    {
-        PoisonedMasmPtr::assertIsNotPoisoned(m_value);
-        ASSERT_VALID_CODE_POINTER(m_value);
-    }
-
-    template<typename returnType, typename argType1, typename argType2, typename argType3>
-    FunctionPtr(returnType(*value)(argType1, argType2, argType3))
-        : m_value((void*)value)
-    {
-        PoisonedMasmPtr::assertIsNotPoisoned(m_value);
-        ASSERT_VALID_CODE_POINTER(m_value);
-    }
-
-    template<typename returnType, typename argType1, typename argType2, typename argType3, typename argType4>
-    FunctionPtr(returnType(*value)(argType1, argType2, argType3, argType4))
-        : m_value((void*)value)
-    {
-        PoisonedMasmPtr::assertIsNotPoisoned(m_value);
-        ASSERT_VALID_CODE_POINTER(m_value);
-    }
-
-    template<typename returnType, typename argType1, typename argType2, typename argType3, typename argType4, typename argType5>
-    FunctionPtr(returnType(*value)(argType1, argType2, argType3, argType4, argType5))
-        : m_value((void*)value)
-    {
-        PoisonedMasmPtr::assertIsNotPoisoned(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)
-    {
-        PoisonedMasmPtr::assertIsNotPoisoned(m_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)
 
-    template<typename returnType>
-    FunctionPtr(returnType (CDECL *value)())
-        : m_value((void*)value)
+    template<typename returnType, typename... Arguments>
+    FunctionPtr(returnType(CDECL *value)(Arguments...))
+        : m_value(reinterpret_cast<void*>(value))
     {
         PoisonedMasmPtr::assertIsNotPoisoned(m_value);
         ASSERT_VALID_CODE_POINTER(m_value);
     }
 
-    template<typename returnType, typename argType1>
-    FunctionPtr(returnType (CDECL *value)(argType1))
-        : m_value((void*)value)
-    {
-        PoisonedMasmPtr::assertIsNotPoisoned(m_value);
-        ASSERT_VALID_CODE_POINTER(m_value);
-    }
+#endif // CALLING_CONVENTION_IS_STDCALL && !OS(WINDOWS)
 
-    template<typename returnType, typename argType1, typename argType2>
-    FunctionPtr(returnType (CDECL *value)(argType1, argType2))
-        : m_value((void*)value)
-    {
-        PoisonedMasmPtr::assertIsNotPoisoned(m_value);
-        ASSERT_VALID_CODE_POINTER(m_value);
-    }
-
-    template<typename returnType, typename argType1, typename argType2, typename argType3>
-    FunctionPtr(returnType (CDECL *value)(argType1, argType2, argType3))
-        : m_value((void*)value)
-    {
-        PoisonedMasmPtr::assertIsNotPoisoned(m_value);
-        ASSERT_VALID_CODE_POINTER(m_value);
-    }
-
-    template<typename returnType, typename argType1, typename argType2, typename argType3, typename argType4>
-    FunctionPtr(returnType (CDECL *value)(argType1, argType2, argType3, argType4))
-        : m_value((void*)value)
-    {
-        PoisonedMasmPtr::assertIsNotPoisoned(m_value);
-        ASSERT_VALID_CODE_POINTER(m_value);
-    }
-#endif
-
 #if COMPILER_SUPPORTS(FASTCALL_CALLING_CONVENTION)
 
-    template<typename returnType>
-    FunctionPtr(returnType (FASTCALL *value)())
-        : m_value((void*)value)
+    template<typename returnType, typename... Arguments>
+    FunctionPtr(returnType(FASTCALL *value)(Arguments...))
+        : m_value(reinterpret_cast<void*>(value))
     {
         PoisonedMasmPtr::assertIsNotPoisoned(m_value);
         ASSERT_VALID_CODE_POINTER(m_value);
     }
 
-    template<typename returnType, typename argType1>
-    FunctionPtr(returnType (FASTCALL *value)(argType1))
-        : m_value((void*)value)
-    {
-        PoisonedMasmPtr::assertIsNotPoisoned(m_value);
-        ASSERT_VALID_CODE_POINTER(m_value);
-    }
+#endif // COMPILER_SUPPORTS(FASTCALL_CALLING_CONVENTION)
 
-    template<typename returnType, typename argType1, typename argType2>
-    FunctionPtr(returnType (FASTCALL *value)(argType1, argType2))
-        : m_value((void*)value)
-    {
-        PoisonedMasmPtr::assertIsNotPoisoned(m_value);
-        ASSERT_VALID_CODE_POINTER(m_value);
-    }
-
-    template<typename returnType, typename argType1, typename argType2, typename argType3>
-    FunctionPtr(returnType (FASTCALL *value)(argType1, argType2, argType3))
-        : m_value((void*)value)
-    {
-        PoisonedMasmPtr::assertIsNotPoisoned(m_value);
-        ASSERT_VALID_CODE_POINTER(m_value);
-    }
-
-    template<typename returnType, typename argType1, typename argType2, typename argType3, typename argType4>
-    FunctionPtr(returnType (FASTCALL *value)(argType1, argType2, argType3, argType4))
-        : m_value((void*)value)
-    {
-        PoisonedMasmPtr::assertIsNotPoisoned(m_value);
-        ASSERT_VALID_CODE_POINTER(m_value);
-    }
-#endif
-
     template<typename FunctionType>
     explicit FunctionPtr(FunctionType* value)
         // Using a C-ctyle cast here to avoid compiler error on RVTC:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to