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 2706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2717 // pointer iteration. This is an issue if the store buffer overflows and we | 2717 // pointer iteration. This is an issue if the store buffer overflows and we |
2718 // have to scan the entire old space, including dead objects, looking for | 2718 // have to scan the entire old space, including dead objects, looking for |
2719 // pointers to new space. | 2719 // pointers to new space. |
2720 void MarkCompactCollector::MigrateObject(Address dst, | 2720 void MarkCompactCollector::MigrateObject(Address dst, |
2721 Address src, | 2721 Address src, |
2722 int size, | 2722 int size, |
2723 AllocationSpace dest) { | 2723 AllocationSpace dest) { |
2724 HEAP_PROFILE(heap(), ObjectMoveEvent(src, dst)); | 2724 HEAP_PROFILE(heap(), ObjectMoveEvent(src, dst)); |
2725 // TODO(hpayer): Replace that check with an assert. | 2725 // TODO(hpayer): Replace that check with an assert. |
2726 CHECK(dest != LO_SPACE && size <= Page::kMaxNonCodeHeapObjectSize); | 2726 CHECK(dest != LO_SPACE && size <= Page::kMaxNonCodeHeapObjectSize); |
| 2727 // Objects in old pointer space and old data space can just be moved by |
| 2728 // compaction to a different page in the same space. |
| 2729 // TODO(hpayer): Replace that following checks with asserts. |
| 2730 CHECK(!heap_->old_pointer_space()->Contains(src) || |
| 2731 (heap_->old_pointer_space()->Contains(dst) && |
| 2732 heap_->TargetSpace(HeapObject::FromAddress(src)) == |
| 2733 heap_->old_pointer_space())); |
| 2734 CHECK(!heap_->old_data_space()->Contains(src) || |
| 2735 (heap_->old_data_space()->Contains(dst) && |
| 2736 heap_->TargetSpace(HeapObject::FromAddress(src)) == |
| 2737 heap_->old_data_space())); |
2727 if (dest == OLD_POINTER_SPACE) { | 2738 if (dest == OLD_POINTER_SPACE) { |
| 2739 // TODO(hpayer): Replace this check with an assert. |
| 2740 CHECK(heap_->TargetSpace(HeapObject::FromAddress(src)) == |
| 2741 heap_->old_pointer_space()); |
2728 Address src_slot = src; | 2742 Address src_slot = src; |
2729 Address dst_slot = dst; | 2743 Address dst_slot = dst; |
2730 ASSERT(IsAligned(size, kPointerSize)); | 2744 ASSERT(IsAligned(size, kPointerSize)); |
2731 | 2745 |
2732 for (int remaining = size / kPointerSize; remaining > 0; remaining--) { | 2746 for (int remaining = size / kPointerSize; remaining > 0; remaining--) { |
2733 Object* value = Memory::Object_at(src_slot); | 2747 Object* value = Memory::Object_at(src_slot); |
2734 | 2748 |
2735 Memory::Object_at(dst_slot) = value; | 2749 Memory::Object_at(dst_slot) = value; |
2736 | 2750 |
2737 if (heap_->InNewSpace(value)) { | 2751 if (heap_->InNewSpace(value)) { |
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4300 while (buffer != NULL) { | 4314 while (buffer != NULL) { |
4301 SlotsBuffer* next_buffer = buffer->next(); | 4315 SlotsBuffer* next_buffer = buffer->next(); |
4302 DeallocateBuffer(buffer); | 4316 DeallocateBuffer(buffer); |
4303 buffer = next_buffer; | 4317 buffer = next_buffer; |
4304 } | 4318 } |
4305 *buffer_address = NULL; | 4319 *buffer_address = NULL; |
4306 } | 4320 } |
4307 | 4321 |
4308 | 4322 |
4309 } } // namespace v8::internal | 4323 } } // namespace v8::internal |
OLD | NEW |