Changeset 229989 in webkit


Ignore:
Timestamp:
Mar 26, 2018 2:41:13 PM (6 years ago)
Author:
Ross Kirsling
Message:

JIT callOperation() needs to support operations that return SlowPathReturnType differently on Windows.
https://bugs.webkit.org/show_bug.cgi?id=183655

Reviewed by Keith Miller.

  • jit/CCallHelpers.h:

(JSC::CCallHelpers::ArgCollection::argCount):
(JSC::CCallHelpers::marshallArgumentRegister):
(JSC::CCallHelpers::setupArgumentsImpl):
On Win64, ensure that argCount always includes GPRs and FPRs and that counting starts from 1 for SlowPathReturnType.

  • jit/JIT.h:

(JSC::JIT::callOperation):
(JSC::JIT::is64BitType):
(JSC::JIT::is64BitType<void>):
On Win64, ensure special call is used for SlowPathReturnType.

  • jit/JITOperations.h:

Update changed type.

Location:
trunk/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r229988 r229989  
     12018-03-26  Ross Kirsling  <ross.kirsling@sony.com>
     2
     3        JIT callOperation() needs to support operations that return SlowPathReturnType differently on Windows.
     4        https://bugs.webkit.org/show_bug.cgi?id=183655
     5
     6        Reviewed by Keith Miller.
     7
     8        * jit/CCallHelpers.h:
     9        (JSC::CCallHelpers::ArgCollection::argCount):
     10        (JSC::CCallHelpers::marshallArgumentRegister):
     11        (JSC::CCallHelpers::setupArgumentsImpl):
     12        On Win64, ensure that argCount always includes GPRs and FPRs and that counting starts from 1 for SlowPathReturnType.
     13
     14        * jit/JIT.h:
     15        (JSC::JIT::callOperation):
     16        (JSC::JIT::is64BitType):
     17        (JSC::JIT::is64BitType<void>):
     18        On Win64, ensure special call is used for SlowPathReturnType.
     19
     20        * jit/JITOperations.h:
     21        Update changed type.
     22
    1232018-03-26  Yusuke Suzuki  <utatane.tea@gmail.com>
    224
  • trunk/Source/JavaScriptCore/jit/CCallHelpers.h

    r229648 r229989  
    239239        }
    240240
    241 
     241#if OS(WINDOWS) && CPU(X86_64)
     242        unsigned argCount(GPRReg) { return numGPRArgs + numFPRArgs; }
     243        unsigned argCount(FPRReg) { return numGPRArgs + numFPRArgs; }
     244#else
    242245        unsigned argCount(GPRReg) { return numGPRArgs; }
    243246        unsigned argCount(FPRReg) { return numFPRArgs; }
     247#endif
    244248
    245249        std::array<GPRReg, GPRInfo::numberOfRegisters> gprSources;
     
    288292
    289293#define CURRENT_ARGUMENT_TYPE typename FunctionTraits<OperationType>::template ArgumentType<numGPRArgs + numFPRArgs>
     294#define RESULT_TYPE typename FunctionTraits<OperationType>::ResultType
    290295
    291296#if USE(JSVALUE64)
     
    296301        using InfoType = InfoTypeForReg<RegType>;
    297302        unsigned numArgRegisters = InfoType::numberOfArgumentRegisters;
     303#if OS(WINDOWS) && CPU(X86_64)
     304        unsigned currentArgCount = argSourceRegs.argCount(arg) + (std::is_same<RESULT_TYPE, SlowPathReturnType>::value ? 1 : 0);
     305#else
    298306        unsigned currentArgCount = argSourceRegs.argCount(arg);
     307#endif
    299308        if (currentArgCount < numArgRegisters) {
    300309            auto updatedArgSourceRegs = argSourceRegs.pushRegArg(arg, InfoType::toArgumentRegister(currentArgCount));
     
    386395        static_assert(!std::is_floating_point<CURRENT_ARGUMENT_TYPE>::value, "We don't support immediate floats/doubles in setupArguments");
    387396        auto numArgRegisters = GPRInfo::numberOfArgumentRegisters;
    388         if (numGPRArgs < numArgRegisters) {
     397#if OS(WINDOWS) && CPU(X86_64)
     398        auto currentArgCount = numGPRArgs + numFPRArgs + (std::is_same<RESULT_TYPE, SlowPathReturnType>::value ? 1 : 0);
     399#else
     400        auto currentArgCount = numGPRArgs;
     401#endif
     402        if (currentArgCount < numArgRegisters) {
    389403            setupArgumentsImpl<OperationType>(argSourceRegs.addGPRArg(), args...);
    390             move(arg, GPRInfo::toArgumentRegister(numGPRArgs));
     404            move(arg, GPRInfo::toArgumentRegister(currentArgCount));
    391405            return;
    392406        }
     
    437451
    438452#undef CURRENT_ARGUMENT_TYPE
     453#undef RESULT_TYPE
    439454
    440455    // Base case; set up the argument registers.
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r229957 r229989  
    717717        MacroAssembler::Call appendCallWithExceptionCheck(const FunctionPtr, PtrTag);
    718718#if OS(WINDOWS) && CPU(X86_64)
    719         MacroAssembler::Call appendCallWithExceptionCheckAndSlowPathReturnType(const FunctionPtr, PtrTag = NoPtrTag);
     719        MacroAssembler::Call appendCallWithExceptionCheckAndSlowPathReturnType(const FunctionPtr, PtrTag);
    720720#endif
    721721        MacroAssembler::Call appendCallWithCallFrameRollbackOnException(const FunctionPtr, PtrTag);
     
    739739        }
    740740
    741         template<typename OperationType, typename... Args>
    742         MacroAssembler::Call callOperation(OperationType operation, PtrTag tag, Args... args)
    743         {
     741#if OS(WINDOWS) && CPU(X86_64)
     742        template<typename OperationType, typename... Args>
     743        std::enable_if_t<std::is_same<typename FunctionTraits<OperationType>::ResultType, SlowPathReturnType>::value, MacroAssembler::Call>
     744        callOperation(OperationType operation, PtrTag tag, Args... args)
     745        {
     746            setupArguments<OperationType>(args...);
     747            return appendCallWithExceptionCheckAndSlowPathReturnType(operation, tag);
     748        }
     749
     750        template<typename Type>
     751        static constexpr bool is64BitType() { return sizeof(Type) <= 8; }
     752
     753        template<>
     754        static constexpr bool is64BitType<void>() { return true; }
     755
     756        template<typename OperationType, typename... Args>
     757        std::enable_if_t<!std::is_same<typename FunctionTraits<OperationType>::ResultType, SlowPathReturnType>::value, MacroAssembler::Call>
     758        callOperation(OperationType operation, PtrTag tag, Args... args)
     759        {
     760            static_assert(is64BitType<typename FunctionTraits<OperationType>::ResultType>(), "Win64 cannot use standard call when return type is larger than 64 bits.");
    744761            setupArguments<OperationType>(args...);
    745762            return appendCallWithExceptionCheck(operation, tag);
    746763        }
     764#else // OS(WINDOWS) && CPU(X86_64)
     765        template<typename OperationType, typename... Args>
     766        MacroAssembler::Call callOperation(OperationType operation, PtrTag tag, Args... args)
     767        {
     768            setupArguments<OperationType>(args...);
     769            return appendCallWithExceptionCheck(operation, tag);
     770        }
     771#endif // OS(WINDOWS) && CPU(X86_64)
    747772
    748773        template<typename OperationType, typename... Args>
  • trunk/Source/JavaScriptCore/jit/JITOperations.h

    r229957 r229989  
    261261typedef size_t (JIT_OPERATION *S_JITOperation_EReoJss)(ExecState*, RegExpObject*, JSString*);
    262262typedef size_t (JIT_OPERATION *S_JITOperation_J)(EncodedJSValue);
    263 typedef SlowPathReturnType (JIT_OPERATION *Sprt_JITOperation_EZ)(ExecState*, int32_t);
     263typedef SlowPathReturnType (JIT_OPERATION *Sprt_JITOperation_EUi)(ExecState*, uint32_t);
    264264typedef void (JIT_OPERATION *V_JITOperation)();
    265265typedef void (JIT_OPERATION *V_JITOperation_E)(ExecState*);
Note: See TracChangeset for help on using the changeset viewer.