LCOV - code coverage report
Current view: top level - js/src/jit - PerfSpewer.h (source / functions) Hit Total Coverage
Test: output.info Lines: 1 2 50.0 %
Date: 2017-07-14 16:53:18 Functions: 1 2 50.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
       2             :  * vim: set ts=8 sts=4 et sw=4 tw=99:
       3             :  * This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef jit_PerfSpewer_h
       8             : #define jit_PerfSpewer_h
       9             : 
      10             : #ifdef JS_ION_PERF
      11             : # include <stdio.h>
      12             : # include "jit/MacroAssembler.h"
      13             : #endif
      14             : 
      15             : namespace js {
      16             : namespace jit {
      17             : 
      18             : class MBasicBlock;
      19             : class MacroAssembler;
      20             : 
      21             : #ifdef JS_ION_PERF
      22             : void CheckPerf();
      23             : bool PerfBlockEnabled();
      24             : bool PerfFuncEnabled();
      25             : static inline bool PerfEnabled() {
      26             :     return PerfBlockEnabled() || PerfFuncEnabled();
      27             : }
      28             : #else
      29           3 : static inline void CheckPerf() {}
      30             : static inline bool PerfBlockEnabled() { return false; }
      31             : static inline bool PerfFuncEnabled() { return false; }
      32           0 : static inline bool PerfEnabled() { return false; }
      33             : #endif
      34             : 
      35             : #ifdef JS_ION_PERF
      36             : 
      37             : struct Record {
      38             :     const char* filename;
      39             :     unsigned lineNumber;
      40             :     unsigned columnNumber;
      41             :     uint32_t id;
      42             :     Label start, end;
      43             :     size_t startOffset, endOffset;
      44             : 
      45             :     Record(const char* filename,
      46             :            unsigned lineNumber,
      47             :            unsigned columnNumber,
      48             :            uint32_t id)
      49             :       : filename(filename), lineNumber(lineNumber),
      50             :         columnNumber(columnNumber), id(id),
      51             :         startOffset(0u), endOffset(0u)
      52             :     {}
      53             : };
      54             : 
      55             : typedef Vector<Record, 1, SystemAllocPolicy> BasicBlocksVector;
      56             : 
      57             : class PerfSpewer
      58             : {
      59             :   protected:
      60             :     static uint32_t nextFunctionIndex;
      61             : 
      62             :   public:
      63             :     Label endInlineCode;
      64             : 
      65             :   protected:
      66             :     BasicBlocksVector basicBlocks_;
      67             : 
      68             :   public:
      69             :     virtual MOZ_MUST_USE bool startBasicBlock(MBasicBlock* blk, MacroAssembler& masm);
      70             :     virtual MOZ_MUST_USE bool endBasicBlock(MacroAssembler& masm);
      71             :     MOZ_MUST_USE bool noteEndInlineCode(MacroAssembler& masm);
      72             : 
      73             :     void writeProfile(JSScript* script, JitCode* code, MacroAssembler& masm);
      74             : };
      75             : 
      76             : void writePerfSpewerBaselineProfile(JSScript* script, JitCode* code);
      77             : void writePerfSpewerJitCodeProfile(JitCode* code, const char* msg);
      78             : 
      79             : // wasm doesn't support block annotations.
      80             : class WasmPerfSpewer : public PerfSpewer
      81             : {
      82             :   public:
      83             :     MOZ_MUST_USE bool startBasicBlock(MBasicBlock* blk, MacroAssembler& masm) { return true; }
      84             :     MOZ_MUST_USE bool endBasicBlock(MacroAssembler& masm) { return true; }
      85             : };
      86             : 
      87             : void writePerfSpewerWasmFunctionMap(uintptr_t base, uintptr_t size, const char* filename,
      88             :                                     unsigned lineno, unsigned colIndex, const char* funcName);
      89             : 
      90             : #endif // JS_ION_PERF
      91             : 
      92             : } // namespace jit
      93             : } // namespace js
      94             : 
      95             : #endif /* jit_PerfSpewer_h */

Generated by: LCOV version 1.13