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 2774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2785 // pointers to new space. | 2785 // pointers to new space. |
2786 void MarkCompactCollector::MigrateObject(Address dst, | 2786 void MarkCompactCollector::MigrateObject(Address dst, |
2787 Address src, | 2787 Address src, |
2788 int size, | 2788 int size, |
2789 AllocationSpace dest) { | 2789 AllocationSpace dest) { |
2790 HeapProfiler* heap_profiler = heap()->isolate()->heap_profiler(); | 2790 HeapProfiler* heap_profiler = heap()->isolate()->heap_profiler(); |
2791 if (heap_profiler->is_tracking_object_moves()) { | 2791 if (heap_profiler->is_tracking_object_moves()) { |
2792 heap_profiler->ObjectMoveEvent(src, dst, size); | 2792 heap_profiler->ObjectMoveEvent(src, dst, size); |
2793 } | 2793 } |
2794 ASSERT(heap()->AllowedToBeMigrated(HeapObject::FromAddress(src), dest)); | 2794 ASSERT(heap()->AllowedToBeMigrated(HeapObject::FromAddress(src), dest)); |
2795 ASSERT(dest != LO_SPACE && size <= Page::kMaxNonCodeHeapObjectSize); | 2795 ASSERT(dest != LO_SPACE && size <= Page::kMaxRegularHeapObjectSize); |
2796 if (dest == OLD_POINTER_SPACE) { | 2796 if (dest == OLD_POINTER_SPACE) { |
2797 Address src_slot = src; | 2797 Address src_slot = src; |
2798 Address dst_slot = dst; | 2798 Address dst_slot = dst; |
2799 ASSERT(IsAligned(size, kPointerSize)); | 2799 ASSERT(IsAligned(size, kPointerSize)); |
2800 | 2800 |
2801 for (int remaining = size / kPointerSize; remaining > 0; remaining--) { | 2801 for (int remaining = size / kPointerSize; remaining > 0; remaining--) { |
2802 Object* value = Memory::Object_at(src_slot); | 2802 Object* value = Memory::Object_at(src_slot); |
2803 | 2803 |
2804 Memory::Object_at(dst_slot) = value; | 2804 Memory::Object_at(dst_slot) = value; |
2805 | 2805 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2959 return String::cast(map_word.ToForwardingAddress()); | 2959 return String::cast(map_word.ToForwardingAddress()); |
2960 } | 2960 } |
2961 | 2961 |
2962 return String::cast(*p); | 2962 return String::cast(*p); |
2963 } | 2963 } |
2964 | 2964 |
2965 | 2965 |
2966 bool MarkCompactCollector::TryPromoteObject(HeapObject* object, | 2966 bool MarkCompactCollector::TryPromoteObject(HeapObject* object, |
2967 int object_size) { | 2967 int object_size) { |
2968 // TODO(hpayer): Replace that check with an assert. | 2968 // TODO(hpayer): Replace that check with an assert. |
2969 CHECK(object_size <= Page::kMaxNonCodeHeapObjectSize); | 2969 CHECK(object_size <= Page::kMaxRegularHeapObjectSize); |
2970 | 2970 |
2971 OldSpace* target_space = heap()->TargetSpace(object); | 2971 OldSpace* target_space = heap()->TargetSpace(object); |
2972 | 2972 |
2973 ASSERT(target_space == heap()->old_pointer_space() || | 2973 ASSERT(target_space == heap()->old_pointer_space() || |
2974 target_space == heap()->old_data_space()); | 2974 target_space == heap()->old_data_space()); |
2975 Object* result; | 2975 Object* result; |
2976 MaybeObject* maybe_result = target_space->AllocateRaw(object_size); | 2976 MaybeObject* maybe_result = target_space->AllocateRaw(object_size); |
2977 if (maybe_result->ToObject(&result)) { | 2977 if (maybe_result->ToObject(&result)) { |
2978 HeapObject* target = HeapObject::cast(result); | 2978 HeapObject* target = HeapObject::cast(result); |
2979 MigrateObject(target->address(), | 2979 MigrateObject(target->address(), |
(...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4396 while (buffer != NULL) { | 4396 while (buffer != NULL) { |
4397 SlotsBuffer* next_buffer = buffer->next(); | 4397 SlotsBuffer* next_buffer = buffer->next(); |
4398 DeallocateBuffer(buffer); | 4398 DeallocateBuffer(buffer); |
4399 buffer = next_buffer; | 4399 buffer = next_buffer; |
4400 } | 4400 } |
4401 *buffer_address = NULL; | 4401 *buffer_address = NULL; |
4402 } | 4402 } |
4403 | 4403 |
4404 | 4404 |
4405 } } // namespace v8::internal | 4405 } } // namespace v8::internal |
OLD | NEW |