11cb0ef41Sopenharmony_ci// Copyright 2019 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_ciextern class BreakPoint extends Struct {
61cb0ef41Sopenharmony_ci  id: Smi;
71cb0ef41Sopenharmony_ci  condition: String;
81cb0ef41Sopenharmony_ci}
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_ciextern class BreakPointInfo extends Struct {
111cb0ef41Sopenharmony_ci  // The position in the source for the break position.
121cb0ef41Sopenharmony_ci  source_position: Smi;
131cb0ef41Sopenharmony_ci  // List of related JavaScript break points.
141cb0ef41Sopenharmony_ci  break_points: FixedArray|BreakPoint|Undefined;
151cb0ef41Sopenharmony_ci}
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_cibitfield struct DebugInfoFlags extends uint31 {
181cb0ef41Sopenharmony_ci  has_break_info: bool: 1 bit;
191cb0ef41Sopenharmony_ci  prepared_for_debug_execution: bool: 1 bit;
201cb0ef41Sopenharmony_ci  has_coverage_info: bool: 1 bit;
211cb0ef41Sopenharmony_ci  break_at_entry: bool: 1 bit;
221cb0ef41Sopenharmony_ci  can_break_at_entry: bool: 1 bit;
231cb0ef41Sopenharmony_ci  debug_execution_mode: bool: 1 bit;
241cb0ef41Sopenharmony_ci}
251cb0ef41Sopenharmony_ci
261cb0ef41Sopenharmony_cibitfield struct DebuggerHints extends uint31 {
271cb0ef41Sopenharmony_ci  side_effect_state: int32: 2 bit;
281cb0ef41Sopenharmony_ci  debug_is_blackboxed: bool: 1 bit;
291cb0ef41Sopenharmony_ci  computed_debug_is_blackboxed: bool: 1 bit;
301cb0ef41Sopenharmony_ci  debugging_id: int32: 20 bit;
311cb0ef41Sopenharmony_ci}
321cb0ef41Sopenharmony_ci
331cb0ef41Sopenharmony_ciextern class DebugInfo extends Struct {
341cb0ef41Sopenharmony_ci  shared: SharedFunctionInfo;
351cb0ef41Sopenharmony_ci  // Bit field containing various information collected for debugging.
361cb0ef41Sopenharmony_ci  debugger_hints: SmiTagged<DebuggerHints>;
371cb0ef41Sopenharmony_ci  // Script field from shared function info.
381cb0ef41Sopenharmony_ci  script: Undefined|Script;
391cb0ef41Sopenharmony_ci  // The original uninstrumented bytecode array for functions with break
401cb0ef41Sopenharmony_ci  // points - the instrumented bytecode is held in the shared function info.
411cb0ef41Sopenharmony_ci  @cppAcquireLoad
421cb0ef41Sopenharmony_ci  @cppReleaseStore
431cb0ef41Sopenharmony_ci  original_bytecode_array: Undefined|BytecodeArray;
441cb0ef41Sopenharmony_ci  // The debug instrumented bytecode array for functions with break points
451cb0ef41Sopenharmony_ci  // - also pointed to by the shared function info.
461cb0ef41Sopenharmony_ci  @cppAcquireLoad
471cb0ef41Sopenharmony_ci  @cppReleaseStore
481cb0ef41Sopenharmony_ci  debug_bytecode_array: Undefined|BytecodeArray;
491cb0ef41Sopenharmony_ci  // Fixed array holding status information for each active break point.
501cb0ef41Sopenharmony_ci  break_points: FixedArray;
511cb0ef41Sopenharmony_ci  // A bitfield that lists uses of the current instance.
521cb0ef41Sopenharmony_ci  @cppRelaxedLoad @cppRelaxedStore flags: SmiTagged<DebugInfoFlags>;
531cb0ef41Sopenharmony_ci  coverage_info: CoverageInfo|Undefined;
541cb0ef41Sopenharmony_ci}
551cb0ef41Sopenharmony_ci
561cb0ef41Sopenharmony_ci@export
571cb0ef41Sopenharmony_cistruct CoverageInfoSlot {
581cb0ef41Sopenharmony_ci  start_source_position: int32;
591cb0ef41Sopenharmony_ci  end_source_position: int32;
601cb0ef41Sopenharmony_ci  block_count: int32;
611cb0ef41Sopenharmony_ci  padding: int32;  // Padding to make the index count 4.
621cb0ef41Sopenharmony_ci}
631cb0ef41Sopenharmony_ci
641cb0ef41Sopenharmony_ci// CoverageInfo's visitor is included in DATA_ONLY_VISITOR_ID_LIST, so it must
651cb0ef41Sopenharmony_ci// not contain any HeapObject fields.
661cb0ef41Sopenharmony_ciextern class CoverageInfo extends HeapObject {
671cb0ef41Sopenharmony_ci  const slot_count: int32;
681cb0ef41Sopenharmony_ci  slots[slot_count]: CoverageInfoSlot;
691cb0ef41Sopenharmony_ci}
701cb0ef41Sopenharmony_ci
711cb0ef41Sopenharmony_cibitfield struct StackFrameInfoFlags extends uint31 {
721cb0ef41Sopenharmony_ci  is_constructor: bool: 1 bit;
731cb0ef41Sopenharmony_ci  bytecode_offset_or_source_position: int32: 30 bit;
741cb0ef41Sopenharmony_ci}
751cb0ef41Sopenharmony_ci
761cb0ef41Sopenharmony_ciextern class StackFrameInfo extends Struct {
771cb0ef41Sopenharmony_ci  // In case this field holds a SharedFunctionInfo, the
781cb0ef41Sopenharmony_ci  // |bytecode_offset_or_source_position| part of the
791cb0ef41Sopenharmony_ci  // |flags| bit field below contains the bytecode offset
801cb0ef41Sopenharmony_ci  // within that SharedFunctionInfo. Otherwise if this
811cb0ef41Sopenharmony_ci  // is a Script, the |bytecode_offset_or_source_position|
821cb0ef41Sopenharmony_ci  // holds the source position within the Script.
831cb0ef41Sopenharmony_ci  shared_or_script: SharedFunctionInfo|Script;
841cb0ef41Sopenharmony_ci  function_name: String;
851cb0ef41Sopenharmony_ci  flags: SmiTagged<StackFrameInfoFlags>;
861cb0ef41Sopenharmony_ci}
871cb0ef41Sopenharmony_ci
881cb0ef41Sopenharmony_ci// This struct is used by V8 as error_data_symbol on JSError
891cb0ef41Sopenharmony_ci// instances when the inspector asks V8 to keep (detailed)
901cb0ef41Sopenharmony_ci// stack traces in addition to the (simple) stack traces that
911cb0ef41Sopenharmony_ci// are collected by V8 for error.stack.
921cb0ef41Sopenharmony_ci//
931cb0ef41Sopenharmony_ci// This can have one of the following forms:
941cb0ef41Sopenharmony_ci//
951cb0ef41Sopenharmony_ci// (1) A pair of FixedArray<CallSiteInfo> and positive limit
961cb0ef41Sopenharmony_ci//     if the stack information is not formatted yet and the
971cb0ef41Sopenharmony_ci//     inspector did not yet request any information about the
981cb0ef41Sopenharmony_ci//     error's stack trace. The positive limit specifies the cap
991cb0ef41Sopenharmony_ci//     for the number of call sites exposed to error.stack.
1001cb0ef41Sopenharmony_ci// (2) A pair of FixedArray<CallSiteInfo> and negative limit
1011cb0ef41Sopenharmony_ci//     is similar to the above, except that the limit should be
1021cb0ef41Sopenharmony_ci//     applied to the inspector StackFrameInfo list once computed
1031cb0ef41Sopenharmony_ci//     rather than the number of call sites exposed to error.stack.
1041cb0ef41Sopenharmony_ci// (3) A FixedArray<CallSiteInfo> and FixedArray<StackFrameInfo>
1051cb0ef41Sopenharmony_ci//     pair indicates that the inspector already asked for the
1061cb0ef41Sopenharmony_ci//     detailed stack information, but the error.stack property
1071cb0ef41Sopenharmony_ci//     was not yet formatted. If any limit (negative or positive)
1081cb0ef41Sopenharmony_ci//     was stored in the second field before, it was applied to the
1091cb0ef41Sopenharmony_ci//     appropriate FixedArray now.
1101cb0ef41Sopenharmony_ci// (4) A valid JavaScript object and FixedArray<StackFrameInfo>
1111cb0ef41Sopenharmony_ci//     once error.stack was accessed.
1121cb0ef41Sopenharmony_ci//
1131cb0ef41Sopenharmony_ci// Memorizing the limits is important to ensure that the fact that
1141cb0ef41Sopenharmony_ci// the inspector is active doesn't influence the script execution
1151cb0ef41Sopenharmony_ci// (i.e. the observable limit of call sites in error.stack is the
1161cb0ef41Sopenharmony_ci// same independent of whether the inspector is active or not).
1171cb0ef41Sopenharmony_ciextern class ErrorStackData extends Struct {
1181cb0ef41Sopenharmony_ci  // This holds either the FixedArray of CallSiteInfo instances or
1191cb0ef41Sopenharmony_ci  // the formatted stack value (usually a string) that's returned
1201cb0ef41Sopenharmony_ci  // from the error.stack property.
1211cb0ef41Sopenharmony_ci  call_site_infos_or_formatted_stack: FixedArray|JSAny;
1221cb0ef41Sopenharmony_ci  // This holds either the FixedArray of StackFrameInfo instances
1231cb0ef41Sopenharmony_ci  // for the inspector stack trace or a stack trace limit, which
1241cb0ef41Sopenharmony_ci  // if positive specifies how many of the CallSiteInfo instances
1251cb0ef41Sopenharmony_ci  // in the first field are to be revealed via error.stack or if
1261cb0ef41Sopenharmony_ci  // negative specifies the (negated) limit for the inspector
1271cb0ef41Sopenharmony_ci  // stack traces.
1281cb0ef41Sopenharmony_ci  limit_or_stack_frame_infos: Smi|FixedArray;
1291cb0ef41Sopenharmony_ci}
1301cb0ef41Sopenharmony_ci
1311cb0ef41Sopenharmony_ciextern class PromiseOnStack extends Struct {
1321cb0ef41Sopenharmony_ci  prev: PromiseOnStack|Zero;
1331cb0ef41Sopenharmony_ci  promise: Weak<JSObject>;
1341cb0ef41Sopenharmony_ci}
135