• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 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_CODE_STATS_H_
6 #define V8_HEAP_CODE_STATS_H_
7 
8 namespace v8 {
9 namespace internal {
10 
11 class CodeCommentsIterator;
12 class HeapObject;
13 class Isolate;
14 class OldLargeObjectSpace;
15 class PagedSpace;
16 
17 class CodeStatistics {
18  public:
19   // Collect statistics related to code size.
20   static void CollectCodeStatistics(PagedSpace* space, Isolate* isolate);
21 
22   // Collect statistics related to code size from large object space.
23   static void CollectCodeStatistics(OldLargeObjectSpace* space,
24                                     Isolate* isolate);
25 
26   // Reset code size related statistics
27   static void ResetCodeAndMetadataStatistics(Isolate* isolate);
28 
29 #ifdef DEBUG
30   // Report statistics about code kind, code+metadata and code comments.
31   static void ReportCodeStatistics(Isolate* isolate);
32 #endif
33 
34  private:
35   static void RecordCodeAndMetadataStatistics(HeapObject object,
36                                               Isolate* isolate);
37 
38 #ifdef DEBUG
39   static void CollectCommentStatistics(Isolate* isolate,
40                                        CodeCommentsIterator* it);
41   static void CollectCodeCommentStatistics(HeapObject obj, Isolate* isolate);
42   static void EnterComment(Isolate* isolate, const char* comment, int delta);
43   static void ResetCodeStatistics(Isolate* isolate);
44 #endif
45 };
46 
47 }  // namespace internal
48 }  // namespace v8
49 
50 #endif  // V8_HEAP_CODE_STATS_H_
51