LCOV - code coverage report
Current view: top level - src/interpreter - interpreter.h (source / functions) Hit Total Coverage
Test: app.info Lines: 1 1 100.0 %
Date: 2017-04-26 Functions: 2 2 100.0 %

          Line data    Source code
       1             : // Copyright 2015 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_INTERPRETER_INTERPRETER_H_
       6             : #define V8_INTERPRETER_INTERPRETER_H_
       7             : 
       8             : #include <memory>
       9             : 
      10             : // Clients of this interface shouldn't depend on lots of interpreter internals.
      11             : // Do not include anything from src/interpreter other than
      12             : // src/interpreter/bytecodes.h here!
      13             : #include "src/base/macros.h"
      14             : #include "src/builtins/builtins.h"
      15             : #include "src/interpreter/bytecodes.h"
      16             : #include "src/parsing/token.h"
      17             : #include "src/runtime/runtime.h"
      18             : 
      19             : namespace v8 {
      20             : namespace internal {
      21             : 
      22             : class Isolate;
      23             : class Callable;
      24             : class CompilationInfo;
      25             : class CompilationJob;
      26             : class SetupIsolateDelegate;
      27             : class RootVisitor;
      28             : 
      29             : namespace interpreter {
      30             : 
      31             : class InterpreterAssembler;
      32             : 
      33             : class Interpreter {
      34             :  public:
      35             :   explicit Interpreter(Isolate* isolate);
      36      177855 :   virtual ~Interpreter() {}
      37             : 
      38             :   // Returns the interrupt budget which should be used for the profiler counter.
      39             :   static int InterruptBudget();
      40             : 
      41             :   // Creates a compilation job which will generate bytecode for |info|.
      42             :   static CompilationJob* NewCompilationJob(CompilationInfo* info);
      43             : 
      44             :   // Return bytecode handler for |bytecode|.
      45             :   Code* GetBytecodeHandler(Bytecode bytecode, OperandScale operand_scale);
      46             : 
      47             :   // GC support.
      48             :   void IterateDispatchTable(RootVisitor* v);
      49             : 
      50             :   // Disassembler support (only useful with ENABLE_DISASSEMBLER defined).
      51             :   const char* LookupNameOfBytecodeHandler(Code* code);
      52             : 
      53             :   V8_EXPORT_PRIVATE Local<v8::Object> GetDispatchCountersObject();
      54             : 
      55             :   Address dispatch_table_address() {
      56             :     return reinterpret_cast<Address>(&dispatch_table_[0]);
      57             :   }
      58             : 
      59             :   Address bytecode_dispatch_counters_table() {
      60             :     return reinterpret_cast<Address>(bytecode_dispatch_counters_table_.get());
      61             :   }
      62             : 
      63             :   // TODO(ignition): Tune code size multiplier.
      64             :   static const int kCodeSizeMultiplier = 24;
      65             : 
      66             :  private:
      67             :   friend class SetupInterpreter;
      68             :   friend class v8::internal::SetupIsolateDelegate;
      69             : 
      70             :   uintptr_t GetDispatchCounter(Bytecode from, Bytecode to) const;
      71             : 
      72             :   // Get dispatch table index of bytecode.
      73             :   static size_t GetDispatchTableIndex(Bytecode bytecode,
      74             :                                       OperandScale operand_scale);
      75             : 
      76             :   bool IsDispatchTableInitialized();
      77             : 
      78             :   static const int kNumberOfWideVariants = 3;
      79             :   static const int kDispatchTableSize = kNumberOfWideVariants * (kMaxUInt8 + 1);
      80             :   static const int kNumberOfBytecodes = static_cast<int>(Bytecode::kLast) + 1;
      81             : 
      82             :   Isolate* isolate_;
      83             :   Address dispatch_table_[kDispatchTableSize];
      84             :   std::unique_ptr<uintptr_t[]> bytecode_dispatch_counters_table_;
      85             : 
      86             :   DISALLOW_COPY_AND_ASSIGN(Interpreter);
      87             : };
      88             : 
      89             : }  // namespace interpreter
      90             : }  // namespace internal
      91             : }  // namespace v8
      92             : 
      93             : #endif  // V8_INTERPRETER_INTERPRETER_H_

Generated by: LCOV version 1.10