Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(798)

Unified Diff: runtime/vm/code_statistics.h

Issue 2584613002: PATCH (not to be comitted): Support for printing instruction statistics
Patch Set: Fixed polymorphic call inside try, added more tags for remaining unknown code Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/clustered_snapshot.cc ('k') | runtime/vm/code_statistics.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_statistics.h
diff --git a/runtime/vm/code_statistics.h b/runtime/vm/code_statistics.h
new file mode 100644
index 0000000000000000000000000000000000000000..d28217bb680400b6bb09b2c456e8a4ff82872d91
--- /dev/null
+++ b/runtime/vm/code_statistics.h
@@ -0,0 +1,107 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#ifndef VM_CODE_STATISTICS_H_
+#define VM_CODE_STATISTICS_H_
+
+#include "vm/object.h"
+#include "vm/assembler.h"
+#include "vm/intermediate_language.h"
+
+namespace dart {
+
+class CombinedCodeStatistics {
+ public:
+ enum EntryCounter {
+#define DO(type) kTag##type,
+FOR_EACH_INSTRUCTION(DO)
+#undef DO
+
+ kPolymorphicInstanceCallAsStaticCall,
+
+ kTagCheckedSmiSlowPath,
+ kTagCheckedSmiCmpSlowPath,
+ kTagBoxAllocationSlowPath,
+ kTagAllocateContextSlowPath,
+ kTagCheckStackOverflowSlowPath,
+ kTagMegamorphicSlowPath,
+
+ kTagCheckArgumentCount,
+ kTagCopyParameters,
+ kTagStubCode,
+ kTagCheckedEntry,
+ kTagFrameEntry,
+ kTagLoadClosureContext,
+ kTagIntrinsics,
+ kDebugAfterBody,
+
+ kTagTrySyncSpilling,
+
+ kNumEntries,
+ };
+
+ CombinedCodeStatistics();
+
+ void Begin(Instruction* instruction);
+ void End(Instruction* instruction);
+
+ void DumpStatistics();
+
+ private:
+ friend class CodeStatistics;
+
+ void SlowSort();
+ void Swap(intptr_t a, intptr_t b);
+
+ typedef struct {
+ const char* name;
+ intptr_t bytes;
+ intptr_t count;
+ } Entry;
+
+ Entry entries_[kNumEntries];
+ intptr_t unaccounted_bytes_;
+ intptr_t alignment_bytes_;
+ intptr_t object_header_bytes_;
+ intptr_t wasteful_function_count_;
+ intptr_t return_const_count_;
+ intptr_t return_const_with_load_field_count_;
+};
+
+class CodeStatistics {
+ public:
+ explicit CodeStatistics(Assembler* assembler);
+
+ void Begin(Instruction* instruction);
+ void End(Instruction* instruction);
+
+ void SpecialBegin(intptr_t tag);
+ void SpecialEnd(intptr_t tag);
+
+ void AppendTo(CombinedCodeStatistics* stat);
+
+ void Finalize();
+
+ private:
+ static const int kStackSize = 8;
+
+ Assembler* assembler_;
+
+ typedef struct {
+ intptr_t bytes;
+ intptr_t count;
+ } Entry;
+
+ Entry entries_[CombinedCodeStatistics::kNumEntries];
+ intptr_t instruction_bytes_;
+ intptr_t unaccounted_bytes_;
+ intptr_t alignment_bytes_;
+
+ intptr_t stack_[kStackSize];
+ intptr_t stack_index_;
+};
+
+} // namespace dart
+
+#endif // VM_CODE_STATISTICS_H_
« no previous file with comments | « runtime/vm/clustered_snapshot.cc ('k') | runtime/vm/code_statistics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698