| 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/v8.h" | 5 #include "src/v8.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/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 #ifdef DEBUG | 40 #ifdef DEBUG |
| 41 state_(IDLE), | 41 state_(IDLE), |
| 42 #endif | 42 #endif |
| 43 reduce_memory_footprint_(false), | 43 reduce_memory_footprint_(false), |
| 44 abort_incremental_marking_(false), | 44 abort_incremental_marking_(false), |
| 45 marking_parity_(ODD_MARKING_PARITY), | 45 marking_parity_(ODD_MARKING_PARITY), |
| 46 compacting_(false), | 46 compacting_(false), |
| 47 was_marked_incrementally_(false), | 47 was_marked_incrementally_(false), |
| 48 sweeping_in_progress_(false), | 48 sweeping_in_progress_(false), |
| 49 pending_sweeper_jobs_semaphore_(0), | 49 pending_sweeper_jobs_semaphore_(0), |
| 50 sequential_sweeping_(false), | 50 evacuation_(false), |
| 51 migration_slots_buffer_(NULL), | 51 migration_slots_buffer_(NULL), |
| 52 heap_(heap), | 52 heap_(heap), |
| 53 code_flusher_(NULL), | 53 code_flusher_(NULL), |
| 54 have_code_to_deoptimize_(false) { | 54 have_code_to_deoptimize_(false) { |
| 55 } | 55 } |
| 56 | 56 |
| 57 #ifdef VERIFY_HEAP | 57 #ifdef VERIFY_HEAP |
| 58 class VerifyMarkingVisitor : public ObjectVisitor { | 58 class VerifyMarkingVisitor : public ObjectVisitor { |
| 59 public: | 59 public: |
| 60 explicit VerifyMarkingVisitor(Heap* heap) : heap_(heap) {} | 60 explicit VerifyMarkingVisitor(Heap* heap) : heap_(heap) {} |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 pending_sweeper_jobs_semaphore_.Wait(); | 480 pending_sweeper_jobs_semaphore_.Wait(); |
| 481 } | 481 } |
| 482 ParallelSweepSpacesComplete(); | 482 ParallelSweepSpacesComplete(); |
| 483 sweeping_in_progress_ = false; | 483 sweeping_in_progress_ = false; |
| 484 RefillFreeList(heap()->paged_space(OLD_DATA_SPACE)); | 484 RefillFreeList(heap()->paged_space(OLD_DATA_SPACE)); |
| 485 RefillFreeList(heap()->paged_space(OLD_POINTER_SPACE)); | 485 RefillFreeList(heap()->paged_space(OLD_POINTER_SPACE)); |
| 486 heap()->paged_space(OLD_DATA_SPACE)->ResetUnsweptFreeBytes(); | 486 heap()->paged_space(OLD_DATA_SPACE)->ResetUnsweptFreeBytes(); |
| 487 heap()->paged_space(OLD_POINTER_SPACE)->ResetUnsweptFreeBytes(); | 487 heap()->paged_space(OLD_POINTER_SPACE)->ResetUnsweptFreeBytes(); |
| 488 | 488 |
| 489 #ifdef VERIFY_HEAP | 489 #ifdef VERIFY_HEAP |
| 490 if (FLAG_verify_heap) { | 490 if (FLAG_verify_heap && !evacuation()) { |
| 491 VerifyEvacuation(heap_); | 491 VerifyEvacuation(heap_); |
| 492 } | 492 } |
| 493 #endif | 493 #endif |
| 494 } | 494 } |
| 495 | 495 |
| 496 | 496 |
| 497 bool MarkCompactCollector::IsSweepingCompleted() { | 497 bool MarkCompactCollector::IsSweepingCompleted() { |
| 498 if (!pending_sweeper_jobs_semaphore_.WaitFor( | 498 if (!pending_sweeper_jobs_semaphore_.WaitFor( |
| 499 base::TimeDelta::FromSeconds(0))) { | 499 base::TimeDelta::FromSeconds(0))) { |
| 500 return false; | 500 return false; |
| (...skipping 2885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3386 { | 3386 { |
| 3387 GCTracer::Scope gc_scope(heap()->tracer(), | 3387 GCTracer::Scope gc_scope(heap()->tracer(), |
| 3388 GCTracer::Scope::MC_SWEEP_NEWSPACE); | 3388 GCTracer::Scope::MC_SWEEP_NEWSPACE); |
| 3389 code_slots_filtering_required = MarkInvalidatedCode(); | 3389 code_slots_filtering_required = MarkInvalidatedCode(); |
| 3390 EvacuateNewSpace(); | 3390 EvacuateNewSpace(); |
| 3391 } | 3391 } |
| 3392 | 3392 |
| 3393 { | 3393 { |
| 3394 GCTracer::Scope gc_scope(heap()->tracer(), | 3394 GCTracer::Scope gc_scope(heap()->tracer(), |
| 3395 GCTracer::Scope::MC_EVACUATE_PAGES); | 3395 GCTracer::Scope::MC_EVACUATE_PAGES); |
| 3396 EvacuationScope evacuation_scope(this); |
| 3396 EvacuatePages(); | 3397 EvacuatePages(); |
| 3397 } | 3398 } |
| 3398 | 3399 |
| 3399 // Second pass: find pointers to new space and update them. | 3400 // Second pass: find pointers to new space and update them. |
| 3400 PointersUpdatingVisitor updating_visitor(heap()); | 3401 PointersUpdatingVisitor updating_visitor(heap()); |
| 3401 | 3402 |
| 3402 { | 3403 { |
| 3403 GCTracer::Scope gc_scope(heap()->tracer(), | 3404 GCTracer::Scope gc_scope(heap()->tracer(), |
| 3404 GCTracer::Scope::MC_UPDATE_NEW_TO_NEW_POINTERS); | 3405 GCTracer::Scope::MC_UPDATE_NEW_TO_NEW_POINTERS); |
| 3405 // Update pointers in to space. | 3406 // Update pointers in to space. |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4132 | 4133 |
| 4133 // Noncompacting collections simply sweep the spaces to clear the mark | 4134 // Noncompacting collections simply sweep the spaces to clear the mark |
| 4134 // bits and free the nonlive blocks (for old and map spaces). We sweep | 4135 // bits and free the nonlive blocks (for old and map spaces). We sweep |
| 4135 // the map space last because freeing non-live maps overwrites them and | 4136 // the map space last because freeing non-live maps overwrites them and |
| 4136 // the other spaces rely on possibly non-live maps to get the sizes for | 4137 // the other spaces rely on possibly non-live maps to get the sizes for |
| 4137 // non-live objects. | 4138 // non-live objects. |
| 4138 { | 4139 { |
| 4139 GCTracer::Scope sweep_scope(heap()->tracer(), | 4140 GCTracer::Scope sweep_scope(heap()->tracer(), |
| 4140 GCTracer::Scope::MC_SWEEP_OLDSPACE); | 4141 GCTracer::Scope::MC_SWEEP_OLDSPACE); |
| 4141 { | 4142 { |
| 4142 SequentialSweepingScope scope(this); | |
| 4143 SweepSpace(heap()->old_pointer_space(), CONCURRENT_SWEEPING); | 4143 SweepSpace(heap()->old_pointer_space(), CONCURRENT_SWEEPING); |
| 4144 SweepSpace(heap()->old_data_space(), CONCURRENT_SWEEPING); | 4144 SweepSpace(heap()->old_data_space(), CONCURRENT_SWEEPING); |
| 4145 } | 4145 } |
| 4146 sweeping_in_progress_ = true; | 4146 sweeping_in_progress_ = true; |
| 4147 if (FLAG_concurrent_sweeping) { | 4147 if (FLAG_concurrent_sweeping) { |
| 4148 StartSweeperThreads(); | 4148 StartSweeperThreads(); |
| 4149 } | 4149 } |
| 4150 } | 4150 } |
| 4151 RemoveDeadInvalidatedCode(); | 4151 RemoveDeadInvalidatedCode(); |
| 4152 | 4152 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4406 SlotsBuffer* buffer = *buffer_address; | 4406 SlotsBuffer* buffer = *buffer_address; |
| 4407 while (buffer != NULL) { | 4407 while (buffer != NULL) { |
| 4408 SlotsBuffer* next_buffer = buffer->next(); | 4408 SlotsBuffer* next_buffer = buffer->next(); |
| 4409 DeallocateBuffer(buffer); | 4409 DeallocateBuffer(buffer); |
| 4410 buffer = next_buffer; | 4410 buffer = next_buffer; |
| 4411 } | 4411 } |
| 4412 *buffer_address = NULL; | 4412 *buffer_address = NULL; |
| 4413 } | 4413 } |
| 4414 } | 4414 } |
| 4415 } // namespace v8::internal | 4415 } // namespace v8::internal |
| OLD | NEW |