Skip to content

Commit 43eb2f7

Browse files
rakudramacommit-bot@chromium.org
authored andcommitted
[dart2js] new-rti: Add new-rti type in String.split lowering
Change-Id: I4f02fc023bdfcdf8bd27aed9024f2453f221ded7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112300 Commit-Queue: Stephen Adams <[email protected]> Reviewed-by: Mayank Patke <[email protected]>
1 parent ccf56d6 commit 43eb2f7

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

pkg/compiler/lib/src/ssa/optimize.dart

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -634,24 +634,32 @@ class SsaInstructionSimplifier extends HBaseVisitor
634634
return splitInstruction;
635635
}
636636

637-
// TODO(sra): Implement tagging with `JSArray<String>` for new rti.
638-
639637
node.block.addBefore(node, splitInstruction);
640638

641-
HInstruction stringTypeInfo = new HTypeInfoExpression(
642-
TypeInfoExpressionKind.COMPLETE,
643-
_closedWorld.elementEnvironment.getThisType(commonElements.stringClass),
644-
<HInstruction>[],
645-
_abstractValueDomain.dynamicType);
646-
node.block.addBefore(node, stringTypeInfo);
647-
648-
HInstruction typeInfo = new HTypeInfoExpression(
649-
TypeInfoExpressionKind.INSTANCE,
650-
_closedWorld.elementEnvironment
651-
.getThisType(commonElements.jsArrayClass),
652-
<HInstruction>[stringTypeInfo],
653-
_abstractValueDomain.dynamicType);
654-
node.block.addBefore(node, typeInfo);
639+
HInstruction typeInfo;
640+
if (_options.experimentNewRti) {
641+
typeInfo = HLoadType(
642+
_closedWorld.elementEnvironment.createInterfaceType(
643+
commonElements.jsArrayClass, [commonElements.stringType]),
644+
_abstractValueDomain.dynamicType);
645+
node.block.addBefore(node, typeInfo);
646+
} else {
647+
HInstruction stringTypeInfo = new HTypeInfoExpression(
648+
TypeInfoExpressionKind.COMPLETE,
649+
_closedWorld.elementEnvironment
650+
.getThisType(commonElements.stringClass),
651+
<HInstruction>[],
652+
_abstractValueDomain.dynamicType);
653+
node.block.addBefore(node, stringTypeInfo);
654+
655+
typeInfo = new HTypeInfoExpression(
656+
TypeInfoExpressionKind.INSTANCE,
657+
_closedWorld.elementEnvironment
658+
.getThisType(commonElements.jsArrayClass),
659+
<HInstruction>[stringTypeInfo],
660+
_abstractValueDomain.dynamicType);
661+
node.block.addBefore(node, typeInfo);
662+
}
655663

656664
HInvokeStatic tagInstruction = new HInvokeStatic(
657665
commonElements.setRuntimeTypeInfo,

0 commit comments

Comments
 (0)