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

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

Issue 1317553002: [heap] Prevent direct access to StoreBuffer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. Created 5 years, 3 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/mark-compact.h ('k') | src/heap/store-buffer.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/heap/mark-compact.h" 5 #include "src/heap/mark-compact.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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 #ifdef VERIFY_HEAP 296 #ifdef VERIFY_HEAP
297 static void VerifyValidSlotsBufferEntries(Heap* heap, PagedSpace* space) { 297 static void VerifyValidSlotsBufferEntries(Heap* heap, PagedSpace* space) {
298 PageIterator it(space); 298 PageIterator it(space);
299 while (it.has_next()) { 299 while (it.has_next()) {
300 Page* p = it.next(); 300 Page* p = it.next();
301 SlotsBuffer::VerifySlots(heap, p->slots_buffer()); 301 SlotsBuffer::VerifySlots(heap, p->slots_buffer());
302 } 302 }
303 } 303 }
304 304
305 305
306 static void VerifyValidStoreAndSlotsBufferEntries(Heap* heap) { 306 void MarkCompactCollector::VerifyValidStoreAndSlotsBufferEntries() {
307 heap->store_buffer()->VerifyValidStoreBufferEntries(); 307 heap()->store_buffer()->VerifyValidStoreBufferEntries();
308 308
309 VerifyValidSlotsBufferEntries(heap, heap->old_space()); 309 VerifyValidSlotsBufferEntries(heap(), heap()->old_space());
310 VerifyValidSlotsBufferEntries(heap, heap->code_space()); 310 VerifyValidSlotsBufferEntries(heap(), heap()->code_space());
311 VerifyValidSlotsBufferEntries(heap, heap->map_space()); 311 VerifyValidSlotsBufferEntries(heap(), heap()->map_space());
312 312
313 LargeObjectIterator it(heap->lo_space()); 313 LargeObjectIterator it(heap()->lo_space());
314 for (HeapObject* object = it.Next(); object != NULL; object = it.Next()) { 314 for (HeapObject* object = it.Next(); object != NULL; object = it.Next()) {
315 MemoryChunk* chunk = MemoryChunk::FromAddress(object->address()); 315 MemoryChunk* chunk = MemoryChunk::FromAddress(object->address());
316 SlotsBuffer::VerifySlots(heap, chunk->slots_buffer()); 316 SlotsBuffer::VerifySlots(heap(), chunk->slots_buffer());
317 } 317 }
318 } 318 }
319 #endif 319 #endif
320 320
321 321
322 void MarkCompactCollector::CollectGarbage() { 322 void MarkCompactCollector::CollectGarbage() {
323 // Make sure that Prepare() has been called. The individual steps below will 323 // Make sure that Prepare() has been called. The individual steps below will
324 // update the state as they proceed. 324 // update the state as they proceed.
325 DCHECK(state_ == PREPARE_GC); 325 DCHECK(state_ == PREPARE_GC);
326 326
(...skipping 15 matching lines...) Expand all
342 #ifdef VERIFY_HEAP 342 #ifdef VERIFY_HEAP
343 if (FLAG_verify_heap) { 343 if (FLAG_verify_heap) {
344 VerifyMarking(heap_); 344 VerifyMarking(heap_);
345 } 345 }
346 #endif 346 #endif
347 347
348 ClearInvalidStoreAndSlotsBufferEntries(); 348 ClearInvalidStoreAndSlotsBufferEntries();
349 349
350 #ifdef VERIFY_HEAP 350 #ifdef VERIFY_HEAP
351 if (FLAG_verify_heap) { 351 if (FLAG_verify_heap) {
352 VerifyValidStoreAndSlotsBufferEntries(heap_); 352 VerifyValidStoreAndSlotsBufferEntries();
353 } 353 }
354 #endif 354 #endif
355 355
356 SweepSpaces(); 356 SweepSpaces();
357 357
358 Finish(); 358 Finish();
359 359
360 if (marking_parity_ == EVEN_MARKING_PARITY) { 360 if (marking_parity_ == EVEN_MARKING_PARITY) {
361 marking_parity_ = ODD_MARKING_PARITY; 361 marking_parity_ = ODD_MARKING_PARITY;
362 } else { 362 } else {
(...skipping 4333 matching lines...) Expand 10 before | Expand all | Expand 10 after
4696 SlotsBuffer* buffer = *buffer_address; 4696 SlotsBuffer* buffer = *buffer_address;
4697 while (buffer != NULL) { 4697 while (buffer != NULL) {
4698 SlotsBuffer* next_buffer = buffer->next(); 4698 SlotsBuffer* next_buffer = buffer->next();
4699 DeallocateBuffer(buffer); 4699 DeallocateBuffer(buffer);
4700 buffer = next_buffer; 4700 buffer = next_buffer;
4701 } 4701 }
4702 *buffer_address = NULL; 4702 *buffer_address = NULL;
4703 } 4703 }
4704 } // namespace internal 4704 } // namespace internal
4705 } // namespace v8 4705 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/mark-compact.h ('k') | src/heap/store-buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698