Title: [135828] trunk/Source/WTF
Revision
135828
Author
aba...@webkit.org
Date
2012-11-26 23:34:15 -0800 (Mon, 26 Nov 2012)

Log Message

[Chromium] fastMalloc has an extra branch on Windows
https://bugs.webkit.org/show_bug.cgi?id=103027

Reviewed by Eric Seidel.

There's no need to override the new/delete operators on non-Mac
platform because:

1) We use the system malloc anyway.
2) We've modified the system malloc to crash in out-of-memory conditions.

This patch removes a branch (and a call) from malloc, which will
hopefully improve performance. I haven't measured the performance
characteristics of this patch, but I will look at the graphs closely
when landing.

* wtf/FastAllocBase.h:
* wtf/Platform.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (135827 => 135828)


--- trunk/Source/WTF/ChangeLog	2012-11-27 07:24:14 UTC (rev 135827)
+++ trunk/Source/WTF/ChangeLog	2012-11-27 07:34:15 UTC (rev 135828)
@@ -1,3 +1,24 @@
+2012-11-26  Adam Barth  <aba...@webkit.org>
+
+        [Chromium] fastMalloc has an extra branch on Windows
+        https://bugs.webkit.org/show_bug.cgi?id=103027
+
+        Reviewed by Eric Seidel.
+
+        There's no need to override the new/delete operators on non-Mac
+        platform because:
+
+        1) We use the system malloc anyway.
+        2) We've modified the system malloc to crash in out-of-memory conditions.
+
+        This patch removes a branch (and a call) from malloc, which will
+        hopefully improve performance. I haven't measured the performance
+        characteristics of this patch, but I will look at the graphs closely
+        when landing.
+
+        * wtf/FastAllocBase.h:
+        * wtf/Platform.h:
+
 2012-11-26  Filip Pizlo  <fpi...@apple.com>
 
         DataLog to a file should work if there are multiple processes using WTF

Modified: trunk/Source/WTF/wtf/FastAllocBase.h (135827 => 135828)


--- trunk/Source/WTF/wtf/FastAllocBase.h	2012-11-27 07:24:14 UTC (rev 135827)
+++ trunk/Source/WTF/wtf/FastAllocBase.h	2012-11-27 07:34:15 UTC (rev 135828)
@@ -93,6 +93,8 @@
 #include <wtf/StdLibExtras.h>
 #include <wtf/TypeTraits.h>
 
+#if ENABLE(PER_OBJECT_FASTMALLOC_NEW)
+
 #define WTF_MAKE_FAST_ALLOCATED \
 public: \
     void* operator new(size_t, void* p) { return p; } \
@@ -131,6 +133,14 @@
 private: \
 typedef int __thisIsHereToForceASemicolonAfterThisMacro
 
+#else // !ENABLE(PER_OBJECT_FASTMALLOC_NEW)
+
+#define WTF_MAKE_FAST_ALLOCATED \
+private: \
+typedef int __thisIsHereToForceASemicolonAfterThisMacro
+
+#endif
+
 namespace WTF {
 
     // fastNew / fastDelete

Modified: trunk/Source/WTF/wtf/Platform.h (135827 => 135828)


--- trunk/Source/WTF/wtf/Platform.h	2012-11-27 07:24:14 UTC (rev 135827)
+++ trunk/Source/WTF/wtf/Platform.h	2012-11-27 07:34:15 UTC (rev 135828)
@@ -579,15 +579,16 @@
 #endif
 
 #if PLATFORM(CHROMIUM)
-#if OS(DARWIN)
 /* We can't override the global operator new and delete on OS(DARWIN) because
- * some object are allocated by WebKit and deallocated by the embedder. */
+ * some object are allocated by WebKit and deallocated by the embedder. 
+ *
+ * On non-OS(DARWIN), the "system malloc" is actually TCMalloc anyway, so there's
+ * no need to use WebKit's copy of TCMalloc. */
 #define ENABLE_GLOBAL_FASTMALLOC_NEW 0
-#else /* !OS(DARWIN) */
-/* On non-OS(DARWIN), the "system malloc" is actually TCMalloc anyway, so there's
- * no need to use WebKit's copy of TCMalloc. */
+#if !OS(DARWIN)
+#define ENABLE_PER_OBJECT_FASTMALLOC_NEW 0
 #define USE_SYSTEM_MALLOC 1
-#endif /* OS(DARWIN) */
+#endif /* !OS(DARWIN) */
 #endif /* PLATFORM(CHROMIUM) */
 
 #if PLATFORM(IOS)
@@ -823,6 +824,10 @@
 #define ENABLE_GLOBAL_FASTMALLOC_NEW 1
 #endif
 
+#if !defined(ENABLE_PER_OBJECT_FASTMALLOC_NEW)
+#define ENABLE_PER_OBJECT_FASTMALLOC_NEW 1
+#endif
+
 #if !defined(ENABLE_PARSED_STYLE_SHEET_CACHING)
 #define ENABLE_PARSED_STYLE_SHEET_CACHING 1
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to