OLD | NEW |
1 // Copyright 2011 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 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 kVisitStruct9, | 98 kVisitStruct9, |
99 kVisitStructGeneric, | 99 kVisitStructGeneric, |
100 | 100 |
101 kVisitConsString, | 101 kVisitConsString, |
102 kVisitOddball, | 102 kVisitOddball, |
103 kVisitCode, | 103 kVisitCode, |
104 kVisitMap, | 104 kVisitMap, |
105 kVisitPropertyCell, | 105 kVisitPropertyCell, |
106 kVisitSharedFunctionInfo, | 106 kVisitSharedFunctionInfo, |
107 kVisitJSFunction, | 107 kVisitJSFunction, |
| 108 kVisitJSRegExp, |
108 | 109 |
109 kVisitorIdCount, | 110 kVisitorIdCount, |
110 kMinObjectSizeInWords = 2 | 111 kMinObjectSizeInWords = 2 |
111 }; | 112 }; |
112 | 113 |
113 // Visitor ID should fit in one byte. | 114 // Visitor ID should fit in one byte. |
114 STATIC_ASSERT(kVisitorIdCount <= 256); | 115 STATIC_ASSERT(kVisitorIdCount <= 256); |
115 | 116 |
116 // Determine which specialized visitor should be used for given instance type | 117 // Determine which specialized visitor should be used for given instance type |
117 // and instance type. | 118 // and instance type. |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 Context::ScavengeBodyDescriptor, | 294 Context::ScavengeBodyDescriptor, |
294 int>::Visit); | 295 int>::Visit); |
295 | 296 |
296 table_.Register(kVisitByteArray, &VisitByteArray); | 297 table_.Register(kVisitByteArray, &VisitByteArray); |
297 | 298 |
298 table_.Register(kVisitSharedFunctionInfo, | 299 table_.Register(kVisitSharedFunctionInfo, |
299 &FixedBodyVisitor<StaticVisitor, | 300 &FixedBodyVisitor<StaticVisitor, |
300 SharedFunctionInfo::BodyDescriptor, | 301 SharedFunctionInfo::BodyDescriptor, |
301 int>::Visit); | 302 int>::Visit); |
302 | 303 |
| 304 table_.Register(kVisitJSRegExp, &VisitJSRegExp); |
| 305 |
303 table_.Register(kVisitSeqAsciiString, &VisitSeqAsciiString); | 306 table_.Register(kVisitSeqAsciiString, &VisitSeqAsciiString); |
304 | 307 |
305 table_.Register(kVisitSeqTwoByteString, &VisitSeqTwoByteString); | 308 table_.Register(kVisitSeqTwoByteString, &VisitSeqTwoByteString); |
306 | 309 |
307 table_.Register(kVisitJSFunction, | 310 table_.Register(kVisitJSFunction, |
308 &JSObjectVisitor:: | 311 &JSObjectVisitor:: |
309 template VisitSpecialized<JSFunction::kSize>); | 312 template VisitSpecialized<JSFunction::kSize>); |
310 | 313 |
311 table_.RegisterSpecializations<DataObjectVisitor, | 314 table_.RegisterSpecializations<DataObjectVisitor, |
312 kVisitDataObject, | 315 kVisitDataObject, |
(...skipping 22 matching lines...) Expand all Loading... |
335 static inline int VisitFixedDoubleArray(Map* map, HeapObject* object) { | 338 static inline int VisitFixedDoubleArray(Map* map, HeapObject* object) { |
336 int length = reinterpret_cast<FixedDoubleArray*>(object)->length(); | 339 int length = reinterpret_cast<FixedDoubleArray*>(object)->length(); |
337 return FixedDoubleArray::SizeFor(length); | 340 return FixedDoubleArray::SizeFor(length); |
338 } | 341 } |
339 | 342 |
340 static inline int VisitSeqAsciiString(Map* map, HeapObject* object) { | 343 static inline int VisitSeqAsciiString(Map* map, HeapObject* object) { |
341 return SeqAsciiString::cast(object)-> | 344 return SeqAsciiString::cast(object)-> |
342 SeqAsciiStringSize(map->instance_type()); | 345 SeqAsciiStringSize(map->instance_type()); |
343 } | 346 } |
344 | 347 |
| 348 static inline int VisitJSRegExp(Map* map, HeapObject* object) { |
| 349 return JSObjectVisitor::Visit(map, object); |
| 350 } |
| 351 |
345 static inline int VisitSeqTwoByteString(Map* map, HeapObject* object) { | 352 static inline int VisitSeqTwoByteString(Map* map, HeapObject* object) { |
346 return SeqTwoByteString::cast(object)-> | 353 return SeqTwoByteString::cast(object)-> |
347 SeqTwoByteStringSize(map->instance_type()); | 354 SeqTwoByteStringSize(map->instance_type()); |
348 } | 355 } |
349 | 356 |
350 class DataObjectVisitor { | 357 class DataObjectVisitor { |
351 public: | 358 public: |
352 template<int object_size> | 359 template<int object_size> |
353 static inline int VisitSpecialized(Map* map, HeapObject* object) { | 360 static inline int VisitSpecialized(Map* map, HeapObject* object) { |
354 return object_size; | 361 return object_size; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 | 430 |
424 for (; !it.done(); it.next()) { | 431 for (; !it.done(); it.next()) { |
425 it.rinfo()->template Visit<StaticVisitor>(heap); | 432 it.rinfo()->template Visit<StaticVisitor>(heap); |
426 } | 433 } |
427 } | 434 } |
428 | 435 |
429 | 436 |
430 } } // namespace v8::internal | 437 } } // namespace v8::internal |
431 | 438 |
432 #endif // V8_OBJECTS_VISITING_H_ | 439 #endif // V8_OBJECTS_VISITING_H_ |
OLD | NEW |