| 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 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1246 marking_stack_.Push(descriptors); | 1246 marking_stack_.Push(descriptors); |
| 1247 } | 1247 } |
| 1248 | 1248 |
| 1249 | 1249 |
| 1250 void MarkCompactCollector::CreateBackPointers() { | 1250 void MarkCompactCollector::CreateBackPointers() { |
| 1251 HeapObjectIterator iterator(heap()->map_space()); | 1251 HeapObjectIterator iterator(heap()->map_space()); |
| 1252 for (HeapObject* next_object = iterator.next(); | 1252 for (HeapObject* next_object = iterator.next(); |
| 1253 next_object != NULL; next_object = iterator.next()) { | 1253 next_object != NULL; next_object = iterator.next()) { |
| 1254 if (next_object->IsMap()) { // Could also be ByteArray on free list. | 1254 if (next_object->IsMap()) { // Could also be ByteArray on free list. |
| 1255 Map* map = Map::cast(next_object); | 1255 Map* map = Map::cast(next_object); |
| 1256 STATIC_ASSERT(LAST_TYPE == LAST_CALLABLE_SPEC_OBJECT_TYPE); | 1256 STATIC_ASSERT(LAST_TYPE == LAST_JS_RECEIVER_TYPE); |
| 1257 if (map->instance_type() >= FIRST_JS_RECEIVER_TYPE) { | 1257 if (map->instance_type() >= FIRST_JS_RECEIVER_TYPE) { |
| 1258 map->CreateBackPointers(); | 1258 map->CreateBackPointers(); |
| 1259 } else { | 1259 } else { |
| 1260 ASSERT(map->instance_descriptors() == heap()->empty_descriptor_array()); | 1260 ASSERT(map->instance_descriptors() == heap()->empty_descriptor_array()); |
| 1261 } | 1261 } |
| 1262 } | 1262 } |
| 1263 } | 1263 } |
| 1264 } | 1264 } |
| 1265 | 1265 |
| 1266 | 1266 |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1686 // scan the descriptor arrays of those maps, not all maps. | 1686 // scan the descriptor arrays of those maps, not all maps. |
| 1687 // All of these actions are carried out only on maps of JSObjects | 1687 // All of these actions are carried out only on maps of JSObjects |
| 1688 // and related subtypes. | 1688 // and related subtypes. |
| 1689 for (HeapObject* obj = map_iterator.next(); | 1689 for (HeapObject* obj = map_iterator.next(); |
| 1690 obj != NULL; obj = map_iterator.next()) { | 1690 obj != NULL; obj = map_iterator.next()) { |
| 1691 Map* map = reinterpret_cast<Map*>(obj); | 1691 Map* map = reinterpret_cast<Map*>(obj); |
| 1692 if (!map->IsMarked() && map->IsByteArray()) continue; | 1692 if (!map->IsMarked() && map->IsByteArray()) continue; |
| 1693 | 1693 |
| 1694 ASSERT(SafeIsMap(map)); | 1694 ASSERT(SafeIsMap(map)); |
| 1695 // Only JSObject and subtypes have map transitions and back pointers. | 1695 // Only JSObject and subtypes have map transitions and back pointers. |
| 1696 STATIC_ASSERT(LAST_TYPE == LAST_CALLABLE_SPEC_OBJECT_TYPE); | 1696 STATIC_ASSERT(LAST_TYPE == LAST_JS_OBJECT_TYPE); |
| 1697 if (map->instance_type() < FIRST_JS_RECEIVER_TYPE) continue; | 1697 if (map->instance_type() < FIRST_JS_OBJECT_TYPE) continue; |
| 1698 | 1698 |
| 1699 if (map->IsMarked() && map->attached_to_shared_function_info()) { | 1699 if (map->IsMarked() && map->attached_to_shared_function_info()) { |
| 1700 // This map is used for inobject slack tracking and has been detached | 1700 // This map is used for inobject slack tracking and has been detached |
| 1701 // from SharedFunctionInfo during the mark phase. | 1701 // from SharedFunctionInfo during the mark phase. |
| 1702 // Since it survived the GC, reattach it now. | 1702 // Since it survived the GC, reattach it now. |
| 1703 map->unchecked_constructor()->unchecked_shared()->AttachInitialMap(map); | 1703 map->unchecked_constructor()->unchecked_shared()->AttachInitialMap(map); |
| 1704 } | 1704 } |
| 1705 | 1705 |
| 1706 // Clear dead prototype transitions. | 1706 // Clear dead prototype transitions. |
| 1707 int number_of_transitions = map->NumberOfProtoTransitions(); | 1707 int number_of_transitions = map->NumberOfProtoTransitions(); |
| (...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3354 } | 3354 } |
| 3355 | 3355 |
| 3356 | 3356 |
| 3357 void MarkCompactCollector::Initialize() { | 3357 void MarkCompactCollector::Initialize() { |
| 3358 StaticPointersToNewGenUpdatingVisitor::Initialize(); | 3358 StaticPointersToNewGenUpdatingVisitor::Initialize(); |
| 3359 StaticMarkingVisitor::Initialize(); | 3359 StaticMarkingVisitor::Initialize(); |
| 3360 } | 3360 } |
| 3361 | 3361 |
| 3362 | 3362 |
| 3363 } } // namespace v8::internal | 3363 } } // namespace v8::internal |
| OLD | NEW |