[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 11:26:34 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 4ee2acb02009a07cd5137927647b5ad0b724408b
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jul 23 16:24:42 2010 +0000

    2010-07-23  Patrick Gansterer  <paroga at paroga.com>
    
            Reviewed by Adam Roben.
    
            [WINCE] Implement TCSpinLock.
            https://bugs.webkit.org/show_bug.cgi?id=41792
    
            Implement the SpinLock with InterlockedExchange from the Windows API.
    
            * wtf/TCSpinLock.h:
            (TCMalloc_SpinLock::Lock):
            (TCMalloc_SpinLock::Unlock):
            (TCMalloc_SpinLock::IsHeld):
            (TCMalloc_SpinLock::Init):
            (TCMalloc_SlowLock):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63981 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index e0cd2cb..3ccd9c1 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-07-23  Patrick Gansterer  <paroga at paroga.com>
+
+        Reviewed by Adam Roben.
+
+        [WINCE] Implement TCSpinLock.
+        https://bugs.webkit.org/show_bug.cgi?id=41792
+
+        Implement the SpinLock with InterlockedExchange from the Windows API.
+
+        * wtf/TCSpinLock.h:
+        (TCMalloc_SpinLock::Lock):
+        (TCMalloc_SpinLock::Unlock):
+        (TCMalloc_SpinLock::IsHeld):
+        (TCMalloc_SpinLock::Init):
+        (TCMalloc_SlowLock):
+
 2010-07-22  Csaba Osztrogonác  <ossy at webkit.org>
 
         Unreviewed rolling out r63947 and r63948, because they broke Qt Windows build.
diff --git a/JavaScriptCore/wtf/TCSpinLock.h b/JavaScriptCore/wtf/TCSpinLock.h
index 8a73e13..240b497 100644
--- a/JavaScriptCore/wtf/TCSpinLock.h
+++ b/JavaScriptCore/wtf/TCSpinLock.h
@@ -1,4 +1,5 @@
 // Copyright (c) 2005, 2006, Google Inc.
+// Copyright (c) 2010, Patrick Gansterer <paroga at paroga.com>
 // All rights reserved.
 // 
 // Redistribution and use in source and binary forms, with or without
@@ -189,6 +190,44 @@ static void TCMalloc_SlowLock(volatile unsigned int* lockword) {
   }
 }
 
+#elif OS(WINDOWS)
+
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+
+static void TCMalloc_SlowLock(LPLONG lockword);
+
+// The following is a struct so that it can be initialized at compile time
+struct TCMalloc_SpinLock {
+
+    inline void Lock() {
+        if (InterlockedExchange(&m_lockword, 1))
+            TCMalloc_SlowLock(&m_lockword);
+    }
+
+    inline void Unlock() {
+        InterlockedExchange(&m_lockword, 0);
+    }
+
+    inline bool IsHeld() const {
+        return m_lockword != 0;
+    }
+
+    inline void Init() { m_lockword = 0; }
+
+    LONG m_lockword;
+};
+
+#define SPINLOCK_INITIALIZER { 0 }
+
+static void TCMalloc_SlowLock(LPLONG lockword) {
+    Sleep(0);        // Yield immediately since fast path failed
+    while (InterlockedExchange(lockword, 1))
+        Sleep(2);
+}
+
 #else
 
 #include <pthread.h>

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list