| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/heap/mark-compact.h" | 5 #include "src/heap/mark-compact.h" |
| 6 | 6 |
| 7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
| 8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
| 9 #include "src/base/sys-info.h" | 9 #include "src/base/sys-info.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1328 MarkObject(optimized_code, optimized_code_mark); | 1328 MarkObject(optimized_code, optimized_code_mark); |
| 1329 } | 1329 } |
| 1330 } | 1330 } |
| 1331 } | 1331 } |
| 1332 | 1332 |
| 1333 | 1333 |
| 1334 void MarkCompactCollector::PrepareForCodeFlushing() { | 1334 void MarkCompactCollector::PrepareForCodeFlushing() { |
| 1335 // If code flushing is disabled, there is no need to prepare for it. | 1335 // If code flushing is disabled, there is no need to prepare for it. |
| 1336 if (!is_code_flushing_enabled()) return; | 1336 if (!is_code_flushing_enabled()) return; |
| 1337 | 1337 |
| 1338 // Ensure that empty descriptor array is marked. Method MarkDescriptorArray | |
| 1339 // relies on it being marked before any other descriptor array. | |
| 1340 HeapObject* descriptor_array = heap()->empty_descriptor_array(); | |
| 1341 MarkBit descriptor_array_mark = Marking::MarkBitFrom(descriptor_array); | |
| 1342 MarkObject(descriptor_array, descriptor_array_mark); | |
| 1343 | |
| 1344 // Make sure we are not referencing the code from the stack. | 1338 // Make sure we are not referencing the code from the stack. |
| 1345 DCHECK(this == heap()->mark_compact_collector()); | 1339 DCHECK(this == heap()->mark_compact_collector()); |
| 1346 PrepareThreadForCodeFlushing(heap()->isolate(), | 1340 PrepareThreadForCodeFlushing(heap()->isolate(), |
| 1347 heap()->isolate()->thread_local_top()); | 1341 heap()->isolate()->thread_local_top()); |
| 1348 | 1342 |
| 1349 // Iterate the archived stacks in all threads to check if | 1343 // Iterate the archived stacks in all threads to check if |
| 1350 // the code is referenced. | 1344 // the code is referenced. |
| 1351 CodeMarkingVisitor code_marking_visitor(this); | 1345 CodeMarkingVisitor code_marking_visitor(this); |
| 1352 heap()->isolate()->thread_manager()->IterateArchivedThreads( | 1346 heap()->isolate()->thread_manager()->IterateArchivedThreads( |
| 1353 &code_marking_visitor); | 1347 &code_marking_visitor); |
| (...skipping 2455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3809 MarkBit mark_bit = Marking::MarkBitFrom(host); | 3803 MarkBit mark_bit = Marking::MarkBitFrom(host); |
| 3810 if (Marking::IsBlack(mark_bit)) { | 3804 if (Marking::IsBlack(mark_bit)) { |
| 3811 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); | 3805 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); |
| 3812 RecordRelocSlot(host, &rinfo, target); | 3806 RecordRelocSlot(host, &rinfo, target); |
| 3813 } | 3807 } |
| 3814 } | 3808 } |
| 3815 } | 3809 } |
| 3816 | 3810 |
| 3817 } // namespace internal | 3811 } // namespace internal |
| 3818 } // namespace v8 | 3812 } // namespace v8 |
| OLD | NEW |