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

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

Issue 25655004: Print out how many AllocationMementos were found during mark-sweep. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/heap-inl.h ('k') | src/objects.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 return compacting_; 400 return compacting_;
401 } 401 }
402 402
403 403
404 void MarkCompactCollector::CollectGarbage() { 404 void MarkCompactCollector::CollectGarbage() {
405 // Make sure that Prepare() has been called. The individual steps below will 405 // Make sure that Prepare() has been called. The individual steps below will
406 // update the state as they proceed. 406 // update the state as they proceed.
407 ASSERT(state_ == PREPARE_GC); 407 ASSERT(state_ == PREPARE_GC);
408 ASSERT(encountered_weak_collections_ == Smi::FromInt(0)); 408 ASSERT(encountered_weak_collections_ == Smi::FromInt(0));
409 409
410 heap()->allocation_mementos_found_ = 0;
411
410 MarkLiveObjects(); 412 MarkLiveObjects();
411 ASSERT(heap_->incremental_marking()->IsStopped()); 413 ASSERT(heap_->incremental_marking()->IsStopped());
412 414
413 if (FLAG_collect_maps) ClearNonLiveReferences(); 415 if (FLAG_collect_maps) ClearNonLiveReferences();
414 416
415 ClearWeakCollections(); 417 ClearWeakCollections();
416 418
417 #ifdef VERIFY_HEAP 419 #ifdef VERIFY_HEAP
418 if (FLAG_verify_heap) { 420 if (FLAG_verify_heap) {
419 VerifyMarking(heap_); 421 VerifyMarking(heap_);
(...skipping 22 matching lines...) Expand all
442 444
443 Finish(); 445 Finish();
444 446
445 if (marking_parity_ == EVEN_MARKING_PARITY) { 447 if (marking_parity_ == EVEN_MARKING_PARITY) {
446 marking_parity_ = ODD_MARKING_PARITY; 448 marking_parity_ = ODD_MARKING_PARITY;
447 } else { 449 } else {
448 ASSERT(marking_parity_ == ODD_MARKING_PARITY); 450 ASSERT(marking_parity_ == ODD_MARKING_PARITY);
449 marking_parity_ = EVEN_MARKING_PARITY; 451 marking_parity_ = EVEN_MARKING_PARITY;
450 } 452 }
451 453
454 if (FLAG_trace_track_allocation_sites &&
455 heap()->allocation_mementos_found_ > 0) {
456 PrintF("AllocationMementos found during mark-sweep = %d\n",
457 heap()->allocation_mementos_found_);
458 }
452 tracer_ = NULL; 459 tracer_ = NULL;
453 } 460 }
454 461
455 462
456 #ifdef VERIFY_HEAP 463 #ifdef VERIFY_HEAP
457 void MarkCompactCollector::VerifyMarkbitsAreClean(PagedSpace* space) { 464 void MarkCompactCollector::VerifyMarkbitsAreClean(PagedSpace* space) {
458 PageIterator it(space); 465 PageIterator it(space);
459 466
460 while (it.has_next()) { 467 while (it.has_next()) {
461 Page* p = it.next(); 468 Page* p = it.next();
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1995 while (current_cell != 0) { 2002 while (current_cell != 0) {
1996 int trailing_zeros = CompilerIntrinsics::CountTrailingZeros(current_cell); 2003 int trailing_zeros = CompilerIntrinsics::CountTrailingZeros(current_cell);
1997 current_cell >>= trailing_zeros; 2004 current_cell >>= trailing_zeros;
1998 offset += trailing_zeros; 2005 offset += trailing_zeros;
1999 Address address = cell_base + offset * kPointerSize; 2006 Address address = cell_base + offset * kPointerSize;
2000 HeapObject* object = HeapObject::FromAddress(address); 2007 HeapObject* object = HeapObject::FromAddress(address);
2001 2008
2002 int size = object->Size(); 2009 int size = object->Size();
2003 survivors_size += size; 2010 survivors_size += size;
2004 2011
2012 if (FLAG_trace_track_allocation_sites && object->IsJSObject()) {
2013 if (AllocationMemento::FindForJSObject(JSObject::cast(object), true)
2014 != NULL) {
2015 heap()->allocation_mementos_found_++;
2016 }
2017 }
2018
2005 offset++; 2019 offset++;
2006 current_cell >>= 1; 2020 current_cell >>= 1;
2007 // Aggressively promote young survivors to the old space. 2021 // Aggressively promote young survivors to the old space.
2008 if (TryPromoteObject(object, size)) { 2022 if (TryPromoteObject(object, size)) {
2009 continue; 2023 continue;
2010 } 2024 }
2011 2025
2012 // Promotion failed. Just migrate object to another semispace. 2026 // Promotion failed. Just migrate object to another semispace.
2013 MaybeObject* allocation = new_space->AllocateRaw(size); 2027 MaybeObject* allocation = new_space->AllocateRaw(size);
2014 if (allocation->IsFailure()) { 2028 if (allocation->IsFailure()) {
(...skipping 2284 matching lines...) Expand 10 before | Expand all | Expand 10 after
4299 while (buffer != NULL) { 4313 while (buffer != NULL) {
4300 SlotsBuffer* next_buffer = buffer->next(); 4314 SlotsBuffer* next_buffer = buffer->next();
4301 DeallocateBuffer(buffer); 4315 DeallocateBuffer(buffer);
4302 buffer = next_buffer; 4316 buffer = next_buffer;
4303 } 4317 }
4304 *buffer_address = NULL; 4318 *buffer_address = NULL;
4305 } 4319 }
4306 4320
4307 4321
4308 } } // namespace v8::internal 4322 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap-inl.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698