11cb0ef41Sopenharmony_ci// Copyright 2017 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci#ifndef V8_OBJECTS_DEBUG_OBJECTS_INL_H_
61cb0ef41Sopenharmony_ci#define V8_OBJECTS_DEBUG_OBJECTS_INL_H_
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ci#include "src/objects/debug-objects.h"
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_ci#include "src/heap/heap-write-barrier-inl.h"
111cb0ef41Sopenharmony_ci#include "src/objects/code-inl.h"
121cb0ef41Sopenharmony_ci#include "src/objects/objects-inl.h"
131cb0ef41Sopenharmony_ci#include "src/objects/shared-function-info.h"
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ci// Has to be the last include (doesn't have include guards):
161cb0ef41Sopenharmony_ci#include "src/objects/object-macros.h"
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_cinamespace v8 {
191cb0ef41Sopenharmony_cinamespace internal {
201cb0ef41Sopenharmony_ci
211cb0ef41Sopenharmony_ci#include "torque-generated/src/objects/debug-objects-tq-inl.inc"
221cb0ef41Sopenharmony_ci
231cb0ef41Sopenharmony_ciTQ_OBJECT_CONSTRUCTORS_IMPL(BreakPoint)
241cb0ef41Sopenharmony_ciTQ_OBJECT_CONSTRUCTORS_IMPL(BreakPointInfo)
251cb0ef41Sopenharmony_ciTQ_OBJECT_CONSTRUCTORS_IMPL(CoverageInfo)
261cb0ef41Sopenharmony_ciTQ_OBJECT_CONSTRUCTORS_IMPL(DebugInfo)
271cb0ef41Sopenharmony_ci
281cb0ef41Sopenharmony_ciNEVER_READ_ONLY_SPACE_IMPL(DebugInfo)
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ciBIT_FIELD_ACCESSORS(DebugInfo, debugger_hints, side_effect_state,
311cb0ef41Sopenharmony_ci                    DebugInfo::SideEffectStateBits)
321cb0ef41Sopenharmony_ciBIT_FIELD_ACCESSORS(DebugInfo, debugger_hints, debug_is_blackboxed,
331cb0ef41Sopenharmony_ci                    DebugInfo::DebugIsBlackboxedBit)
341cb0ef41Sopenharmony_ciBIT_FIELD_ACCESSORS(DebugInfo, debugger_hints, computed_debug_is_blackboxed,
351cb0ef41Sopenharmony_ci                    DebugInfo::ComputedDebugIsBlackboxedBit)
361cb0ef41Sopenharmony_ciBIT_FIELD_ACCESSORS(DebugInfo, debugger_hints, debugging_id,
371cb0ef41Sopenharmony_ci                    DebugInfo::DebuggingIdBits)
381cb0ef41Sopenharmony_ci
391cb0ef41Sopenharmony_cibool DebugInfo::HasInstrumentedBytecodeArray() {
401cb0ef41Sopenharmony_ci  return debug_bytecode_array(kAcquireLoad).IsBytecodeArray();
411cb0ef41Sopenharmony_ci}
421cb0ef41Sopenharmony_ci
431cb0ef41Sopenharmony_ciBytecodeArray DebugInfo::OriginalBytecodeArray() {
441cb0ef41Sopenharmony_ci  DCHECK(HasInstrumentedBytecodeArray());
451cb0ef41Sopenharmony_ci  return BytecodeArray::cast(original_bytecode_array(kAcquireLoad));
461cb0ef41Sopenharmony_ci}
471cb0ef41Sopenharmony_ci
481cb0ef41Sopenharmony_ciBytecodeArray DebugInfo::DebugBytecodeArray() {
491cb0ef41Sopenharmony_ci  DCHECK(HasInstrumentedBytecodeArray());
501cb0ef41Sopenharmony_ci  DCHECK_EQ(shared().GetActiveBytecodeArray(),
511cb0ef41Sopenharmony_ci            debug_bytecode_array(kAcquireLoad));
521cb0ef41Sopenharmony_ci  return BytecodeArray::cast(debug_bytecode_array(kAcquireLoad));
531cb0ef41Sopenharmony_ci}
541cb0ef41Sopenharmony_ci
551cb0ef41Sopenharmony_ciTQ_OBJECT_CONSTRUCTORS_IMPL(StackFrameInfo)
561cb0ef41Sopenharmony_ciNEVER_READ_ONLY_SPACE_IMPL(StackFrameInfo)
571cb0ef41Sopenharmony_ci
581cb0ef41Sopenharmony_ciScript StackFrameInfo::script() const {
591cb0ef41Sopenharmony_ci  HeapObject object = shared_or_script();
601cb0ef41Sopenharmony_ci  if (object.IsSharedFunctionInfo()) {
611cb0ef41Sopenharmony_ci    object = SharedFunctionInfo::cast(object).script();
621cb0ef41Sopenharmony_ci  }
631cb0ef41Sopenharmony_ci  return Script::cast(object);
641cb0ef41Sopenharmony_ci}
651cb0ef41Sopenharmony_ci
661cb0ef41Sopenharmony_ciBIT_FIELD_ACCESSORS(StackFrameInfo, flags, bytecode_offset_or_source_position,
671cb0ef41Sopenharmony_ci                    StackFrameInfo::BytecodeOffsetOrSourcePositionBits)
681cb0ef41Sopenharmony_ciBIT_FIELD_ACCESSORS(StackFrameInfo, flags, is_constructor,
691cb0ef41Sopenharmony_ci                    StackFrameInfo::IsConstructorBit)
701cb0ef41Sopenharmony_ci
711cb0ef41Sopenharmony_ciNEVER_READ_ONLY_SPACE_IMPL(ErrorStackData)
721cb0ef41Sopenharmony_ciTQ_OBJECT_CONSTRUCTORS_IMPL(ErrorStackData)
731cb0ef41Sopenharmony_ci
741cb0ef41Sopenharmony_cibool ErrorStackData::HasFormattedStack() const {
751cb0ef41Sopenharmony_ci  return !call_site_infos_or_formatted_stack().IsFixedArray();
761cb0ef41Sopenharmony_ci}
771cb0ef41Sopenharmony_ci
781cb0ef41Sopenharmony_ciACCESSORS_RELAXED_CHECKED(ErrorStackData, formatted_stack, Object,
791cb0ef41Sopenharmony_ci                          kCallSiteInfosOrFormattedStackOffset,
801cb0ef41Sopenharmony_ci                          !limit_or_stack_frame_infos().IsSmi())
811cb0ef41Sopenharmony_ci
821cb0ef41Sopenharmony_cibool ErrorStackData::HasCallSiteInfos() const { return !HasFormattedStack(); }
831cb0ef41Sopenharmony_ci
841cb0ef41Sopenharmony_ciACCESSORS_RELAXED_CHECKED(ErrorStackData, call_site_infos, FixedArray,
851cb0ef41Sopenharmony_ci                          kCallSiteInfosOrFormattedStackOffset,
861cb0ef41Sopenharmony_ci                          !HasFormattedStack())
871cb0ef41Sopenharmony_ci
881cb0ef41Sopenharmony_ciNEVER_READ_ONLY_SPACE_IMPL(PromiseOnStack)
891cb0ef41Sopenharmony_ciTQ_OBJECT_CONSTRUCTORS_IMPL(PromiseOnStack)
901cb0ef41Sopenharmony_ci
911cb0ef41Sopenharmony_ci}  // namespace internal
921cb0ef41Sopenharmony_ci}  // namespace v8
931cb0ef41Sopenharmony_ci
941cb0ef41Sopenharmony_ci#include "src/objects/object-macros-undef.h"
951cb0ef41Sopenharmony_ci
961cb0ef41Sopenharmony_ci#endif  // V8_OBJECTS_DEBUG_OBJECTS_INL_H_
97