4f96421419
In certain cases involving auto-generated Dart sources there could be a huge number of allocated classes which are subtypes of a certain class. Specializing such cone types to set types, as well as intersection and union operations on such types may be slow and may severely affect compilation time. Also, gradually discovering allocated classes in such cone types may cause a lot of invalidations during analysis. In order to avoid servere degradation of compilation time in such case, this change adds WideConeType which works like a ConeType when number of allocated classes is large, but it doesn't specialize to a SetType and has more efficient but approximate implementation of union and intersection. Uncompressed size of Flutter gallery AOT snapshot (android/arm64): WideConeType approximation for types with >32 allocated subtypes: +0.1176% >64 allocated subtypes: +0.0956% >128 allocated subtypes: +0.0027% For now conservative approximation is used when number of allocated types >128. TFA time of large app #1: 175s -> 119s (-32%) TFA time of large app #2: 211s -> 81s (-61.6%) Snapshot size changes are insignificant. TEST=Stress tested on precomp bots with maxAllocatedTypesInSetSpecializations = 3 and 0. Issue: https://github.com/dart-lang/sdk/issues/42442 Issue: https://github.com/dart-lang/sdk/issues/43299 Change-Id: Idae33205ddda81714e4aeccc7ae292e0164be651 b/154155290, b/177498788, b/177497864 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179200 Commit-Queue: Alexander Markov <alexmarkov@google.com> Reviewed-by: Vyacheslav Egorov <vegorov@google.com> Reviewed-by: Aske Simon Christensen <askesc@google.com>