public static void UpdateCallProfile(CodeGen.Profiler profiler, int profileIndex, DFunction function) { if (profiler != null) { profiler.GetOrAddCallNodeProfile(profileIndex).UpdateNodeProfile(function); } }
public override void Execute(ref mdr.CallFrame callFrame) { if (SpecializedMethod != null && !Metadata.IsBlackListed) SpecializedMethod(ref callFrame); else { ///NOTE: don't try to use interpreter instances since we may run this function recursively. var currProfiler = Profiler; if (Profiler != null) { var canProfile = //Profiler.ExecutionCount > 0 &&//We don't want to profile in the very first execution SpecializedMethodHandle == null &&//to be sure function is not being Jitted !Metadata.IsBlackListed ; ++Profiler.ExecutionCount; if (canProfile) Profiler.Prepare(); else Profiler = null; //Remove it to prevent profiling } if (GenericMethod != null) GenericMethod(ref callFrame); else if (JSRuntime.Instance.Configuration.EnableRecursiveInterpreter) (new CodeGen.Interpreter()).Execute(ref callFrame); else Operations.ICMethods.Execute(ref callFrame, 0, Metadata.InlineCache.Length -1); if (currProfiler == null && JSRuntime.Instance.Configuration.EnableProfiling && !Metadata.IsBlackListed) { //This was the first excution currProfiler = new CodeGen.Profiler(Metadata); currProfiler.ExecutionCount = 1; } Profiler = currProfiler; //put it back } }