Global Metrics

path: .metrics.cognitive.average
old: null
new: 24.0

path: .metrics.cognitive.sum
old: 1.0
new: 24.0

path: .metrics.mi.mi_original
old: 76.63363950412963
new: 43.49697954286749

path: .metrics.mi.mi_visual_studio
old: 44.814993862064114
new: 25.436830142027773

path: .metrics.mi.mi_sei
old: 78.39639760072784
new: 15.83030904663752

path: .metrics.cyclomatic.average
old: 1.5
new: 11.0

path: .metrics.cyclomatic.sum
old: 3.0
new: 22.0

path: .metrics.nexits.average
old: null
new: 1.0

path: .metrics.nexits.sum
old: 0.0
new: 1.0

path: .metrics.nom.functions
old: 0.0
new: 1.0

path: .metrics.nom.total
old: 0.0
new: 1.0

path: .metrics.halstead.effort
old: 784.6835296779816
new: 109168.6572074987

path: .metrics.halstead.bugs
old: 0.02835796768351768
new: 0.7613962337493705

path: .metrics.halstead.N1
old: 22.0
new: 350.0

path: .metrics.halstead.estimated_program_length
old: 143.8917375627406
new: 657.5102353602084

path: .metrics.halstead.n1
old: 6.0
new: 27.0

path: .metrics.halstead.n2
old: 27.0
new: 83.0

path: .metrics.halstead.time
old: 43.59352942655453
new: 6064.925400416595

path: .metrics.halstead.N2
old: 28.0
new: 185.0

path: .metrics.halstead.length
old: 50.0
new: 535.0

path: .metrics.halstead.level
old: 0.3214285714285714
new: 0.03323323323323323

path: .metrics.halstead.purity_ratio
old: 2.8778347512548117
new: 1.2289910941312308

path: .metrics.halstead.difficulty
old: 3.111111111111111
new: 30.09036144578313

path: .metrics.halstead.vocabulary
old: 33.0
new: 110.0

path: .metrics.halstead.volume
old: 252.21970596792264
new: 3628.027446735693

path: .metrics.loc.sloc
old: 55.0
new: 138.0

path: .metrics.loc.ploc
old: 31.0
new: 93.0

path: .metrics.loc.cloc
old: 25.0
new: 18.0

path: .metrics.loc.lloc
old: 0.0
new: 66.0

path: .metrics.loc.blank
old: 0.0
new: 27.0

path: .metrics.nargs.average
old: null
new: 5.0

path: .metrics.nargs.sum
old: 0.0
new: 5.0

Spaces Data

Minimal test - lines (19, 116)

path: .spaces[0].metrics.halstead.vocabulary
old: 20.0
new: 102.0

path: .spaces[0].metrics.halstead.length
old: 32.0
new: 498.0

path: .spaces[0].metrics.halstead.N1
old: 16.0
new: 325.0

path: .spaces[0].metrics.halstead.estimated_program_length
old: 72.0
new: 595.5433643456047

path: .spaces[0].metrics.halstead.bugs
old: 0.014150889923089415
new: 0.7346827811892073

path: .spaces[0].metrics.halstead.n2
old: 16.0
new: 75.0

path: .spaces[0].metrics.halstead.time
old: 15.3668554484884
new: 5748.561329122122

path: .spaces[0].metrics.halstead.effort
old: 276.6033980727912
new: 103474.1039241982

path: .spaces[0].metrics.halstead.level
old: 0.5
new: 0.03211303789338471

path: .spaces[0].metrics.halstead.N2
old: 16.0
new: 173.0

path: .spaces[0].metrics.halstead.n1
old: 4.0
new: 27.0

path: .spaces[0].metrics.halstead.difficulty
old: 2.0
new: 31.14

path: .spaces[0].metrics.halstead.purity_ratio
old: 2.25
new: 1.1958702095293268

path: .spaces[0].metrics.halstead.volume
old: 138.3016990363956
new: 3322.8678203018044

path: .spaces[0].metrics.nexits.average
old: null
new: 1.0

path: .spaces[0].metrics.nexits.sum
old: 0.0
new: 1.0

path: .spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 21.0

path: .spaces[0].metrics.cyclomatic.average
old: 1.0
new: 21.0

path: .spaces[0].metrics.loc.cloc
old: 18.0
new: 9.0

path: .spaces[0].metrics.loc.blank
old: 0.0
new: 7.0

