Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Unified Diff: third_party/WebKit/Source/platform/heap/TraceTraits.h

Issue 2643403003: Disable g++ inlining of eager-tracing mark() method. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/heap/TraceTraits.h
diff --git a/third_party/WebKit/Source/platform/heap/TraceTraits.h b/third_party/WebKit/Source/platform/heap/TraceTraits.h
index 11d4d8ce2041aefda877d924eb39adb694c33b5a..7e967449e3cd3c2365fe5137e533c236ab7c7329 100644
--- a/third_party/WebKit/Source/platform/heap/TraceTraits.h
+++ b/third_party/WebKit/Source/platform/heap/TraceTraits.h
@@ -39,6 +39,22 @@ class WeakMember;
template <typename T>
class WeakPersistent;
+// "g++ -Os" reasonably considers the mark() eager-tracing specialization
+// as an inlinable method. Its optimization pipeline will however trigger
+// unconditional uses of that inlining inside trace() methods, i.e., without
+// consideration for resulting code size, so one for each use of
+// "visitor->trace(..)". This results in an unwanted amount of extra code
+// across all trace methods. Address the issue indirectly by turning off
+// inlining for the method. See crbug.com/681991 for further details.
+//
+// TODO(sof): revisit with later g++ versions, or when g++ is no
+// longer used for production builds.
+#if !defined(__clang__) && defined(__GNUC__)
+#define NOINLINE_GXX_ONLY NOINLINE
+#else
+#define NOINLINE_GXX_ONLY
+#endif
+
template <typename T, bool = NeedsAdjustAndMark<T>::value>
class AdjustAndMarkTrait;
@@ -48,7 +64,7 @@ class AdjustAndMarkTrait<T, false> {
public:
template <typename VisitorDispatcher>
- static void mark(VisitorDispatcher visitor, const T* t) {
+ static NOINLINE_GXX_ONLY void mark(VisitorDispatcher visitor, const T* t) {
#if DCHECK_IS_ON()
assertObjectHasGCInfo(const_cast<T*>(t), GCInfoTrait<T>::index());
#endif
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698