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 #include "src/assembler.h" 6 #include "src/heap/spaces.h" 7 #include "src/isolate.h" 8 #include "src/objects.h" 9 10 namespace v8 { 11 namespace internal { 12 13 class CodeStatistics { 14 public: 15 // Collect statistics related to code size. 16 static void CollectCodeStatistics(PagedSpace* space, Isolate* isolate); 17 18 // Collect statistics related to code size from large object space. 19 static void CollectCodeStatistics(LargeObjectSpace* space, Isolate* isolate); 20 21 // Reset code size related statistics 22 static void ResetCodeAndMetadataStatistics(Isolate* isolate); 23 24 #ifdef DEBUG 25 // Report statistics about code kind, code+metadata and code comments. 26 static void ReportCodeStatistics(Isolate* isolate); 27 #endif 28 29 private: 30 static void RecordCodeAndMetadataStatistics(HeapObject* object, 31 Isolate* isolate); 32 33 #ifdef DEBUG 34 static void CollectCommentStatistics(Isolate* isolate, RelocIterator* it); 35 static void CollectCodeCommentStatistics(HeapObject* obj, Isolate* isolate); 36 static void EnterComment(Isolate* isolate, const char* comment, int delta); 37 static void ResetCodeStatistics(Isolate* isolate); 38 #endif 39 }; 40 41 } // namespace internal 42 } // namespace v8 43