| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 } | 205 } |
| 206 }; | 206 }; |
| 207 | 207 |
| 208 | 208 |
| 209 template<typename StaticVisitor, typename BodyDescriptor, typename ReturnType> | 209 template<typename StaticVisitor, typename BodyDescriptor, typename ReturnType> |
| 210 class FlexibleBodyVisitor : public BodyVisitorBase<StaticVisitor> { | 210 class FlexibleBodyVisitor : public BodyVisitorBase<StaticVisitor> { |
| 211 public: | 211 public: |
| 212 static inline ReturnType Visit(Map* map, HeapObject* object) { | 212 static inline ReturnType Visit(Map* map, HeapObject* object) { |
| 213 int object_size = BodyDescriptor::SizeOf(map, object); | 213 int object_size = BodyDescriptor::SizeOf(map, object); |
| 214 BodyVisitorBase<StaticVisitor>::IteratePointers( | 214 BodyVisitorBase<StaticVisitor>::IteratePointers( |
| 215 map->heap(), | 215 map->GetHeap(), |
| 216 object, | 216 object, |
| 217 BodyDescriptor::kStartOffset, | 217 BodyDescriptor::kStartOffset, |
| 218 object_size); | 218 object_size); |
| 219 return static_cast<ReturnType>(object_size); | 219 return static_cast<ReturnType>(object_size); |
| 220 } | 220 } |
| 221 | 221 |
| 222 template<int object_size> | 222 template<int object_size> |
| 223 static inline ReturnType VisitSpecialized(Map* map, HeapObject* object) { | 223 static inline ReturnType VisitSpecialized(Map* map, HeapObject* object) { |
| 224 ASSERT(BodyDescriptor::SizeOf(map, object) == object_size); | 224 ASSERT(BodyDescriptor::SizeOf(map, object) == object_size); |
| 225 BodyVisitorBase<StaticVisitor>::IteratePointers( | 225 BodyVisitorBase<StaticVisitor>::IteratePointers( |
| 226 map->heap(), | 226 map->GetHeap(), |
| 227 object, | 227 object, |
| 228 BodyDescriptor::kStartOffset, | 228 BodyDescriptor::kStartOffset, |
| 229 object_size); | 229 object_size); |
| 230 return static_cast<ReturnType>(object_size); | 230 return static_cast<ReturnType>(object_size); |
| 231 } | 231 } |
| 232 }; | 232 }; |
| 233 | 233 |
| 234 | 234 |
| 235 template<typename StaticVisitor, typename BodyDescriptor, typename ReturnType> | 235 template<typename StaticVisitor, typename BodyDescriptor, typename ReturnType> |
| 236 class FixedBodyVisitor : public BodyVisitorBase<StaticVisitor> { | 236 class FixedBodyVisitor : public BodyVisitorBase<StaticVisitor> { |
| 237 public: | 237 public: |
| 238 static inline ReturnType Visit(Map* map, HeapObject* object) { | 238 static inline ReturnType Visit(Map* map, HeapObject* object) { |
| 239 BodyVisitorBase<StaticVisitor>::IteratePointers( | 239 BodyVisitorBase<StaticVisitor>::IteratePointers( |
| 240 map->heap(), | 240 map->GetHeap(), |
| 241 object, | 241 object, |
| 242 BodyDescriptor::kStartOffset, | 242 BodyDescriptor::kStartOffset, |
| 243 BodyDescriptor::kEndOffset); | 243 BodyDescriptor::kEndOffset); |
| 244 return static_cast<ReturnType>(BodyDescriptor::kSize); | 244 return static_cast<ReturnType>(BodyDescriptor::kSize); |
| 245 } | 245 } |
| 246 }; | 246 }; |
| 247 | 247 |
| 248 | 248 |
| 249 // Base class for visitors used for a linear new space iteration. | 249 // Base class for visitors used for a linear new space iteration. |
| 250 // IterateBody returns size of visited object. | 250 // IterateBody returns size of visited object. |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 | 411 |
| 412 for (; !it.done(); it.next()) { | 412 for (; !it.done(); it.next()) { |
| 413 it.rinfo()->template Visit<StaticVisitor>(heap); | 413 it.rinfo()->template Visit<StaticVisitor>(heap); |
| 414 } | 414 } |
| 415 } | 415 } |
| 416 | 416 |
| 417 | 417 |
| 418 } } // namespace v8::internal | 418 } } // namespace v8::internal |
| 419 | 419 |
| 420 #endif // V8_OBJECTS_VISITING_H_ | 420 #endif // V8_OBJECTS_VISITING_H_ |
| OLD | NEW |