Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
code_statistics.h
Go to the documentation of this file.
1// Copyright (c) 2018, 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 RUNTIME_VM_COMPILER_BACKEND_CODE_STATISTICS_H_
6#define RUNTIME_VM_COMPILER_BACKEND_CODE_STATISTICS_H_
7
8#if defined(DART_PRECOMPILED_RUNTIME)
9#error "AOT runtime should not use compiler sources (including header files)"
10#endif // defined(DART_PRECOMPILED_RUNTIME)
11
14#include "vm/object.h"
15
16namespace dart {
17
19 public:
20 // clang-format off
22#define DO(type, attrs) kTag##type,
24#undef DO
25
26#define DO(type, attrs) kTag##type##SlowPath,
28#undef DO
29
33
36
38 };
39 // clang-format on
40
42
43 void Begin(Instruction* instruction);
44 void End(Instruction* instruction);
45
46 void DumpStatistics();
47
49 return static_cast<CombinedCodeStatistics::EntryCounter>(
50 CombinedCodeStatistics::kTagGraphEntrySlowPath + tag);
51 }
52
53 private:
54 friend class CodeStatistics;
55
56 static int CompareEntries(const void* a, const void* b);
57
58 typedef struct {
59 const char* name;
60 intptr_t bytes;
61 intptr_t count;
62 } Entry;
63
64 Entry entries_[kNumEntries];
65 intptr_t unaccounted_bytes_;
66 intptr_t alignment_bytes_;
67 intptr_t object_header_bytes_;
68 intptr_t return_const_count_;
69 intptr_t return_const_with_load_field_count_;
70};
71
73 public:
74 explicit CodeStatistics(compiler::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
83
84 void Finalize();
85
86 private:
87 static constexpr int kStackSize = 8;
88
89 compiler::Assembler* assembler_;
90
91 typedef struct {
92 intptr_t bytes;
93 intptr_t count;
94 } Entry;
95
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 // RUNTIME_VM_COMPILER_BACKEND_CODE_STATISTICS_H_
int count
void End(Instruction *instruction)
void AppendTo(CombinedCodeStatistics *stat)
void SpecialBegin(intptr_t tag)
void SpecialEnd(intptr_t tag)
void Begin(Instruction *instruction)
void End(Instruction *instruction)
static EntryCounter SlowPathCounterFor(Instruction::Tag tag)
void Begin(Instruction *instruction)
#define DO(type, attrs)
static bool b
struct MyStruct a[10]
#define FOR_EACH_INSTRUCTION(M)
Definition il.h:405
const char *const name