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

Side by Side Diff: src/heap/objects-visiting.h

Issue 1301583003: Make heap.h usable without objects-inl.h header. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-includes-heap-3
Patch Set: Simplify scavenger dispatch. Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « src/heap/identity-map.cc ('k') | src/heap/objects-visiting-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project 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 V8_OBJECTS_VISITING_H_ 5 #ifndef V8_OBJECTS_VISITING_H_
6 #define V8_OBJECTS_VISITING_H_ 6 #define V8_OBJECTS_VISITING_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/heap/spaces.h" 9 #include "src/heap/spaces.h"
10 #include "src/layout-descriptor.h" 10 #include "src/layout-descriptor.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 public: 141 public:
142 void CopyFrom(VisitorDispatchTable* other) { 142 void CopyFrom(VisitorDispatchTable* other) {
143 // We are not using memcpy to guarantee that during update 143 // We are not using memcpy to guarantee that during update
144 // every element of callbacks_ array will remain correct 144 // every element of callbacks_ array will remain correct
145 // pointer (memcpy might be implemented as a byte copying loop). 145 // pointer (memcpy might be implemented as a byte copying loop).
146 for (int i = 0; i < StaticVisitorBase::kVisitorIdCount; i++) { 146 for (int i = 0; i < StaticVisitorBase::kVisitorIdCount; i++) {
147 base::NoBarrier_Store(&callbacks_[i], other->callbacks_[i]); 147 base::NoBarrier_Store(&callbacks_[i], other->callbacks_[i]);
148 } 148 }
149 } 149 }
150 150
151 inline Callback GetVisitor(Map* map);
152
151 inline Callback GetVisitorById(StaticVisitorBase::VisitorId id) { 153 inline Callback GetVisitorById(StaticVisitorBase::VisitorId id) {
152 return reinterpret_cast<Callback>(callbacks_[id]); 154 return reinterpret_cast<Callback>(callbacks_[id]);
153 } 155 }
154 156
155 inline Callback GetVisitor(Map* map) {
156 return reinterpret_cast<Callback>(callbacks_[map->visitor_id()]);
157 }
158
159 void Register(StaticVisitorBase::VisitorId id, Callback callback) { 157 void Register(StaticVisitorBase::VisitorId id, Callback callback) {
160 DCHECK(id < StaticVisitorBase::kVisitorIdCount); // id is unsigned. 158 DCHECK(id < StaticVisitorBase::kVisitorIdCount); // id is unsigned.
161 callbacks_[id] = reinterpret_cast<base::AtomicWord>(callback); 159 callbacks_[id] = reinterpret_cast<base::AtomicWord>(callback);
162 } 160 }
163 161
164 template <typename Visitor, StaticVisitorBase::VisitorId base, 162 template <typename Visitor, StaticVisitorBase::VisitorId base,
165 StaticVisitorBase::VisitorId generic, int object_size_in_words> 163 StaticVisitorBase::VisitorId generic, int object_size_in_words>
166 void RegisterSpecialization() { 164 void RegisterSpecialization() {
167 static const int size = object_size_in_words * kPointerSize; 165 static const int size = object_size_in_words * kPointerSize;
168 Register(StaticVisitorBase::GetVisitorIdForSize(base, generic, size, false), 166 Register(StaticVisitorBase::GetVisitorIdForSize(base, generic, size, false),
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 // the next element. Given the head of the list, this function removes dead 491 // the next element. Given the head of the list, this function removes dead
494 // elements from the list and if requested records slots for next-element 492 // elements from the list and if requested records slots for next-element
495 // pointers. The template parameter T is a WeakListVisitor that defines how to 493 // pointers. The template parameter T is a WeakListVisitor that defines how to
496 // access the next-element pointers. 494 // access the next-element pointers.
497 template <class T> 495 template <class T>
498 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); 496 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer);
499 } 497 }
500 } // namespace v8::internal 498 } // namespace v8::internal
501 499
502 #endif // V8_OBJECTS_VISITING_H_ 500 #endif // V8_OBJECTS_VISITING_H_
OLDNEW
« no previous file with comments | « src/heap/identity-map.cc ('k') | src/heap/objects-visiting-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698