OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef TraceTraits_h | 5 #ifndef TraceTraits_h |
6 #define TraceTraits_h | 6 #define TraceTraits_h |
7 | 7 |
8 #include "platform/heap/GCInfo.h" | 8 #include "platform/heap/GCInfo.h" |
9 #include "platform/heap/Heap.h" | 9 #include "platform/heap/Heap.h" |
10 #include "platform/heap/InlinedGlobalMarkingVisitor.h" | 10 #include "platform/heap/InlinedGlobalMarkingVisitor.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 class Member; | 32 class Member; |
33 template <typename T> | 33 template <typename T> |
34 class TraceEagerlyTrait; | 34 class TraceEagerlyTrait; |
35 template <typename T> | 35 template <typename T> |
36 class TraceTrait; | 36 class TraceTrait; |
37 template <typename T> | 37 template <typename T> |
38 class WeakMember; | 38 class WeakMember; |
39 template <typename T> | 39 template <typename T> |
40 class WeakPersistent; | 40 class WeakPersistent; |
41 | 41 |
| 42 // "g++ -Os" reasonably considers the mark() eager-tracing specialization |
| 43 // as an inlinable method. Its optimization pipeline will however trigger |
| 44 // unconditional uses of that inlining inside trace() methods, i.e., without |
| 45 // consideration for resulting code size, so one for each use of |
| 46 // "visitor->trace(..)". This results in an unwanted amount of extra code |
| 47 // across all trace methods. Address the issue indirectly by turning off |
| 48 // inlining for the method. See crbug.com/681991 for further details. |
| 49 // |
| 50 // TODO(sof): revisit with later g++ versions, or when g++ is no |
| 51 // longer used for production builds. |
| 52 #if !defined(__clang__) && defined(__GNUC__) |
| 53 #define NOINLINE_GXX_ONLY NOINLINE |
| 54 #else |
| 55 #define NOINLINE_GXX_ONLY |
| 56 #endif |
| 57 |
42 template <typename T, bool = NeedsAdjustAndMark<T>::value> | 58 template <typename T, bool = NeedsAdjustAndMark<T>::value> |
43 class AdjustAndMarkTrait; | 59 class AdjustAndMarkTrait; |
44 | 60 |
45 template <typename T> | 61 template <typename T> |
46 class AdjustAndMarkTrait<T, false> { | 62 class AdjustAndMarkTrait<T, false> { |
47 STATIC_ONLY(AdjustAndMarkTrait); | 63 STATIC_ONLY(AdjustAndMarkTrait); |
48 | 64 |
49 public: | 65 public: |
50 template <typename VisitorDispatcher> | 66 template <typename VisitorDispatcher> |
51 static void mark(VisitorDispatcher visitor, const T* t) { | 67 static NOINLINE_GXX_ONLY void mark(VisitorDispatcher visitor, const T* t) { |
52 #if DCHECK_IS_ON() | 68 #if DCHECK_IS_ON() |
53 assertObjectHasGCInfo(const_cast<T*>(t), GCInfoTrait<T>::index()); | 69 assertObjectHasGCInfo(const_cast<T*>(t), GCInfoTrait<T>::index()); |
54 #endif | 70 #endif |
55 // Default mark method of the trait just calls the two-argument mark | 71 // Default mark method of the trait just calls the two-argument mark |
56 // method on the visitor. The second argument is the static trace method | 72 // method on the visitor. The second argument is the static trace method |
57 // of the trait, which by default calls the instance method | 73 // of the trait, which by default calls the instance method |
58 // trace(Visitor*) on the object. | 74 // trace(Visitor*) on the object. |
59 // | 75 // |
60 // If the trait allows it, invoke the trace callback right here on the | 76 // If the trait allows it, invoke the trace callback right here on the |
61 // not-yet-marked object. | 77 // not-yet-marked object. |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 // since iterating over the hash table backing will find the whole | 807 // since iterating over the hash table backing will find the whole |
792 // chain. | 808 // chain. |
793 visitor->markNoTracing(node); | 809 visitor->markNoTracing(node); |
794 return false; | 810 return false; |
795 } | 811 } |
796 }; | 812 }; |
797 | 813 |
798 } // namespace WTF | 814 } // namespace WTF |
799 | 815 |
800 #endif | 816 #endif |
OLD | NEW |