Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: src/heap/mark-compact.cc

Issue 1188313006: Version 4.4.63.8 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.4
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/objects-visiting-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3113 matching lines...) Expand 10 before | Expand all | Expand 10 after
3124 if (object->NeedsToEnsureDoubleAlignment()) { 3124 if (object->NeedsToEnsureDoubleAlignment()) {
3125 allocation = old_space->AllocateRawDoubleAligned(object_size); 3125 allocation = old_space->AllocateRawDoubleAligned(object_size);
3126 } else { 3126 } else {
3127 allocation = old_space->AllocateRaw(object_size); 3127 allocation = old_space->AllocateRaw(object_size);
3128 } 3128 }
3129 #else 3129 #else
3130 allocation = old_space->AllocateRaw(object_size); 3130 allocation = old_space->AllocateRaw(object_size);
3131 #endif 3131 #endif
3132 if (allocation.To(&target)) { 3132 if (allocation.To(&target)) {
3133 MigrateObject(target, object, object_size, old_space->identity()); 3133 MigrateObject(target, object, object_size, old_space->identity());
3134 // If we end up needing more special cases, we should factor this out.
3135 if (V8_UNLIKELY(target->IsJSArrayBuffer())) {
3136 heap()->PromoteArrayBuffer(target);
3137 }
3134 heap()->IncrementPromotedObjectsSize(object_size); 3138 heap()->IncrementPromotedObjectsSize(object_size);
3135 return true; 3139 return true;
3136 } 3140 }
3137 3141
3138 return false; 3142 return false;
3139 } 3143 }
3140 3144
3141 3145
3142 bool MarkCompactCollector::IsSlotInBlackObject(Page* p, Address slot, 3146 bool MarkCompactCollector::IsSlotInBlackObject(Page* p, Address slot,
3143 HeapObject** out_object) { 3147 HeapObject** out_object) {
(...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after
4430 void MarkCompactCollector::SweepSpaces() { 4434 void MarkCompactCollector::SweepSpaces() {
4431 GCTracer::Scope gc_scope(heap()->tracer(), GCTracer::Scope::MC_SWEEP); 4435 GCTracer::Scope gc_scope(heap()->tracer(), GCTracer::Scope::MC_SWEEP);
4432 double start_time = 0.0; 4436 double start_time = 0.0;
4433 if (FLAG_print_cumulative_gc_stat) { 4437 if (FLAG_print_cumulative_gc_stat) {
4434 start_time = base::OS::TimeCurrentMillis(); 4438 start_time = base::OS::TimeCurrentMillis();
4435 } 4439 }
4436 4440
4437 #ifdef DEBUG 4441 #ifdef DEBUG
4438 state_ = SWEEP_SPACES; 4442 state_ = SWEEP_SPACES;
4439 #endif 4443 #endif
4440 heap()->FreeDeadArrayBuffers();
4441 4444
4442 MoveEvacuationCandidatesToEndOfPagesList(); 4445 MoveEvacuationCandidatesToEndOfPagesList();
4443 4446
4444 // Noncompacting collections simply sweep the spaces to clear the mark 4447 // Noncompacting collections simply sweep the spaces to clear the mark
4445 // bits and free the nonlive blocks (for old and map spaces). We sweep 4448 // bits and free the nonlive blocks (for old and map spaces). We sweep
4446 // the map space last because freeing non-live maps overwrites them and 4449 // the map space last because freeing non-live maps overwrites them and
4447 // the other spaces rely on possibly non-live maps to get the sizes for 4450 // the other spaces rely on possibly non-live maps to get the sizes for
4448 // non-live objects. 4451 // non-live objects.
4449 { 4452 {
4450 GCTracer::Scope sweep_scope(heap()->tracer(), 4453 GCTracer::Scope sweep_scope(heap()->tracer(),
4451 GCTracer::Scope::MC_SWEEP_OLDSPACE); 4454 GCTracer::Scope::MC_SWEEP_OLDSPACE);
4452 { SweepSpace(heap()->old_space(), CONCURRENT_SWEEPING); } 4455 { SweepSpace(heap()->old_space(), CONCURRENT_SWEEPING); }
4453 sweeping_in_progress_ = true; 4456 sweeping_in_progress_ = true;
4454 if (heap()->concurrent_sweeping_enabled()) { 4457 if (heap()->concurrent_sweeping_enabled()) {
4455 StartSweeperThreads(); 4458 StartSweeperThreads();
4456 } 4459 }
4457 } 4460 }
4458 RemoveDeadInvalidatedCode(); 4461 RemoveDeadInvalidatedCode();
4459 4462
4460 { 4463 {
4461 GCTracer::Scope sweep_scope(heap()->tracer(), 4464 GCTracer::Scope sweep_scope(heap()->tracer(),
4462 GCTracer::Scope::MC_SWEEP_CODE); 4465 GCTracer::Scope::MC_SWEEP_CODE);
4463 SweepSpace(heap()->code_space(), SEQUENTIAL_SWEEPING); 4466 SweepSpace(heap()->code_space(), SEQUENTIAL_SWEEPING);
4464 } 4467 }
4465 4468
4466 EvacuateNewSpaceAndCandidates(); 4469 EvacuateNewSpaceAndCandidates();
4467 4470
4471 heap()->FreeDeadArrayBuffers(false);
4472
4468 // ClearNonLiveReferences depends on precise sweeping of map space to 4473 // ClearNonLiveReferences depends on precise sweeping of map space to
4469 // detect whether unmarked map became dead in this collection or in one 4474 // detect whether unmarked map became dead in this collection or in one
4470 // of the previous ones. 4475 // of the previous ones.
4471 { 4476 {
4472 GCTracer::Scope sweep_scope(heap()->tracer(), 4477 GCTracer::Scope sweep_scope(heap()->tracer(),
4473 GCTracer::Scope::MC_SWEEP_MAP); 4478 GCTracer::Scope::MC_SWEEP_MAP);
4474 SweepSpace(heap()->map_space(), SEQUENTIAL_SWEEPING); 4479 SweepSpace(heap()->map_space(), SEQUENTIAL_SWEEPING);
4475 } 4480 }
4476 4481
4477 // Deallocate unmarked objects and clear marked bits for marked objects. 4482 // Deallocate unmarked objects and clear marked bits for marked objects.
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
4782 SlotsBuffer* buffer = *buffer_address; 4787 SlotsBuffer* buffer = *buffer_address;
4783 while (buffer != NULL) { 4788 while (buffer != NULL) {
4784 SlotsBuffer* next_buffer = buffer->next(); 4789 SlotsBuffer* next_buffer = buffer->next();
4785 DeallocateBuffer(buffer); 4790 DeallocateBuffer(buffer);
4786 buffer = next_buffer; 4791 buffer = next_buffer;
4787 } 4792 }
4788 *buffer_address = NULL; 4793 *buffer_address = NULL;
4789 } 4794 }
4790 } 4795 }
4791 } // namespace v8::internal 4796 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/objects-visiting-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698