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/08 13:39:29
Please don't add any JS type specific functionalit
| |
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(); | 4418 // MarkCompact will always also evacuate the new space. |
4419 heap()->FreeDeadArrayBuffers(true); | |
4420 heap()->FreeDeadArrayBuffers(false); | |
4416 | 4421 |
4417 MoveEvacuationCandidatesToEndOfPagesList(); | 4422 MoveEvacuationCandidatesToEndOfPagesList(); |
4418 | 4423 |
4419 // Noncompacting collections simply sweep the spaces to clear the mark | 4424 // Noncompacting collections simply sweep the spaces to clear the mark |
4420 // bits and free the nonlive blocks (for old and map spaces). We sweep | 4425 // 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 | 4426 // 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 | 4427 // the other spaces rely on possibly non-live maps to get the sizes for |
4423 // non-live objects. | 4428 // non-live objects. |
4424 { | 4429 { |
4425 GCTracer::Scope sweep_scope(heap()->tracer(), | 4430 GCTracer::Scope sweep_scope(heap()->tracer(), |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4757 SlotsBuffer* buffer = *buffer_address; | 4762 SlotsBuffer* buffer = *buffer_address; |
4758 while (buffer != NULL) { | 4763 while (buffer != NULL) { |
4759 SlotsBuffer* next_buffer = buffer->next(); | 4764 SlotsBuffer* next_buffer = buffer->next(); |
4760 DeallocateBuffer(buffer); | 4765 DeallocateBuffer(buffer); |
4761 buffer = next_buffer; | 4766 buffer = next_buffer; |
4762 } | 4767 } |
4763 *buffer_address = NULL; | 4768 *buffer_address = NULL; |
4764 } | 4769 } |
4765 } | 4770 } |
4766 } // namespace v8::internal | 4771 } // namespace v8::internal |
OLD | NEW |