aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/src/heap/code-stats.h
blob: cc28640f2a9396ae3082fc88cb41b0db4e6dd291 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_HEAP_CODE_STATS_H_
#define V8_HEAP_CODE_STATS_H_

namespace v8 {
namespace internal {

class CodeCommentsIterator;
class HeapObject;
class Isolate;
class LargeObjectSpace;
class PagedSpace;

class CodeStatistics {
 public:
  // Collect statistics related to code size.
  static void CollectCodeStatistics(PagedSpace* space, Isolate* isolate);

  // Collect statistics related to code size from large object space.
  static void CollectCodeStatistics(LargeObjectSpace* space, Isolate* isolate);

  // Reset code size related statistics
  static void ResetCodeAndMetadataStatistics(Isolate* isolate);

#ifdef DEBUG
  // Report statistics about code kind, code+metadata and code comments.
  static void ReportCodeStatistics(Isolate* isolate);
#endif

 private:
  static void RecordCodeAndMetadataStatistics(HeapObject object,
                                              Isolate* isolate);

#ifdef DEBUG
  static void CollectCommentStatistics(Isolate* isolate,
                                       CodeCommentsIterator* it);
  static void CollectCodeCommentStatistics(HeapObject obj, Isolate* isolate);
  static void EnterComment(Isolate* isolate, const char* comment, int delta);
  static void ResetCodeStatistics(Isolate* isolate);
#endif
};

}  // namespace internal
}  // namespace v8

#endif  // V8_HEAP_CODE_STATS_H_