path: .spaces[0].metrics.loc.sloc
old: 29.0
new: 98.0

path: .spaces[0].metrics.loc.lloc
old: 0.0
new: 66.0

path: .spaces[0].metrics.loc.ploc
old: 17.0
new: 82.0

path: .spaces[0].metrics.nargs.sum
old: 0.0
new: 5.0

path: .spaces[0].metrics.nargs.average
old: null
new: 5.0

path: .spaces[0].metrics.mi.mi_sei
old: 102.0537960834111
new: 20.801965316586113

path: .spaces[0].metrics.mi.mi_visual_studio
old: 52.97469732791705
new: 29.081223798681105

path: .spaces[0].metrics.mi.mi_original
old: 90.58673243073817
new: 49.72889269574469

path: .spaces[0].metrics.cognitive.average
old: null
new: 24.0

path: .spaces[0].metrics.cognitive.sum
old: 0.0
new: 24.0

path: .spaces[0].metrics.nom.total
old: 0.0
new: 1.0

path: .spaces[0].metrics.nom.functions
old: 0.0
new: 1.0

Code

PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex,
  uint64_t* intargs, uint64_t* floatargs, uint64_t* restargs)
{


  nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT];
  const nsXPTMethodInfo* info;
  uint64_t* iargs = intargs;
  uint64_t* fargs = floatargs;
  uint8_t paramCount;
  uint8_t i;

  NS_ASSERTION(self,"no self");

  self->mEntry->GetMethodInfo(uint16_t(methodIndex), &info);
  NS_ASSERTION(info,"no interface info");

  paramCount = info->GetParamCount();

  const uint8_t indexOfJSContext = info->IndexOfJSContext();

  for(i = 0; i < paramCount; ++i)
  {
    int isfloat = 0;
    const nsXPTParamInfo& param = info->GetParam(i);
    const nsXPTType& type = param.GetType();
    nsXPTCMiniVariant* dp = ¶mBuffer[i];

    MOZ_CRASH("NYI: support implicit JSContext*, bug 1475699");

    if(param.IsOut() || !type.IsArithmetic())
    {
#ifdef __LP64__
        /* 64 bit pointer mode */
        dp->val.p = (void*) *iargs;
#else
        /* 32 bit pointer mode */
        uint32_t* adr = (uint32_t*) iargs;
        dp->val.p = (void*) (*(adr+1));
#endif
    }
    else
    switch(type)
    {
    case nsXPTType::T_I8     : dp->val.i8  = *(iargs); break;
    case nsXPTType::T_I16    : dp->val.i16 = *(iargs); break;
    case nsXPTType::T_I32    : dp->val.i32 = *(iargs); break;
    case nsXPTType::T_I64    : dp->val.i64 = *(iargs); break;
    case nsXPTType::T_U8     : dp->val.u8  = *(iargs); break;
    case nsXPTType::T_U16    : dp->val.u16 = *(iargs); break;
    case nsXPTType::T_U32    : dp->val.u32 = *(iargs); break;
    case nsXPTType::T_U64    : dp->val.u64 = *(iargs); break;
    case nsXPTType::T_FLOAT  :
      isfloat = 1;
      if (i < 7)
        dp->val.f = (float) *((double*) fargs); /* register */
      else
        dp->val.u32 = *(fargs); /* memory */
      break;
    case nsXPTType::T_DOUBLE :
      isfloat = 1;
      dp->val.u64 = *(fargs);
      break;
    case nsXPTType::T_BOOL   : dp->val.b   = *(iargs); break;
    case nsXPTType::T_CHAR   : dp->val.c   = *(iargs); break;
    case nsXPTType::T_WCHAR  : dp->val.wc  = *(iargs); break;
    default:
      NS_ERROR("bad type");
      break;
    }
    if (i < 7)
    {
      /* we are parsing register arguments */
      if (i == 6)
      {
        // run out of register arguments, move on to memory arguments
        iargs = restargs;
        fargs = restargs;
      }
      else
      {
        ++iargs; // advance one integer register slot
        if (isfloat) ++fargs; // advance float register slot if isfloat
      }
    }
    else
    {
      /* we are parsing memory arguments */
      ++iargs;
      ++fargs;
    }
  }

  nsresult result = self->mOuter->CallMethod((uint16_t) methodIndex, info,
                                             paramBuffer);

  return result;
}