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