• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2019 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
5extern class BreakPoint extends Struct {
6  id: Smi;
7  condition: String;
8}
9
10extern class BreakPointInfo extends Struct {
11  // The position in the source for the break position.
12  source_position: Smi;
13  // List of related JavaScript break points.
14  break_points: FixedArray|BreakPoint|Undefined;
15}
16
17bitfield struct DebugInfoFlags extends uint31 {
18  has_break_info: bool: 1 bit;
19  prepared_for_debug_execution: bool: 1 bit;
20  has_coverage_info: bool: 1 bit;
21  break_at_entry: bool: 1 bit;
22  can_break_at_entry: bool: 1 bit;
23  debug_execution_mode: bool: 1 bit;
24}
25
26bitfield struct DebuggerHints extends uint31 {
27  side_effect_state: int32: 2 bit;
28  debug_is_blackboxed: bool: 1 bit;
29  computed_debug_is_blackboxed: bool: 1 bit;
30  debugging_id: int32: 20 bit;
31}
32
33extern class DebugInfo extends Struct {
34  shared: SharedFunctionInfo;
35  // Bit field containing various information collected for debugging.
36  debugger_hints: SmiTagged<DebuggerHints>;
37  // Script field from shared function info.
38  script: Undefined|Script;
39  // The original uninstrumented bytecode array for functions with break
40  // points - the instrumented bytecode is held in the shared function info.
41  @cppAcquireLoad
42  @cppReleaseStore
43  original_bytecode_array: Undefined|BytecodeArray;
44  // The debug instrumented bytecode array for functions with break points
45  // - also pointed to by the shared function info.
46  @cppAcquireLoad
47  @cppReleaseStore
48  debug_bytecode_array: Undefined|BytecodeArray;
49  // Fixed array holding status information for each active break point.
50  break_points: FixedArray;
51  // A bitfield that lists uses of the current instance.
52  @cppRelaxedLoad @cppRelaxedStore flags: SmiTagged<DebugInfoFlags>;
53  coverage_info: CoverageInfo|Undefined;
54}
55
56@export
57struct CoverageInfoSlot {
58  start_source_position: int32;
59  end_source_position: int32;
60  block_count: int32;
61  padding: int32;  // Padding to make the index count 4.
62}
63
64// CoverageInfo's visitor is included in DATA_ONLY_VISITOR_ID_LIST, so it must
65// not contain any HeapObject fields.
66extern class CoverageInfo extends HeapObject {
67  const slot_count: int32;
68  slots[slot_count]: CoverageInfoSlot;
69}
70
71bitfield struct StackFrameInfoFlags extends uint31 {
72  is_constructor: bool: 1 bit;
73  bytecode_offset_or_source_position: int32: 30 bit;
74}
75
76extern class StackFrameInfo extends Struct {
77  // In case this field holds a SharedFunctionInfo, the
78  // |bytecode_offset_or_source_position| part of the
79  // |flags| bit field below contains the bytecode offset
80  // within that SharedFunctionInfo. Otherwise if this
81  // is a Script, the |bytecode_offset_or_source_position|
82  // holds the source position within the Script.
83  shared_or_script: SharedFunctionInfo|Script;
84  function_name: String;
85  flags: SmiTagged<StackFrameInfoFlags>;
86}
87
88// This struct is used by V8 as error_data_symbol on JSError
89// instances when the inspector asks V8 to keep (detailed)
90// stack traces in addition to the (simple) stack traces that
91// are collected by V8 for error.stack.
92//
93// This can have one of the following forms:
94//
95// (1) A pair of FixedArray<CallSiteInfo> and positive limit
96//     if the stack information is not formatted yet and the
97//     inspector did not yet request any information about the
98//     error's stack trace. The positive limit specifies the cap
99//     for the number of call sites exposed to error.stack.
100// (2) A pair of FixedArray<CallSiteInfo> and negative limit
101//     is similar to the above, except that the limit should be
102//     applied to the inspector StackFrameInfo list once computed
103//     rather than the number of call sites exposed to error.stack.
104// (3) A FixedArray<CallSiteInfo> and FixedArray<StackFrameInfo>
105//     pair indicates that the inspector already asked for the
106//     detailed stack information, but the error.stack property
107//     was not yet formatted. If any limit (negative or positive)
108//     was stored in the second field before, it was applied to the
109//     appropriate FixedArray now.
110// (4) A valid JavaScript object and FixedArray<StackFrameInfo>
111//     once error.stack was accessed.
112//
113// Memorizing the limits is important to ensure that the fact that
114// the inspector is active doesn't influence the script execution
115// (i.e. the observable limit of call sites in error.stack is the
116// same independent of whether the inspector is active or not).
117extern class ErrorStackData extends Struct {
118  // This holds either the FixedArray of CallSiteInfo instances or
119  // the formatted stack value (usually a string) that's returned
120  // from the error.stack property.
121  call_site_infos_or_formatted_stack: FixedArray|JSAny;
122  // This holds either the FixedArray of StackFrameInfo instances
123  // for the inspector stack trace or a stack trace limit, which
124  // if positive specifies how many of the CallSiteInfo instances
125  // in the first field are to be revealed via error.stack or if
126  // negative specifies the (negated) limit for the inspector
127  // stack traces.
128  limit_or_stack_frame_infos: Smi|FixedArray;
129}
130
131extern class PromiseOnStack extends Struct {
132  prev: PromiseOnStack|Zero;
133  promise: Weak<JSObject>;
134}
135