Title: [220148] trunk/Source
Revision
220148
Author
[email protected]
Date
2017-08-02 12:57:50 -0700 (Wed, 02 Aug 2017)

Log Message

We should be OK with the gigacage being disabled on gmalloc
https://bugs.webkit.org/show_bug.cgi?id=175082

Reviewed by Michael Saboff.
Source/bmalloc:

        
This adds Gigacage::shouldBeEnabled(), which returns false when we're using gmalloc or other things
that enable DebugHeap.

* bmalloc/Environment.cpp:
(bmalloc::Environment::Environment):
* bmalloc/Environment.h:
* bmalloc/Gigacage.cpp:
(Gigacage::ensureGigacage):
(Gigacage::shouldBeEnabled):
* bmalloc/Gigacage.h:
* bmalloc/Heap.cpp:
(bmalloc::Heap::Heap):
* bmalloc/Heap.h:

Source/_javascript_Core:


* jsc.cpp:
(jscmain):

Source/WebKit:


* WebProcess/WebProcess.cpp:
(WebKit::m_webSQLiteDatabaseTracker):

Source/WTF:


* wtf/Gigacage.h:
(Gigacage::shouldBeEnabled):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (220147 => 220148)


--- trunk/Source/_javascript_Core/ChangeLog	2017-08-02 18:35:22 UTC (rev 220147)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-08-02 19:57:50 UTC (rev 220148)
@@ -1,3 +1,13 @@
+2017-08-02  Filip Pizlo  <[email protected]>
+
+        We should be OK with the gigacage being disabled on gmalloc
+        https://bugs.webkit.org/show_bug.cgi?id=175082
+
+        Reviewed by Michael Saboff.
+
+        * jsc.cpp:
+        (jscmain):
+
 2017-08-02  Saam Barati  <[email protected]>
 
         On memory-constrained iOS devices, reduce the rate at which the JS heap grows before a GC to try to keep more memory available for the system

Modified: trunk/Source/_javascript_Core/jsc.cpp (220147 => 220148)


--- trunk/Source/_javascript_Core/jsc.cpp	2017-08-02 18:35:22 UTC (rev 220147)
+++ trunk/Source/_javascript_Core/jsc.cpp	2017-08-02 19:57:50 UTC (rev 220148)
@@ -3826,7 +3826,7 @@
 #if ENABLE(WEBASSEMBLY)
     JSC::Wasm::enableFastMemory();
 #endif
-    if (GIGACAGE_ENABLED)
+    if (Gigacage::shouldBeEnabled())
         Gigacage::addDisableCallback(gigacageDisabled, nullptr);
 
     int result;

Modified: trunk/Source/WTF/ChangeLog (220147 => 220148)


--- trunk/Source/WTF/ChangeLog	2017-08-02 18:35:22 UTC (rev 220147)
+++ trunk/Source/WTF/ChangeLog	2017-08-02 19:57:50 UTC (rev 220148)
@@ -1,3 +1,13 @@
+2017-08-02  Filip Pizlo  <[email protected]>
+
+        We should be OK with the gigacage being disabled on gmalloc
+        https://bugs.webkit.org/show_bug.cgi?id=175082
+
+        Reviewed by Michael Saboff.
+
+        * wtf/Gigacage.h:
+        (Gigacage::shouldBeEnabled):
+
 2017-08-01  Filip Pizlo  <[email protected]>
 
         Bmalloc and GC should put auxiliaries (butterflies, typed array backing stores) in a gigacage (separate multi-GB VM region)

Modified: trunk/Source/WTF/wtf/Gigacage.h (220147 => 220148)


--- trunk/Source/WTF/wtf/Gigacage.h	2017-08-02 18:35:22 UTC (rev 220147)
+++ trunk/Source/WTF/wtf/Gigacage.h	2017-08-02 19:57:50 UTC (rev 220148)
@@ -39,6 +39,7 @@
 
 inline void ensureGigacage() { }
 inline void disableGigacage() { }
