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 2373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2384 } | 2384 } |
2385 ProcessMarkingDeque(); | 2385 ProcessMarkingDeque(); |
2386 } | 2386 } |
2387 | 2387 |
2388 | 2388 |
2389 void MarkCompactCollector::ReattachInitialMaps() { | 2389 void MarkCompactCollector::ReattachInitialMaps() { |
2390 HeapObjectIterator map_iterator(heap()->map_space()); | 2390 HeapObjectIterator map_iterator(heap()->map_space()); |
2391 for (HeapObject* obj = map_iterator.Next(); | 2391 for (HeapObject* obj = map_iterator.Next(); |
2392 obj != NULL; | 2392 obj != NULL; |
2393 obj = map_iterator.Next()) { | 2393 obj = map_iterator.Next()) { |
2394 if (obj->IsFreeSpace()) continue; | |
2395 Map* map = Map::cast(obj); | 2394 Map* map = Map::cast(obj); |
2396 | 2395 |
2397 STATIC_ASSERT(LAST_TYPE == LAST_JS_RECEIVER_TYPE); | 2396 STATIC_ASSERT(LAST_TYPE == LAST_JS_RECEIVER_TYPE); |
2398 if (map->instance_type() < FIRST_JS_RECEIVER_TYPE) continue; | 2397 if (map->instance_type() < FIRST_JS_RECEIVER_TYPE) continue; |
2399 | 2398 |
2400 if (map->attached_to_shared_function_info()) { | 2399 if (map->attached_to_shared_function_info()) { |
2401 JSFunction::cast(map->constructor())->shared()->AttachInitialMap(map); | 2400 JSFunction::cast(map->constructor())->shared()->AttachInitialMap(map); |
2402 } | 2401 } |
2403 } | 2402 } |
2404 } | 2403 } |
2405 | 2404 |
2406 | 2405 |
2407 void MarkCompactCollector::ClearNonLiveReferences() { | 2406 void MarkCompactCollector::ClearNonLiveReferences() { |
2408 HeapObjectIterator map_iterator(heap()->map_space()); | |
2409 // Iterate over the map space, setting map transitions that go from | 2407 // Iterate over the map space, setting map transitions that go from |
2410 // a marked map to an unmarked map to null transitions. This action | 2408 // a marked map to an unmarked map to null transitions. This action |
2411 // is carried out only on maps of JSObjects and related subtypes. | 2409 // is carried out only on maps of JSObjects and related subtypes. |
| 2410 HeapObjectIterator map_iterator(heap()->map_space()); |
2412 for (HeapObject* obj = map_iterator.Next(); | 2411 for (HeapObject* obj = map_iterator.Next(); |
2413 obj != NULL; obj = map_iterator.Next()) { | 2412 obj != NULL; |
2414 Map* map = reinterpret_cast<Map*>(obj); | 2413 obj = map_iterator.Next()) { |
2415 MarkBit map_mark = Marking::MarkBitFrom(map); | 2414 Map* map = Map::cast(obj); |
2416 if (map->IsFreeSpace()) continue; | |
2417 | 2415 |
2418 ASSERT(map->IsMap()); | |
2419 if (!map->CanTransition()) continue; | 2416 if (!map->CanTransition()) continue; |
2420 | 2417 |
2421 if (map_mark.Get() && | 2418 MarkBit map_mark = Marking::MarkBitFrom(map); |
2422 map->attached_to_shared_function_info()) { | 2419 if (map_mark.Get() && map->attached_to_shared_function_info()) { |
2423 // This map is used for inobject slack tracking and has been detached | 2420 // This map is used for inobject slack tracking and has been detached |
2424 // from SharedFunctionInfo during the mark phase. | 2421 // from SharedFunctionInfo during the mark phase. |
2425 // Since it survived the GC, reattach it now. | 2422 // Since it survived the GC, reattach it now. |
2426 JSFunction::cast(map->constructor())->shared()->AttachInitialMap(map); | 2423 JSFunction::cast(map->constructor())->shared()->AttachInitialMap(map); |
2427 } | 2424 } |
2428 | 2425 |
2429 ClearNonLivePrototypeTransitions(map); | 2426 ClearNonLivePrototypeTransitions(map); |
2430 ClearNonLiveMapTransitions(map, map_mark); | 2427 ClearNonLiveMapTransitions(map, map_mark); |
2431 | 2428 |
2432 if (map_mark.Get()) { | 2429 if (map_mark.Get()) { |
(...skipping 1856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4289 while (buffer != NULL) { | 4286 while (buffer != NULL) { |
4290 SlotsBuffer* next_buffer = buffer->next(); | 4287 SlotsBuffer* next_buffer = buffer->next(); |
4291 DeallocateBuffer(buffer); | 4288 DeallocateBuffer(buffer); |
4292 buffer = next_buffer; | 4289 buffer = next_buffer; |
4293 } | 4290 } |
4294 *buffer_address = NULL; | 4291 *buffer_address = NULL; |
4295 } | 4292 } |
4296 | 4293 |
4297 | 4294 |
4298 } } // namespace v8::internal | 4295 } } // namespace v8::internal |
OLD | NEW |