• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_HEAP_STRESS_SCAVENGE_OBSERVER_H_
6 #define V8_HEAP_STRESS_SCAVENGE_OBSERVER_H_
7 
8 #include "src/heap/heap.h"
9 
10 namespace v8 {
11 namespace internal {
12 
13 class StressScavengeObserver : public AllocationObserver {
14  public:
15   explicit StressScavengeObserver(Heap& heap);
16 
17   void Step(int bytes_allocated, Address soon_object, size_t size) override;
18 
19   bool HasRequestedGC() const;
20   void RequestedGCDone();
21 
22   // The maximum percent of the newspace capacity reached. This is tracked when
23   // specyfing --fuzzer-gc-analysis.
24   double MaxNewSpaceSizeReached() const;
25 
26  private:
27   Heap& heap_;
28   int limit_percentage_;
29   bool has_requested_gc_;
30 
31   double max_new_space_size_reached_;
32 
33   int NextLimit(int min = 0);
34 };
35 
36 }  // namespace internal
37 }  // namespace v8
38 
39 #endif  // V8_HEAP_STRESS_SCAVENGE_OBSERVER_H_
40