debug-objects-inl.h 3.26 KB
Newer Older
1 2 3 4 5 6 7 8 9
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_OBJECTS_DEBUG_OBJECTS_INL_H_
#define V8_OBJECTS_DEBUG_OBJECTS_INL_H_

#include "src/objects/debug-objects.h"

10 11
#include "src/heap/heap-write-barrier-inl.h"
#include "src/objects/code-inl.h"
12
#include "src/objects/objects-inl.h"
13
#include "src/objects/shared-function-info.h"
14 15 16 17 18 19 20

// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"

namespace v8 {
namespace internal {

21 22
#include "torque-generated/src/objects/debug-objects-tq-inl.inc"

23 24
TQ_OBJECT_CONSTRUCTORS_IMPL(BreakPoint)
TQ_OBJECT_CONSTRUCTORS_IMPL(BreakPointInfo)
25
TQ_OBJECT_CONSTRUCTORS_IMPL(CoverageInfo)
26
TQ_OBJECT_CONSTRUCTORS_IMPL(DebugInfo)
27

28 29
NEVER_READ_ONLY_SPACE_IMPL(DebugInfo)

30 31 32 33 34 35 36 37 38 39
BIT_FIELD_ACCESSORS(DebugInfo, debugger_hints, side_effect_state,
                    DebugInfo::SideEffectStateBits)
BIT_FIELD_ACCESSORS(DebugInfo, debugger_hints, debug_is_blackboxed,
                    DebugInfo::DebugIsBlackboxedBit)
BIT_FIELD_ACCESSORS(DebugInfo, debugger_hints, computed_debug_is_blackboxed,
                    DebugInfo::ComputedDebugIsBlackboxedBit)
BIT_FIELD_ACCESSORS(DebugInfo, debugger_hints, debugging_id,
                    DebugInfo::DebuggingIdBits)

bool DebugInfo::HasInstrumentedBytecodeArray() {
40
  return debug_bytecode_array(kAcquireLoad).IsBytecodeArray();
41 42
}

43
BytecodeArray DebugInfo::OriginalBytecodeArray() {
44
  DCHECK(HasInstrumentedBytecodeArray());
45
  return BytecodeArray::cast(original_bytecode_array(kAcquireLoad));
46 47
}

48
BytecodeArray DebugInfo::DebugBytecodeArray() {
49
  DCHECK(HasInstrumentedBytecodeArray());
50 51 52
  DCHECK_EQ(shared().GetActiveBytecodeArray(),
            debug_bytecode_array(kAcquireLoad));
  return BytecodeArray::cast(debug_bytecode_array(kAcquireLoad));
53 54
}

55 56 57
TQ_OBJECT_CONSTRUCTORS_IMPL(StackFrameInfo)
NEVER_READ_ONLY_SPACE_IMPL(StackFrameInfo)

58 59 60 61 62 63 64 65 66 67
Script StackFrameInfo::script() const {
  HeapObject object = shared_or_script();
  if (object.IsSharedFunctionInfo()) {
    object = SharedFunctionInfo::cast(object).script();
  }
  return Script::cast(object);
}

BIT_FIELD_ACCESSORS(StackFrameInfo, flags, bytecode_offset_or_source_position,
                    StackFrameInfo::BytecodeOffsetOrSourcePositionBits)
68 69 70
BIT_FIELD_ACCESSORS(StackFrameInfo, flags, is_constructor,
                    StackFrameInfo::IsConstructorBit)

71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
NEVER_READ_ONLY_SPACE_IMPL(ErrorStackData)
TQ_OBJECT_CONSTRUCTORS_IMPL(ErrorStackData)

bool ErrorStackData::HasFormattedStack() const {
  return !call_site_infos_or_formatted_stack().IsFixedArray();
}

ACCESSORS_RELAXED_CHECKED(ErrorStackData, formatted_stack, Object,
                          kCallSiteInfosOrFormattedStackOffset,
                          !limit_or_stack_frame_infos().IsSmi())

bool ErrorStackData::HasCallSiteInfos() const { return !HasFormattedStack(); }

ACCESSORS_RELAXED_CHECKED(ErrorStackData, call_site_infos, FixedArray,
                          kCallSiteInfosOrFormattedStackOffset,
                          !HasFormattedStack())

88 89 90
NEVER_READ_ONLY_SPACE_IMPL(PromiseOnStack)
TQ_OBJECT_CONSTRUCTORS_IMPL(PromiseOnStack)

91 92 93 94 95 96
}  // namespace internal
}  // namespace v8

#include "src/objects/object-macros-undef.h"

#endif  // V8_OBJECTS_DEBUG_OBJECTS_INL_H_