V8 Project
basic-block-profiler.h
Go to the documentation of this file.
1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_BASIC_BLOCK_PROFILER_H_
6 #define V8_BASIC_BLOCK_PROFILER_H_
7 
8 #include <list>
9 
10 #include "src/v8.h"
11 
12 namespace v8 {
13 namespace internal {
14 
15 class Schedule;
16 class Graph;
17 
19  public:
20  class Data {
21  public:
22  size_t n_blocks() const { return n_blocks_; }
23  const uint32_t* counts() const { return &counts_[0]; }
24 
25  void SetCode(OStringStream* os);
27  void SetSchedule(OStringStream* os);
28  void SetBlockId(size_t offset, int block_id);
29  uint32_t* GetCounterAddress(size_t offset);
30 
31  private:
32  friend class BasicBlockProfiler;
33  friend OStream& operator<<(OStream& os, const BasicBlockProfiler::Data& s);
34 
35  explicit Data(size_t n_blocks);
36  ~Data();
37 
38  void ResetCounts();
39 
40  const size_t n_blocks_;
41  std::vector<int> block_ids_;
42  std::vector<uint32_t> counts_;
43  std::string function_name_;
44  std::string schedule_;
45  std::string code_;
47  };
48 
49  typedef std::list<Data*> DataList;
50 
53 
54  Data* NewData(size_t n_blocks);
55  void ResetCounts();
56 
57  const DataList* data_list() { return &data_list_; }
58 
59  private:
60  friend OStream& operator<<(OStream& os, const BasicBlockProfiler& s);
61 
63 
65 };
66 
69 
70 } // namespace internal
71 } // namespace v8
72 
73 #endif // V8_BASIC_BLOCK_PROFILER_H_
friend OStream & operator<<(OStream &os, const BasicBlockProfiler::Data &s)
void SetBlockId(size_t offset, int block_id)
friend OStream & operator<<(OStream &os, const BasicBlockProfiler &s)
DISALLOW_COPY_AND_ASSIGN(BasicBlockProfiler)
OStream & operator<<(OStream &os, const BasicBlockProfiler &p)
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20