public CallNodeProfile GetCallNodeProfile(int index) { if (index >= CallProfileData.Count) { _resizeProfileData <CallNodeProfile>(CallProfileData, index + 1, null); CallProfileData[index] = new CallNodeProfile(null); } if (CallProfileData[index] == null) { CallProfileData[index] = new CallNodeProfile(null); } Debug.Assert(index > -1 && index < CallProfileData.Count, "Assignment happens in codegen time"); return(CallProfileData[index]); }
//Public functions public void CreateNewProfile(Invocation node, mdr.DFunction target) { CallNodeProfile prof = new CallNodeProfile(target); if (node.ProfileIndex == -1) { node.ProfileIndex = CallProfileData.Count; CallProfileData.Add(prof); jsMD.CallProfileSize++; } else { _resizeProfileData <CallNodeProfile>(CallProfileData, node.ProfileIndex + 1, null); CallProfileData[node.ProfileIndex] = prof; } }
public int GetCallNodeIndex(Invocation node) { //Debug.Assert(node.ProfileIndex <= CallProfileData.Count, "Assignment happens in codegen time"); if (node.ProfileIndex == -1) { node.ProfileIndex = CallProfilerCounter; int index = node.ProfileIndex; if (index == CallProfileData.Count) { _resizeProfileData <CallNodeProfile>(CallProfileData, index + 1, null); CallProfileData[index] = new CallNodeProfile(null); } CallProfilerCounter++; if (CallProfilerCounter > jsMD.CallProfileSize) { jsMD.CallProfileSize = CallProfilerCounter; } } return(node.ProfileIndex); }