Title: [229989] trunk/Source/_javascript_Core
Revision
229989
Author
ross.kirsl...@sony.com
Date
2018-03-26 14:41:13 -0700 (Mon, 26 Mar 2018)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (229988 => 229989)


--- trunk/Source/_javascript_Core/ChangeLog	2018-03-26 21:07:21 UTC (rev 229988)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-03-26 21:41:13 UTC (rev 229989)
@@ -1,3 +1,25 @@
+2018-03-26  Ross Kirsling  <ross.kirsl...@sony.com>
+
+        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.
+
 2018-03-26  Yusuke Suzuki  <utatane....@gmail.com>
 
         We should have SSE4 detection in the X86 MacroAssembler.

Modified: trunk/Source/_javascript_Core/jit/CCallHelpers.h (229988 => 229989)


--- trunk/Source/_javascript_Core/jit/CCallHelpers.h	2018-03-26 21:07:21 UTC (rev 229988)
+++ trunk/Source/_javascript_Core/jit/CCallHelpers.h	2018-03-26 21:41:13 UTC (rev 229989)
@@ -238,9 +238,13 @@
             return ArgCollection<numGPRArgs, numGPRSources, numFPRArgs, numFPRSources, extraPoke + 1>(*this);
         }
 
-
+#if OS(WINDOWS) && CPU(X86_64)
+        unsigned argCount(GPRReg) { return numGPRArgs + numFPRArgs; }
+        unsigned argCount(FPRReg) { return numGPRArgs + numFPRArgs; }
+#else
         unsigned argCount(GPRReg) { return numGPRArgs; }
         unsigned argCount(FPRReg) { return numFPRArgs; }
+#endif
 
         std::array<GPRReg, GPRInfo::numberOfRegisters> gprSources;
         std::array<GPRReg, GPRInfo::numberOfRegisters> gprDestinations;
@@ -287,6 +291,7 @@
     // recursion we can fill immediates.
 
 #define CURRENT_ARGUMENT_TYPE typename FunctionTraits<OperationType>::template ArgumentType<numGPRArgs + numFPRArgs>
+#define RESULT_TYPE typename FunctionTraits<OperationType>::ResultType
 
 #if USE(JSVALUE64)
 
