LCOV - code coverage report
Current view: top level - js/src/jit - CompileInfo-inl.h (source / functions) Hit Total Coverage
Test: output.info Lines: 22 31 71.0 %
Date: 2017-07-14 16:53:18 Functions: 5 6 83.3 %
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_CompileInfo_inl_h
       8             : #define jit_CompileInfo_inl_h
       9             : 
      10             : #include "jit/CompileInfo.h"
      11             : #include "jit/JitAllocPolicy.h"
      12             : 
      13             : #include "jsscriptinlines.h"
      14             : 
      15             : namespace js {
      16             : namespace jit {
      17             : 
      18             : inline RegExpObject*
      19           0 : CompileInfo::getRegExp(jsbytecode* pc) const
      20             : {
      21           0 :     return script_->getRegExp(pc);
      22             : }
      23             : 
      24             : inline JSFunction*
      25          29 : CompileInfo::getFunction(jsbytecode* pc) const
      26             : {
      27          29 :     return script_->getFunction(GET_UINT32_INDEX(pc));
      28             : }
      29             : 
      30             : InlineScriptTree*
      31         179 : InlineScriptTree::New(TempAllocator* allocator, InlineScriptTree* callerTree,
      32             :                       jsbytecode* callerPc, JSScript* script)
      33             : {
      34         179 :     MOZ_ASSERT_IF(!callerTree, !callerPc);
      35         179 :     MOZ_ASSERT_IF(callerTree, callerTree->script()->containsPC(callerPc));
      36             : 
      37             :     // Allocate a new InlineScriptTree
      38         179 :     void* treeMem = allocator->allocate(sizeof(InlineScriptTree));
      39         179 :     if (!treeMem)
      40           0 :         return nullptr;
      41             : 
      42             :     // Initialize it.
      43         179 :     return new (treeMem) InlineScriptTree(callerTree, callerPc, script);
      44             : }
      45             : 
      46             : InlineScriptTree*
      47          33 : InlineScriptTree::addCallee(TempAllocator* allocator, jsbytecode* callerPc,
      48             :                             JSScript* calleeScript)
      49             : {
      50          33 :     MOZ_ASSERT(script_ && script_->containsPC(callerPc));
      51          33 :     InlineScriptTree* calleeTree = New(allocator, this, callerPc, calleeScript);
      52          33 :     if (!calleeTree)
      53           0 :         return nullptr;
      54             : 
      55          33 :     calleeTree->nextCallee_ = children_;
      56          33 :     children_ = calleeTree;
      57          33 :     return calleeTree;
      58             : }
      59             : 
      60             : static inline const char*
      61         136 : AnalysisModeString(AnalysisMode mode)
      62             : {
      63         136 :     switch (mode) {
      64             :       case Analysis_None:
      65           0 :         return "Analysis_None";
      66             :       case Analysis_DefiniteProperties:
      67           1 :         return "Analysis_DefiniteProperties";
      68             :       case Analysis_ArgumentsUsage:
      69         135 :         return "Analysis_ArgumentsUsage";
      70             :       default:
      71           0 :         MOZ_CRASH("Invalid AnalysisMode");
      72             :     }
      73             : }
      74             : 
      75             : static inline bool
      76          56 : CanIonCompile(JSScript* script, AnalysisMode mode)
      77             : {
      78          56 :     switch (mode) {
      79          56 :       case Analysis_None: return script->canIonCompile();
      80           0 :       case Analysis_DefiniteProperties: return true;
      81           0 :       case Analysis_ArgumentsUsage: return true;
      82             :       default:;
      83             :     }
      84           0 :     MOZ_CRASH("Invalid AnalysisMode");
      85             : }
      86             : 
      87             : } // namespace jit
      88             : } // namespace js
      89             : 
      90             : #endif /* jit_CompileInfo_inl_h */

Generated by: LCOV version 1.13