本文整理汇总了C#中Profiler.GetNodeProfile方法的典型用法代码示例。如果您正苦于以下问题:C# Profiler.GetNodeProfile方法的具体用法?C# Profiler.GetNodeProfile怎么用?C# Profiler.GetNodeProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profiler
的用法示例。
在下文中一共展示了Profiler.GetNodeProfile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetType
internal static mdr.ValueTypes GetType(GuardedCast node, Profiler profiler)
{
var expType = node.Expression.ValueType;
if (expType != mdr.ValueTypes.DValueRef && JSRuntime.Instance.Configuration.EnableGuardElimination)
node.IsRequired = false;
if (expType == mdr.ValueTypes.DValueRef && JSRuntime.Instance.Configuration.EnableSpeculativeJIT && profiler != null)
{
var nodeProfile = profiler.GetNodeProfile(node) as GuardNodeProfile;
var speculativeType = nodeProfile != null ? nodeProfile.GetHotPrimitiveType() : mdr.ValueTypes.DValueRef;
if (speculativeType != mdr.ValueTypes.DValueRef)
{
expType = speculativeType;
}
if (JSRuntime.Instance.Configuration.EnableGuardElimination) node.IsRequired = true;
}
return expType;
}
示例2: InlineScope
void InlineScope(Scope scope, Profiler scopeProfile)
{
foreach (Invocation ScopeInvocation in scope.Invocations)
{
CallExpression invocation = ScopeInvocation as CallExpression;
if (invocation == null)
continue; //For now we only support calls
mdr.DFunction target = null;
Profiler targetProfile = null;
if (scopeProfile != null && JSRuntime.Instance.Configuration.EnableSpeculativeJIT)
{
var nodeProfile = scopeProfile.GetNodeProfile(invocation);
if (nodeProfile != null)
{
target = nodeProfile.Target;
if (target != null)
{
if (target.Code != null)
targetProfile = (target.Code as JSFunctionCode).Profiler;
}
}
}
var targetFuncMD = invocation.TargetFunctionMetadata;
if (targetFuncMD != null)
{
if (invocation.InlinedIR != null)
{
///We might be re-jiting a function and hence calling inliner again
///for invocation that were statically resolved and inline, we don't
///have to repease the process again and can reuse the old inlined IR
///we can still use the targetProfile to help the rest of algorithms
invocation.InlinedIR.TargetProfile = targetProfile;
continue; //skip this call
}
}
else
{
///We need to clear the old inlined IR,
///TODO: we should walk over the arguments of the call and remove users
invocation.InlinedIR = null; //clear the old results if any
if (target != null)
{
targetFuncMD = target.Metadata as JSFunctionMetadata;
}
}
if (targetFuncMD != null)
{
InlineInvocation(invocation, targetFuncMD);
if (invocation.InlinedIR != null)
{
invocation.InlinedIR.TargetProfile = targetProfile;
InlineScope(invocation.InlinedIR.Scope, targetProfile);
}
}
}
}