+inline bool shouldBeEnabled() { return false; }
 
 inline void addDisableCallback(void (*)(void*), void*) { }
 inline void removeDisableCallback(void (*)(void*), void*) { }

Modified: trunk/Source/WebKit/ChangeLog (220147 => 220148)


--- trunk/Source/WebKit/ChangeLog	2017-08-02 18:35:22 UTC (rev 220147)
+++ trunk/Source/WebKit/ChangeLog	2017-08-02 19:57:50 UTC (rev 220148)
@@ -1,3 +1,13 @@
+2017-08-02  Filip Pizlo  <[email protected]>
+
+        We should be OK with the gigacage being disabled on gmalloc
+        https://bugs.webkit.org/show_bug.cgi?id=175082
+
+        Reviewed by Michael Saboff.
+
+        * WebProcess/WebProcess.cpp:
+        (WebKit::m_webSQLiteDatabaseTracker):
+
 2017-08-02  Brian Burg  <[email protected]>
 
         Web Automation: files selected for upload should be checked against values of the 'accept' attribute

Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (220147 => 220148)


--- trunk/Source/WebKit/WebProcess/WebProcess.cpp	2017-08-02 18:35:22 UTC (rev 220147)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp	2017-08-02 19:57:50 UTC (rev 220148)
@@ -202,7 +202,7 @@
         parentProcessConnection()->send(Messages::WebResourceLoadStatisticsStore::ResourceLoadStatisticsUpdated(WTFMove(statistics)), 0);
     });
 
-    if (GIGACAGE_ENABLED)
+    if (Gigacage::shouldBeEnabled())
         Gigacage::addDisableCallback(gigacageDisabled, nullptr);
 }
 

Modified: trunk/Source/bmalloc/ChangeLog (220147 => 220148)


--- trunk/Source/bmalloc/ChangeLog	2017-08-02 18:35:22 UTC (rev 220147)
+++ trunk/Source/bmalloc/ChangeLog	2017-08-02 19:57:50 UTC (rev 220148)
@@ -1,3 +1,24 @@
+2017-08-02  Filip Pizlo  <[email protected]>
+
+        We should be OK with the gigacage being disabled on gmalloc
+        https://bugs.webkit.org/show_bug.cgi?id=175082
+
+        Reviewed by Michael Saboff.
+        
+        This adds Gigacage::shouldBeEnabled(), which returns false when we're using gmalloc or other things
+        that enable DebugHeap.
+
+        * bmalloc/Environment.cpp:
+        (bmalloc::Environment::Environment):
+        * bmalloc/Environment.h:
+        * bmalloc/Gigacage.cpp:
+        (Gigacage::ensureGigacage):
+        (Gigacage::shouldBeEnabled):
+        * bmalloc/Gigacage.h:
+        * bmalloc/Heap.cpp:
+        (bmalloc::Heap::Heap):
+        * bmalloc/Heap.h:
+
 2017-08-01  Filip Pizlo  <[email protected]>
 
         Bmalloc and GC should put auxiliaries (butterflies, typed array backing stores) in a gigacage (separate multi-GB VM region)

Modified: trunk/Source/bmalloc/bmalloc/Environment.cpp (220147 => 220148)


--- trunk/Source/bmalloc/bmalloc/Environment.cpp	2017-08-02 18:35:22 UTC (rev 220147)
+++ trunk/Source/bmalloc/bmalloc/Environment.cpp	2017-08-02 19:57:50 UTC (rev 220148)
@@ -107,7 +107,7 @@
 #endif
 }
 
-Environment::Environment()
+Environment::Environment(std::lock_guard<StaticMutex>&)
     : m_isDebugHeapEnabled(computeIsDebugHeapEnabled())
 {
 }

Modified: trunk/Source/bmalloc/bmalloc/Environment.h (220147 => 220148)


--- trunk/Source/bmalloc/bmalloc/Environment.h	2017-08-02 18:35:22 UTC (rev 220147)
+++ trunk/Source/bmalloc/bmalloc/Environment.h	2017-08-02 19:57:50 UTC (rev 220148)
@@ -26,11 +26,13 @@
 #ifndef Environment_h
 #define Environment_h
 
