Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Side by Side Diff: src/objects/debug-objects.h

Issue 2900713004: [objects] Extract DebugInfo and BreakPointInfo to own file (Closed)
Patch Set: Remove undefs from objects-inl.h Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects-printer.cc ('k') | src/objects/debug-objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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_OBJECTS_DEBUG_OBJECTS_H_
6 #define V8_OBJECTS_DEBUG_OBJECTS_H_
7
8 #include "src/objects.h"
9
10 // Has to be the last include (doesn't have include guards):
11 #include "src/objects/object-macros.h"
12
13 namespace v8 {
14 namespace internal {
15
16 // The DebugInfo class holds additional information for a function being
17 // debugged.
18 class DebugInfo : public Struct {
19 public:
20 // The shared function info for the source being debugged.
21 DECL_ACCESSORS(shared, SharedFunctionInfo)
22
23 // Bit field containing various information collected for debugging.
24 DECL_INT_ACCESSORS(debugger_hints)
25
26 DECL_ACCESSORS(debug_bytecode_array, Object)
27 // Fixed array holding status information for each active break point.
28 DECL_ACCESSORS(break_points, FixedArray)
29
30 // Check if there is a break point at a source position.
31 bool HasBreakPoint(int source_position);
32 // Attempt to clear a break point. Return true if successful.
33 static bool ClearBreakPoint(Handle<DebugInfo> debug_info,
34 Handle<Object> break_point_object);
35 // Set a break point.
36 static void SetBreakPoint(Handle<DebugInfo> debug_info, int source_position,
37 Handle<Object> break_point_object);
38 // Get the break point objects for a source position.
39 Handle<Object> GetBreakPointObjects(int source_position);
40 // Find the break point info holding this break point object.
41 static Handle<Object> FindBreakPointInfo(Handle<DebugInfo> debug_info,
42 Handle<Object> break_point_object);
43 // Get the number of break points for this function.
44 int GetBreakPointCount();
45
46 inline bool HasDebugBytecodeArray();
47 inline bool HasDebugCode();
48
49 inline BytecodeArray* OriginalBytecodeArray();
50 inline BytecodeArray* DebugBytecodeArray();
51 inline Code* DebugCode();
52
53 DECLARE_CAST(DebugInfo)
54
55 // Dispatched behavior.
56 DECLARE_PRINTER(DebugInfo)
57 DECLARE_VERIFIER(DebugInfo)
58
59 static const int kSharedFunctionInfoIndex = Struct::kHeaderSize;
60 static const int kDebuggerHintsIndex =
61 kSharedFunctionInfoIndex + kPointerSize;
62 static const int kDebugBytecodeArrayIndex =
63 kDebuggerHintsIndex + kPointerSize;
64 static const int kBreakPointsStateIndex =
65 kDebugBytecodeArrayIndex + kPointerSize;
66 static const int kSize = kBreakPointsStateIndex + kPointerSize;
67
68 static const int kEstimatedNofBreakPointsInFunction = 4;
69
70 private:
71 // Get the break point info object for a source position.
72 Object* GetBreakPointInfo(int source_position);
73
74 DISALLOW_IMPLICIT_CONSTRUCTORS(DebugInfo);
75 };
76
77 // The BreakPointInfo class holds information for break points set in a
78 // function. The DebugInfo object holds a BreakPointInfo object for each code
79 // position with one or more break points.
80 class BreakPointInfo : public Tuple2 {
81 public:
82 // The position in the source for the break position.
83 DECL_INT_ACCESSORS(source_position)
84 // List of related JavaScript break points.
85 DECL_ACCESSORS(break_point_objects, Object)
86
87 // Removes a break point.
88 static void ClearBreakPoint(Handle<BreakPointInfo> info,
89 Handle<Object> break_point_object);
90 // Set a break point.
91 static void SetBreakPoint(Handle<BreakPointInfo> info,
92 Handle<Object> break_point_object);
93 // Check if break point info has this break point object.
94 static bool HasBreakPointObject(Handle<BreakPointInfo> info,
95 Handle<Object> break_point_object);
96 // Get the number of break points for this code offset.
97 int GetBreakPointCount();
98
99 int GetStatementPosition(Handle<DebugInfo> debug_info);
100
101 DECLARE_CAST(BreakPointInfo)
102
103 static const int kSourcePositionIndex = kValue1Offset;
104 static const int kBreakPointObjectsIndex = kValue2Offset;
105
106 private:
107 DISALLOW_IMPLICIT_CONSTRUCTORS(BreakPointInfo);
108 };
109
110 } // namespace internal
111 } // namespace v8
112
113 #include "src/objects/object-macros-undef.h"
114
115 #endif // V8_OBJECTS_DEBUG_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/objects-printer.cc ('k') | src/objects/debug-objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698