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, | |
Erik Corry
2011/06/30 18:48:25
Fits on one line.
Rico
2011/07/01 05:58:09
Done.
| |
305 &VisitJSRegExp); | |
306 | |
303 table_.Register(kVisitSeqAsciiString, &VisitSeqAsciiString); | 307 table_.Register(kVisitSeqAsciiString, &VisitSeqAsciiString); |
304 | 308 |
305 table_.Register(kVisitSeqTwoByteString, &VisitSeqTwoByteString); | 309 table_.Register(kVisitSeqTwoByteString, &VisitSeqTwoByteString); |
306 | 310 |
307 table_.Register(kVisitJSFunction, | 311 table_.Register(kVisitJSFunction, |
308 &JSObjectVisitor:: | 312 &JSObjectVisitor:: |
309 template VisitSpecialized<JSFunction::kSize>); | 313 template VisitSpecialized<JSFunction::kSize>); |
310 | 314 |
311 table_.RegisterSpecializations<DataObjectVisitor, | 315 table_.RegisterSpecializations<DataObjectVisitor, |
312 kVisitDataObject, | 316 kVisitDataObject, |
(...skipping 22 matching lines...) Expand all Loading... | |
335 static inline int VisitFixedDoubleArray(Map* map, HeapObject* object) { | 339 static inline int VisitFixedDoubleArray(Map* map, HeapObject* object) { |
336 int length = reinterpret_cast<FixedDoubleArray*>(object)->length(); | 340 int length = reinterpret_cast<FixedDoubleArray*>(object)->length(); |
337 return FixedDoubleArray::SizeFor(length); | 341 return FixedDoubleArray::SizeFor(length); |
338 } | 342 } |
339 | 343 |
340 static inline int VisitSeqAsciiString(Map* map, HeapObject* object) { | 344 static inline int VisitSeqAsciiString(Map* map, HeapObject* object) { |
341 return SeqAsciiString::cast(object)-> | 345 return SeqAsciiString::cast(object)-> |
342 SeqAsciiStringSize(map->instance_type()); | 346 SeqAsciiStringSize(map->instance_type()); |
343 } | 347 } |
344 | 348 |
349 static inline int VisitJSRegExp(Map* map, HeapObject* object) { | |
350 return JSObjectVisitor::Visit(map, object); | |
351 } | |
352 | |
345 static inline int VisitSeqTwoByteString(Map* map, HeapObject* object) { | 353 static inline int VisitSeqTwoByteString(Map* map, HeapObject* object) { |
346 return SeqTwoByteString::cast(object)-> | 354 return SeqTwoByteString::cast(object)-> |
347 SeqTwoByteStringSize(map->instance_type()); | 355 SeqTwoByteStringSize(map->instance_type()); |
348 } | 356 } |
349 | 357 |
350 class DataObjectVisitor { | 358 class DataObjectVisitor { |
351 public: | 359 public: |
352 template<int object_size> | 360 template<int object_size> |
353 static inline int VisitSpecialized(Map* map, HeapObject* object) { | 361 static inline int VisitSpecialized(Map* map, HeapObject* object) { |
354 return object_size; | 362 return object_size; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
423 | 431 |
424 for (; !it.done(); it.next()) { | 432 for (; !it.done(); it.next()) { |
425 it.rinfo()->template Visit<StaticVisitor>(heap); | 433 it.rinfo()->template Visit<StaticVisitor>(heap); |
426 } | 434 } |
427 } | 435 } |
428 | 436 |
429 | 437 |
430 } } // namespace v8::internal | 438 } } // namespace v8::internal |
431 | 439 |
432 #endif // V8_OBJECTS_VISITING_H_ | 440 #endif // V8_OBJECTS_VISITING_H_ |
OLD | NEW |