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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/TraceWrapperMember.h

Issue 2564153002: [wrapper-tracing] Remove unnecessary barrier (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 TraceWrapperMember_h 5 #ifndef TraceWrapperMember_h
6 #define TraceWrapperMember_h 6 #define TraceWrapperMember_h
7 7
8 #include "bindings/core/v8/ScriptWrappableVisitor.h" 8 #include "bindings/core/v8/ScriptWrappableVisitor.h"
9 #include "platform/heap/HeapAllocator.h" 9 #include "platform/heap/HeapAllocator.h"
10 10
(...skipping 10 matching lines...) Expand all
21 */ 21 */
22 template <class T> 22 template <class T>
23 class TraceWrapperMember : public Member<T> { 23 class TraceWrapperMember : public Member<T> {
24 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 24 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
25 25
26 public: 26 public:
27 TraceWrapperMember(void* parent, T* raw) : Member<T>(raw), m_parent(parent) { 27 TraceWrapperMember(void* parent, T* raw) : Member<T>(raw), m_parent(parent) {
28 #if DCHECK_IS_ON() 28 #if DCHECK_IS_ON()
29 DCHECK(!m_parent || HeapObjectHeader::fromPayload(m_parent)->checkHeader()); 29 DCHECK(!m_parent || HeapObjectHeader::fromPayload(m_parent)->checkHeader());
30 #endif 30 #endif
31 ScriptWrappableVisitor::writeBarrier(m_parent, raw); 31 // We don't require a write barrier here as TraceWrapperMember is used for
32 // the following scenarios:
33 // - Initial initialization: The write barrier will not fire as the parent
34 // is initially white.
haraken 2016/12/12 01:02:07 To guarantee this fact, you need to guarantee that
Michael Lippautz 2016/12/12 08:18:57 We (still) cannot handle this case :) We cannot ma
35 // - Wrapping when inserting into a container: The write barrier will fire
36 // upon establishing the move into the container.
37 // - Assignment to a field: The regular assignment operator will fire the
38 // write barrier.
39 // Note that support for black allocation would require a barrier here.
haraken 2016/12/12 08:44:13 Can we add a dcheck to check if m_parent is a whit
Michael Lippautz 2016/12/12 11:42:27 Unfortunately not, as we use this type also as a w
32 } 40 }
33 TraceWrapperMember(WTF::HashTableDeletedValueType x) 41 TraceWrapperMember(WTF::HashTableDeletedValueType x)
34 : Member<T>(x), m_parent(nullptr) {} 42 : Member<T>(x), m_parent(nullptr) {}
35 43
36 /** 44 /**
37 * Copying a TraceWrapperMember means that its backpointer will also be 45 * Copying a TraceWrapperMember means that its backpointer will also be
38 * copied. 46 * copied.
39 */ 47 */
40 TraceWrapperMember(const TraceWrapperMember& other) { *this = other; } 48 TraceWrapperMember(const TraceWrapperMember& other) { *this = other; }
41 49
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 b.clear(); 136 b.clear();
129 b.reserveCapacity(temp.size()); 137 b.reserveCapacity(temp.size());
130 for (auto item : temp) { 138 for (auto item : temp) {
131 b.push_back(item.get()); 139 b.push_back(item.get());
132 } 140 }
133 } 141 }
134 142
135 } // namespace blink 143 } // namespace blink
136 144
137 #endif // TraceWrapperMember_h 145 #endif // TraceWrapperMember_h
OLDNEW
« 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