LCOV - code coverage report
Current view: top level - src/wasm - function-compiler.h (source / functions) Hit Total Coverage
Test: app.info Lines: 1 1 100.0 %
Date: 2019-01-20 Functions: 1 1 100.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_WASM_FUNCTION_COMPILER_H_
       6             : #define V8_WASM_FUNCTION_COMPILER_H_
       7             : 
       8             : #include "src/wasm/compilation-environment.h"
       9             : #include "src/wasm/function-body-decoder.h"
      10             : #include "src/wasm/wasm-limits.h"
      11             : #include "src/wasm/wasm-module.h"
      12             : #include "src/wasm/wasm-tier.h"
      13             : 
      14             : namespace v8 {
      15             : namespace internal {
      16             : 
      17             : class Counters;
      18             : 
      19             : namespace compiler {
      20             : class TurbofanWasmCompilationUnit;
      21             : }  // namespace compiler
      22             : 
      23             : namespace wasm {
      24             : 
      25             : class LiftoffCompilationUnit;
      26             : class NativeModule;
      27             : class WasmCode;
      28             : class WasmEngine;
      29             : struct WasmFunction;
      30             : 
      31     3510698 : class WasmCompilationUnit final {
      32             :  public:
      33             :   static ExecutionTier GetDefaultExecutionTier(const WasmModule*);
      34             : 
      35             :   // If constructing from a background thread, pass in a Counters*, and ensure
      36             :   // that the Counters live at least as long as this compilation unit (which
      37             :   // typically means to hold a std::shared_ptr<Counters>).
      38             :   // If used exclusively from a foreground thread, Isolate::counters() may be
      39             :   // used by callers to pass Counters.
      40             :   WasmCompilationUnit(WasmEngine*, int index, ExecutionTier);
      41             : 
      42             :   ~WasmCompilationUnit();
      43             : 
      44             :   void ExecuteCompilation(CompilationEnv*, NativeModule*,
      45             :                           const std::shared_ptr<WireBytesStorage>&, Counters*,
      46             :                           WasmFeatures* detected);
      47             : 
      48             :   ExecutionTier tier() const { return tier_; }
      49             :   WasmCode* result() const { return result_; }
      50             : 
      51             :   static void CompileWasmFunction(Isolate*, NativeModule*,
      52             :                                   WasmFeatures* detected, const WasmFunction*,
      53             :                                   ExecutionTier);
      54             : 
      55             :  private:
      56             :   friend class LiftoffCompilationUnit;
      57             :   friend class compiler::TurbofanWasmCompilationUnit;
      58             : 
      59             :   WasmEngine* const wasm_engine_;
      60             :   const int func_index_;
      61             :   ExecutionTier tier_;
      62             :   WasmCode* result_ = nullptr;
      63             : 
      64             :   // LiftoffCompilationUnit, set if {tier_ == kLiftoff}.
      65             :   std::unique_ptr<LiftoffCompilationUnit> liftoff_unit_;
      66             :   // TurbofanWasmCompilationUnit, set if {tier_ == kTurbofan}.
      67             :   std::unique_ptr<compiler::TurbofanWasmCompilationUnit> turbofan_unit_;
      68             : 
      69             :   void SwitchTier(ExecutionTier new_tier);
      70             : 
      71             :   // Called from {ExecuteCompilation} to set the result of compilation.
      72             :   void SetResult(WasmCode*, Counters*);
      73             : 
      74             :   DISALLOW_COPY_AND_ASSIGN(WasmCompilationUnit);
      75             : };
      76             : 
      77             : }  // namespace wasm
      78             : }  // namespace internal
      79             : }  // namespace v8
      80             : 
      81             : #endif  // V8_WASM_FUNCTION_COMPILER_H_

Generated by: LCOV version 1.10