LCOV - code coverage report
Current view: top level - src - code-reference.h (source / functions) Hit Total Coverage
Test: app.info Lines: 0 1 0.0 %
Date: 2019-03-21 Functions: 0 0 -

          Line data    Source code
       1             : // Copyright 2018 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_CODE_REFERENCE_H_
       6             : #define V8_CODE_REFERENCE_H_
       7             : 
       8             : #include "src/handles.h"
       9             : #include "src/objects/code.h"
      10             : 
      11             : namespace v8 {
      12             : namespace internal {
      13             : 
      14             : class Code;
      15             : class CodeDesc;
      16             : 
      17             : namespace wasm {
      18             : class WasmCode;
      19             : }
      20             : 
      21             : class CodeReference {
      22             :  public:
      23           0 :   CodeReference() : kind_(NONE), null_(nullptr) {}
      24             :   explicit CodeReference(const wasm::WasmCode* wasm_code)
      25             :       : kind_(WASM), wasm_code_(wasm_code) {}
      26             :   explicit CodeReference(const CodeDesc* code_desc)
      27             :       : kind_(CODE_DESC), code_desc_(code_desc) {}
      28             :   explicit CodeReference(Handle<Code> js_code) : kind_(JS), js_code_(js_code) {}
      29             : 
      30             :   Address constant_pool() const;
      31             :   Address instruction_start() const;
      32             :   Address instruction_end() const;
      33             :   int instruction_size() const;
      34             :   const byte* relocation_start() const;
      35             :   const byte* relocation_end() const;
      36             :   int relocation_size() const;
      37             :   Address code_comments() const;
      38             : 
      39             :   bool is_null() const { return kind_ == NONE; }
      40             :   bool is_js() const { return kind_ == JS; }
      41             :   bool is_wasm_code() const { return kind_ == WASM; }
      42             : 
      43             :   Handle<Code> as_js_code() const {
      44             :     DCHECK_EQ(JS, kind_);
      45             :     return js_code_;
      46             :   }
      47             : 
      48             :   const wasm::WasmCode* as_wasm_code() const {
      49             :     DCHECK_EQ(WASM, kind_);
      50             :     return wasm_code_;
      51             :   }
      52             : 
      53             :  private:
      54             :   enum { NONE, JS, WASM, CODE_DESC } kind_;
      55             :   union {
      56             :     std::nullptr_t null_;
      57             :     const wasm::WasmCode* wasm_code_;
      58             :     const CodeDesc* code_desc_;
      59             :     Handle<Code> js_code_;
      60             :   };
      61             : 
      62             :   DISALLOW_NEW_AND_DELETE()
      63             : };
      64             : ASSERT_TRIVIALLY_COPYABLE(CodeReference);
      65             : 
      66             : }  // namespace internal
      67             : }  // namespace v8
      68             : 
      69             : #endif  // V8_CODE_REFERENCE_H_

Generated by: LCOV version 1.10