| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 kVisitStruct9, | 97 kVisitStruct9, |
| 98 kVisitStructGeneric, | 98 kVisitStructGeneric, |
| 99 | 99 |
| 100 kVisitConsString, | 100 kVisitConsString, |
| 101 kVisitOddball, | 101 kVisitOddball, |
| 102 kVisitCode, | 102 kVisitCode, |
| 103 kVisitMap, | 103 kVisitMap, |
| 104 kVisitPropertyCell, | 104 kVisitPropertyCell, |
| 105 kVisitSharedFunctionInfo, | 105 kVisitSharedFunctionInfo, |
| 106 kVisitJSFunction, | 106 kVisitJSFunction, |
| 107 kVisitJSRegExp, |
| 107 | 108 |
| 108 kVisitorIdCount, | 109 kVisitorIdCount, |
| 109 kMinObjectSizeInWords = 2 | 110 kMinObjectSizeInWords = 2 |
| 110 }; | 111 }; |
| 111 | 112 |
| 112 // Visitor ID should fit in one byte. | 113 // Visitor ID should fit in one byte. |
| 113 STATIC_ASSERT(kVisitorIdCount <= 256); | 114 STATIC_ASSERT(kVisitorIdCount <= 256); |
| 114 | 115 |
| 115 // Determine which specialized visitor should be used for given instance type | 116 // Determine which specialized visitor should be used for given instance type |
| 116 // and instance type. | 117 // and instance type. |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 Context::ScavengeBodyDescriptor, | 291 Context::ScavengeBodyDescriptor, |
| 291 int>::Visit); | 292 int>::Visit); |
| 292 | 293 |
| 293 table_.Register(kVisitByteArray, &VisitByteArray); | 294 table_.Register(kVisitByteArray, &VisitByteArray); |
| 294 | 295 |
| 295 table_.Register(kVisitSharedFunctionInfo, | 296 table_.Register(kVisitSharedFunctionInfo, |
| 296 &FixedBodyVisitor<StaticVisitor, | 297 &FixedBodyVisitor<StaticVisitor, |
| 297 SharedFunctionInfo::BodyDescriptor, | 298 SharedFunctionInfo::BodyDescriptor, |
| 298 int>::Visit); | 299 int>::Visit); |
| 299 | 300 |
| 301 table_.Register(kVisitJSRegExp, &VisitJSRegExp); |
| 302 |
| 300 table_.Register(kVisitSeqAsciiString, &VisitSeqAsciiString); | 303 table_.Register(kVisitSeqAsciiString, &VisitSeqAsciiString); |
| 301 | 304 |
| 302 table_.Register(kVisitSeqTwoByteString, &VisitSeqTwoByteString); | 305 table_.Register(kVisitSeqTwoByteString, &VisitSeqTwoByteString); |
| 303 | 306 |
| 304 table_.Register(kVisitJSFunction, | 307 table_.Register(kVisitJSFunction, |
| 305 &JSObjectVisitor:: | 308 &JSObjectVisitor:: |
| 306 template VisitSpecialized<JSFunction::kSize>); | 309 template VisitSpecialized<JSFunction::kSize>); |
| 307 | 310 |
| 308 table_.RegisterSpecializations<DataObjectVisitor, | 311 table_.RegisterSpecializations<DataObjectVisitor, |
| 309 kVisitDataObject, | 312 kVisitDataObject, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 327 private: | 330 private: |
| 328 static inline int VisitByteArray(Map* map, HeapObject* object) { | 331 static inline int VisitByteArray(Map* map, HeapObject* object) { |
| 329 return reinterpret_cast<ByteArray*>(object)->ByteArraySize(); | 332 return reinterpret_cast<ByteArray*>(object)->ByteArraySize(); |
| 330 } | 333 } |
| 331 | 334 |
| 332 static inline int VisitSeqAsciiString(Map* map, HeapObject* object) { | 335 static inline int VisitSeqAsciiString(Map* map, HeapObject* object) { |
| 333 return SeqAsciiString::cast(object)-> | 336 return SeqAsciiString::cast(object)-> |
| 334 SeqAsciiStringSize(map->instance_type()); | 337 SeqAsciiStringSize(map->instance_type()); |
| 335 } | 338 } |
| 336 | 339 |
| 340 static inline int VisitJSRegExp(Map* map, HeapObject* object) { |
| 341 return JSObjectVisitor::Visit(map, object); |
| 342 } |
| 343 |
| 337 static inline int VisitSeqTwoByteString(Map* map, HeapObject* object) { | 344 static inline int VisitSeqTwoByteString(Map* map, HeapObject* object) { |
| 338 return SeqTwoByteString::cast(object)-> | 345 return SeqTwoByteString::cast(object)-> |
| 339 SeqTwoByteStringSize(map->instance_type()); | 346 SeqTwoByteStringSize(map->instance_type()); |
| 340 } | 347 } |
| 341 | 348 |
| 342 class DataObjectVisitor { | 349 class DataObjectVisitor { |
| 343 public: | 350 public: |
| 344 template<int object_size> | 351 template<int object_size> |
| 345 static inline int VisitSpecialized(Map* map, HeapObject* object) { | 352 static inline int VisitSpecialized(Map* map, HeapObject* object) { |
| 346 return object_size; | 353 return object_size; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 | 422 |
| 416 for (; !it.done(); it.next()) { | 423 for (; !it.done(); it.next()) { |
| 417 it.rinfo()->template Visit<StaticVisitor>(heap); | 424 it.rinfo()->template Visit<StaticVisitor>(heap); |
| 418 } | 425 } |
| 419 } | 426 } |
| 420 | 427 |
| 421 | 428 |
| 422 } } // namespace v8::internal | 429 } } // namespace v8::internal |
| 423 | 430 |
| 424 #endif // V8_OBJECTS_VISITING_H_ | 431 #endif // V8_OBJECTS_VISITING_H_ |
| OLD | NEW |