Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 255 } | 255 } |
| 256 | 256 |
| 257 // When map collection is enabled we have to mark through map's | 257 // When map collection is enabled we have to mark through map's |
| 258 // transitions and back pointers in a special way to make these links | 258 // transitions and back pointers in a special way to make these links |
| 259 // weak. Only maps for subclasses of JSReceiver can have transitions. | 259 // weak. Only maps for subclasses of JSReceiver can have transitions. |
| 260 STATIC_ASSERT(LAST_TYPE == LAST_JS_RECEIVER_TYPE); | 260 STATIC_ASSERT(LAST_TYPE == LAST_JS_RECEIVER_TYPE); |
| 261 if (FLAG_collect_maps && | 261 if (FLAG_collect_maps && |
| 262 map_object->instance_type() >= FIRST_JS_RECEIVER_TYPE) { | 262 map_object->instance_type() >= FIRST_JS_RECEIVER_TYPE) { |
| 263 MarkMapContents(heap, map_object); | 263 MarkMapContents(heap, map_object); |
| 264 } else { | 264 } else { |
| 265 StaticVisitor::VisitPointers(heap, | 265 Object** start = |
|
Michael Starzinger
2012/09/26 11:40:07
Can we call that "start_slot" for consistency.
| |
| 266 HeapObject::RawField(object, Map::kPointerFieldsBeginOffset), | 266 HeapObject::RawField(object, Map::kPointerFieldsBeginOffset); |
| 267 HeapObject::RawField(object, Map::kPointerFieldsEndOffset)); | 267 Object** end = |
|
Michael Starzinger
2012/09/26 11:40:07
Can we call that "end_slot" for consistency.
| |
| 268 HeapObject::RawField(object, Map::kPointerFieldsEndOffset); | |
| 269 StaticVisitor::VisitPointers(heap, start, start, end); | |
| 268 } | 270 } |
| 269 } | 271 } |
| 270 | 272 |
| 271 | 273 |
| 272 template<typename StaticVisitor> | 274 template<typename StaticVisitor> |
| 273 void StaticMarkingVisitor<StaticVisitor>::VisitCode( | 275 void StaticMarkingVisitor<StaticVisitor>::VisitCode( |
| 274 Map* map, HeapObject* object) { | 276 Map* map, HeapObject* object) { |
| 275 Heap* heap = map->GetHeap(); | 277 Heap* heap = map->GetHeap(); |
| 276 Code* code = Code::cast(object); | 278 Code* code = Code::cast(object); |
| 277 if (FLAG_cleanup_code_caches_at_gc) { | 279 if (FLAG_cleanup_code_caches_at_gc) { |
| 278 code->ClearTypeFeedbackCells(heap); | 280 code->ClearTypeFeedbackCells(heap); |
| 279 } | 281 } |
| 280 code->CodeIterateBody<StaticVisitor>(heap); | 282 code->CodeIterateBody<StaticVisitor>(heap); |
| 281 } | 283 } |
| 282 | 284 |
| 283 | 285 |
| 284 template<typename StaticVisitor> | 286 template<typename StaticVisitor> |
| 285 void StaticMarkingVisitor<StaticVisitor>::VisitJSRegExp( | 287 void StaticMarkingVisitor<StaticVisitor>::VisitJSRegExp( |
| 286 Map* map, HeapObject* object) { | 288 Map* map, HeapObject* object) { |
| 287 int last_property_offset = | 289 int last_property_offset = |
| 288 JSRegExp::kSize + kPointerSize * map->inobject_properties(); | 290 JSRegExp::kSize + kPointerSize * map->inobject_properties(); |
| 289 StaticVisitor::VisitPointers(map->GetHeap(), | 291 Object** start = HeapObject::RawField(object, JSRegExp::kPropertiesOffset); |
| 290 HeapObject::RawField(object, JSRegExp::kPropertiesOffset), | 292 Object** end = HeapObject::RawField(object, last_property_offset); |
|
Michael Starzinger
2012/09/26 11:40:07
Likewise.
| |
| 291 HeapObject::RawField(object, last_property_offset)); | 293 StaticVisitor::VisitPointers(map->GetHeap(), start, start, end); |
| 292 } | 294 } |
| 293 | 295 |
| 294 | 296 |
| 295 template<typename StaticVisitor> | 297 template<typename StaticVisitor> |
| 296 void StaticMarkingVisitor<StaticVisitor>::MarkMapContents( | 298 void StaticMarkingVisitor<StaticVisitor>::MarkMapContents( |
| 297 Heap* heap, Map* map) { | 299 Heap* heap, Map* map) { |
| 298 // Make sure that the back pointer stored either in the map itself or | 300 // Make sure that the back pointer stored either in the map itself or |
| 299 // inside its transitions array is marked. Skip recording the back | 301 // inside its transitions array is marked. Skip recording the back |
| 300 // pointer slot since map space is not compacted. | 302 // pointer slot since map space is not compacted. |
| 301 StaticVisitor::MarkObject(heap, HeapObject::cast(map->GetBackPointer())); | 303 StaticVisitor::MarkObject(heap, HeapObject::cast(map->GetBackPointer())); |
| 302 | 304 |
| 303 // Treat pointers in the transitions array as weak and also mark that | 305 // Treat pointers in the transitions array as weak and also mark that |
| 304 // array to prevent visiting it later. Skip recording the transition | 306 // array to prevent visiting it later. Skip recording the transition |
| 305 // array slot, since it will be implicitly recorded when the pointer | 307 // array slot, since it will be implicitly recorded when the pointer |
| 306 // fields of this map are visited. | 308 // fields of this map are visited. |
| 307 TransitionArray* transitions = map->unchecked_transition_array(); | 309 TransitionArray* transitions = map->unchecked_transition_array(); |
| 308 if (transitions->IsTransitionArray()) { | 310 if (transitions->IsTransitionArray()) { |
| 309 MarkTransitionArray(heap, transitions); | 311 MarkTransitionArray(heap, transitions); |
| 310 } else { | 312 } else { |
| 311 // Already marked by marking map->GetBackPointer() above. | 313 // Already marked by marking map->GetBackPointer() above. |
| 312 ASSERT(transitions->IsMap() || transitions->IsUndefined()); | 314 ASSERT(transitions->IsMap() || transitions->IsUndefined()); |
| 313 } | 315 } |
| 314 | 316 |
| 315 // Mark the pointer fields of the Map. Since the transitions array has | 317 // Mark the pointer fields of the Map. Since the transitions array has |
| 316 // been marked already, it is fine that one of these fields contains a | 318 // been marked already, it is fine that one of these fields contains a |
| 317 // pointer to it. | 319 // pointer to it. |
| 318 StaticVisitor::VisitPointers(heap, | 320 Object** start = HeapObject::RawField(map, Map::kPointerFieldsBeginOffset); |
| 319 HeapObject::RawField(map, Map::kPointerFieldsBeginOffset), | 321 Object** end = HeapObject::RawField(map, Map::kPointerFieldsEndOffset); |
|
Michael Starzinger
2012/09/26 11:40:07
Likewise.
| |
| 320 HeapObject::RawField(map, Map::kPointerFieldsEndOffset)); | 322 StaticVisitor::VisitPointers(heap, start, start, end); |
| 321 } | 323 } |
| 322 | 324 |
| 323 | 325 |
| 324 template<typename StaticVisitor> | 326 template<typename StaticVisitor> |
| 325 void StaticMarkingVisitor<StaticVisitor>::MarkTransitionArray( | 327 void StaticMarkingVisitor<StaticVisitor>::MarkTransitionArray( |
| 326 Heap* heap, TransitionArray* transitions) { | 328 Heap* heap, TransitionArray* transitions) { |
| 327 if (!StaticVisitor::MarkObjectWithoutPush(heap, transitions)) return; | 329 if (!StaticVisitor::MarkObjectWithoutPush(heap, transitions)) return; |
| 328 | 330 |
| 329 // Skip recording the descriptors_pointer slot since the cell space | 331 // Skip recording the descriptors_pointer slot since the cell space |
| 330 // is not compacted and descriptors are referenced through a cell. | 332 // is not compacted and descriptors are referenced through a cell. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 RelocIterator it(this, mode_mask); | 402 RelocIterator it(this, mode_mask); |
| 401 for (; !it.done(); it.next()) { | 403 for (; !it.done(); it.next()) { |
| 402 it.rinfo()->template Visit<StaticVisitor>(heap); | 404 it.rinfo()->template Visit<StaticVisitor>(heap); |
| 403 } | 405 } |
| 404 } | 406 } |
| 405 | 407 |
| 406 | 408 |
| 407 } } // namespace v8::internal | 409 } } // namespace v8::internal |
| 408 | 410 |
| 409 #endif // V8_OBJECTS_VISITING_INL_H_ | 411 #endif // V8_OBJECTS_VISITING_INL_H_ |
| OLD | NEW |