LCOV - code coverage report
Current view: top level - src/debug - interface-types.h (source / functions) Hit Total Coverage
Test: app.info Lines: 8 54 14.8 %
Date: 2017-10-20 Functions: 1 26 3.8 %

          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         386 :       : byte_offset(byte_offset), line(line), column(column) {}
      55             : 
      56             :   uint32_t byte_offset;
      57             :   int line;
      58             :   int column;
      59             : };
      60             : 
      61         178 : struct WasmDisassembly {
      62             :   using OffsetTable = std::vector<WasmDisassemblyOffsetTableEntry>;
      63             :   WasmDisassembly() {}
      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 PromiseDebugActionType {
      73             :   kDebugPromiseCreated,
      74             :   kDebugEnqueueAsyncFunction,
      75             :   kDebugEnqueuePromiseResolve,
      76             :   kDebugEnqueuePromiseReject,
      77             :   kDebugWillHandle,
      78             :   kDebugDidHandle,
      79             : };
      80             : 
      81             : enum BreakLocationType {
      82             :   kCallBreakLocation,
      83             :   kReturnBreakLocation,
      84             :   kDebuggerStatementBreakLocation,
      85             :   kCommonBreakLocation
      86             : };
      87             : 
      88             : class V8_EXPORT_PRIVATE BreakLocation : public Location {
      89             :  public:
      90             :   BreakLocation(int line_number, int column_number, BreakLocationType type)
      91        3640 :       : Location(line_number, column_number), type_(type) {}
      92             : 
      93             :   BreakLocationType type() const { return type_; }
      94             : 
      95             :  private:
      96             :   BreakLocationType type_;
      97             : };
      98             : 
      99             : class ConsoleCallArguments : private v8::FunctionCallbackInfo<v8::Value> {
     100             :  public:
     101       20529 :   int Length() const { return v8::FunctionCallbackInfo<v8::Value>::Length(); }
     102             :   V8_INLINE Local<Value> operator[](int i) const {
     103             :     return v8::FunctionCallbackInfo<v8::Value>::operator[](i);
     104             :   }
     105             : 
     106             :   explicit ConsoleCallArguments(const v8::FunctionCallbackInfo<v8::Value>&);
     107             :   explicit ConsoleCallArguments(internal::BuiltinArguments&);
     108             : };
     109             : 
     110             : class ConsoleContext {
     111             :  public:
     112        7347 :   ConsoleContext(int id, v8::Local<v8::String> name) : id_(id), name_(name) {}
     113         380 :   ConsoleContext() : id_(0) {}
     114             : 
     115             :   int id() const { return id_; }
     116             :   v8::Local<v8::String> name() const { return name_; }
     117             : 
     118             :  private:
     119             :   int id_;
     120             :   v8::Local<v8::String> name_;
     121             : };
     122             : 
     123       30431 : class ConsoleDelegate {
     124             :  public:
     125           0 :   virtual void Debug(const ConsoleCallArguments& args,
     126           0 :                      const ConsoleContext& context) {}
     127           0 :   virtual void Error(const ConsoleCallArguments& args,
     128           0 :                      const ConsoleContext& context) {}
     129           0 :   virtual void Info(const ConsoleCallArguments& args,
     130           0 :                     const ConsoleContext& context) {}
     131           0 :   virtual void Log(const ConsoleCallArguments& args,
     132           0 :                    const ConsoleContext& context) {}
     133           0 :   virtual void Warn(const ConsoleCallArguments& args,
     134           0 :                     const ConsoleContext& context) {}
     135           0 :   virtual void Dir(const ConsoleCallArguments& args,
     136           0 :                    const ConsoleContext& context) {}
     137           0 :   virtual void DirXml(const ConsoleCallArguments& args,
     138           0 :                       const ConsoleContext& context) {}
     139           0 :   virtual void Table(const ConsoleCallArguments& args,
     140           0 :                      const ConsoleContext& context) {}
     141           0 :   virtual void Trace(const ConsoleCallArguments& args,
     142           0 :                      const ConsoleContext& context) {}
     143           0 :   virtual void Group(const ConsoleCallArguments& args,
     144           0 :                      const ConsoleContext& context) {}
     145           0 :   virtual void GroupCollapsed(const ConsoleCallArguments& args,
     146           0 :                               const ConsoleContext& context) {}
     147           0 :   virtual void GroupEnd(const ConsoleCallArguments& args,
     148           0 :                         const ConsoleContext& context) {}
     149           0 :   virtual void Clear(const ConsoleCallArguments& args,
     150           0 :                      const ConsoleContext& context) {}
     151           0 :   virtual void Count(const ConsoleCallArguments& args,
     152           0 :                      const ConsoleContext& context) {}
     153           0 :   virtual void Assert(const ConsoleCallArguments& args,
     154           0 :                       const ConsoleContext& context) {}
     155           0 :   virtual void MarkTimeline(const ConsoleCallArguments& args,
     156           0 :                             const ConsoleContext& context) {}
     157           0 :   virtual void Profile(const ConsoleCallArguments& args,
     158           0 :                        const ConsoleContext& context) {}
     159           0 :   virtual void ProfileEnd(const ConsoleCallArguments& args,
     160           0 :                           const ConsoleContext& context) {}
     161           0 :   virtual void Timeline(const ConsoleCallArguments& args,
     162           0 :                         const ConsoleContext& context) {}
     163           0 :   virtual void TimelineEnd(const ConsoleCallArguments& args,
     164           0 :                            const ConsoleContext& context) {}
     165           0 :   virtual void Time(const ConsoleCallArguments& args,
     166           0 :                     const ConsoleContext& context) {}
     167           0 :   virtual void TimeEnd(const ConsoleCallArguments& args,
     168           0 :                        const ConsoleContext& context) {}
     169           0 :   virtual void TimeStamp(const ConsoleCallArguments& args,
     170           0 :                          const ConsoleContext& context) {}
     171       30044 :   virtual ~ConsoleDelegate() = default;
     172             : };
     173             : 
     174             : typedef int BreakpointId;
     175             : 
     176             : }  // namespace debug
     177             : }  // namespace v8
     178             : 
     179             : #endif  // V8_DEBUG_INTERFACE_TYPES_H_

Generated by: LCOV version 1.10