| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 kVisitStruct9, | 114 kVisitStruct9, |
| 115 kVisitStructGeneric, | 115 kVisitStructGeneric, |
| 116 | 116 |
| 117 kVisitConsString, | 117 kVisitConsString, |
| 118 kVisitOddball, | 118 kVisitOddball, |
| 119 kVisitCode, | 119 kVisitCode, |
| 120 kVisitMap, | 120 kVisitMap, |
| 121 kVisitPropertyCell, | 121 kVisitPropertyCell, |
| 122 kVisitSharedFunctionInfo, | 122 kVisitSharedFunctionInfo, |
| 123 kVisitJSFunction, | 123 kVisitJSFunction, |
| 124 kVisitJSWeakMap, |
| 124 kVisitJSRegExp, | 125 kVisitJSRegExp, |
| 125 | 126 |
| 126 kVisitorIdCount, | 127 kVisitorIdCount, |
| 127 kMinObjectSizeInWords = 2 | 128 kMinObjectSizeInWords = 2 |
| 128 }; | 129 }; |
| 129 | 130 |
| 130 // Visitor ID should fit in one byte. | 131 // Visitor ID should fit in one byte. |
| 131 STATIC_ASSERT(kVisitorIdCount <= 256); | 132 STATIC_ASSERT(kVisitorIdCount <= 256); |
| 132 | 133 |
| 133 // Determine which specialized visitor should be used for given instance type | 134 // Determine which specialized visitor should be used for given instance type |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 Context::ScavengeBodyDescriptor, | 311 Context::ScavengeBodyDescriptor, |
| 311 int>::Visit); | 312 int>::Visit); |
| 312 | 313 |
| 313 table_.Register(kVisitByteArray, &VisitByteArray); | 314 table_.Register(kVisitByteArray, &VisitByteArray); |
| 314 | 315 |
| 315 table_.Register(kVisitSharedFunctionInfo, | 316 table_.Register(kVisitSharedFunctionInfo, |
| 316 &FixedBodyVisitor<StaticVisitor, | 317 &FixedBodyVisitor<StaticVisitor, |
| 317 SharedFunctionInfo::BodyDescriptor, | 318 SharedFunctionInfo::BodyDescriptor, |
| 318 int>::Visit); | 319 int>::Visit); |
| 319 | 320 |
| 320 table_.Register(kVisitJSRegExp, &VisitJSRegExp); | 321 table_.Register(kVisitJSWeakMap, &VisitJSObject); |
| 322 |
| 323 table_.Register(kVisitJSRegExp, &VisitJSObject); |
| 321 | 324 |
| 322 table_.Register(kVisitSeqAsciiString, &VisitSeqAsciiString); | 325 table_.Register(kVisitSeqAsciiString, &VisitSeqAsciiString); |
| 323 | 326 |
| 324 table_.Register(kVisitSeqTwoByteString, &VisitSeqTwoByteString); | 327 table_.Register(kVisitSeqTwoByteString, &VisitSeqTwoByteString); |
| 325 | 328 |
| 326 table_.Register(kVisitJSFunction, | 329 table_.Register(kVisitJSFunction, |
| 327 &JSObjectVisitor:: | 330 &JSObjectVisitor:: |
| 328 template VisitSpecialized<JSFunction::kSize>); | 331 template VisitSpecialized<JSFunction::kSize>); |
| 329 | 332 |
| 330 table_.RegisterSpecializations<DataObjectVisitor, | 333 table_.RegisterSpecializations<DataObjectVisitor, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 349 private: | 352 private: |
| 350 static inline int VisitByteArray(Map* map, HeapObject* object) { | 353 static inline int VisitByteArray(Map* map, HeapObject* object) { |
| 351 return reinterpret_cast<ByteArray*>(object)->ByteArraySize(); | 354 return reinterpret_cast<ByteArray*>(object)->ByteArraySize(); |
| 352 } | 355 } |
| 353 | 356 |
| 354 static inline int VisitFixedDoubleArray(Map* map, HeapObject* object) { | 357 static inline int VisitFixedDoubleArray(Map* map, HeapObject* object) { |
| 355 int length = reinterpret_cast<FixedDoubleArray*>(object)->length(); | 358 int length = reinterpret_cast<FixedDoubleArray*>(object)->length(); |
| 356 return FixedDoubleArray::SizeFor(length); | 359 return FixedDoubleArray::SizeFor(length); |
| 357 } | 360 } |
| 358 | 361 |
| 362 static inline int VisitJSObject(Map* map, HeapObject* object) { |
| 363 return JSObjectVisitor::Visit(map, object); |
| 364 } |
| 365 |
| 359 static inline int VisitSeqAsciiString(Map* map, HeapObject* object) { | 366 static inline int VisitSeqAsciiString(Map* map, HeapObject* object) { |
| 360 return SeqAsciiString::cast(object)-> | 367 return SeqAsciiString::cast(object)-> |
| 361 SeqAsciiStringSize(map->instance_type()); | 368 SeqAsciiStringSize(map->instance_type()); |
| 362 } | 369 } |
| 363 | 370 |
| 364 static inline int VisitJSRegExp(Map* map, HeapObject* object) { | |
| 365 return JSObjectVisitor::Visit(map, object); | |
| 366 } | |
| 367 | |
| 368 static inline int VisitSeqTwoByteString(Map* map, HeapObject* object) { | 371 static inline int VisitSeqTwoByteString(Map* map, HeapObject* object) { |
| 369 return SeqTwoByteString::cast(object)-> | 372 return SeqTwoByteString::cast(object)-> |
| 370 SeqTwoByteStringSize(map->instance_type()); | 373 SeqTwoByteStringSize(map->instance_type()); |
| 371 } | 374 } |
| 372 | 375 |
| 373 class DataObjectVisitor { | 376 class DataObjectVisitor { |
| 374 public: | 377 public: |
| 375 template<int object_size> | 378 template<int object_size> |
| 376 static inline int VisitSpecialized(Map* map, HeapObject* object) { | 379 static inline int VisitSpecialized(Map* map, HeapObject* object) { |
| 377 return object_size; | 380 return object_size; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 | 449 |
| 447 for (; !it.done(); it.next()) { | 450 for (; !it.done(); it.next()) { |
| 448 it.rinfo()->template Visit<StaticVisitor>(heap); | 451 it.rinfo()->template Visit<StaticVisitor>(heap); |
| 449 } | 452 } |
| 450 } | 453 } |
| 451 | 454 |
| 452 | 455 |
| 453 } } // namespace v8::internal | 456 } } // namespace v8::internal |
| 454 | 457 |
| 455 #endif // V8_OBJECTS_VISITING_H_ | 458 #endif // V8_OBJECTS_VISITING_H_ |
| OLD | NEW |