LCOV - code coverage report
Current view: top level - src/wasm - local-decl-encoder.h (source / functions) Hit Total Coverage
Test: app.info Lines: 3 3 100.0 %
Date: 2019-04-17 Functions: 0 0 -

          Line data    Source code
       1             : // Copyright 2017 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_WASM_LOCAL_DECL_ENCODER_H_
       6             : #define V8_WASM_LOCAL_DECL_ENCODER_H_
       7             : 
       8             : #include "src/globals.h"
       9             : #include "src/wasm/wasm-opcodes.h"
      10             : #include "src/zone/zone-containers.h"
      11             : #include "src/zone/zone.h"
      12             : 
      13             : namespace v8 {
      14             : namespace internal {
      15             : namespace wasm {
      16             : 
      17             : // A helper for encoding local declarations prepended to the body of a
      18             : // function.
      19     1103528 : class V8_EXPORT_PRIVATE LocalDeclEncoder {
      20             :  public:
      21             :   explicit LocalDeclEncoder(Zone* zone, FunctionSig* s = nullptr)
      22     2238242 :       : sig(s), local_decls(zone), total(0) {}
      23             : 
      24             :   // Prepend local declarations by creating a new buffer and copying data
      25             :   // over. The new buffer must be delete[]'d by the caller.
      26             :   void Prepend(Zone* zone, const byte** start, const byte** end) const;
      27             : 
      28             :   size_t Emit(byte* buffer) const;
      29             : 
      30             :   // Add locals declarations to this helper. Return the index of the newly added
      31             :   // local(s), with an optional adjustment for the parameters.
      32             :   uint32_t AddLocals(uint32_t count, ValueType type);
      33             : 
      34             :   size_t Size() const;
      35             : 
      36             :   bool has_sig() const { return sig != nullptr; }
      37             :   FunctionSig* get_sig() const { return sig; }
      38       14985 :   void set_sig(FunctionSig* s) { sig = s; }
      39             : 
      40             :  private:
      41             :   FunctionSig* sig;
      42             :   ZoneVector<std::pair<uint32_t, ValueType>> local_decls;
      43             :   size_t total;
      44             : };
      45             : 
      46             : }  // namespace wasm
      47             : }  // namespace internal
      48             : }  // namespace v8
      49             : 
      50             : #endif  // V8_WASM_LOCAL_DECL_ENCODER_H_

Generated by: LCOV version 1.10