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_INL_H_
6 #define V8_OBJECTS_DEBUG_OBJECTS_INL_H_
7
8 #include "src/objects/debug-objects.h"
9 #include "src/objects/shared-function-info.h"
10
11 #include "src/heap/heap-inl.h"
12
13 // Has to be the last include (doesn't have include guards):
14 #include "src/objects/object-macros.h"
15
16 namespace v8 {
17 namespace internal {
18
19 CAST_ACCESSOR(BreakPointInfo)
CAST_ACCESSOR(DebugInfo)20 CAST_ACCESSOR(DebugInfo)
21 CAST_ACCESSOR(CoverageInfo)
22 CAST_ACCESSOR(BreakPoint)
23
24 SMI_ACCESSORS(DebugInfo, flags, kFlagsOffset)
25 ACCESSORS(DebugInfo, shared, SharedFunctionInfo, kSharedFunctionInfoOffset)
26 SMI_ACCESSORS(DebugInfo, debugger_hints, kDebuggerHintsOffset)
27 ACCESSORS(DebugInfo, script, Object, kScriptOffset)
28 ACCESSORS(DebugInfo, original_bytecode_array, Object,
29 kOriginalBytecodeArrayOffset)
30 ACCESSORS(DebugInfo, break_points, FixedArray, kBreakPointsStateOffset)
31 ACCESSORS(DebugInfo, coverage_info, Object, kCoverageInfoOffset)
32
33 BIT_FIELD_ACCESSORS(DebugInfo, debugger_hints, side_effect_state,
34 DebugInfo::SideEffectStateBits)
35 BIT_FIELD_ACCESSORS(DebugInfo, debugger_hints, debug_is_blackboxed,
36 DebugInfo::DebugIsBlackboxedBit)
37 BIT_FIELD_ACCESSORS(DebugInfo, debugger_hints, computed_debug_is_blackboxed,
38 DebugInfo::ComputedDebugIsBlackboxedBit)
39 BIT_FIELD_ACCESSORS(DebugInfo, debugger_hints, debugging_id,
40 DebugInfo::DebuggingIdBits)
41
42 SMI_ACCESSORS(BreakPointInfo, source_position, kSourcePositionOffset)
43 ACCESSORS(BreakPointInfo, break_points, Object, kBreakPointsOffset)
44
45 SMI_ACCESSORS(BreakPoint, id, kIdOffset)
46 ACCESSORS(BreakPoint, condition, String, kConditionOffset)
47
48 bool DebugInfo::HasInstrumentedBytecodeArray() {
49 return original_bytecode_array()->IsBytecodeArray();
50 }
51
OriginalBytecodeArray()52 BytecodeArray* DebugInfo::OriginalBytecodeArray() {
53 DCHECK(HasInstrumentedBytecodeArray());
54 return BytecodeArray::cast(original_bytecode_array());
55 }
56
DebugBytecodeArray()57 BytecodeArray* DebugInfo::DebugBytecodeArray() {
58 DCHECK(HasInstrumentedBytecodeArray());
59 return shared()->GetDebugBytecodeArray();
60 }
61
62 } // namespace internal
63 } // namespace v8
64
65 #include "src/objects/object-macros-undef.h"
66
67 #endif // V8_OBJECTS_DEBUG_OBJECTS_INL_H_
68