public GuardNodeProfile GetGuardNodeProfile(int index) { if (index >= GuardProfileData.Count) { _resizeProfileData <GuardNodeProfile>(GuardProfileData, index + 1, null); GuardProfileData[index] = new GuardNodeProfile(mdr.ValueTypes.Unknown); } if (GuardProfileData[index] == null) { GuardProfileData[index] = new GuardNodeProfile(mdr.ValueTypes.Unknown); } Debug.Assert(index > -1 && index < GuardProfileData.Count, "Assignment happens in codegen time"); return(GuardProfileData[index]); }
public int GetGuardNodeIndex(GuardedCast node) { //Debug.Assert(node.ProfileIndex <= GuardProfileData.Count, "Assignment happens in codegen time"); if (node.ProfileIndex == -1) { node.ProfileIndex = GuardProfilerCounter; int index = node.ProfileIndex; if (index >= GuardProfileData.Count) { _resizeProfileData <GuardNodeProfile>(GuardProfileData, index + 1, null); GuardProfileData[index] = new GuardNodeProfile(mdr.ValueTypes.Unknown); } GuardProfilerCounter++; if (GuardProfilerCounter > jsMD.GuardProfileSize) { jsMD.GuardProfileSize = GuardProfilerCounter; } } return(node.ProfileIndex); }
public void UpdateTypeProfile(GuardedCast node, mdr.ValueTypes type) { if (node.ProfileIndex < GuardProfileData.Count && node.ProfileIndex != -1) { var prof = GuardProfileData[node.ProfileIndex]; prof.UpdateNodeProfile(type); } else { GuardNodeProfile prof = new GuardNodeProfile(type); if (node.ProfileIndex == -1) { node.ProfileIndex = GuardProfileData.Count; GuardProfileData.Add(prof); jsMD.GuardProfileSize++; } else { _resizeProfileData <GuardNodeProfile>(GuardProfileData, node.ProfileIndex + 1, null); GuardProfileData[node.ProfileIndex] = prof; } } }