@@ -295,7 +300,11 @@
     {
         using InfoType = InfoTypeForReg<RegType>;
         unsigned numArgRegisters = InfoType::numberOfArgumentRegisters;
+#if OS(WINDOWS) && CPU(X86_64)
+        unsigned currentArgCount = argSourceRegs.argCount(arg) + (std::is_same<RESULT_TYPE, SlowPathReturnType>::value ? 1 : 0);
+#else
         unsigned currentArgCount = argSourceRegs.argCount(arg);
+#endif
         if (currentArgCount < numArgRegisters) {
             auto updatedArgSourceRegs = argSourceRegs.pushRegArg(arg, InfoType::toArgumentRegister(currentArgCount));
             setupArgumentsImpl<OperationType>(updatedArgSourceRegs, args...);
@@ -385,9 +394,14 @@
         // gross so it's probably better to do that marshalling before the call operation...
         static_assert(!std::is_floating_point<CURRENT_ARGUMENT_TYPE>::value, "We don't support immediate floats/doubles in setupArguments");
         auto numArgRegisters = GPRInfo::numberOfArgumentRegisters;
-        if (numGPRArgs < numArgRegisters) {
+#if OS(WINDOWS) && CPU(X86_64)
+        auto currentArgCount = numGPRArgs + numFPRArgs + (std::is_same<RESULT_TYPE, SlowPathReturnType>::value ? 1 : 0);
+#else
+        auto currentArgCount = numGPRArgs;
+#endif
+        if (currentArgCount < numArgRegisters) {
             setupArgumentsImpl<OperationType>(argSourceRegs.addGPRArg(), args...);
-            move(arg, GPRInfo::toArgumentRegister(numGPRArgs));
+            move(arg, GPRInfo::toArgumentRegister(currentArgCount));
             return;
         }
 
@@ -436,6 +450,7 @@
     }
 
 #undef CURRENT_ARGUMENT_TYPE
+#undef RESULT_TYPE
 
     // Base case; set up the argument registers.
     template<typename OperationType, unsigned numGPRArgs, unsigned numGPRSources, unsigned numFPRArgs, unsigned numFPRSources, unsigned extraPoke>

Modified: trunk/Source/_javascript_Core/jit/JIT.h (229988 => 229989)


--- trunk/Source/_javascript_Core/jit/JIT.h	2018-03-26 21:07:21 UTC (rev 229988)
+++ trunk/Source/_javascript_Core/jit/JIT.h	2018-03-26 21:41:13 UTC (rev 229989)
@@ -716,7 +716,7 @@
 
         MacroAssembler::Call appendCallWithExceptionCheck(const FunctionPtr, PtrTag);
 #if OS(WINDOWS) && CPU(X86_64)
-        MacroAssembler::Call appendCallWithExceptionCheckAndSlowPathReturnType(const FunctionPtr, PtrTag = NoPtrTag);
+        MacroAssembler::Call appendCallWithExceptionCheckAndSlowPathReturnType(const FunctionPtr, PtrTag);
 #endif
         MacroAssembler::Call appendCallWithCallFrameRollbackOnException(const FunctionPtr, PtrTag);
         MacroAssembler::Call appendCallWithExceptionCheckSetJSValueResult(const FunctionPtr, PtrTag, int);
@@ -738,12 +738,37 @@
             return callOperation(operation, tag, result, args...);
         }
 
+#if OS(WINDOWS) && CPU(X86_64)
         template<typename OperationType, typename... Args>
+        std::enable_if_t<std::is_same<typename FunctionTraits<OperationType>::ResultType, SlowPathReturnType>::value, MacroAssembler::Call>
+        callOperation(OperationType operation, PtrTag tag, Args... args)
+        {
+            setupArguments<OperationType>(args...);
+            return appendCallWithExceptionCheckAndSlowPathReturnType(operation, tag);
+        }
+
+        template<typename Type>
+        static constexpr bool is64BitType() { return sizeof(Type) <= 8; }
+
+        template<>
+        static constexpr bool is64BitType<void>() { return true; }
+
+        template<typename OperationType, typename... Args>
+        std::enable_if_t<!std::is_same<typename FunctionTraits<OperationType>::ResultType, SlowPathReturnType>::value, MacroAssembler::Call>
+        callOperation(OperationType operation, PtrTag tag, Args... args)
+        {
+            static_assert(is64BitType<typename FunctionTraits<OperationType>::ResultType>(), "Win64 cannot use standard call when return type is larger than 64 bits.");
+            setupArguments<OperationType>(args...);
+            return appendCallWithExceptionCheck(operation, tag);
+        }
+#else // OS(WINDOWS) && CPU(X86_64)
+        template<typename OperationType, typename... Args>
         MacroAssembler::Call callOperation(OperationType operation, PtrTag tag, Args... args)
         {
             setupArguments<OperationType>(args...);
             return appendCallWithExceptionCheck(operation, tag);
         }
+#endif // OS(WINDOWS) && CPU(X86_64)
 
         template<typename OperationType, typename... Args>
         MacroAssembler::Call callOperation(OperationType operation, Args... args)

Modified: trunk/Source/_javascript_Core/jit/JITOperations.h (229988 => 229989)


--- trunk/Source/_javascript_Core/jit/JITOperations.h	2018-03-26 21:07:21 UTC (rev 229988)
+++ trunk/Source/_javascript_Core/jit/JITOperations.h	2018-03-26 21:41:13 UTC (rev 229989)
@@ -260,7 +260,7 @@
 typedef size_t (JIT_OPERATION *S_JITOperation_EReoJ)(ExecState*, RegExpObject*, EncodedJSValue);
 typedef size_t (JIT_OPERATION *S_JITOperation_EReoJss)(ExecState*, RegExpObject*, JSString*);
 typedef size_t (JIT_OPERATION *S_JITOperation_J)(EncodedJSValue);
-typedef SlowPathReturnType (JIT_OPERATION *Sprt_JITOperation_EZ)(ExecState*, int32_t);
+typedef SlowPathReturnType (JIT_OPERATION *Sprt_JITOperation_EUi)(ExecState*, uint32_t);
 typedef void (JIT_OPERATION *V_JITOperation)();
 typedef void (JIT_OPERATION *V_JITOperation_E)(ExecState*);
 typedef void (JIT_OPERATION *V_JITOperation_EC)(ExecState*, JSCell*);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to