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: