Gardening: Speculative build fix for Windows.
authormark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Apr 2018 22:59:04 +0000 (22:59 +0000)
committermark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Apr 2018 22:59:04 +0000 (22:59 +0000)
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: https://svn.webkit.org/repository/webkit/trunk@231079 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/JSCPtrTag.h
Source/WTF/ChangeLog
Source/WTF/wtf/PtrTag.h
Source/WebCore/ChangeLog
Source/WebCore/cssjit/CSSPtrTag.h

index 1cc49cf..fda2860 100644 (file)
@@ -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.
index 642ab6a..a8f6d22 100644 (file)
@@ -53,7 +53,16 @@ using PtrTag = WTF::PtrTag;
     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
 
index 586565e..6cb0c0e 100644 (file)
@@ -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
index a41a86f..04b63a7 100644 (file)
@@ -48,16 +48,9 @@ enum PtrTag : uintptr_t {
 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 @@ constexpr uintptr_t makePtrTagHash(const char (&str)[N])
 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>"; }
index 55f21ac..f80c07f 100644 (file)
@@ -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
index 71e2b5d..78d0e83 100644 (file)
@@ -35,8 +35,17 @@ namespace WebCore {
     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)