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 3088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3099 if (object->NeedsToEnsureDoubleAlignment()) { | 3099 if (object->NeedsToEnsureDoubleAlignment()) { |
3100 allocation = old_space->AllocateRawDoubleAligned(object_size); | 3100 allocation = old_space->AllocateRawDoubleAligned(object_size); |
3101 } else { | 3101 } else { |
3102 allocation = old_space->AllocateRaw(object_size); | 3102 allocation = old_space->AllocateRaw(object_size); |
3103 } | 3103 } |
3104 #else | 3104 #else |
3105 allocation = old_space->AllocateRaw(object_size); | 3105 allocation = old_space->AllocateRaw(object_size); |
3106 #endif | 3106 #endif |
3107 if (allocation.To(&target)) { | 3107 if (allocation.To(&target)) { |
3108 MigrateObject(target, object, object_size, old_space->identity()); | 3108 MigrateObject(target, object, object_size, old_space->identity()); |
3109 if (target->IsJSArrayBuffer()) { | |
3110 heap()->PromoteArrayBuffer(JSArrayBuffer::cast(target)); | |
Hannes Payer (out of office)
2015/05/12 06:33:28
I think we should clean that up together with the
| |
3111 } | |
3109 heap()->IncrementPromotedObjectsSize(object_size); | 3112 heap()->IncrementPromotedObjectsSize(object_size); |
3110 return true; | 3113 return true; |
3111 } | 3114 } |
3112 | 3115 |
3113 return false; | 3116 return false; |
3114 } | 3117 } |
3115 | 3118 |
3116 | 3119 |
3117 bool MarkCompactCollector::IsSlotInBlackObject(Page* p, Address slot, | 3120 bool MarkCompactCollector::IsSlotInBlackObject(Page* p, Address slot, |
3118 HeapObject** out_object) { | 3121 HeapObject** out_object) { |
(...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4405 void MarkCompactCollector::SweepSpaces() { | 4408 void MarkCompactCollector::SweepSpaces() { |
4406 GCTracer::Scope gc_scope(heap()->tracer(), GCTracer::Scope::MC_SWEEP); | 4409 GCTracer::Scope gc_scope(heap()->tracer(), GCTracer::Scope::MC_SWEEP); |
4407 double start_time = 0.0; | 4410 double start_time = 0.0; |
4408 if (FLAG_print_cumulative_gc_stat) { | 4411 if (FLAG_print_cumulative_gc_stat) { |
4409 start_time = base::OS::TimeCurrentMillis(); | 4412 start_time = base::OS::TimeCurrentMillis(); |
4410 } | 4413 } |
4411 | 4414 |
4412 #ifdef DEBUG | 4415 #ifdef DEBUG |
4413 state_ = SWEEP_SPACES; | 4416 state_ = SWEEP_SPACES; |
4414 #endif | 4417 #endif |
4415 heap()->FreeDeadArrayBuffers(); | |
4416 | 4418 |
4417 MoveEvacuationCandidatesToEndOfPagesList(); | 4419 MoveEvacuationCandidatesToEndOfPagesList(); |
4418 | 4420 |
4419 // Noncompacting collections simply sweep the spaces to clear the mark | 4421 // Noncompacting collections simply sweep the spaces to clear the mark |
4420 // bits and free the nonlive blocks (for old and map spaces). We sweep | 4422 // bits and free the nonlive blocks (for old and map spaces). We sweep |
4421 // the map space last because freeing non-live maps overwrites them and | 4423 // the map space last because freeing non-live maps overwrites them and |
4422 // the other spaces rely on possibly non-live maps to get the sizes for | 4424 // the other spaces rely on possibly non-live maps to get the sizes for |
4423 // non-live objects. | 4425 // non-live objects. |
4424 { | 4426 { |
4425 GCTracer::Scope sweep_scope(heap()->tracer(), | 4427 GCTracer::Scope sweep_scope(heap()->tracer(), |
4426 GCTracer::Scope::MC_SWEEP_OLDSPACE); | 4428 GCTracer::Scope::MC_SWEEP_OLDSPACE); |
4427 { SweepSpace(heap()->old_space(), CONCURRENT_SWEEPING); } | 4429 { SweepSpace(heap()->old_space(), CONCURRENT_SWEEPING); } |
4428 sweeping_in_progress_ = true; | 4430 sweeping_in_progress_ = true; |
4429 if (heap()->concurrent_sweeping_enabled()) { | 4431 if (heap()->concurrent_sweeping_enabled()) { |
4430 StartSweeperThreads(); | 4432 StartSweeperThreads(); |
4431 } | 4433 } |
4432 } | 4434 } |
4433 RemoveDeadInvalidatedCode(); | 4435 RemoveDeadInvalidatedCode(); |
4434 | 4436 |
4435 { | 4437 { |
4436 GCTracer::Scope sweep_scope(heap()->tracer(), | 4438 GCTracer::Scope sweep_scope(heap()->tracer(), |
4437 GCTracer::Scope::MC_SWEEP_CODE); | 4439 GCTracer::Scope::MC_SWEEP_CODE); |
4438 SweepSpace(heap()->code_space(), SEQUENTIAL_SWEEPING); | 4440 SweepSpace(heap()->code_space(), SEQUENTIAL_SWEEPING); |
4439 } | 4441 } |
4440 | 4442 |
4441 EvacuateNewSpaceAndCandidates(); | 4443 EvacuateNewSpaceAndCandidates(); |
4442 | 4444 |
4445 heap()->FreeDeadArrayBuffers(false); | |
4446 | |
4443 // ClearNonLiveReferences depends on precise sweeping of map space to | 4447 // ClearNonLiveReferences depends on precise sweeping of map space to |
4444 // detect whether unmarked map became dead in this collection or in one | 4448 // detect whether unmarked map became dead in this collection or in one |
4445 // of the previous ones. | 4449 // of the previous ones. |
4446 { | 4450 { |
4447 GCTracer::Scope sweep_scope(heap()->tracer(), | 4451 GCTracer::Scope sweep_scope(heap()->tracer(), |
4448 GCTracer::Scope::MC_SWEEP_MAP); | 4452 GCTracer::Scope::MC_SWEEP_MAP); |
4449 SweepSpace(heap()->map_space(), SEQUENTIAL_SWEEPING); | 4453 SweepSpace(heap()->map_space(), SEQUENTIAL_SWEEPING); |
4450 } | 4454 } |
4451 | 4455 |
4452 // Deallocate unmarked objects and clear marked bits for marked objects. | 4456 // Deallocate unmarked objects and clear marked bits for marked objects. |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4757 SlotsBuffer* buffer = *buffer_address; | 4761 SlotsBuffer* buffer = *buffer_address; |
4758 while (buffer != NULL) { | 4762 while (buffer != NULL) { |
4759 SlotsBuffer* next_buffer = buffer->next(); | 4763 SlotsBuffer* next_buffer = buffer->next(); |
4760 DeallocateBuffer(buffer); | 4764 DeallocateBuffer(buffer); |
4761 buffer = next_buffer; | 4765 buffer = next_buffer; |
4762 } | 4766 } |
4763 *buffer_address = NULL; | 4767 *buffer_address = NULL; |
4764 } | 4768 } |
4765 } | 4769 } |
4766 } // namespace v8::internal | 4770 } // namespace v8::internal |
OLD | NEW |