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

Unified Diff: src/heap.h

Issue 403543002: Make GCTracer persistent. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove destr and initialize last gc timestamp. Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.h
diff --git a/src/heap.h b/src/heap.h
index 6569c198309947d5c21ef01724e5f90e155ba5b8..e75c7231ffdd9ea90349584f3a21336e50db9506 100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -359,7 +359,6 @@ namespace internal {
V(intl_impl_object_string, "v8::intl_object")
// Forward declarations.
-class GCTracer;
class HeapStats;
class Isolate;
class WeakObjectRetainer;
@@ -549,6 +548,126 @@ enum ArrayStorageAllocationMode {
};
+// GCTracer collects and prints ONE line after each garbage collector
+// invocation IFF --trace_gc is used.
+
+class GCTracer BASE_EMBEDDED {
+ public:
+ class Scope BASE_EMBEDDED {
+ public:
+ enum ScopeId {
+ EXTERNAL,
+ MC_MARK,
+ MC_SWEEP,
+ MC_SWEEP_NEWSPACE,
+ MC_SWEEP_OLDSPACE,
+ MC_SWEEP_CODE,
+ MC_SWEEP_CELL,
+ MC_SWEEP_MAP,
+ MC_EVACUATE_PAGES,
+ MC_UPDATE_NEW_TO_NEW_POINTERS,
+ MC_UPDATE_ROOT_TO_NEW_POINTERS,
+ MC_UPDATE_OLD_TO_NEW_POINTERS,
+ MC_UPDATE_POINTERS_TO_EVACUATED,
+ MC_UPDATE_POINTERS_BETWEEN_EVACUATED,
+ MC_UPDATE_MISC_POINTERS,
+ MC_WEAKCOLLECTION_PROCESS,
+ MC_WEAKCOLLECTION_CLEAR,
+ MC_FLUSH_CODE,
+ NUMBER_OF_SCOPES
+ };
+
+ Scope(GCTracer* tracer, ScopeId scope)
+ : tracer_(tracer),
+ scope_(scope) {
+ start_time_ = base::OS::TimeCurrentMillis();
+ }
+
+ ~Scope() {
+ ASSERT(scope_ < NUMBER_OF_SCOPES); // scope_ is unsigned.
+ tracer_->scopes_[scope_] += base::OS::TimeCurrentMillis() - start_time_;
+ }
+
+ private:
+ GCTracer* tracer_;
+ ScopeId scope_;
+ double start_time_;
+
+ DISALLOW_COPY_AND_ASSIGN(Scope);
+ };
+
+ explicit GCTracer(Heap* heap);
+
+ // Start collecting data.
+ void start(GarbageCollector collector,
+ const char* gc_reason,
+ const char* collector_reason);
+
+ // Stop collecting data and print results.
+ void stop();
+
+ private:
+ // Returns a string matching the collector.
+ const char* CollectorString() const;
+
+ // Print one detailed trace line in name=value format.
+ void PrintNVP() const;
+
+ // Print one trace line.
+ void Print() const;
+
+ // Timestamp set in the constructor.
+ double start_time_;
+
+ // Timestamp set in the destructor.
+ double end_time_;
+
+ // Size of objects in heap set in constructor.
+ intptr_t start_object_size_;
+
+ // Size of objects in heap set in destructor.
+ intptr_t end_object_size_;
+
+ // Size of memory allocated from OS set in constructor.
+ intptr_t start_memory_size_;
+
+ // Size of memory allocated from OS set in destructor.
+ intptr_t end_memory_size_;
+
+ // Type of collector.
+ GarbageCollector collector_;
+
+ // Amounts of time spent in different scopes during GC.
+ double scopes_[Scope::NUMBER_OF_SCOPES];
+
+ // Total amount of space either wasted or contained in one of free lists
+ // before the current GC.
+ intptr_t in_free_list_or_wasted_before_gc_;
+
+ // Difference between space used in the heap at the beginning of the current
+ // collection and the end of the previous collection.
+ intptr_t allocated_since_last_gc_;
+
+ // Amount of time spent in mutator that is time elapsed between end of the
+ // previous collection and the beginning of the current one.
+ double spent_in_mutator_;
+
+ // Incremental marking steps counters.
+ int steps_count_;
+ double steps_took_;
+ double longest_step_;
+ int steps_count_since_last_gc_;
+ double steps_took_since_last_gc_;
+
+ Heap* heap_;
+
+ const char* gc_reason_;
+ const char* collector_reason_;
+
+ DISALLOW_COPY_AND_ASSIGN(GCTracer);
+};
+
+
class Heap {
public:
// Configure heap size in MB before setup. Return false if the heap has been
@@ -1230,7 +1349,7 @@ class Heap {
void ClearNormalizedMapCaches();
- GCTracer* tracer() { return tracer_; }
+ GCTracer* tracer() { return &tracer_; }
// Returns the size of objects residing in non new spaces.
intptr_t PromotedSpaceSizeOfObjects();
@@ -1752,7 +1871,6 @@ class Heap {
// collect more garbage.
bool PerformGarbageCollection(
GarbageCollector collector,
- GCTracer* tracer,
const GCCallbackFlags gc_callback_flags = kNoGCCallbackFlags);
inline void UpdateOldSpaceLimits();
@@ -1978,7 +2096,7 @@ class Heap {
StoreBufferEvent event);
// Performs a major collection in the whole heap.
- void MarkCompact(GCTracer* tracer);
+ void MarkCompact();
// Code to be run before and after mark-compact.
void MarkCompactPrologue();
@@ -2009,7 +2127,7 @@ class Heap {
// Total RegExp code ever generated
double total_regexp_code_generated_;
- GCTracer* tracer_;
+ GCTracer tracer_;
// Creates and installs the full-sized number string cache.
int FullSizeNumberStringCacheLength();
@@ -2530,122 +2648,6 @@ class DescriptorLookupCache {
};
-// GCTracer collects and prints ONE line after each garbage collector
-// invocation IFF --trace_gc is used.
-
-class GCTracer BASE_EMBEDDED {
- public:
- class Scope BASE_EMBEDDED {
- public:
- enum ScopeId {
- EXTERNAL,
- MC_MARK,
- MC_SWEEP,
- MC_SWEEP_NEWSPACE,
- MC_SWEEP_OLDSPACE,
- MC_SWEEP_CODE,
- MC_SWEEP_CELL,
- MC_SWEEP_MAP,
- MC_EVACUATE_PAGES,
- MC_UPDATE_NEW_TO_NEW_POINTERS,
- MC_UPDATE_ROOT_TO_NEW_POINTERS,
- MC_UPDATE_OLD_TO_NEW_POINTERS,
- MC_UPDATE_POINTERS_TO_EVACUATED,
- MC_UPDATE_POINTERS_BETWEEN_EVACUATED,
- MC_UPDATE_MISC_POINTERS,
- MC_WEAKCOLLECTION_PROCESS,
- MC_WEAKCOLLECTION_CLEAR,
- MC_FLUSH_CODE,
- NUMBER_OF_SCOPES
- };
-
- Scope(GCTracer* tracer, ScopeId scope)
- : tracer_(tracer),
- scope_(scope) {
- start_time_ = base::OS::TimeCurrentMillis();
- }
-
- ~Scope() {
- ASSERT(scope_ < NUMBER_OF_SCOPES); // scope_ is unsigned.
- tracer_->scopes_[scope_] += base::OS::TimeCurrentMillis() - start_time_;
- }
-
- private:
- GCTracer* tracer_;
- ScopeId scope_;
- double start_time_;
-
- DISALLOW_COPY_AND_ASSIGN(Scope);
- };
-
- explicit GCTracer(Heap* heap,
- GarbageCollector collector,
- const char* gc_reason,
- const char* collector_reason);
- ~GCTracer();
-
- private:
- // Returns a string matching the collector.
- const char* CollectorString() const;
-
- // Print one detailed trace line in name=value format.
- void PrintNVP() const;
-
- // Print one trace line.
- void Print() const;
-
- // Timestamp set in the constructor.
- double start_time_;
-
- // Timestamp set in the destructor.
- double end_time_;
-
- // Size of objects in heap set in constructor.
- intptr_t start_object_size_;
-
- // Size of objects in heap set in destructor.
- intptr_t end_object_size_;
-
- // Size of memory allocated from OS set in constructor.
- intptr_t start_memory_size_;
-
- // Size of memory allocated from OS set in destructor.
- intptr_t end_memory_size_;
-
- // Type of collector.
- GarbageCollector collector_;
-
- // Amounts of time spent in different scopes during GC.
- double scopes_[Scope::NUMBER_OF_SCOPES];
-
- // Total amount of space either wasted or contained in one of free lists
- // before the current GC.
- intptr_t in_free_list_or_wasted_before_gc_;
-
- // Difference between space used in the heap at the beginning of the current
- // collection and the end of the previous collection.
- intptr_t allocated_since_last_gc_;
-
- // Amount of time spent in mutator that is time elapsed between end of the
- // previous collection and the beginning of the current one.
- double spent_in_mutator_;
-
- // Incremental marking steps counters.
- int steps_count_;
- double steps_took_;
- double longest_step_;
- int steps_count_since_last_gc_;
- double steps_took_since_last_gc_;
-
- Heap* heap_;
-
- const char* gc_reason_;
- const char* collector_reason_;
-
- DISALLOW_COPY_AND_ASSIGN(GCTracer);
-};
-
-
class RegExpResultsCache {
public:
enum ResultsCacheType { REGEXP_MULTIPLE_INDICES, STRING_SPLIT_SUBSTRINGS };
« no previous file with comments | « no previous file | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698