5 #ifndef V8_OBJECTS_DEBUG_OBJECTS_H_ 6 #define V8_OBJECTS_DEBUG_OBJECTS_H_ 8 #include "src/objects.h" 9 #include "src/objects/fixed-array.h" 12 #include "src/objects/object-macros.h" 26 kHasBreakInfo = 1 << 0,
27 kPreparedForDebugExecution = 1 << 1,
28 kHasCoverageInfo = 1 << 2,
29 kBreakAtEntry = 1 << 3,
30 kCanBreakAtEntry = 1 << 4,
31 kDebugExecutionMode = 1 << 5
37 DECL_INT_ACCESSORS(flags)
43 DECL_INT_ACCESSORS(debugger_hints)
46 DECL_ACCESSORS(script,
Object)
54 enum ExecutionMode { kBreakpoints = 0, kSideEffects = kDebugExecutionMode };
59 ExecutionMode DebugExecutionMode()
const;
60 void SetDebugExecutionMode(ExecutionMode value);
65 inline bool HasInstrumentedBytecodeArray();
73 bool HasBreakInfo()
const;
76 void ClearBreakInfo(
Isolate* isolate);
80 void SetBreakAtEntry();
81 void ClearBreakAtEntry();
82 bool BreakAtEntry()
const;
86 DECL_ACCESSORS(original_bytecode_array,
Object)
90 DECL_ACCESSORS(debug_bytecode_array,
Object)
96 bool HasBreakPoint(
Isolate* isolate,
int source_position);
111 int GetBreakPointCount(
Isolate* isolate);
115 bool CanBreakAtEntry()
const;
121 DECL_BOOLEAN_ACCESSORS(debug_is_blackboxed)
124 DECL_BOOLEAN_ACCESSORS(computed_debug_is_blackboxed)
127 DECL_INT_ACCESSORS(side_effect_state)
129 enum SideEffectState {
132 kRequiresRuntimeChecks = 2,
133 kHasNoSideEffect = 3,
136 SideEffectState GetSideEffectState(
Isolate* isolate);
140 DECL_INT_ACCESSORS(debugging_id);
143 #define DEBUGGER_HINTS_BIT_FIELDS(V, _) \ 144 V(SideEffectStateBits, int, 2, _) \ 145 V(DebugIsBlackboxedBit, bool, 1, _) \ 146 V(ComputedDebugIsBlackboxedBit, bool, 1, _) \ 147 V(DebuggingIdBits, int, 20, _) 149 DEFINE_BIT_FIELDS(DEBUGGER_HINTS_BIT_FIELDS)
150 #undef DEBUGGER_HINTS_BIT_FIELDS 152 static const int kNoDebuggingId = 0;
157 bool HasCoverageInfo()
const;
160 void ClearCoverageInfo(
Isolate* isolate);
161 DECL_ACCESSORS(coverage_info,
Object)
170 #define DEBUG_INFO_FIELDS(V) \ 171 V(kSharedFunctionInfoOffset, kTaggedSize) \ 172 V(kDebuggerHintsOffset, kTaggedSize) \ 173 V(kScriptOffset, kTaggedSize) \ 174 V(kOriginalBytecodeArrayOffset, kTaggedSize) \ 175 V(kDebugBytecodeArrayOffset, kTaggedSize) \ 176 V(kBreakPointsStateOffset, kTaggedSize) \ 177 V(kFlagsOffset, kTaggedSize) \ 178 V(kCoverageInfoOffset, kTaggedSize) \ 182 DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize, DEBUG_INFO_FIELDS)
183 #undef DEBUG_INFO_FIELDS 185 static const int kEstimatedNofBreakPointsInFunction = 4;
189 Object* GetBreakPointInfo(
Isolate* isolate,
int source_position);
191 DISALLOW_IMPLICIT_CONSTRUCTORS(
DebugInfo);
200 DECL_INT_ACCESSORS(source_position)
202 DECL_ACCESSORS(break_points,
Object)
214 int GetBreakPointCount(
Isolate* isolate);
220 static const int kSourcePositionOffset = kValue1Offset;
221 static const int kBreakPointsOffset = kValue2Offset;
230 int SlotCount()
const;
232 int StartSourcePosition(
int slot_index)
const;
233 int EndSourcePosition(
int slot_index)
const;
234 int BlockCount(
int slot_index)
const;
236 void InitializeSlot(
int slot_index,
int start_pos,
int end_pos);
237 void IncrementBlockCount(
int slot_index);
238 void ResetBlockCount(
int slot_index);
240 static int FixedArrayLengthForSlotCount(
int slot_count) {
241 return slot_count * kSlotIndexCount + kFirstSlotIndex;
247 void Print(std::unique_ptr<
char[]> function_name);
250 static int FirstIndexForSlot(
int slot_index) {
251 return kFirstSlotIndex + slot_index * kSlotIndexCount;
254 static const int kFirstSlotIndex = 0;
258 static const int kSlotStartSourcePositionIndex = 0;
259 static const int kSlotEndSourcePositionIndex = 1;
260 static const int kSlotBlockCountIndex = 2;
261 static const int kSlotIndexCount = 3;
269 DECL_INT_ACCESSORS(
id)
270 DECL_ACCESSORS2(condition,
String)
274 static const int kIdOffset = kValue1Offset;
275 static const int kConditionOffset = kValue2Offset;
284 #include "src/objects/object-macros-undef.h" 286 #endif // V8_OBJECTS_DEBUG_OBJECTS_H_