Description
Most of dart2js's 'Front end' task is spent in constant evaluation, in Constant _evaluateSubexpression(Expression node)
This accounts for 3-4% of total dart2js compile time.
Since half of the time is attributed to the re-throw, I suspect that using exceptions for control flow might be a contributing factor. It might still be the best approach.
I noticed is that the nodeCache is large - 1.6M entries in the program I was looking at. Nearly half the nodes passed to _evaluateSubexpression are ConstantExpression nodes. It should be possible to avoid entering most of these in the nodeCache - either the constant is directly available, or in some infrequent cases it is unevaluated, and the unevaluated expression can be used for the cache key. Another 10% are null and bool literals which could be handled trivially without caching.