Index: src/heap/heap.h |
diff --git a/src/heap/heap.h b/src/heap/heap.h |
index 4535bbb2cb08b4139e10b6a83cf97c92b2c57332..8b41fb7b2647295544c9eb1cf766b36972bbe979 100644 |
--- a/src/heap/heap.h |
+++ b/src/heap/heap.h |
@@ -1312,6 +1312,19 @@ class Heap { |
} |
} |
+ void UpdateNewSpaceAllocationCounter() { |
+ new_space_allocation_counter_ = NewSpaceAllocationCounter(); |
+ } |
+ |
+ size_t NewSpaceAllocationCounter() { |
+ return new_space_allocation_counter_ + new_space()->AllocatedSinceLastGC(); |
+ } |
+ |
+ // This should be used only for testing. |
+ void set_new_space_allocation_counter(size_t new_value) { |
+ new_space_allocation_counter_ = new_value; |
+ } |
+ |
// Update GC statistics that are tracked on the Heap. |
void UpdateCumulativeGCStatistics(double duration, double spent_in_mutator, |
double marking_time); |
@@ -2182,6 +2195,11 @@ class Heap { |
size_t full_codegen_bytes_generated_; |
size_t crankshaft_codegen_bytes_generated_; |
+ // This counter is increased before each GC and never reset. |
+ // To account for the bytes allocated since the last GC, use the |
+ // NewSpaceAllocationCounter() function. |
+ size_t new_space_allocation_counter_; |
+ |
// If the --deopt_every_n_garbage_collections flag is set to a positive value, |
// this variable holds the number of garbage collections since the last |
// deoptimization triggered by garbage collection. |