Gardening: Speculative build fix for Windows.
https://bugs.webkit.org/show_bug.cgi?id=184976
<rdar://problem/39723901>

Not reviewed.

Source/JavaScriptCore:

* runtime/JSCPtrTag.h:

Source/WebCore:

* cssjit/CSSPtrTag.h:

Source/WTF:

* wtf/PtrTag.h:
(WTF::makePtrTagHash): Undo last speculative build fix that did not work for 64-bit.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@231079 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
index 1cc49cf..fda2860 100644
--- a/Source/JavaScriptCore/ChangeLog
+++ b/Source/JavaScriptCore/ChangeLog
@@ -1,5 +1,15 @@
 2018-04-26  Mark Lam  <mark.lam@apple.com>
 
+        Gardening: Speculative build fix for Windows.
+        https://bugs.webkit.org/show_bug.cgi?id=184976
+        <rdar://problem/39723901>
+
+        Not reviewed.
+
+        * runtime/JSCPtrTag.h:
+
+2018-04-26  Mark Lam  <mark.lam@apple.com>
+
         Gardening: Windows build fix.
 
         Not reviewed.
diff --git a/Source/JavaScriptCore/runtime/JSCPtrTag.h b/Source/JavaScriptCore/runtime/JSCPtrTag.h
index 642ab6a..a8f6d22 100644
--- a/Source/JavaScriptCore/runtime/JSCPtrTag.h
+++ b/Source/JavaScriptCore/runtime/JSCPtrTag.h
@@ -53,7 +53,16 @@
     v(YarrMatchOnly16BitPtrTag) \
     v(YarrBacktrackPtrTag) \
 
+#if COMPILER(MSVC)
+#pragma warning(push)
+#pragma warning(disable:4307)
+#endif
+
 FOR_EACH_JSC_PTRTAG(WTF_DECLARE_PTRTAG)
 
+#if COMPILER(MSVC)
+#pragma warning(pop)
+#endif
+
 } // namespace JSC
 
diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog
index 586565e..6cb0c0e 100644
--- a/Source/WTF/ChangeLog
+++ b/Source/WTF/ChangeLog
@@ -1,3 +1,14 @@
+2018-04-26  Mark Lam  <mark.lam@apple.com>
+
+        Gardening: Speculative build fix for Windows.
+        https://bugs.webkit.org/show_bug.cgi?id=184976
+        <rdar://problem/39723901>
+
+        Not reviewed.
+
+        * wtf/PtrTag.h:
+        (WTF::makePtrTagHash): Undo last speculative build fix that did not work for 64-bit.
+
 2018-04-26  Andy VanWagoner  <thetalecrafter@gmail.com>
 
         [INTL] Implement Intl.PluralRules
diff --git a/Source/WTF/wtf/PtrTag.h b/Source/WTF/wtf/PtrTag.h
index a41a86f..04b63a7 100644
--- a/Source/WTF/wtf/PtrTag.h
+++ b/Source/WTF/wtf/PtrTag.h
@@ -48,16 +48,9 @@
 template<size_t N>
 constexpr uintptr_t makePtrTagHash(const char (&str)[N])
 {
-    // The only reason for the following dance with casting to result64Bit and
-    // back is because, on 32-bit, MSVC will complain about "C4307: integral
-    // constant overflow" but not allow us to disable the warning for all clients
-    // of this function.
     uintptr_t result = 134775813;
-    for (size_t i = 0; i < N; ++i) {
-        uint64_t result64Bit = static_cast<uint64_t>(result);
-        result64Bit += ((result64Bit * str[i]) ^ (result64Bit >> 16));
-        result = static_cast<uintptr_t>(result64Bit);
-    }
+    for (size_t i = 0; i < N; ++i)
+        result += ((result * str[i]) ^ (result >> 16));
     return result & 0xffff;
 }
 
@@ -71,8 +64,17 @@
 static_assert(static_cast<uintptr_t>(NoPtrTag) == static_cast<uintptr_t>(0), "");
 static_assert(static_cast<uintptr_t>(CFunctionPtrTag) == static_cast<uintptr_t>(1), "");
 
+#if COMPILER(MSVC)
+#pragma warning(push)
+#pragma warning(disable:4307)
+#endif
+
 FOR_EACH_ADDITIONAL_WTF_PTRTAG(WTF_DECLARE_PTRTAG)
 
+#if COMPILER(MSVC)
+#pragma warning(pop)
+#endif
+
 #if !USE(POINTER_PROFILING)
 
 inline const char* tagForPtr(const void*) { return "<no tag>"; }
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 55f21ac..f80c07f 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,13 @@
+2018-04-26  Mark Lam  <mark.lam@apple.com>
+
+        Gardening: Speculative build fix for Windows.
+        https://bugs.webkit.org/show_bug.cgi?id=184976
+        <rdar://problem/39723901>
+
+        Not reviewed.
+
+        * cssjit/CSSPtrTag.h:
+
 2018-04-26  Brent Fulgham  <bfulgham@apple.com>
 
         Show punycode if URL contains Latin small letter o with dot below character
diff --git a/Source/WebCore/cssjit/CSSPtrTag.h b/Source/WebCore/cssjit/CSSPtrTag.h
index 71e2b5d..78d0e83 100644
--- a/Source/WebCore/cssjit/CSSPtrTag.h
+++ b/Source/WebCore/cssjit/CSSPtrTag.h
@@ -35,8 +35,17 @@
     v(CSSSelectorPtrTag) \
     v(CSSOperationPtrTag) \
 
+#if COMPILER(MSVC)
+#pragma warning(push)
+#pragma warning(disable:4307)
+#endif
+
 FOR_EACH_CSS_PTRTAG(WTF_DECLARE_PTRTAG)
 
+#if COMPILER(MSVC)
+#pragma warning(pop)
+#endif
+
 } // namespace WebCore
 
 #endif // ENABLE(CSS_SELECTOR_JIT)