Code with Finding: |
class AliasKeywords {
/**
* Calculates the minimum number of occurrences of throw needed to alias
* throw.
*/
static int estimateMinOccurrencesRequriedToAlias() {
// Assuming that the alias function name is two bytes in length, two bytes
// will be saved per occurrence of throw:
// <code>throw e;</code>, compared to
// <code>TT(e);</code>.
// However, the alias definition is some length, N, e.g.,
// <code>function TT(t){throw t;}</code>
// Hence there must be more than N/2 occurrences of throw to reduce
// the code size.
Node alias = createAliasFunctionNode("TT");
return InlineCostEstimator.getCost(alias) / 2 + 1;
}
}
|