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
10 #include "src/heap/heap-write-barrier-inl.h"
11 #include "src/objects/code-inl.h"
12 #include "src/objects/objects-inl.h"
13 #include "src/objects/shared-function-info.h"
14
15 // Has to be the last include (doesn't have include guards):
16 #include "src/objects/object-macros.h"
17
18 namespace v8 {
19 namespace internal {
20
21 #include "torque-generated/src/objects/debug-objects-tq-inl.inc"
22
23 TQ_OBJECT_CONSTRUCTORS_IMPL(BreakPoint)
TQ_OBJECT_CONSTRUCTORS_IMPL(BreakPointInfo)24 TQ_OBJECT_CONSTRUCTORS_IMPL(BreakPointInfo)
25 TQ_OBJECT_CONSTRUCTORS_IMPL(CoverageInfo)
26 TQ_OBJECT_CONSTRUCTORS_IMPL(DebugInfo)
27
28 NEVER_READ_ONLY_SPACE_IMPL(DebugInfo)
29
30 BIT_FIELD_ACCESSORS(DebugInfo, debugger_hints, side_effect_state,
31 DebugInfo::SideEffectStateBits)
32 BIT_FIELD_ACCESSORS(DebugInfo, debugger_hints, debug_is_blackboxed,
33 DebugInfo::DebugIsBlackboxedBit)
34 BIT_FIELD_ACCESSORS(DebugInfo, debugger_hints, computed_debug_is_blackboxed,
35 DebugInfo::ComputedDebugIsBlackboxedBit)
36 BIT_FIELD_ACCESSORS(DebugInfo, debugger_hints, debugging_id,
37 DebugInfo::DebuggingIdBits)
38
39 bool DebugInfo::HasInstrumentedBytecodeArray() {
40 return debug_bytecode_array(kAcquireLoad).IsBytecodeArray();
41 }
42
OriginalBytecodeArray()43 BytecodeArray DebugInfo::OriginalBytecodeArray() {
44 DCHECK(HasInstrumentedBytecodeArray());
45 return BytecodeArray::cast(original_bytecode_array(kAcquireLoad));
46 }
47
DebugBytecodeArray()48 BytecodeArray DebugInfo::DebugBytecodeArray() {
49 DCHECK(HasInstrumentedBytecodeArray());
50 DCHECK_EQ(shared().GetActiveBytecodeArray(),
51 debug_bytecode_array(kAcquireLoad));
52 return BytecodeArray::cast(debug_bytecode_array(kAcquireLoad));
53 }
54
55 TQ_OBJECT_CONSTRUCTORS_IMPL(StackFrameInfo)
NEVER_READ_ONLY_SPACE_IMPL(StackFrameInfo)56 NEVER_READ_ONLY_SPACE_IMPL(StackFrameInfo)
57
58 Script StackFrameInfo::script() const {
59 HeapObject object = shared_or_script();
60 if (object.IsSharedFunctionInfo()) {
61 object = SharedFunctionInfo::cast(object).script();
62 }
63 return Script::cast(object);
64 }
65
BIT_FIELD_ACCESSORS(StackFrameInfo,flags,bytecode_offset_or_source_position,StackFrameInfo::BytecodeOffsetOrSourcePositionBits)66 BIT_FIELD_ACCESSORS(StackFrameInfo, flags, bytecode_offset_or_source_position,
67 StackFrameInfo::BytecodeOffsetOrSourcePositionBits)
68 BIT_FIELD_ACCESSORS(StackFrameInfo, flags, is_constructor,
69 StackFrameInfo::IsConstructorBit)
70
71 NEVER_READ_ONLY_SPACE_IMPL(ErrorStackData)
72 TQ_OBJECT_CONSTRUCTORS_IMPL(ErrorStackData)
73
74 bool ErrorStackData::HasFormattedStack() const {
75 return !call_site_infos_or_formatted_stack().IsFixedArray();
76 }
77
78 ACCESSORS_RELAXED_CHECKED(ErrorStackData, formatted_stack, Object,
79 kCallSiteInfosOrFormattedStackOffset,
80 !limit_or_stack_frame_infos().IsSmi())
81
HasCallSiteInfos()82 bool ErrorStackData::HasCallSiteInfos() const { return !HasFormattedStack(); }
83
84 ACCESSORS_RELAXED_CHECKED(ErrorStackData, call_site_infos, FixedArray,
85 kCallSiteInfosOrFormattedStackOffset,
86 !HasFormattedStack())
87
88 NEVER_READ_ONLY_SPACE_IMPL(PromiseOnStack)
89 TQ_OBJECT_CONSTRUCTORS_IMPL(PromiseOnStack)
90
91 } // namespace internal
92 } // namespace v8
93
94 #include "src/objects/object-macros-undef.h"
95
96 #endif // V8_OBJECTS_DEBUG_OBJECTS_INL_H_
97