OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 #ifndef VM_CODE_STATISTICS_H_ |
| 6 #define VM_CODE_STATISTICS_H_ |
| 7 |
| 8 #include "vm/object.h" |
| 9 #include "vm/assembler.h" |
| 10 #include "vm/intermediate_language.h" |
| 11 |
| 12 namespace dart { |
| 13 |
| 14 class CombinedCodeStatistics { |
| 15 public: |
| 16 enum EntryCounter { |
| 17 #define DO(type) kTag##type, |
| 18 FOR_EACH_INSTRUCTION(DO) |
| 19 #undef DO |
| 20 |
| 21 kPolymorphicInstanceCallAsStaticCall, |
| 22 |
| 23 kTagCheckedSmiSlowPath, |
| 24 kTagCheckedSmiCmpSlowPath, |
| 25 kTagBoxAllocationSlowPath, |
| 26 kTagAllocateContextSlowPath, |
| 27 kTagCheckStackOverflowSlowPath, |
| 28 kTagMegamorphicSlowPath, |
| 29 |
| 30 kTagCheckArgumentCount, |
| 31 kTagCopyParameters, |
| 32 kTagStubCode, |
| 33 kTagCheckedEntry, |
| 34 kTagFrameEntry, |
| 35 kTagLoadClosureContext, |
| 36 kTagIntrinsics, |
| 37 kDebugAfterBody, |
| 38 |
| 39 kTagTrySyncSpilling, |
| 40 |
| 41 kNumEntries, |
| 42 }; |
| 43 |
| 44 CombinedCodeStatistics(); |
| 45 |
| 46 void Begin(Instruction* instruction); |
| 47 void End(Instruction* instruction); |
| 48 |
| 49 void DumpStatistics(); |
| 50 |
| 51 private: |
| 52 friend class CodeStatistics; |
| 53 |
| 54 void SlowSort(); |
| 55 void Swap(intptr_t a, intptr_t b); |
| 56 |
| 57 typedef struct { |
| 58 const char* name; |
| 59 intptr_t bytes; |
| 60 intptr_t count; |
| 61 } Entry; |
| 62 |
| 63 Entry entries_[kNumEntries]; |
| 64 intptr_t unaccounted_bytes_; |
| 65 intptr_t alignment_bytes_; |
| 66 intptr_t object_header_bytes_; |
| 67 intptr_t wasteful_function_count_; |
| 68 intptr_t return_const_count_; |
| 69 intptr_t return_const_with_load_field_count_; |
| 70 }; |
| 71 |
| 72 class CodeStatistics { |
| 73 public: |
| 74 explicit CodeStatistics(Assembler* assembler); |
| 75 |
| 76 void Begin(Instruction* instruction); |
| 77 void End(Instruction* instruction); |
| 78 |
| 79 void SpecialBegin(intptr_t tag); |
| 80 void SpecialEnd(intptr_t tag); |
| 81 |
| 82 void AppendTo(CombinedCodeStatistics* stat); |
| 83 |
| 84 void Finalize(); |
| 85 |
| 86 private: |
| 87 static const int kStackSize = 8; |
| 88 |
| 89 Assembler* assembler_; |
| 90 |
| 91 typedef struct { |
| 92 intptr_t bytes; |
| 93 intptr_t count; |
| 94 } Entry; |
| 95 |
| 96 Entry entries_[CombinedCodeStatistics::kNumEntries]; |
| 97 intptr_t instruction_bytes_; |
| 98 intptr_t unaccounted_bytes_; |
| 99 intptr_t alignment_bytes_; |
| 100 |
| 101 intptr_t stack_[kStackSize]; |
| 102 intptr_t stack_index_; |
| 103 }; |
| 104 |
| 105 } // namespace dart |
| 106 |
| 107 #endif // VM_CODE_STATISTICS_H_ |
OLD | NEW |