• 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 Isolate;
12 class HeapObject;
13 class LargeObjectSpace;
14 class PagedSpace;
15 class RelocIterator;
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(LargeObjectSpace* space, Isolate* isolate);
24 
25   // Reset code size related statistics
26   static void ResetCodeAndMetadataStatistics(Isolate* isolate);
27 
28 #ifdef DEBUG
29   // Report statistics about code kind, code+metadata and code comments.
30   static void ReportCodeStatistics(Isolate* isolate);
31 #endif
32 
33  private:
34   static void RecordCodeAndMetadataStatistics(HeapObject* object,
35                                               Isolate* isolate);
36 
37 #ifdef DEBUG
38   static void CollectCommentStatistics(Isolate* isolate, RelocIterator* it);
39   static void CollectCodeCommentStatistics(HeapObject* obj, Isolate* isolate);
40   static void EnterComment(Isolate* isolate, const char* comment, int delta);
41   static void ResetCodeStatistics(Isolate* isolate);
42 #endif
43 };
44 
45 }  // namespace internal
46 }  // namespace v8
47 
48 #endif  // V8_HEAP_CODE_STATS_H_
49