[CFE] Avoid AllocateContext in ConstantEvaluator.canonicalize

putIfAbsent uses a closure and the VM allocates a context,
replacing it with ??= which doesn't should be better.

In a previous iteration it was found - with 95% confidence - a
~4ms (~10%) improvement, but for whatever reason those results
cannot currently be reproduced.

Change-Id: Id80a4eb0c0018c5827ab37b08507e70a5a5529a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194761
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
diff --git a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
index 795419a..f6cceab 100644
--- a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
@@ -3330,7 +3330,9 @@
   }
 
   Constant canonicalize(Constant constant) {
-    return canonicalizationCache.putIfAbsent(constant, () => constant);
+    // Don't use putIfAbsent to avoid the context allocation needed
+    // for the closure.
+    return canonicalizationCache[constant] ??= constant;
   }
 
   T withNewInstanceBuilder<T>(