summaryrefslogtreecommitdiff
path: root/deps/v8/src/diagnostics/basic-block-profiler.h
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2019-08-01 08:38:30 +0200
committerMichaël Zasso <targos@protonmail.com>2019-08-01 12:53:56 +0200
commit2dcc3665abf57c3607cebffdeeca062f5894885d (patch)
tree4f560748132edcfb4c22d6f967a7e80d23d7ea2c /deps/v8/src/diagnostics/basic-block-profiler.h
parent1ee47d550c6de132f06110aa13eceb7551d643b3 (diff)
downloadnode-new-2dcc3665abf57c3607cebffdeeca062f5894885d.tar.gz
deps: update V8 to 7.6.303.28
PR-URL: https://github.com/nodejs/node/pull/28016 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann (רפאל פלחי) <refack@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Diffstat (limited to 'deps/v8/src/diagnostics/basic-block-profiler.h')
-rw-r--r--deps/v8/src/diagnostics/basic-block-profiler.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/deps/v8/src/diagnostics/basic-block-profiler.h b/deps/v8/src/diagnostics/basic-block-profiler.h
new file mode 100644
index 0000000000..960b4b43e1
--- /dev/null
+++ b/deps/v8/src/diagnostics/basic-block-profiler.h
@@ -0,0 +1,80 @@
+// 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_DIAGNOSTICS_BASIC_BLOCK_PROFILER_H_
+#define V8_DIAGNOSTICS_BASIC_BLOCK_PROFILER_H_
+
+#include <iosfwd>
+#include <list>
+#include <string>
+#include <vector>
+
+#include "src/base/macros.h"
+#include "src/base/platform/mutex.h"
+#include "src/common/globals.h"
+
+namespace v8 {
+namespace internal {
+
+class BasicBlockProfiler {
+ public:
+ class Data {
+ public:
+ size_t n_blocks() const { return n_blocks_; }
+ const uint32_t* counts() const { return &counts_[0]; }
+
+ void SetCode(std::ostringstream* os);
+ void SetFunctionName(std::unique_ptr<char[]> name);
+ void SetSchedule(std::ostringstream* os);
+ void SetBlockRpoNumber(size_t offset, int32_t block_rpo);
+ intptr_t GetCounterAddress(size_t offset);
+
+ private:
+ friend class BasicBlockProfiler;
+ friend std::ostream& operator<<(std::ostream& os,
+ const BasicBlockProfiler::Data& s);
+
+ explicit Data(size_t n_blocks);
+ ~Data() = default;
+
+ V8_EXPORT_PRIVATE void ResetCounts();
+
+ const size_t n_blocks_;
+ std::vector<int32_t> block_rpo_numbers_;
+ std::vector<uint32_t> counts_;
+ std::string function_name_;
+ std::string schedule_;
+ std::string code_;
+ DISALLOW_COPY_AND_ASSIGN(Data);
+ };
+
+ using DataList = std::list<Data*>;
+
+ BasicBlockProfiler() = default;
+ ~BasicBlockProfiler();
+
+ V8_EXPORT_PRIVATE static BasicBlockProfiler* Get();
+ Data* NewData(size_t n_blocks);
+ V8_EXPORT_PRIVATE void ResetCounts();
+
+ const DataList* data_list() { return &data_list_; }
+
+ private:
+ friend V8_EXPORT_PRIVATE std::ostream& operator<<(
+ std::ostream& os, const BasicBlockProfiler& s);
+
+ DataList data_list_;
+ base::Mutex data_list_mutex_;
+
+ DISALLOW_COPY_AND_ASSIGN(BasicBlockProfiler);
+};
+
+V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
+ const BasicBlockProfiler& s);
+std::ostream& operator<<(std::ostream& os, const BasicBlockProfiler::Data& s);
+
+} // namespace internal
+} // namespace v8
+
+#endif // V8_DIAGNOSTICS_BASIC_BLOCK_PROFILER_H_