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

Unified Diff: src/basic-block-profiler.h

Issue 593563005: [turbofan] basic block profiler (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 months 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 | « BUILD.gn ('k') | src/basic-block-profiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/basic-block-profiler.h
diff --git a/src/basic-block-profiler.h b/src/basic-block-profiler.h
new file mode 100644
index 0000000000000000000000000000000000000000..e625cd23b5fcb59b0197f243183be852b058277b
--- /dev/null
+++ b/src/basic-block-profiler.h
@@ -0,0 +1,73 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_BASIC_BLOCK_PROFILER_H_
+#define V8_BASIC_BLOCK_PROFILER_H_
+
+#include <list>
+
+#include "src/v8.h"
+
+namespace v8 {
+namespace internal {
+
+class Schedule;
+class Graph;
+
+class BasicBlockProfiler {
+ public:
+ class Data {
+ public:
+ size_t n_blocks() const { return n_blocks_; }
+ const uint32_t* counts() const { return &counts_[0]; }
+
+ void SetCode(OStringStream* os);
+ void SetFunctionName(OStringStream* os);
+ void SetSchedule(OStringStream* os);
+ void SetBlockId(size_t offset, int block_id);
+ uint32_t* GetCounterAddress(size_t offset);
+
+ private:
+ friend class BasicBlockProfiler;
+ friend OStream& operator<<(OStream& os, const BasicBlockProfiler::Data& s);
+
+ explicit Data(size_t n_blocks);
+ ~Data();
+
+ void ResetCounts();
+
+ const size_t n_blocks_;
+ std::vector<int> block_ids_;
+ std::vector<uint32_t> counts_;
+ std::string function_name_;
+ std::string schedule_;
+ std::string code_;
+ DISALLOW_COPY_AND_ASSIGN(Data);
+ };
+
+ typedef std::list<Data*> DataList;
+
+ BasicBlockProfiler();
+ ~BasicBlockProfiler();
+
+ Data* NewData(size_t n_blocks);
+ void ResetCounts();
+
+ const DataList* data_list() { return &data_list_; }
+
+ private:
+ friend OStream& operator<<(OStream& os, const BasicBlockProfiler& s);
+
+ DataList data_list_;
+
+ DISALLOW_COPY_AND_ASSIGN(BasicBlockProfiler);
+};
+
+OStream& operator<<(OStream& os, const BasicBlockProfiler& s);
+OStream& operator<<(OStream& os, const BasicBlockProfiler::Data& s);
+
+} // namespace internal
+} // namespace v8
+
+#endif // V8_BASIC_BLOCK_PROFILER_H_
« no previous file with comments | « BUILD.gn ('k') | src/basic-block-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698