| 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 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 | 1053 |
| 1054 void MarkCompactCollector::MarkUnmarkedObject(HeapObject* object) { | 1054 void MarkCompactCollector::MarkUnmarkedObject(HeapObject* object) { |
| 1055 ASSERT(!object->IsMarked()); | 1055 ASSERT(!object->IsMarked()); |
| 1056 ASSERT(HEAP->Contains(object)); | 1056 ASSERT(HEAP->Contains(object)); |
| 1057 if (object->IsMap()) { | 1057 if (object->IsMap()) { |
| 1058 Map* map = Map::cast(object); | 1058 Map* map = Map::cast(object); |
| 1059 if (FLAG_cleanup_code_caches_at_gc) { | 1059 if (FLAG_cleanup_code_caches_at_gc) { |
| 1060 map->ClearCodeCache(heap()); | 1060 map->ClearCodeCache(heap()); |
| 1061 } | 1061 } |
| 1062 SetMark(map); | 1062 SetMark(map); |
| 1063 if (FLAG_collect_maps && | 1063 ASSERT(LAST_TYPE == LAST_FUNCTION_CLASS_TYPE); |
| 1064 map->instance_type() >= FIRST_JS_OBJECT_TYPE && | 1064 if (FLAG_collect_maps && map->instance_type() >= FIRST_JS_RECEIVER_TYPE) { |
| 1065 map->instance_type() <= JS_FUNCTION_TYPE) { | |
| 1066 MarkMapContents(map); | 1065 MarkMapContents(map); |
| 1067 } else { | 1066 } else { |
| 1068 marking_stack_.Push(map); | 1067 marking_stack_.Push(map); |
| 1069 } | 1068 } |
| 1070 } else { | 1069 } else { |
| 1071 SetMark(object); | 1070 SetMark(object); |
| 1072 marking_stack_.Push(object); | 1071 marking_stack_.Push(object); |
| 1073 } | 1072 } |
| 1074 } | 1073 } |
| 1075 | 1074 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 marking_stack_.Push(descriptors); | 1131 marking_stack_.Push(descriptors); |
| 1133 } | 1132 } |
| 1134 | 1133 |
| 1135 | 1134 |
| 1136 void MarkCompactCollector::CreateBackPointers() { | 1135 void MarkCompactCollector::CreateBackPointers() { |
| 1137 HeapObjectIterator iterator(heap()->map_space()); | 1136 HeapObjectIterator iterator(heap()->map_space()); |
| 1138 for (HeapObject* next_object = iterator.next(); | 1137 for (HeapObject* next_object = iterator.next(); |
| 1139 next_object != NULL; next_object = iterator.next()) { | 1138 next_object != NULL; next_object = iterator.next()) { |
| 1140 if (next_object->IsMap()) { // Could also be ByteArray on free list. | 1139 if (next_object->IsMap()) { // Could also be ByteArray on free list. |
| 1141 Map* map = Map::cast(next_object); | 1140 Map* map = Map::cast(next_object); |
| 1142 if (map->instance_type() >= FIRST_JS_OBJECT_TYPE && | 1141 ASSERT(LAST_TYPE == LAST_FUNCTION_CLASS_TYPE); |
| 1143 map->instance_type() <= JS_FUNCTION_TYPE) { | 1142 if (map->instance_type() >= FIRST_JS_RECEIVER_TYPE) { |
| 1144 map->CreateBackPointers(); | 1143 map->CreateBackPointers(); |
| 1145 } else { | 1144 } else { |
| 1146 ASSERT(map->instance_descriptors() == heap()->empty_descriptor_array()); | 1145 ASSERT(map->instance_descriptors() == heap()->empty_descriptor_array()); |
| 1147 } | 1146 } |
| 1148 } | 1147 } |
| 1149 } | 1148 } |
| 1150 } | 1149 } |
| 1151 | 1150 |
| 1152 | 1151 |
| 1153 static int OverflowObjectSize(HeapObject* obj) { | 1152 static int OverflowObjectSize(HeapObject* obj) { |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1509 // scan the descriptor arrays of those maps, not all maps. | 1508 // scan the descriptor arrays of those maps, not all maps. |
| 1510 // All of these actions are carried out only on maps of JSObjects | 1509 // All of these actions are carried out only on maps of JSObjects |
| 1511 // and related subtypes. | 1510 // and related subtypes. |
| 1512 for (HeapObject* obj = map_iterator.next(); | 1511 for (HeapObject* obj = map_iterator.next(); |
| 1513 obj != NULL; obj = map_iterator.next()) { | 1512 obj != NULL; obj = map_iterator.next()) { |
| 1514 Map* map = reinterpret_cast<Map*>(obj); | 1513 Map* map = reinterpret_cast<Map*>(obj); |
| 1515 if (!map->IsMarked() && map->IsByteArray()) continue; | 1514 if (!map->IsMarked() && map->IsByteArray()) continue; |
| 1516 | 1515 |
| 1517 ASSERT(SafeIsMap(map)); | 1516 ASSERT(SafeIsMap(map)); |
| 1518 // Only JSObject and subtypes have map transitions and back pointers. | 1517 // Only JSObject and subtypes have map transitions and back pointers. |
| 1519 if (map->instance_type() < FIRST_JS_OBJECT_TYPE) continue; | 1518 ASSERT(LAST_TYPE == LAST_FUNCTION_CLASS_TYPE); |
| 1520 if (map->instance_type() > JS_FUNCTION_TYPE) continue; | 1519 if (map->instance_type() < FIRST_JS_RECEIVER_TYPE) continue; |
| 1521 | 1520 |
| 1522 if (map->IsMarked() && map->attached_to_shared_function_info()) { | 1521 if (map->IsMarked() && map->attached_to_shared_function_info()) { |
| 1523 // This map is used for inobject slack tracking and has been detached | 1522 // This map is used for inobject slack tracking and has been detached |
| 1524 // from SharedFunctionInfo during the mark phase. | 1523 // from SharedFunctionInfo during the mark phase. |
| 1525 // Since it survived the GC, reattach it now. | 1524 // Since it survived the GC, reattach it now. |
| 1526 map->unchecked_constructor()->unchecked_shared()->AttachInitialMap(map); | 1525 map->unchecked_constructor()->unchecked_shared()->AttachInitialMap(map); |
| 1527 } | 1526 } |
| 1528 | 1527 |
| 1529 // Clear dead prototype transitions. | 1528 // Clear dead prototype transitions. |
| 1530 FixedArray* prototype_transitions = map->unchecked_prototype_transitions(); | 1529 FixedArray* prototype_transitions = map->unchecked_prototype_transitions(); |
| (...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3129 } | 3128 } |
| 3130 | 3129 |
| 3131 | 3130 |
| 3132 void MarkCompactCollector::Initialize() { | 3131 void MarkCompactCollector::Initialize() { |
| 3133 StaticPointersToNewGenUpdatingVisitor::Initialize(); | 3132 StaticPointersToNewGenUpdatingVisitor::Initialize(); |
| 3134 StaticMarkingVisitor::Initialize(); | 3133 StaticMarkingVisitor::Initialize(); |
| 3135 } | 3134 } |
| 3136 | 3135 |
| 3137 | 3136 |
| 3138 } } // namespace v8::internal | 3137 } } // namespace v8::internal |
| OLD | NEW |