[vm/nnbd] Disable usage of specialized type testing stubs for NonNullable/NNBD types
[vm/nnbd] Disable usage of specialized type testing stubs for NonNullable/NNBD types

The following issue can happen:

  When we performa a type-test against a type parameter the TTS stub for
  the type parameter will call the TTS stub for the type argument of the
  parameter (by loading it from the instantiator type arguments).

  The (instantiated) type argument does not yet have a specialized TTS but
  rather the lazy TTS stub, which will got to the runtime.

  The runtime will instantiate the type parameter using the instantiator tav,
  which will give it a non-nullable 'String!'. Though the NNBD mode used
  for instnatiation is kLegacy, which means the instantiation will
  actually return 'String*'.

  Now we generate a specialized TTS and install it on 'String*'.

  => The original 'String!' will still have the lazy TTS installed and we
     will therefore always go to runtime.

Example:

  This code is massively slowed down after 61b4bbcb6b4 "[vm] Set non_nullable_flag() to true"

    main(List<String> args) {
      args = args.toList();
      while (args.isNotEmpty) {
        args.removeAt(0);
      }
    }

  The embedder creates the List<String> when calling main. The embedder
  API uses effectively `ObjectStore::string_type`, which is initialized,
  after 61b4bbcb6b4 to 'String!' (which might be a bug because we do
  have a specific `ObjectStore::non_nullablestring_type`).

=> For now we disable lazy specialization of non-nullable types - which
   makes us fall back to subtype test cache searches in this case (which is
   significantly slower).

See b/148528639

Issue https://github.com/dart-lang/sdk/issues/39755

Change-Id: I715fe2a9ee22932ae2d949b5cef93d6afb3176d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133981
Reviewed-by: Teagan Strickland <cce218d042444252b7ac446d60910fca7732559c@google.com>
Reviewed-by: Alexander Markov <239e774fd29abc1267878f57afe1a8a03e0ca887@google.com>
Commit-Queue: Martin Kustermann <a35dd5b79fac84b2bb3b026a16b8becc55af5961@google.com>

dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk,dart-lang/sdk