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 18namespace v8 { 19namespace internal { 20 21#include "torque-generated/src/objects/debug-objects-tq-inl.inc" 22 23TQ_OBJECT_CONSTRUCTORS_IMPL(BreakPoint) 24TQ_OBJECT_CONSTRUCTORS_IMPL(BreakPointInfo) 25TQ_OBJECT_CONSTRUCTORS_IMPL(CoverageInfo) 26TQ_OBJECT_CONSTRUCTORS_IMPL(DebugInfo) 27 28NEVER_READ_ONLY_SPACE_IMPL(DebugInfo) 29 30BIT_FIELD_ACCESSORS(DebugInfo, debugger_hints, side_effect_state, 31 DebugInfo::SideEffectStateBits) 32BIT_FIELD_ACCESSORS(DebugInfo, debugger_hints, debug_is_blackboxed, 33 DebugInfo::DebugIsBlackboxedBit) 34BIT_FIELD_ACCESSORS(DebugInfo, debugger_hints, computed_debug_is_blackboxed, 35 DebugInfo::ComputedDebugIsBlackboxedBit) 36BIT_FIELD_ACCESSORS(DebugInfo, debugger_hints, debugging_id, 37 DebugInfo::DebuggingIdBits) 38 39bool DebugInfo::HasInstrumentedBytecodeArray() { 40 return debug_bytecode_array(kAcquireLoad).IsBytecodeArray(); 41} 42 43BytecodeArray DebugInfo::OriginalBytecodeArray() { 44 DCHECK(HasInstrumentedBytecodeArray()); 45 return BytecodeArray::cast(original_bytecode_array(kAcquireLoad)); 46} 47 48BytecodeArray 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 55TQ_OBJECT_CONSTRUCTORS_IMPL(StackFrameInfo) 56NEVER_READ_ONLY_SPACE_IMPL(StackFrameInfo) 57 58Script 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 66BIT_FIELD_ACCESSORS(StackFrameInfo, flags, bytecode_offset_or_source_position, 67 StackFrameInfo::BytecodeOffsetOrSourcePositionBits) 68BIT_FIELD_ACCESSORS(StackFrameInfo, flags, is_constructor, 69 StackFrameInfo::IsConstructorBit) 70 71NEVER_READ_ONLY_SPACE_IMPL(ErrorStackData) 72TQ_OBJECT_CONSTRUCTORS_IMPL(ErrorStackData) 73 74bool ErrorStackData::HasFormattedStack() const { 75 return !call_site_infos_or_formatted_stack().IsFixedArray(); 76} 77 78ACCESSORS_RELAXED_CHECKED(ErrorStackData, formatted_stack, Object, 79 kCallSiteInfosOrFormattedStackOffset, 80 !limit_or_stack_frame_infos().IsSmi()) 81 82bool ErrorStackData::HasCallSiteInfos() const { return !HasFormattedStack(); } 83 84ACCESSORS_RELAXED_CHECKED(ErrorStackData, call_site_infos, FixedArray, 85 kCallSiteInfosOrFormattedStackOffset, 86 !HasFormattedStack()) 87 88NEVER_READ_ONLY_SPACE_IMPL(PromiseOnStack) 89TQ_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