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 2741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2752 // The second pass updates pointers to new space in all spaces. It is possible | 2752 // The second pass updates pointers to new space in all spaces. It is possible |
2753 // to encounter pointers to dead new space objects during traversal of pointers | 2753 // to encounter pointers to dead new space objects during traversal of pointers |
2754 // to new space. We should clear them to avoid encountering them during next | 2754 // to new space. We should clear them to avoid encountering them during next |
2755 // pointer iteration. This is an issue if the store buffer overflows and we | 2755 // pointer iteration. This is an issue if the store buffer overflows and we |
2756 // have to scan the entire old space, including dead objects, looking for | 2756 // have to scan the entire old space, including dead objects, looking for |
2757 // pointers to new space. | 2757 // pointers to new space. |
2758 void MarkCompactCollector::MigrateObject(Address dst, | 2758 void MarkCompactCollector::MigrateObject(Address dst, |
2759 Address src, | 2759 Address src, |
2760 int size, | 2760 int size, |
2761 AllocationSpace dest) { | 2761 AllocationSpace dest) { |
2762 HEAP_PROFILE(heap(), ObjectMoveEvent(src, dst)); | 2762 HEAP_PROFILE(heap(), ObjectMoveEvent(src, dst, size)); |
2763 ASSERT(heap()->AllowedToBeMigrated(HeapObject::FromAddress(src), dest)); | 2763 ASSERT(heap()->AllowedToBeMigrated(HeapObject::FromAddress(src), dest)); |
2764 ASSERT(dest != LO_SPACE && size <= Page::kMaxNonCodeHeapObjectSize); | 2764 ASSERT(dest != LO_SPACE && size <= Page::kMaxNonCodeHeapObjectSize); |
2765 if (dest == OLD_POINTER_SPACE) { | 2765 if (dest == OLD_POINTER_SPACE) { |
2766 Address src_slot = src; | 2766 Address src_slot = src; |
2767 Address dst_slot = dst; | 2767 Address dst_slot = dst; |
2768 ASSERT(IsAligned(size, kPointerSize)); | 2768 ASSERT(IsAligned(size, kPointerSize)); |
2769 | 2769 |
2770 for (int remaining = size / kPointerSize; remaining > 0; remaining--) { | 2770 for (int remaining = size / kPointerSize; remaining > 0; remaining--) { |
2771 Object* value = Memory::Object_at(src_slot); | 2771 Object* value = Memory::Object_at(src_slot); |
2772 | 2772 |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2935 bool MarkCompactCollector::TryPromoteObject(HeapObject* object, | 2935 bool MarkCompactCollector::TryPromoteObject(HeapObject* object, |
2936 int object_size) { | 2936 int object_size) { |
2937 // TODO(hpayer): Replace that check with an assert. | 2937 // TODO(hpayer): Replace that check with an assert. |
2938 CHECK(object_size <= Page::kMaxNonCodeHeapObjectSize); | 2938 CHECK(object_size <= Page::kMaxNonCodeHeapObjectSize); |
2939 | 2939 |
2940 OldSpace* target_space = heap()->TargetSpace(object); | 2940 OldSpace* target_space = heap()->TargetSpace(object); |
2941 | 2941 |
2942 ASSERT(target_space == heap()->old_pointer_space() || | 2942 ASSERT(target_space == heap()->old_pointer_space() || |
2943 target_space == heap()->old_data_space()); | 2943 target_space == heap()->old_data_space()); |
2944 Object* result; | 2944 Object* result; |
2945 MaybeObject* maybe_result = target_space->AllocateRaw(object_size); | 2945 MaybeObject* maybe_result = target_space->AllocateRaw( |
| 2946 object_size, |
| 2947 PagedSpace::MOVE_OBJECT); |
2946 if (maybe_result->ToObject(&result)) { | 2948 if (maybe_result->ToObject(&result)) { |
2947 HeapObject* target = HeapObject::cast(result); | 2949 HeapObject* target = HeapObject::cast(result); |
2948 MigrateObject(target->address(), | 2950 MigrateObject(target->address(), |
2949 object->address(), | 2951 object->address(), |
2950 object_size, | 2952 object_size, |
2951 target_space->identity()); | 2953 target_space->identity()); |
2952 heap()->mark_compact_collector()->tracer()-> | 2954 heap()->mark_compact_collector()->tracer()-> |
2953 increment_promoted_objects_size(object_size); | 2955 increment_promoted_objects_size(object_size); |
2954 return true; | 2956 return true; |
2955 } | 2957 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3008 if (*cell == 0) continue; | 3010 if (*cell == 0) continue; |
3009 | 3011 |
3010 int live_objects = MarkWordToObjectStarts(*cell, offsets); | 3012 int live_objects = MarkWordToObjectStarts(*cell, offsets); |
3011 for (int i = 0; i < live_objects; i++) { | 3013 for (int i = 0; i < live_objects; i++) { |
3012 Address object_addr = cell_base + offsets[i] * kPointerSize; | 3014 Address object_addr = cell_base + offsets[i] * kPointerSize; |
3013 HeapObject* object = HeapObject::FromAddress(object_addr); | 3015 HeapObject* object = HeapObject::FromAddress(object_addr); |
3014 ASSERT(Marking::IsBlack(Marking::MarkBitFrom(object))); | 3016 ASSERT(Marking::IsBlack(Marking::MarkBitFrom(object))); |
3015 | 3017 |
3016 int size = object->Size(); | 3018 int size = object->Size(); |
3017 | 3019 |
3018 MaybeObject* target = space->AllocateRaw(size); | 3020 MaybeObject* target = space->AllocateRaw(size, PagedSpace::MOVE_OBJECT); |
3019 if (target->IsFailure()) { | 3021 if (target->IsFailure()) { |
3020 // OS refused to give us memory. | 3022 // OS refused to give us memory. |
3021 V8::FatalProcessOutOfMemory("Evacuation"); | 3023 V8::FatalProcessOutOfMemory("Evacuation"); |
3022 return; | 3024 return; |
3023 } | 3025 } |
3024 | 3026 |
3025 Object* target_object = target->ToObjectUnchecked(); | 3027 Object* target_object = target->ToObjectUnchecked(); |
3026 | 3028 |
3027 MigrateObject(HeapObject::cast(target_object)->address(), | 3029 MigrateObject(HeapObject::cast(target_object)->address(), |
3028 object_addr, | 3030 object_addr, |
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4354 while (buffer != NULL) { | 4356 while (buffer != NULL) { |
4355 SlotsBuffer* next_buffer = buffer->next(); | 4357 SlotsBuffer* next_buffer = buffer->next(); |
4356 DeallocateBuffer(buffer); | 4358 DeallocateBuffer(buffer); |
4357 buffer = next_buffer; | 4359 buffer = next_buffer; |
4358 } | 4360 } |
4359 *buffer_address = NULL; | 4361 *buffer_address = NULL; |
4360 } | 4362 } |
4361 | 4363 |
4362 | 4364 |
4363 } } // namespace v8::internal | 4365 } } // namespace v8::internal |
OLD | NEW |