LCOV - code coverage report
Current view: top level - src/debug - interface-types.h (source / functions) Hit Total Coverage
Test: app.info Lines: 7 51 13.7 %
Date: 2019-04-17 Functions: 1 25 4.0 %

          Line data    Source code
       1             : // Copyright 2016 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_DEBUG_INTERFACE_TYPES_H_
       6             : #define V8_DEBUG_INTERFACE_TYPES_H_
       7             : 
       8             : #include <cstdint>
       9             : #include <string>
      10             : #include <vector>
      11             : 
      12             : #include "include/v8.h"
      13             : #include "src/globals.h"
      14             : 
      15             : namespace v8 {
      16             : 
      17             : namespace internal {
      18             : class BuiltinArguments;
      19             : }  // internal
      20             : 
      21             : namespace debug {
      22             : 
      23             : /**
      24             :  * Defines location inside script.
      25             :  * Lines and columns are 0-based.
      26             :  */
      27             : class V8_EXPORT_PRIVATE Location {
      28             :  public:
      29             :   Location(int line_number, int column_number);
      30             :   /**
      31             :    * Create empty location.
      32             :    */
      33             :   Location();
      34             : 
      35             :   int GetLineNumber() const;
      36             :   int GetColumnNumber() const;
      37             :   bool IsEmpty() const;
      38             : 
      39             :  private:
      40             :   int line_number_;
      41             :   int column_number_;
      42             :   bool is_empty_;
      43             : };
      44             : 
      45             : /**
      46             :  * The result of disassembling a wasm function.
      47             :  * Consists of the disassembly string and an offset table mapping wasm byte
      48             :  * offsets to line and column in the disassembly.
      49             :  * The offset table entries are ordered by the byte_offset.
      50             :  * All numbers are 0-based.
      51             :  */
      52             : struct WasmDisassemblyOffsetTableEntry {
      53             :   WasmDisassemblyOffsetTableEntry(uint32_t byte_offset, int line, int column)
      54         392 :       : byte_offset(byte_offset), line(line), column(column) {}
      55             : 
      56             :   uint32_t byte_offset;
      57             :   int line;
      58             :   int column;
      59             : };
      60             : 
      61         176 : struct WasmDisassembly {
      62             :   using OffsetTable = std::vector<WasmDisassemblyOffsetTableEntry>;
      63             :   WasmDisassembly() = default;
      64             :   WasmDisassembly(std::string disassembly, OffsetTable offset_table)
      65             :       : disassembly(std::move(disassembly)),
      66             :         offset_table(std::move(offset_table)) {}
      67             : 
      68             :   std::string disassembly;
      69             :   OffsetTable offset_table;
      70             : };
      71             : 
      72             : enum DebugAsyncActionType {
      73             :   kDebugPromiseThen,
      74             :   kDebugPromiseCatch,
      75             :   kDebugPromiseFinally,
      76             :   kDebugWillHandle,
      77             :   kDebugDidHandle,
      78             :   kAsyncFunctionSuspended,
      79             :   kAsyncFunctionFinished
      80             : };
      81             : 
      82             : enum BreakLocationType {
      83             :   kCallBreakLocation,
      84             :   kReturnBreakLocation,
      85             :   kDebuggerStatementBreakLocation,
      86             :   kCommonBreakLocation
      87             : };
      88             : 
      89             : enum class CoverageMode {
      90             :   // Make use of existing information in feedback vectors on the heap.
      91             :   // Only return a yes/no result. Optimization and GC are not affected.
      92             :   // Collecting best effort coverage does not reset counters.
      93             :   kBestEffort,
      94             :   // Disable optimization and prevent feedback vectors from being garbage
      95             :   // collected in order to preserve precise invocation counts. Collecting
      96             :   // precise count coverage resets counters to get incremental updates.
      97             :   kPreciseCount,
      98             :   // We are only interested in a yes/no result for the function. Optimization
      99             :   // and GC can be allowed once a function has been invoked. Collecting
     100             :   // precise binary coverage resets counters for incremental updates.
     101             :   kPreciseBinary,
     102             :   // Similar to the precise coverage modes but provides coverage at a
     103             :   // lower granularity. Design doc: goo.gl/lA2swZ.
     104             :   kBlockCount,
     105             :   kBlockBinary,
     106             : };
     107             : 
     108             : enum class TypeProfileMode {
     109             :   kNone,
     110             :   kCollect,
     111             : };
     112             : 
     113             : class V8_EXPORT_PRIVATE BreakLocation : public Location {
     114             :  public:
     115             :   BreakLocation(int line_number, int column_number, BreakLocationType type)
     116        5152 :       : Location(line_number, column_number), type_(type) {}
     117             : 
     118             :   BreakLocationType type() const { return type_; }
     119             : 
     120             :  private:
     121             :   BreakLocationType type_;
     122             : };
     123             : 
     124             : class ConsoleCallArguments : private v8::FunctionCallbackInfo<v8::Value> {
     125             :  public:
     126             :   int Length() const { return v8::FunctionCallbackInfo<v8::Value>::Length(); }
     127             :   V8_INLINE Local<Value> operator[](int i) const {
     128             :     return v8::FunctionCallbackInfo<v8::Value>::operator[](i);
     129             :   }
     130             : 
     131             :   explicit ConsoleCallArguments(const v8::FunctionCallbackInfo<v8::Value>&);
     132             :   explicit ConsoleCallArguments(internal::BuiltinArguments&);
     133             : };
     134             : 
     135             : class ConsoleContext {
     136             :  public:
     137       12870 :   ConsoleContext(int id, v8::Local<v8::String> name) : id_(id), name_(name) {}
     138         425 :   ConsoleContext() : id_(0) {}
     139             : 
     140             :   int id() const { return id_; }
     141             :   v8::Local<v8::String> name() const { return name_; }
     142             : 
     143             :  private:
     144             :   int id_;
     145             :   v8::Local<v8::String> name_;
     146             : };
     147             : 
     148       34473 : class ConsoleDelegate {
     149             :  public:
     150           0 :   virtual void Debug(const ConsoleCallArguments& args,
     151           0 :                      const ConsoleContext& context) {}
     152           0 :   virtual void Error(const ConsoleCallArguments& args,
     153           0 :                      const ConsoleContext& context) {}
     154           0 :   virtual void Info(const ConsoleCallArguments& args,
     155           0 :                     const ConsoleContext& context) {}
     156           0 :   virtual void Log(const ConsoleCallArguments& args,
     157           0 :                    const ConsoleContext& context) {}
     158           0 :   virtual void Warn(const ConsoleCallArguments& args,
     159           0 :                     const ConsoleContext& context) {}
     160           0 :   virtual void Dir(const ConsoleCallArguments& args,
     161           0 :                    const ConsoleContext& context) {}
     162           0 :   virtual void DirXml(const ConsoleCallArguments& args,
     163           0 :                       const ConsoleContext& context) {}
     164           0 :   virtual void Table(const ConsoleCallArguments& args,
     165           0 :                      const ConsoleContext& context) {}
     166           0 :   virtual void Trace(const ConsoleCallArguments& args,
     167           0 :                      const ConsoleContext& context) {}
     168           0 :   virtual void Group(const ConsoleCallArguments& args,
     169           0 :                      const ConsoleContext& context) {}
     170           0 :   virtual void GroupCollapsed(const ConsoleCallArguments& args,
     171           0 :                               const ConsoleContext& context) {}
     172           0 :   virtual void GroupEnd(const ConsoleCallArguments& args,
     173           0 :                         const ConsoleContext& context) {}
     174           0 :   virtual void Clear(const ConsoleCallArguments& args,
     175           0 :                      const ConsoleContext& context) {}
     176           0 :   virtual void Count(const ConsoleCallArguments& args,
     177           0 :                      const ConsoleContext& context) {}
     178           0 :   virtual void CountReset(const ConsoleCallArguments& args,
     179           0 :                           const ConsoleContext& context) {}
     180           0 :   virtual void Assert(const ConsoleCallArguments& args,
     181           0 :                       const ConsoleContext& context) {}
     182           0 :   virtual void Profile(const ConsoleCallArguments& args,
     183           0 :                        const ConsoleContext& context) {}
     184           0 :   virtual void ProfileEnd(const ConsoleCallArguments& args,
     185           0 :                           const ConsoleContext& context) {}
     186           0 :   virtual void Time(const ConsoleCallArguments& args,
     187           0 :                     const ConsoleContext& context) {}
     188           0 :   virtual void TimeLog(const ConsoleCallArguments& args,
     189           0 :                        const ConsoleContext& context) {}
     190           0 :   virtual void TimeEnd(const ConsoleCallArguments& args,
     191           0 :                        const ConsoleContext& context) {}
     192           0 :   virtual void TimeStamp(const ConsoleCallArguments& args,
     193           0 :                          const ConsoleContext& context) {}
     194       34477 :   virtual ~ConsoleDelegate() = default;
     195             : };
     196             : 
     197             : using BreakpointId = int;
     198             : 
     199             : }  // namespace debug
     200             : }  // namespace v8
     201             : 
     202             : #endif  // V8_DEBUG_INTERFACE_TYPES_H_

Generated by: LCOV version 1.10