LCOV - code coverage report
Current view: top level - src/crankshaft - lithium-codegen.h (source / functions) Hit Total Coverage
Test: app.info Lines: 2 4 50.0 %
Date: 2017-04-26 Functions: 0 4 0.0 %

          Line data    Source code
       1             : // Copyright 2013 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_CRANKSHAFT_LITHIUM_CODEGEN_H_
       6             : #define V8_CRANKSHAFT_LITHIUM_CODEGEN_H_
       7             : 
       8             : #include "src/bailout-reason.h"
       9             : #include "src/deoptimizer.h"
      10             : #include "src/source-position-table.h"
      11             : 
      12             : namespace v8 {
      13             : namespace internal {
      14             : 
      15             : class CompilationInfo;
      16             : class HGraph;
      17             : class LChunk;
      18             : class LEnvironment;
      19             : class LInstruction;
      20             : class LPlatformChunk;
      21             : 
      22             : class LCodeGenBase BASE_EMBEDDED {
      23             :  public:
      24             :   LCodeGenBase(LChunk* chunk,
      25             :                MacroAssembler* assembler,
      26             :                CompilationInfo* info);
      27      279085 :   virtual ~LCodeGenBase() {}
      28             : 
      29             :   // Simple accessors.
      30             :   MacroAssembler* masm() const { return masm_; }
      31             :   CompilationInfo* info() const { return info_; }
      32             :   Isolate* isolate() const;
      33          66 :   Factory* factory() const { return isolate()->factory(); }
      34             :   Heap* heap() const { return isolate()->heap(); }
      35             :   Zone* zone() const { return zone_; }
      36             :   LPlatformChunk* chunk() const { return chunk_; }
      37             :   HGraph* graph() const;
      38             :   SourcePositionTableBuilder* source_position_table_builder() {
      39             :     return &source_position_table_builder_;
      40             :   }
      41             : 
      42             :   void PRINTF_FORMAT(2, 3) Comment(const char* format, ...);
      43             :   void DeoptComment(const Deoptimizer::DeoptInfo& deopt_info);
      44             :   static Deoptimizer::DeoptInfo MakeDeoptInfo(LInstruction* instr,
      45             :                                               DeoptimizeReason deopt_reason,
      46             :                                               int deopt_id);
      47             : 
      48             :   bool GenerateBody();
      49           0 :   virtual void GenerateBodyInstructionPre(LInstruction* instr) {}
      50           0 :   virtual void GenerateBodyInstructionPost(LInstruction* instr) {}
      51             : 
      52             :   virtual void EnsureSpaceForLazyDeopt(int space_needed) = 0;
      53             :   void RecordAndWritePosition(SourcePosition position);
      54             : 
      55             :   int GetNextEmittedBlock() const;
      56             : 
      57             :   void WriteTranslationFrame(LEnvironment* environment,
      58             :                              Translation* translation);
      59             :   int DefineDeoptimizationLiteral(Handle<Object> literal);
      60             : 
      61             :   void PopulateDeoptimizationData(Handle<Code> code);
      62             :   void PopulateDeoptimizationLiteralsWithInlinedFunctions();
      63             : 
      64             :   // Check that an environment assigned via AssignEnvironment is actually being
      65             :   // used. Redundant assignments keep things alive longer than necessary, and
      66             :   // consequently lead to worse code, so it's important to minimize this.
      67             :   void CheckEnvironmentUsage();
      68             : 
      69             :  protected:
      70             :   enum Status {
      71             :     UNUSED,
      72             :     GENERATING,
      73             :     DONE,
      74             :     ABORTED
      75             :   };
      76             : 
      77             :   LPlatformChunk* const chunk_;
      78             :   MacroAssembler* const masm_;
      79             :   CompilationInfo* const info_;
      80             :   Zone* zone_;
      81             :   Status status_;
      82             :   int current_block_;
      83             :   int current_instruction_;
      84             :   const ZoneList<LInstruction*>* instructions_;
      85             :   ZoneList<LEnvironment*> deoptimizations_;
      86             :   ZoneList<Handle<Object> > deoptimization_literals_;
      87             :   TranslationBuffer translations_;
      88             :   int inlined_function_count_;
      89             :   int last_lazy_deopt_pc_;
      90             :   int osr_pc_offset_;
      91             :   SourcePositionTableBuilder source_position_table_builder_;
      92             : 
      93             :   bool is_unused() const { return status_ == UNUSED; }
      94             :   bool is_generating() const { return status_ == GENERATING; }
      95             :   bool is_done() const { return status_ == DONE; }
      96             :   bool is_aborted() const { return status_ == ABORTED; }
      97             : 
      98             :   void Abort(BailoutReason reason);
      99             :   void Retry(BailoutReason reason);
     100             : 
     101             :   // Methods for code dependencies.
     102             :   void AddDeprecationDependency(Handle<Map> map);
     103             :   void AddStabilityDependency(Handle<Map> map);
     104             : };
     105             : 
     106             : 
     107             : }  // namespace internal
     108             : }  // namespace v8
     109             : 
     110             : #endif  // V8_CRANKSHAFT_LITHIUM_CODEGEN_H_

Generated by: LCOV version 1.10