OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 StaticVisitor::VisitPointers(start_slot, end_slot); | 192 StaticVisitor::VisitPointers(start_slot, end_slot); |
193 } | 193 } |
194 }; | 194 }; |
195 | 195 |
196 | 196 |
197 template<typename StaticVisitor, typename BodyDescriptor, typename ReturnType> | 197 template<typename StaticVisitor, typename BodyDescriptor, typename ReturnType> |
198 class FlexibleBodyVisitor : public BodyVisitorBase<StaticVisitor> { | 198 class FlexibleBodyVisitor : public BodyVisitorBase<StaticVisitor> { |
199 public: | 199 public: |
200 static inline ReturnType Visit(Map* map, HeapObject* object) { | 200 static inline ReturnType Visit(Map* map, HeapObject* object) { |
201 int object_size = BodyDescriptor::SizeOf(map, object); | 201 int object_size = BodyDescriptor::SizeOf(map, object); |
202 IteratePointers(object, BodyDescriptor::kStartOffset, object_size); | 202 BodyVisitorBase<StaticVisitor>::IteratePointers( |
| 203 object, BodyDescriptor::kStartOffset, object_size); |
203 return static_cast<ReturnType>(object_size); | 204 return static_cast<ReturnType>(object_size); |
204 } | 205 } |
205 | 206 |
206 template<int object_size> | 207 template<int object_size> |
207 static inline ReturnType VisitSpecialized(Map* map, HeapObject* object) { | 208 static inline ReturnType VisitSpecialized(Map* map, HeapObject* object) { |
208 ASSERT(BodyDescriptor::SizeOf(map, object) == object_size); | 209 ASSERT(BodyDescriptor::SizeOf(map, object) == object_size); |
209 IteratePointers(object, BodyDescriptor::kStartOffset, object_size); | 210 BodyVisitorBase<StaticVisitor>::IteratePointers( |
| 211 object, BodyDescriptor::kStartOffset, object_size); |
210 return static_cast<ReturnType>(object_size); | 212 return static_cast<ReturnType>(object_size); |
211 } | 213 } |
212 }; | 214 }; |
213 | 215 |
214 | 216 |
215 template<typename StaticVisitor, typename BodyDescriptor, typename ReturnType> | 217 template<typename StaticVisitor, typename BodyDescriptor, typename ReturnType> |
216 class FixedBodyVisitor : public BodyVisitorBase<StaticVisitor> { | 218 class FixedBodyVisitor : public BodyVisitorBase<StaticVisitor> { |
217 public: | 219 public: |
218 static inline ReturnType Visit(Map* map, HeapObject* object) { | 220 static inline ReturnType Visit(Map* map, HeapObject* object) { |
219 IteratePointers(object, | 221 BodyVisitorBase<StaticVisitor>::IteratePointers( |
220 BodyDescriptor::kStartOffset, | 222 object, BodyDescriptor::kStartOffset, BodyDescriptor::kEndOffset); |
221 BodyDescriptor::kEndOffset); | |
222 return static_cast<ReturnType>(BodyDescriptor::kSize); | 223 return static_cast<ReturnType>(BodyDescriptor::kSize); |
223 } | 224 } |
224 }; | 225 }; |
225 | 226 |
226 | 227 |
227 // Base class for visitors used for a linear new space iteration. | 228 // Base class for visitors used for a linear new space iteration. |
228 // IterateBody returns size of visited object. | 229 // IterateBody returns size of visited object. |
229 // Certain types of objects (i.e. Code objects) are not handled | 230 // Certain types of objects (i.e. Code objects) are not handled |
230 // by dispatch table of this visitor because they cannot appear | 231 // by dispatch table of this visitor because they cannot appear |
231 // in the new space. | 232 // in the new space. |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 380 |
380 for (; !it.done(); it.next()) { | 381 for (; !it.done(); it.next()) { |
381 it.rinfo()->template Visit<StaticVisitor>(); | 382 it.rinfo()->template Visit<StaticVisitor>(); |
382 } | 383 } |
383 } | 384 } |
384 | 385 |
385 | 386 |
386 } } // namespace v8::internal | 387 } } // namespace v8::internal |
387 | 388 |
388 #endif // V8_OBJECTS_ITERATION_H_ | 389 #endif // V8_OBJECTS_ITERATION_H_ |
OLD | NEW |