1 // Copyright 2020 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_PROFILER_SYMBOLIZER_H_ 6 #define V8_PROFILER_SYMBOLIZER_H_ 7 8 #include "src/base/macros.h" 9 #include "src/profiler/profile-generator.h" 10 11 namespace v8 { 12 namespace internal { 13 14 class CodeEntry; 15 class CodeMap; 16 17 class V8_EXPORT_PRIVATE Symbolizer { 18 public: 19 explicit Symbolizer(CodeMap* code_map); 20 Symbolizer(const Symbolizer&) = delete; 21 Symbolizer& operator=(const Symbolizer&) = delete; 22 23 struct SymbolizedSample { 24 ProfileStackTrace stack_trace; 25 int src_line; 26 }; 27 28 // Use the CodeMap to turn the raw addresses recorded in the sample into 29 // code/function names. 30 SymbolizedSample SymbolizeTickSample(const TickSample& sample); 31 code_map()32 CodeMap* code_map() { return code_map_; } 33 34 private: 35 CodeEntry* FindEntry(Address address, 36 Address* out_instruction_start = nullptr); 37 38 CodeMap* const code_map_; 39 }; 40 41 } // namespace internal 42 } // namespace v8 43 44 #endif // V8_PROFILER_SYMBOLIZER_H_ 45