Global Metrics

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

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

path: .metrics.cyclomatic.sum
old: 40.0
new: 23.0

path: .metrics.cyclomatic.average
old: 1.4814814814814814
new: 11.5

path: .metrics.cognitive.sum
old: 9.0
new: 25.0

path: .metrics.cognitive.average
old: 0.375
new: 25.0

path: .metrics.halstead.purity_ratio
old: 1.6739909427382798
new: 1.2275583506860324

path: .metrics.halstead.N1
old: 519.0
new: 355.0

path: .metrics.halstead.time
old: 10304.821008099088
new: 6148.582372482577

path: .metrics.halstead.vocabulary
old: 205.0
new: 111.0

path: .metrics.halstead.n2
old: 177.0
new: 84.0

path: .metrics.halstead.effort
old: 185486.7781457836
new: 110674.48270468638

path: .metrics.halstead.N2
old: 351.0
new: 187.0

path: .metrics.halstead.difficulty
old: 27.76271186440678
new: 30.053571428571427

path: .metrics.halstead.volume
old: 6681.147686569739
new: 3682.5733995617575

path: .metrics.halstead.length
old: 870.0
new: 542.0

path: .metrics.halstead.estimated_program_length
old: 1456.3721201823034
new: 665.3366260718295

path: .metrics.halstead.bugs
old: 1.0841450313011036
new: 0.7683818169216973

path: .metrics.halstead.level
old: 0.03601953601953602
new: 0.033273915626856804

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

path: .metrics.nexits.sum
old: 22.0
new: 2.0

path: .metrics.nexits.average
old: 0.9166666666666666
new: 2.0

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

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

path: .metrics.mi.mi_sei
old: -10.798501880591395
new: 14.731664857472715

path: .metrics.mi.mi_visual_studio
old: 15.759789726504527
new: 25.05320523929544

path: .metrics.mi.mi_original
old: 26.94924043232274
new: 42.84098095919521

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

path: .metrics.loc.ploc
old: 174.0
new: 96.0

path: .metrics.loc.lloc
old: 45.0
new: 68.0

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

path: .metrics.loc.sloc
old: 244.0
new: 141.0

Spaces Data

Minimal test - lines (20, 119)

path: .spaces[0].metrics.halstead.N2
old: 334.0
new: 175.0

path: .spaces[0].metrics.halstead.N1
old: 512.0
new: 330.0

path: .spaces[0].metrics.halstead.length
old: 846.0
new: 505.0

path: .spaces[0].metrics.halstead.estimated_program_length
old: 1306.114432999591
new: 603.2244535801261

path: .spaces[0].metrics.halstead.purity_ratio
old: 1.5438704881791854
new: 1.1945038684754972

path: .spaces[0].metrics.halstead.difficulty
old: 29.225
new: 31.085526315789473

path: .spaces[0].metrics.halstead.bugs
old: 1.0891872682815535
new: 0.7417275370703915

path: .spaces[0].metrics.halstead.effort
old: 186782.29887497603
new: 104965.96098963854

path: .spaces[0].metrics.halstead.level
old: 0.03421727972626176
new: 0.032169312169312174

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

path: .spaces[0].metrics.halstead.n2
old: 160.0
new: 76.0

path: .spaces[0].metrics.halstead.time
old: 10376.794381943111
new: 5831.442277202141

path: .spaces[0].metrics.halstead.vocabulary
old: 188.0
new: 103.0

path: .spaces[0].metrics.halstead.volume
old: 6391.182168519282
new: 3376.6827662275255

path: .spaces[0].metrics.cognitive.sum
old: 9.0
new: 25.0

path: .spaces[0].metrics.cognitive.average
old: 0.375
new: 25.0

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

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

path: .spaces[0].metrics.nexits.sum
old: 22.0
new: 2.0

path: .spaces[0].metrics.nexits.average
old: 0.9166666666666666
new: 2.0

path: .spaces[0].metrics.loc.ploc
old: 158.0
new: 84.0

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

path: .spaces[0].metrics.loc.lloc
old: 44.0
new: 68.0

path: .spaces[0].metrics.loc.sloc
old: 218.0
new: 100.0

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

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

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

path: .spaces[0].metrics.cyclomatic.sum
old: 39.0
new: 22.0

path: .spaces[0].metrics.cyclomatic.average
old: 1.5
new: 22.0

path: .spaces[0].metrics.mi.mi_original
old: 29.23527241039089
new: 49.08806778945814

path: .spaces[0].metrics.mi.mi_sei
old: -9.788358280054172
new: 19.768621125516734

path: .spaces[0].metrics.mi.mi_visual_studio
old: 17.09665053239233
new: 28.706472391495986

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 method info");
  if (! info)
      return NS_ERROR_UNEXPECTED;

  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;
}