[bmalloc] NSBundle-based application name check should be executed after debug-heap...
authorysuzuki@apple.com <ysuzuki@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Feb 2019 09:09:57 +0000 (09:09 +0000)
committerysuzuki@apple.com <ysuzuki@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Feb 2019 09:09:57 +0000 (09:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=194694

Reviewed by Mark Lam.

Interestingly, NSBundle allocates fair amount of memory and keeps it for a process-long time. For example, it
allocates global NSConcreteHashTable, which takes 2.5KB. This patch changes the order of gigacage-check, we
first check "Malloc=1" status, and then check the process name through NSBundle. This allows us to remove NSBundle
related allocation in JSC initialization in the system malloc mode.

* bmalloc/Gigacage.cpp:
(Gigacage::shouldBeEnabled):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241581 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/bmalloc/ChangeLog
Source/bmalloc/bmalloc/Gigacage.cpp

index 7e322ca..7ce650a 100644 (file)
@@ -1,5 +1,20 @@
 2019-02-15  Yusuke Suzuki  <ysuzuki@apple.com>
 
+        [bmalloc] NSBundle-based application name check should be executed after debug-heap environment variable check
+        https://bugs.webkit.org/show_bug.cgi?id=194694
+
+        Reviewed by Mark Lam.
+
+        Interestingly, NSBundle allocates fair amount of memory and keeps it for a process-long time. For example, it
+        allocates global NSConcreteHashTable, which takes 2.5KB. This patch changes the order of gigacage-check, we
+        first check "Malloc=1" status, and then check the process name through NSBundle. This allows us to remove NSBundle
+        related allocation in JSC initialization in the system malloc mode.
+
+        * bmalloc/Gigacage.cpp:
+        (Gigacage::shouldBeEnabled):
+
+2019-02-15  Yusuke Suzuki  <ysuzuki@apple.com>
+
         [bmalloc] Do not start scavenger thread if we use system malloc
         https://bugs.webkit.org/show_bug.cgi?id=194674
 
index bd18082..3a9c7d2 100644 (file)
@@ -267,11 +267,11 @@ bool shouldBeEnabled()
     std::call_once(
         onceFlag,
         [] {
-            if (!gigacageEnabledForProcess())
+            bool debugHeapEnabled = PerProcess<Environment>::get()->isDebugHeapEnabled();
+            if (debugHeapEnabled)
                 return;
 
-            bool result = !PerProcess<Environment>::get()->isDebugHeapEnabled();
-            if (!result)
+            if (!gigacageEnabledForProcess())
                 return;
             
             if (char* gigacageEnabled = getenv("GIGACAGE_ENABLED")) {