Title: [276486] trunk/Source/_javascript_Core
Revision
276486
Author
[email protected]
Date
2021-04-22 22:16:59 -0700 (Thu, 22 Apr 2021)

Log Message

[JSC][Win] callOperationNoExceptionCheck() also needs to support operations that return SlowPathReturnType
https://bugs.webkit.org/show_bug.cgi?id=224964

Reviewed by Yusuke Suzuki.

r229989 (Bug 183655) added the x64 Windows support only for
callOperation(), but for callOperationNoExceptionCheck().
callOperationNoExceptionCheck() also needs the x64 Windows
support.

This change is a preparation for Bug 224920 that is going to use
callOperationNoExceptionCheck instead of callOperation.

* jit/JIT.h:
(callOperation): Rewrote by using 'if constexpr' instead of SFINAE.
(callOperationNoExceptionCheck): Added a new implementation for
x64 Windows based on callOperation.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (276485 => 276486)


--- trunk/Source/_javascript_Core/ChangeLog	2021-04-23 05:06:43 UTC (rev 276485)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-04-23 05:16:59 UTC (rev 276486)
@@ -1,3 +1,23 @@
+2021-04-22  Fujii Hironori  <[email protected]>
+
+        [JSC][Win] callOperationNoExceptionCheck() also needs to support operations that return SlowPathReturnType
+        https://bugs.webkit.org/show_bug.cgi?id=224964
+
+        Reviewed by Yusuke Suzuki.
+
+        r229989 (Bug 183655) added the x64 Windows support only for
+        callOperation(), but for callOperationNoExceptionCheck().
+        callOperationNoExceptionCheck() also needs the x64 Windows
+        support.
+
+        This change is a preparation for Bug 224920 that is going to use
+        callOperationNoExceptionCheck instead of callOperation.
+
+        * jit/JIT.h:
+        (callOperation): Rewrote by using 'if constexpr' instead of SFINAE.
+        (callOperationNoExceptionCheck): Added a new implementation for
+        x64 Windows based on callOperation.
+
 2021-04-22  Commit Queue  <[email protected]>
 
         Unreviewed, reverting r276456.

Modified: trunk/Source/_javascript_Core/jit/JIT.h (276485 => 276486)


--- trunk/Source/_javascript_Core/jit/JIT.h	2021-04-23 05:06:43 UTC (rev 276485)
+++ trunk/Source/_javascript_Core/jit/JIT.h	2021-04-23 05:16:59 UTC (rev 276486)
@@ -824,32 +824,18 @@
         }
 
 #if OS(WINDOWS) && CPU(X86_64)
+        template<typename Type> static constexpr bool is64BitType = sizeof(Type) <= 8;
+        template<> static constexpr bool is64BitType<void> = true;
+
         template<typename OperationType, typename... Args>
-        std::enable_if_t<std::is_same<typename FunctionTraits<OperationType>::ResultType, SlowPathReturnType>::value, MacroAssembler::Call>
-        callOperation(OperationType operation, Args... args)
+        MacroAssembler::Call callOperation(OperationType operation, Args... args)
         {
             setupArguments<OperationType>(args...);
+            // x64 Windows cannot use standard call when the return type is larger than 64 bits.
+            if constexpr (is64BitType<typename FunctionTraits<OperationType>::ResultType>)
+                return appendCallWithExceptionCheck(operation);
             return appendCallWithExceptionCheckAndSlowPathReturnType(operation);
         }
-
-        template<typename Type>
-        struct is64BitType {
-            static constexpr bool value = sizeof(Type) <= 8;
-        };
-
-        template<>
-        struct is64BitType<void> {
-            static constexpr bool value = true;
-        };
-
-        template<typename OperationType, typename... Args>
-        std::enable_if_t<!std::is_same<typename FunctionTraits<OperationType>::ResultType, SlowPathReturnType>::value, MacroAssembler::Call>
-        callOperation(OperationType operation, Args... args)
-        {
-            static_assert(is64BitType<typename FunctionTraits<OperationType>::ResultType>::value, "Win64 cannot use standard call when return type is larger than 64 bits.");
-            setupArguments<OperationType>(args...);
-            return appendCallWithExceptionCheck(operation);
-        }
 #else // OS(WINDOWS) && CPU(X86_64)
         template<typename OperationType, typename... Args>
         MacroAssembler::Call callOperation(OperationType operation, Args... args)
@@ -876,13 +862,26 @@
             return result;
         }
 
+#if OS(WINDOWS) && CPU(X86_64)
         template<typename OperationType, typename... Args>
         MacroAssembler::Call callOperationNoExceptionCheck(OperationType operation, Args... args)
         {
             setupArguments<OperationType>(args...);
             updateTopCallFrame();
+            // x64 Windows cannot use standard call when the return type is larger than 64 bits.
+            if constexpr (is64BitType<typename FunctionTraits<OperationType>::ResultType>)
+                return appendCall(operation);
+            return appendCallWithSlowPathReturnType(operation);
+        }
+#else
+        template<typename OperationType, typename... Args>
+        MacroAssembler::Call callOperationNoExceptionCheck(OperationType operation, Args... args)
+        {
+            setupArguments<OperationType>(args...);
+            updateTopCallFrame();
             return appendCall(operation);
         }
+#endif // OS(WINDOWS) && CPU(X86_64)
 
         template<typename OperationType, typename... Args>
         MacroAssembler::Call callOperationWithCallFrameRollbackOnException(OperationType operation, Args... args)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to