@@ -3059,10 +3059,15 @@ class KernelSsaGraphBuilder extends ir.Visitor {
30593059 return object;
30603060 }
30613061 if (options.experimentNewRti) {
3062- // TODO(sra): For new-rti, construct Rti object. [type] could be `List<T>`
3063- // or `JSArray<T>`.
3062+ // [type] could be `List<T>`, so ensure it is `JSArray<T>`.
3063+ InterfaceType arrayType =
3064+ InterfaceType (_commonElements.jsArrayClass, type.typeArguments);
3065+ HInstruction rti =
3066+ _typeBuilder.analyzeTypeArgumentNewRti (arrayType, sourceElement);
30643067
3065- // For now, fall through.
3068+ // TODO(15489): Register at codegen.
3069+ registry? .registerInstantiation (type);
3070+ return _callSetRuntimeTypeInfo (rti, object, sourceInformation);
30663071 }
30673072 List <HInstruction > arguments = < HInstruction > [];
30683073 for (DartType argument in type.typeArguments) {
@@ -4046,6 +4051,8 @@ class KernelSsaGraphBuilder extends ir.Visitor {
40464051 _handleJsInterceptorConstant (invocation);
40474052 } else if (name == 'getInterceptor' ) {
40484053 _handleForeignGetInterceptor (invocation);
4054+ } else if (name == 'getJSArrayInteropRti' ) {
4055+ _handleForeignGetJSArrayInteropRti (invocation);
40494056 } else if (name == 'JS_STRING_CONCAT' ) {
40504057 _handleJsStringConcat (invocation);
40514058 } else if (name == '_createInvocationMirror' ) {
@@ -4608,6 +4615,24 @@ class KernelSsaGraphBuilder extends ir.Visitor {
46084615 stack.add (instruction);
46094616 }
46104617
4618+ void _handleForeignGetJSArrayInteropRti (ir.StaticInvocation invocation) {
4619+ if (_unexpectedForeignArguments (invocation,
4620+ minPositional: 0 , maxPositional: 0 ) ||
4621+ ! options.experimentNewRti) {
4622+ // Result expected on stack.
4623+ stack.add (graph.addConstantNull (closedWorld));
4624+ return ;
4625+ }
4626+ // TODO(sra): Introduce 'any' type.
4627+ InterfaceType interopType =
4628+ InterfaceType (_commonElements.jsArrayClass, [DynamicType ()]);
4629+ SourceInformation sourceInformation =
4630+ _sourceInformationBuilder.buildCall (invocation, invocation);
4631+ HInstruction rti = HLoadType (interopType, _abstractValueDomain.dynamicType)
4632+ ..sourceInformation = sourceInformation;
4633+ push (rti);
4634+ }
4635+
46114636 void _handleForeignJs (ir.StaticInvocation invocation) {
46124637 if (_unexpectedForeignArguments (invocation,
46134638 minPositional: 2 , maxPositional: null , typeArgumentCount: 1 )) {
0 commit comments