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

Unified Diff: runtime/vm/gc_sweeper.cc

Issue 11428067: Merge the Merlin heap tracing to top-of-trunk. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address review comments Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/handles.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/gc_sweeper.cc
diff --git a/runtime/vm/gc_sweeper.cc b/runtime/vm/gc_sweeper.cc
index 7f1cf8b87caa709360d24e89e4b8b3d7ec6ca727..d87ea64988135b71970817dfd60e8eda3884d15b 100644
--- a/runtime/vm/gc_sweeper.cc
+++ b/runtime/vm/gc_sweeper.cc
@@ -6,6 +6,8 @@
#include "vm/freelist.h"
#include "vm/globals.h"
+#include "vm/heap.h"
+#include "vm/heap_trace.h"
#include "vm/pages.h"
namespace dart {
@@ -28,7 +30,7 @@ intptr_t GCSweeper::SweepPage(HeapPage* page, FreeList* freelist) {
while (current < end) {
intptr_t obj_size;
- if (in_use_swept == in_use) {
+ if (in_use_swept == in_use && !HeapTrace::is_enabled()) {
// No more marked objects will be found on this page.
obj_size = end - current;
freelist->Free(current, obj_size);
@@ -42,12 +44,18 @@ intptr_t GCSweeper::SweepPage(HeapPage* page, FreeList* freelist) {
in_use_swept += obj_size;
} else {
uword free_end = current + raw_obj->Size();
+ if (HeapTrace::is_enabled()) {
+ heap_->trace()->TraceSweep(current);
+ }
while (free_end < end) {
RawObject* next_obj = RawObject::FromAddr(free_end);
if (next_obj->IsMarked()) {
// Reached the end of the free block.
break;
}
+ if (HeapTrace::is_enabled()) {
+ heap_->trace()->TraceSweep(free_end);
+ }
// Expand the free block by the size of this object.
free_end += next_obj->Size();
}
@@ -67,6 +75,9 @@ intptr_t GCSweeper::SweepPage(HeapPage* page, FreeList* freelist) {
intptr_t GCSweeper::SweepLargePage(HeapPage* page) {
RawObject* raw_obj = RawObject::FromAddr(page->object_start());
if (!raw_obj->IsMarked()) {
+ if (HeapTrace::is_enabled()) {
+ heap_->trace()->TraceSweep(page->object_start());
+ }
// The large object was not marked. Used size is zero, which also tells the
// calling code that the large object page can be recycled.
return 0;
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698