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 2708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2719 // The second pass updates pointers to new space in all spaces. It is possible | 2719 // The second pass updates pointers to new space in all spaces. It is possible |
2720 // to encounter pointers to dead new space objects during traversal of pointers | 2720 // to encounter pointers to dead new space objects during traversal of pointers |
2721 // to new space. We should clear them to avoid encountering them during next | 2721 // to new space. We should clear them to avoid encountering them during next |
2722 // pointer iteration. This is an issue if the store buffer overflows and we | 2722 // pointer iteration. This is an issue if the store buffer overflows and we |
2723 // have to scan the entire old space, including dead objects, looking for | 2723 // have to scan the entire old space, including dead objects, looking for |
2724 // pointers to new space. | 2724 // pointers to new space. |
2725 void MarkCompactCollector::MigrateObject(Address dst, | 2725 void MarkCompactCollector::MigrateObject(Address dst, |
2726 Address src, | 2726 Address src, |
2727 int size, | 2727 int size, |
2728 AllocationSpace dest) { | 2728 AllocationSpace dest) { |
2729 HEAP_PROFILE(heap(), ObjectMoveEvent(src, dst)); | 2729 HEAP_PROFILE(heap(), ObjectMoveEvent(src, dst, size)); |
2730 // TODO(hpayer): Replace these checks with asserts. | 2730 // TODO(hpayer): Replace these checks with asserts. |
2731 CHECK(heap()->AllowedToBeMigrated(HeapObject::FromAddress(src), dest)); | 2731 CHECK(heap()->AllowedToBeMigrated(HeapObject::FromAddress(src), dest)); |
2732 CHECK(dest != LO_SPACE && size <= Page::kMaxNonCodeHeapObjectSize); | 2732 CHECK(dest != LO_SPACE && size <= Page::kMaxNonCodeHeapObjectSize); |
2733 if (dest == OLD_POINTER_SPACE) { | 2733 if (dest == OLD_POINTER_SPACE) { |
2734 Address src_slot = src; | 2734 Address src_slot = src; |
2735 Address dst_slot = dst; | 2735 Address dst_slot = dst; |
2736 ASSERT(IsAligned(size, kPointerSize)); | 2736 ASSERT(IsAligned(size, kPointerSize)); |
2737 | 2737 |
2738 for (int remaining = size / kPointerSize; remaining > 0; remaining--) { | 2738 for (int remaining = size / kPointerSize; remaining > 0; remaining--) { |
2739 Object* value = Memory::Object_at(src_slot); | 2739 Object* value = Memory::Object_at(src_slot); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2903 bool MarkCompactCollector::TryPromoteObject(HeapObject* object, | 2903 bool MarkCompactCollector::TryPromoteObject(HeapObject* object, |
2904 int object_size) { | 2904 int object_size) { |
2905 // TODO(hpayer): Replace that check with an assert. | 2905 // TODO(hpayer): Replace that check with an assert. |
2906 CHECK(object_size <= Page::kMaxNonCodeHeapObjectSize); | 2906 CHECK(object_size <= Page::kMaxNonCodeHeapObjectSize); |
2907 | 2907 |
2908 OldSpace* target_space = heap()->TargetSpace(object); | 2908 OldSpace* target_space = heap()->TargetSpace(object); |
2909 | 2909 |
2910 ASSERT(target_space == heap()->old_pointer_space() || | 2910 ASSERT(target_space == heap()->old_pointer_space() || |
2911 target_space == heap()->old_data_space()); | 2911 target_space == heap()->old_data_space()); |
2912 Object* result; | 2912 Object* result; |
2913 MaybeObject* maybe_result = target_space->AllocateRaw(object_size); | 2913 MaybeObject* maybe_result = target_space->AllocateRaw( |
| 2914 object_size, |
| 2915 PagedSpace::MOVE_OBJECT); |
2914 if (maybe_result->ToObject(&result)) { | 2916 if (maybe_result->ToObject(&result)) { |
2915 HeapObject* target = HeapObject::cast(result); | 2917 HeapObject* target = HeapObject::cast(result); |
2916 MigrateObject(target->address(), | 2918 MigrateObject(target->address(), |
2917 object->address(), | 2919 object->address(), |
2918 object_size, | 2920 object_size, |
2919 target_space->identity()); | 2921 target_space->identity()); |
2920 heap()->mark_compact_collector()->tracer()-> | 2922 heap()->mark_compact_collector()->tracer()-> |
2921 increment_promoted_objects_size(object_size); | 2923 increment_promoted_objects_size(object_size); |
2922 return true; | 2924 return true; |
2923 } | 2925 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2976 if (*cell == 0) continue; | 2978 if (*cell == 0) continue; |
2977 | 2979 |
2978 int live_objects = MarkWordToObjectStarts(*cell, offsets); | 2980 int live_objects = MarkWordToObjectStarts(*cell, offsets); |
2979 for (int i = 0; i < live_objects; i++) { | 2981 for (int i = 0; i < live_objects; i++) { |
2980 Address object_addr = cell_base + offsets[i] * kPointerSize; | 2982 Address object_addr = cell_base + offsets[i] * kPointerSize; |
2981 HeapObject* object = HeapObject::FromAddress(object_addr); | 2983 HeapObject* object = HeapObject::FromAddress(object_addr); |
2982 ASSERT(Marking::IsBlack(Marking::MarkBitFrom(object))); | 2984 ASSERT(Marking::IsBlack(Marking::MarkBitFrom(object))); |
2983 | 2985 |
2984 int size = object->Size(); | 2986 int size = object->Size(); |
2985 | 2987 |
2986 MaybeObject* target = space->AllocateRaw(size); | 2988 MaybeObject* target = space->AllocateRaw(size, PagedSpace::MOVE_OBJECT); |
2987 if (target->IsFailure()) { | 2989 if (target->IsFailure()) { |
2988 // OS refused to give us memory. | 2990 // OS refused to give us memory. |
2989 V8::FatalProcessOutOfMemory("Evacuation"); | 2991 V8::FatalProcessOutOfMemory("Evacuation"); |
2990 return; | 2992 return; |
2991 } | 2993 } |
2992 | 2994 |
2993 Object* target_object = target->ToObjectUnchecked(); | 2995 Object* target_object = target->ToObjectUnchecked(); |
2994 | 2996 |
2995 MigrateObject(HeapObject::cast(target_object)->address(), | 2997 MigrateObject(HeapObject::cast(target_object)->address(), |
2996 object_addr, | 2998 object_addr, |
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4315 while (buffer != NULL) { | 4317 while (buffer != NULL) { |
4316 SlotsBuffer* next_buffer = buffer->next(); | 4318 SlotsBuffer* next_buffer = buffer->next(); |
4317 DeallocateBuffer(buffer); | 4319 DeallocateBuffer(buffer); |
4318 buffer = next_buffer; | 4320 buffer = next_buffer; |
4319 } | 4321 } |
4320 *buffer_address = NULL; | 4322 *buffer_address = NULL; |
4321 } | 4323 } |
4322 | 4324 |
4323 | 4325 |
4324 } } // namespace v8::internal | 4326 } } // namespace v8::internal |
OLD | NEW |