Ignore:
Timestamp:
Nov 2, 2011, 8:13:27 PM (14 years ago)
Author:
[email protected]
Message:

FunctionPtr should accept FASTCALL functions on X86
https://bugs.webkit.org/show_bug.cgi?id=71434

Patch by Yuqiang Xian <[email protected]> on 2011-11-02
Reviewed by Filip Pizlo.

On X86 we sometimes use FASTCALL convention functions, for example the
cti functions, and we may need the pointers to such functions, e.g.,
in current DFG register file check and arity check, though long term
we may avoid such usage of cti calls in DFG.

  • assembler/MacroAssemblerCodeRef.h:

(JSC::FunctionPtr::FunctionPtr):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h

    r97189 r99133  
    6666#endif
    6767
     68#if CPU(X86)
     69#define HAS_FASTCALL_CALLING_CONVENTION 1
     70#ifndef FASTCALL
     71#if COMPILER(MSVC)
     72#define FASTCALL __fastcall
     73#else
     74#define FASTCALL  __attribute__ ((fastcall))
     75#endif // COMPILER(MSVC)
     76#endif // FASTCALL
     77#else
     78#define HAS_FASTCALL_CALLING_CONVENTION 0
     79#endif // CPU(X86)
     80
    6881namespace JSC {
    6982
     
    146159    template<typename returnType, typename argType1, typename argType2, typename argType3, typename argType4>
    147160    FunctionPtr(returnType (CDECL *value)(argType1, argType2, argType3, argType4))
     161        : m_value((void*)value)
     162    {
     163        ASSERT_VALID_CODE_POINTER(m_value);
     164    }
     165#endif
     166
     167#if HAS_FASTCALL_CALLING_CONVENTION
     168
     169    template<typename returnType>
     170    FunctionPtr(returnType (FASTCALL *value)())
     171        : m_value((void*)value)
     172    {
     173        ASSERT_VALID_CODE_POINTER(m_value);
     174    }
     175
     176    template<typename returnType, typename argType1>
     177    FunctionPtr(returnType (FASTCALL *value)(argType1))
     178        : m_value((void*)value)
     179    {
     180        ASSERT_VALID_CODE_POINTER(m_value);
     181    }
     182
     183    template<typename returnType, typename argType1, typename argType2>
     184    FunctionPtr(returnType (FASTCALL *value)(argType1, argType2))
     185        : m_value((void*)value)
     186    {
     187        ASSERT_VALID_CODE_POINTER(m_value);
     188    }
     189
     190    template<typename returnType, typename argType1, typename argType2, typename argType3>
     191    FunctionPtr(returnType (FASTCALL *value)(argType1, argType2, argType3))
     192        : m_value((void*)value)
     193    {
     194        ASSERT_VALID_CODE_POINTER(m_value);
     195    }
     196
     197    template<typename returnType, typename argType1, typename argType2, typename argType3, typename argType4>
     198    FunctionPtr(returnType (FASTCALL *value)(argType1, argType2, argType3, argType4))
    148199        : m_value((void*)value)
    149200    {
Note: See TracChangeset for help on using the changeset viewer.