LCOV - code coverage report
Current view: top level - src/wasm - local-decl-encoder.h (source / functions) Hit Total Coverage
Test: app.info Lines: 2 2 100.0 %
Date: 2017-04-26 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/wasm/wasm-opcodes.h"
       9             : #include "src/zone/zone-containers.h"
      10             : #include "src/zone/zone.h"
      11             : 
      12             : namespace v8 {
      13             : namespace internal {
      14             : namespace wasm {
      15             : 
      16             : // A helper for encoding local declarations prepended to the body of a
      17             : // function.
      18             : class LocalDeclEncoder {
      19             :  public:
      20             :   explicit LocalDeclEncoder(Zone* zone, FunctionSig* s = nullptr)
      21       41590 :       : sig(s), local_decls(zone), total(0) {}
      22             : 
      23             :   // Prepend local declarations by creating a new buffer and copying data
      24             :   // over. The new buffer must be delete[]'d by the caller.
      25             :   void Prepend(Zone* zone, const byte** start, const byte** end) const;
      26             : 
      27             :   size_t Emit(byte* buffer) const;
      28             : 
      29             :   // Add locals declarations to this helper. Return the index of the newly added
      30             :   // local(s), with an optional adjustment for the parameters.
      31             :   uint32_t AddLocals(uint32_t count, ValueType type);
      32             : 
      33             :   size_t Size() const;
      34             : 
      35             :   bool has_sig() const { return sig != nullptr; }
      36             :   FunctionSig* get_sig() const { return sig; }
      37       20596 :   void set_sig(FunctionSig* s) { sig = s; }
      38             : 
      39             :  private:
      40             :   FunctionSig* sig;
      41             :   ZoneVector<std::pair<uint32_t, ValueType>> local_decls;
      42             :   size_t total;
      43             : };
      44             : 
      45             : }  // namespace wasm
      46             : }  // namespace internal
      47             : }  // namespace v8
      48             : 
      49             : #endif  // V8_WASM_LOCAL_DECL_ENCODER_H_

Generated by: LCOV version 1.10