+#include "StaticMutex.h"
+
 namespace bmalloc {
 
 class Environment {
 public:
-    Environment();
+    Environment(std::lock_guard<StaticMutex>&);
     
     bool isDebugHeapEnabled() { return m_isDebugHeapEnabled; }
 

Modified: trunk/Source/bmalloc/bmalloc/Gigacage.cpp (220147 => 220148)


--- trunk/Source/bmalloc/bmalloc/Gigacage.cpp	2017-08-02 18:35:22 UTC (rev 220147)
+++ trunk/Source/bmalloc/bmalloc/Gigacage.cpp	2017-08-02 19:57:50 UTC (rev 220148)
@@ -25,6 +25,7 @@
 
 #include "Gigacage.h"
 
+#include "Environment.h"
 #include "PerProcess.h"
 #include "VMAllocate.h"
 #include "Vector.h"
@@ -65,6 +66,9 @@
     std::call_once(
         onceFlag,
         [] {
+            if (!shouldBeEnabled())
+                return;
+            
             void* basePtr = tryVMAllocate(GIGACAGE_SIZE, GIGACAGE_SIZE + GIGACAGE_RUNWAY);
             if (!basePtr)
                 return;
@@ -121,6 +125,11 @@
     }
 }
 
+bool shouldBeEnabled()
+{
+    return GIGACAGE_ENABLED && !PerProcess<Environment>::get()->isDebugHeapEnabled();
+}
+
 } // namespace Gigacage
 
 

Modified: trunk/Source/bmalloc/bmalloc/Gigacage.h (220147 => 220148)


--- trunk/Source/bmalloc/bmalloc/Gigacage.h	2017-08-02 18:35:22 UTC (rev 220147)
+++ trunk/Source/bmalloc/bmalloc/Gigacage.h	2017-08-02 19:57:50 UTC (rev 220148)
@@ -71,6 +71,8 @@
     return caged(ptr) == ptr;
 }
 
+BEXPORT bool shouldBeEnabled();
+
 } // namespace Gigacage
 
 

Modified: trunk/Source/bmalloc/bmalloc/Heap.cpp (220147 => 220148)


--- trunk/Source/bmalloc/bmalloc/Heap.cpp	2017-08-02 18:35:22 UTC (rev 220147)
+++ trunk/Source/bmalloc/bmalloc/Heap.cpp	2017-08-02 19:57:50 UTC (rev 220148)
@@ -28,6 +28,7 @@
 #include "AvailableMemory.h"
 #include "BumpAllocator.h"
 #include "Chunk.h"
+#include "Environment.h"
 #include "Gigacage.h"
 #include "DebugHeap.h"
 #include "PerProcess.h"
@@ -52,7 +53,7 @@
     initializeLineMetadata();
     initializePageMetadata();
     
-    if (m_environment.isDebugHeapEnabled())
+    if (PerProcess<Environment>::get()->isDebugHeapEnabled())
         m_debugHeap = PerProcess<DebugHeap>::get();
     else {
         Gigacage::ensureGigacage();

Modified: trunk/Source/bmalloc/bmalloc/Heap.h (220147 => 220148)


--- trunk/Source/bmalloc/bmalloc/Heap.h	2017-08-02 18:35:22 UTC (rev 220147)
+++ trunk/Source/bmalloc/bmalloc/Heap.h	2017-08-02 19:57:50 UTC (rev 220148)
@@ -30,7 +30,6 @@
 #include "AsyncTask.h"
 #include "BumpRange.h"
 #include "Chunk.h"
-#include "Environment.h"
 #include "HeapKind.h"
 #include "LargeMap.h"
 #include "LineMetadata.h"
@@ -136,7 +135,6 @@
     
     AsyncTask<Heap, decltype(&Heap::concurrentScavenge)> m_scavenger;
 
-    Environment m_environment;
     DebugHeap* m_debugHeap;
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to