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

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

Issue 2909893002: [debug] Untangle DebugInfo from break point support (Closed)
Patch Set: Address comments Created 3 years, 6 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
1 // Copyright 2017 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_OBJECTS_DEBUG_OBJECTS_H_ 5 #ifndef V8_OBJECTS_DEBUG_OBJECTS_H_
6 #define V8_OBJECTS_DEBUG_OBJECTS_H_ 6 #define V8_OBJECTS_DEBUG_OBJECTS_H_
7 7
8 #include "src/objects.h" 8 #include "src/objects.h"
9 9
10 // Has to be the last include (doesn't have include guards): 10 // Has to be the last include (doesn't have include guards):
11 #include "src/objects/object-macros.h" 11 #include "src/objects/object-macros.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 15
16 // The DebugInfo class holds additional information for a function being 16 // The DebugInfo class holds additional information for a function being
17 // debugged. 17 // debugged.
18 class DebugInfo : public Struct { 18 class DebugInfo : public Struct {
19 public: 19 public:
20 enum Flag {
21 kNone = 0,
22 kHasBreakInfo = 1 << 0,
23 kHasCoverageInfo = 1 << 1,
24 };
25 typedef base::Flags<Flag> Flags;
26
27 // A bitfield that lists uses of the current instance.
28 DECL_INT_ACCESSORS(flags)
29
20 // The shared function info for the source being debugged. 30 // The shared function info for the source being debugged.
21 DECL_ACCESSORS(shared, SharedFunctionInfo) 31 DECL_ACCESSORS(shared, SharedFunctionInfo)
22 32
23 // Bit field containing various information collected for debugging. 33 // Bit field containing various information collected for debugging.
24 DECL_INT_ACCESSORS(debugger_hints) 34 DECL_INT_ACCESSORS(debugger_hints)
25 35
36 // DebugInfo can be detached from the SharedFunctionInfo iff it is empty.
37 bool IsEmpty() const;
38
39 // --- Break points ---
40 // --------------------
41
42 bool HasBreakInfo() const;
43
44 // Clears all fields related to break points. Returns true iff the
45 // DebugInfo is now empty.
46 bool ClearBreakInfo();
47
48 // The instrumented bytecode array for functions with break points.
26 DECL_ACCESSORS(debug_bytecode_array, Object) 49 DECL_ACCESSORS(debug_bytecode_array, Object)
50
27 // Fixed array holding status information for each active break point. 51 // Fixed array holding status information for each active break point.
28 DECL_ACCESSORS(break_points, FixedArray) 52 DECL_ACCESSORS(break_points, FixedArray)
29 53
30 // Check if there is a break point at a source position. 54 // Check if there is a break point at a source position.
31 bool HasBreakPoint(int source_position); 55 bool HasBreakPoint(int source_position);
32 // Attempt to clear a break point. Return true if successful. 56 // Attempt to clear a break point. Return true if successful.
33 static bool ClearBreakPoint(Handle<DebugInfo> debug_info, 57 static bool ClearBreakPoint(Handle<DebugInfo> debug_info,
34 Handle<Object> break_point_object); 58 Handle<Object> break_point_object);
35 // Set a break point. 59 // Set a break point.
36 static void SetBreakPoint(Handle<DebugInfo> debug_info, int source_position, 60 static void SetBreakPoint(Handle<DebugInfo> debug_info, int source_position,
(...skipping 12 matching lines...) Expand all
49 inline BytecodeArray* OriginalBytecodeArray(); 73 inline BytecodeArray* OriginalBytecodeArray();
50 inline BytecodeArray* DebugBytecodeArray(); 74 inline BytecodeArray* DebugBytecodeArray();
51 inline Code* DebugCode(); 75 inline Code* DebugCode();
52 76
53 DECLARE_CAST(DebugInfo) 77 DECLARE_CAST(DebugInfo)
54 78
55 // Dispatched behavior. 79 // Dispatched behavior.
56 DECLARE_PRINTER(DebugInfo) 80 DECLARE_PRINTER(DebugInfo)
57 DECLARE_VERIFIER(DebugInfo) 81 DECLARE_VERIFIER(DebugInfo)
58 82
59 static const int kSharedFunctionInfoIndex = Struct::kHeaderSize; 83 static const int kSharedFunctionInfoOffset = Struct::kHeaderSize;
60 static const int kDebuggerHintsIndex = 84 static const int kDebuggerHintsOffset =
61 kSharedFunctionInfoIndex + kPointerSize; 85 kSharedFunctionInfoOffset + kPointerSize;
62 static const int kDebugBytecodeArrayIndex = 86 static const int kDebugBytecodeArrayOffset =
63 kDebuggerHintsIndex + kPointerSize; 87 kDebuggerHintsOffset + kPointerSize;
64 static const int kBreakPointsStateIndex = 88 static const int kBreakPointsStateOffset =
65 kDebugBytecodeArrayIndex + kPointerSize; 89 kDebugBytecodeArrayOffset + kPointerSize;
66 static const int kSize = kBreakPointsStateIndex + kPointerSize; 90 static const int kFlagsOffset = kBreakPointsStateOffset + kPointerSize;
91 static const int kSize = kFlagsOffset + kPointerSize;
67 92
68 static const int kEstimatedNofBreakPointsInFunction = 4; 93 static const int kEstimatedNofBreakPointsInFunction = 4;
69 94
70 private: 95 private:
71 // Get the break point info object for a source position. 96 // Get the break point info object for a source position.
72 Object* GetBreakPointInfo(int source_position); 97 Object* GetBreakPointInfo(int source_position);
73 98
74 DISALLOW_IMPLICIT_CONSTRUCTORS(DebugInfo); 99 DISALLOW_IMPLICIT_CONSTRUCTORS(DebugInfo);
75 }; 100 };
76 101
(...skipping 16 matching lines...) Expand all
93 // Check if break point info has this break point object. 118 // Check if break point info has this break point object.
94 static bool HasBreakPointObject(Handle<BreakPointInfo> info, 119 static bool HasBreakPointObject(Handle<BreakPointInfo> info,
95 Handle<Object> break_point_object); 120 Handle<Object> break_point_object);
96 // Get the number of break points for this code offset. 121 // Get the number of break points for this code offset.
97 int GetBreakPointCount(); 122 int GetBreakPointCount();
98 123
99 int GetStatementPosition(Handle<DebugInfo> debug_info); 124 int GetStatementPosition(Handle<DebugInfo> debug_info);
100 125
101 DECLARE_CAST(BreakPointInfo) 126 DECLARE_CAST(BreakPointInfo)
102 127
103 static const int kSourcePositionIndex = kValue1Offset; 128 static const int kSourcePositionOffset = kValue1Offset;
104 static const int kBreakPointObjectsIndex = kValue2Offset; 129 static const int kBreakPointObjectsOffset = kValue2Offset;
105 130
106 private: 131 private:
107 DISALLOW_IMPLICIT_CONSTRUCTORS(BreakPointInfo); 132 DISALLOW_IMPLICIT_CONSTRUCTORS(BreakPointInfo);
108 }; 133 };
109 134
110 } // namespace internal 135 } // namespace internal
111 } // namespace v8 136 } // namespace v8
112 137
113 #include "src/objects/object-macros-undef.h" 138 #include "src/objects/object-macros-undef.h"
114 139
115 #endif // V8_OBJECTS_DEBUG_OBJECTS_H_ 140 #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