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

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

Issue 1178403003: Revert of Keep track of array buffers in new space separately (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
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 3023 matching lines...) Expand 10 before | Expand all | Expand 10 after
3034 int object_size) { 3034 int object_size) {
3035 DCHECK(object_size <= Page::kMaxRegularHeapObjectSize); 3035 DCHECK(object_size <= Page::kMaxRegularHeapObjectSize);
3036 3036
3037 OldSpace* old_space = heap()->old_space(); 3037 OldSpace* old_space = heap()->old_space();
3038 3038
3039 HeapObject* target; 3039 HeapObject* target;
3040 AllocationAlignment alignment = object->RequiredAlignment(); 3040 AllocationAlignment alignment = object->RequiredAlignment();
3041 AllocationResult allocation = old_space->AllocateRaw(object_size, alignment); 3041 AllocationResult allocation = old_space->AllocateRaw(object_size, alignment);
3042 if (allocation.To(&target)) { 3042 if (allocation.To(&target)) {
3043 MigrateObject(target, object, object_size, old_space->identity()); 3043 MigrateObject(target, object, object_size, old_space->identity());
3044 // If we end up needing more special cases, we should factor this out.
3045 if (V8_UNLIKELY(target->IsJSArrayBuffer())) {
3046 heap()->PromoteArrayBuffer(target);
3047 }
3048 heap()->IncrementPromotedObjectsSize(object_size); 3044 heap()->IncrementPromotedObjectsSize(object_size);
3049 return true; 3045 return true;
3050 } 3046 }
3051 3047
3052 return false; 3048 return false;
3053 } 3049 }
3054 3050
3055 3051
3056 bool MarkCompactCollector::IsSlotInBlackObject(Page* p, Address slot, 3052 bool MarkCompactCollector::IsSlotInBlackObject(Page* p, Address slot,
3057 HeapObject** out_object) { 3053 HeapObject** out_object) {
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after
4364 void MarkCompactCollector::SweepSpaces() { 4360 void MarkCompactCollector::SweepSpaces() {
4365 GCTracer::Scope gc_scope(heap()->tracer(), GCTracer::Scope::MC_SWEEP); 4361 GCTracer::Scope gc_scope(heap()->tracer(), GCTracer::Scope::MC_SWEEP);
4366 double start_time = 0.0; 4362 double start_time = 0.0;
4367 if (FLAG_print_cumulative_gc_stat) { 4363 if (FLAG_print_cumulative_gc_stat) {
4368 start_time = base::OS::TimeCurrentMillis(); 4364 start_time = base::OS::TimeCurrentMillis();
4369 } 4365 }
4370 4366
4371 #ifdef DEBUG 4367 #ifdef DEBUG
4372 state_ = SWEEP_SPACES; 4368 state_ = SWEEP_SPACES;
4373 #endif 4369 #endif
4370 heap()->FreeDeadArrayBuffers();
4374 4371
4375 MoveEvacuationCandidatesToEndOfPagesList(); 4372 MoveEvacuationCandidatesToEndOfPagesList();
4376 4373
4377 // Noncompacting collections simply sweep the spaces to clear the mark 4374 // Noncompacting collections simply sweep the spaces to clear the mark
4378 // bits and free the nonlive blocks (for old and map spaces). We sweep 4375 // bits and free the nonlive blocks (for old and map spaces). We sweep
4379 // the map space last because freeing non-live maps overwrites them and 4376 // the map space last because freeing non-live maps overwrites them and
4380 // the other spaces rely on possibly non-live maps to get the sizes for 4377 // the other spaces rely on possibly non-live maps to get the sizes for
4381 // non-live objects. 4378 // non-live objects.
4382 { 4379 {
4383 GCTracer::Scope sweep_scope(heap()->tracer(), 4380 GCTracer::Scope sweep_scope(heap()->tracer(),
4384 GCTracer::Scope::MC_SWEEP_OLDSPACE); 4381 GCTracer::Scope::MC_SWEEP_OLDSPACE);
4385 { SweepSpace(heap()->old_space(), CONCURRENT_SWEEPING); } 4382 { SweepSpace(heap()->old_space(), CONCURRENT_SWEEPING); }
4386 sweeping_in_progress_ = true; 4383 sweeping_in_progress_ = true;
4387 if (heap()->concurrent_sweeping_enabled()) { 4384 if (heap()->concurrent_sweeping_enabled()) {
4388 StartSweeperThreads(); 4385 StartSweeperThreads();
4389 } 4386 }
4390 } 4387 }
4391 RemoveDeadInvalidatedCode(); 4388 RemoveDeadInvalidatedCode();
4392 4389
4393 { 4390 {
4394 GCTracer::Scope sweep_scope(heap()->tracer(), 4391 GCTracer::Scope sweep_scope(heap()->tracer(),
4395 GCTracer::Scope::MC_SWEEP_CODE); 4392 GCTracer::Scope::MC_SWEEP_CODE);
4396 SweepSpace(heap()->code_space(), SEQUENTIAL_SWEEPING); 4393 SweepSpace(heap()->code_space(), SEQUENTIAL_SWEEPING);
4397 } 4394 }
4398 4395
4399 EvacuateNewSpaceAndCandidates(); 4396 EvacuateNewSpaceAndCandidates();
4400 4397
4401 heap()->FreeDeadArrayBuffers(false);
4402
4403 // ClearNonLiveReferences depends on precise sweeping of map space to 4398 // ClearNonLiveReferences depends on precise sweeping of map space to
4404 // detect whether unmarked map became dead in this collection or in one 4399 // detect whether unmarked map became dead in this collection or in one
4405 // of the previous ones. 4400 // of the previous ones.
4406 { 4401 {
4407 GCTracer::Scope sweep_scope(heap()->tracer(), 4402 GCTracer::Scope sweep_scope(heap()->tracer(),
4408 GCTracer::Scope::MC_SWEEP_MAP); 4403 GCTracer::Scope::MC_SWEEP_MAP);
4409 SweepSpace(heap()->map_space(), SEQUENTIAL_SWEEPING); 4404 SweepSpace(heap()->map_space(), SEQUENTIAL_SWEEPING);
4410 } 4405 }
4411 4406
4412 // Deallocate unmarked objects and clear marked bits for marked objects. 4407 // Deallocate unmarked objects and clear marked bits for marked objects.
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
4728 SlotsBuffer* buffer = *buffer_address; 4723 SlotsBuffer* buffer = *buffer_address;
4729 while (buffer != NULL) { 4724 while (buffer != NULL) {
4730 SlotsBuffer* next_buffer = buffer->next(); 4725 SlotsBuffer* next_buffer = buffer->next();
4731 DeallocateBuffer(buffer); 4726 DeallocateBuffer(buffer);
4732 buffer = next_buffer; 4727 buffer = next_buffer;
4733 } 4728 }
4734 *buffer_address = NULL; 4729 *buffer_address = NULL;
4735 } 4730 }
4736 } // namespace internal 4731 } // namespace internal
4737 } // namespace v8 4732 } // namespace v8
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