Line data Source code
1 : // Copyright 2017 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_DEBUG_DEBUG_TYPE_PROFILE_H_
6 : #define V8_DEBUG_DEBUG_TYPE_PROFILE_H_
7 :
8 : #include <vector>
9 :
10 : #include "src/debug/debug-interface.h"
11 : #include "src/handles.h"
12 : #include "src/objects.h"
13 :
14 : namespace v8 {
15 : namespace internal {
16 :
17 : // Forward declaration.
18 : class Isolate;
19 :
20 385 : struct TypeProfileEntry {
21 : explicit TypeProfileEntry(
22 : int pos, std::vector<v8::internal::Handle<internal::String>> t)
23 185 : : position(pos), types(std::move(t)) {}
24 : int position;
25 : std::vector<v8::internal::Handle<internal::String>> types;
26 : };
27 :
28 215 : struct TypeProfileScript {
29 125 : explicit TypeProfileScript(Handle<Script> s) : script(s) {}
30 : Handle<Script> script;
31 : std::vector<TypeProfileEntry> entries;
32 : };
33 :
34 50 : class TypeProfile : public std::vector<TypeProfileScript> {
35 : public:
36 : static std::unique_ptr<TypeProfile> Collect(Isolate* isolate);
37 : static void SelectMode(Isolate* isolate, debug::TypeProfile::Mode mode);
38 :
39 : private:
40 : TypeProfile() = default;
41 : };
42 :
43 : } // namespace internal
44 : } // namespace v8
45 :
46 : #endif // V8_DEBUG_DEBUG_TYPE_PROFILE_H_
|