Skip to content

Commit 3a3dfcb

Browse files
fishythefishCommit Queue
authored andcommitted
[dart2js] Remove references to new-rti/old-rti.
The "new" rti library has been standard for years now and no one should be passing `--experiment-new-rti` or `--use-old-rti`. We can now clean up any references to different versions of rtis. Change-Id: I4421b8943fe5034ed4d259477e8112b25ba0c763 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/416326 Reviewed-by: Nate Biggs <[email protected]> Commit-Queue: Mayank Patke <[email protected]>
1 parent 30f2914 commit 3a3dfcb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1635
-787
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ not match the non-nullable type and this will now throw.
7777
In the future this will likely be a compile-time error and will be entirely
7878
disallowed.
7979

80+
#### Dart to Javascript Compiler (dart2js)
81+
82+
Removed the `--experiment-new-rti` and `--use-old-rti` flags.
83+
8084
## 3.7.0
8185

8286
**Released on:** 2025-02-12

benchmarks/SoundSplayTreeSieve/dart/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ CollectionSieves-SoundSplayTreeSet-removeLoop(RunTime): 4344.902386117137 us.
1515

1616
**Dart2JS**
1717
```
18-
$ sdk/bin/dart2js_developer benchmarks/SoundSplayTreeSieve/dart/SoundSplayTreeSieve.dart --enable-experiment=variance --experiment-new-rti --out=soundsplay_d2js.js
18+
$ sdk/bin/dart2js_developer benchmarks/SoundSplayTreeSieve/dart/SoundSplayTreeSieve.dart --enable-experiment=variance --out=soundsplay_d2js.js
1919
$ third_party/d8/linux/d8 soundsplay_d2js.js
2020
```
2121

2222
**Dart2JS (Omit implicit checks)**
2323
```
24-
$ sdk/bin/dart2js_developer benchmarks/SoundSplayTreeSieve/dart/SoundSplayTreeSieve.dart --enable-experiment=variance --experiment-new-rti --omit-implicit-checks --out=soundsplay_d2js_omit.js --lax-runtime-type-to-string
24+
$ sdk/bin/dart2js_developer benchmarks/SoundSplayTreeSieve/dart/SoundSplayTreeSieve.dart --enable-experiment=variance --omit-implicit-checks --out=soundsplay_d2js_omit.js --lax-runtime-type-to-string
2525
$ third_party/d8/linux/d8 soundsplay_d2js_omit.js
2626
```
2727

2828
**DDK**
2929
```
3030
$ pkg/dev_compiler/tool/ddb -d -r chrome --enable-experiment=variance -k benchmarks/SoundSplayTreeSieve/dart/SoundSplayTreeSieve.dart
31-
```
31+
```

benchmarks/SoundSplayTreeSieve/dart2/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ CollectionSieves-SoundSplayTreeSet-removeLoop(RunTime): 4344.902386117137 us.
1515

1616
**Dart2JS**
1717
```
18-
$ sdk/bin/dart2js_developer benchmarks/SoundSplayTreeSieve/dart/SoundSplayTreeSieve.dart --enable-experiment=variance --experiment-new-rti --out=soundsplay_d2js.js
18+
$ sdk/bin/dart2js_developer benchmarks/SoundSplayTreeSieve/dart/SoundSplayTreeSieve.dart --enable-experiment=variance --out=soundsplay_d2js.js
1919
$ third_party/d8/linux/d8 soundsplay_d2js.js
2020
```
2121

2222
**Dart2JS (Omit implicit checks)**
2323
```
24-
$ sdk/bin/dart2js_developer benchmarks/SoundSplayTreeSieve/dart/SoundSplayTreeSieve.dart --enable-experiment=variance --experiment-new-rti --omit-implicit-checks --out=soundsplay_d2js_omit.js --lax-runtime-type-to-string
24+
$ sdk/bin/dart2js_developer benchmarks/SoundSplayTreeSieve/dart/SoundSplayTreeSieve.dart --enable-experiment=variance --omit-implicit-checks --out=soundsplay_d2js_omit.js --lax-runtime-type-to-string
2525
$ third_party/d8/linux/d8 soundsplay_d2js_omit.js
2626
```
2727

2828
**DDK**
2929
```
3030
$ pkg/dev_compiler/tool/ddb -d -r chrome --enable-experiment=variance -k benchmarks/SoundSplayTreeSieve/dart/SoundSplayTreeSieve.dart
31-
```
31+
```

pkg/compiler/lib/src/commandline_options.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ class Flags {
5858
static const String experimentCallInstrumentation =
5959
'--experiment-call-instrumentation';
6060

61-
static const String experimentNewRti = '--experiment-new-rti';
62-
6361
static const String enableLanguageExperiments = '--enable-experiment';
6462

6563
static const String fastStartup = '--fast-startup';
@@ -107,7 +105,6 @@ class Flags {
107105
'--experimental-trust-js-interop-type-annotations';
108106
static const String useMultiSourceInfo = '--use-multi-source-info';
109107
static const String useNewSourceInfo = '--use-new-source-info';
110-
static const String useOldRti = '--use-old-rti';
111108
static const String useSimpleLoadIds = '--simple-load-ids';
112109
static const String verbose = '--verbose';
113110
static const String verbosity = '--verbosity';

pkg/compiler/lib/src/common/elements.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,7 @@ abstract class CommonElements {
11091109
FunctionEntity get specializedAsStringNullable =>
11101110
_findRtiFunction('_asStringQ');
11111111

1112-
FunctionEntity get instantiatedGenericFunctionTypeNewRti =>
1112+
FunctionEntity get instantiatedGenericFunctionType =>
11131113
_findRtiFunction('instantiatedGenericFunctionType');
11141114

11151115
FunctionEntity get closureFunctionType =>

pkg/compiler/lib/src/dart2js.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,6 @@ Future<api.CompilationResult> compile(
531531
_OneOption(Flags.generateCodeWithCompileTimeErrors, ignoreOption),
532532
_OneOption(Flags.useMultiSourceInfo, passThrough),
533533
_OneOption(Flags.useNewSourceInfo, passThrough),
534-
_OneOption(Flags.useOldRti, passThrough),
535534
_OneOption(Flags.useSimpleLoadIds, passThrough),
536535
_OneOption(Flags.testMode, passThrough),
537536
_OneOption('${Flags.dumpSsa}=.+', passThrough),
@@ -552,7 +551,6 @@ Future<api.CompilationResult> compile(
552551
_OneOption(Flags.experimentToBoolean, passThrough),
553552
_OneOption(Flags.experimentUnreachableMethodsThrow, passThrough),
554553
_OneOption(Flags.experimentCallInstrumentation, passThrough),
555-
_OneOption(Flags.experimentNewRti, ignoreOption),
556554
_OneOption('${Flags.mergeFragmentsThreshold}=.+', passThrough),
557555

558556
// Wire up feature flags.

pkg/compiler/lib/src/deferred_load/entity_data_info.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ class EntityDataInfoBuilder {
237237
break;
238238
case TypeUseKind.rtiValue:
239239
case TypeUseKind.typeArgument:
240-
case TypeUseKind.namedTypeVariableNewRti:
240+
case TypeUseKind.namedTypeVariable:
241241
case TypeUseKind.constructorReference:
242242
failedAt(parent!, "Unexpected type use: $typeUse.");
243243
}

pkg/compiler/lib/src/js_backend/backend_impact.dart

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class BackendImpacts {
9898

9999
late final BackendImpact getRuntimeTypeArgument = BackendImpact(
100100
globalUses: [],
101-
otherImpacts: [newRtiImpact],
101+
otherImpacts: [rtiImpact],
102102
);
103103

104104
late final BackendImpact computeSignature = BackendImpact(
@@ -153,7 +153,7 @@ class BackendImpacts {
153153

154154
late final BackendImpact asCheck = BackendImpact(
155155
staticUses: [],
156-
otherImpacts: [newRtiImpact],
156+
otherImpacts: [rtiImpact],
157157
);
158158

159159
late final BackendImpact stringValues = BackendImpact(
@@ -322,34 +322,34 @@ class BackendImpacts {
322322
);
323323

324324
late final BackendImpact typeCheck = BackendImpact(
325-
otherImpacts: [boolValues, newRtiImpact],
325+
otherImpacts: [boolValues, rtiImpact],
326326
);
327327

328328
late final BackendImpact genericTypeCheck = BackendImpact(
329329
staticUses: [
330330
// TODO(johnniwinther): Investigate why this is needed.
331331
_commonElements.setArrayType,
332332
],
333-
otherImpacts: [listValues, getRuntimeTypeArgument, newRtiImpact],
333+
otherImpacts: [listValues, getRuntimeTypeArgument, rtiImpact],
334334
);
335335

336336
late final BackendImpact genericIsCheck = BackendImpact(
337-
otherImpacts: [intValues, newRtiImpact],
337+
otherImpacts: [intValues, rtiImpact],
338338
);
339339

340340
late final BackendImpact typeVariableTypeCheck = BackendImpact(
341341
staticUses: [],
342-
otherImpacts: [newRtiImpact],
342+
otherImpacts: [rtiImpact],
343343
);
344344

345345
late final BackendImpact functionTypeCheck = BackendImpact(
346346
staticUses: [/*helpers.functionTypeTestMetaHelper*/],
347-
otherImpacts: [newRtiImpact],
347+
otherImpacts: [rtiImpact],
348348
);
349349

350350
late final BackendImpact futureOrTypeCheck = BackendImpact(
351351
staticUses: [],
352-
otherImpacts: [newRtiImpact],
352+
otherImpacts: [rtiImpact],
353353
);
354354

355355
late final BackendImpact nativeTypeCheck = BackendImpact(
@@ -359,7 +359,7 @@ class BackendImpacts {
359359
// [:defineProperty:] is compiled.
360360
_commonElements.defineProperty,
361361
],
362-
otherImpacts: [newRtiImpact],
362+
otherImpacts: [rtiImpact],
363363
);
364364

365365
late final BackendImpact closure = BackendImpact(
@@ -532,7 +532,7 @@ class BackendImpacts {
532532
_genericInstantiation[typeArgumentCount] ??= BackendImpact(
533533
staticUses: [
534534
_commonElements.getInstantiateFunction(typeArgumentCount),
535-
_commonElements.instantiatedGenericFunctionTypeNewRti,
535+
_commonElements.instantiatedGenericFunctionType,
536536
_commonElements.closureFunctionType,
537537
],
538538
instantiatedClasses: [
@@ -541,7 +541,7 @@ class BackendImpacts {
541541
);
542542

543543
// TODO(sra): Split into refined impacts.
544-
late final BackendImpact newRtiImpact = BackendImpact(
544+
late final BackendImpact rtiImpact = BackendImpact(
545545
staticUses: [
546546
if (_options.interopNullAssertions) _commonElements.interopNullAssertion,
547547
_commonElements.findType,

pkg/compiler/lib/src/js_backend/codegen_listener.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class CodegenEnqueuerListener extends EnqueuerListener {
4545
final CodegenWorldBuilder _worldBuilder;
4646

4747
bool _isNoSuchMethodUsed = false;
48-
bool _isNewRtiUsed = false;
48+
bool _isRtiUsed = false;
4949

5050
CodegenEnqueuerListener(
5151
this._options,
@@ -149,30 +149,30 @@ class CodegenEnqueuerListener extends EnqueuerListener {
149149
}
150150

151151
// TODO(fishythefish): Avoid registering unnecessary impacts.
152-
if (!_isNewRtiUsed) {
153-
WorldImpactBuilderImpl newRtiImpact = WorldImpactBuilderImpl();
154-
newRtiImpact.registerStaticUse(
152+
if (!_isRtiUsed) {
153+
WorldImpactBuilderImpl rtiImpact = WorldImpactBuilderImpl();
154+
rtiImpact.registerStaticUse(
155155
StaticUse.staticInvoke(
156156
_commonElements.rtiAddRulesMethod,
157157
CallStructure.twoArgs,
158158
),
159159
);
160-
newRtiImpact.registerStaticUse(
160+
rtiImpact.registerStaticUse(
161161
StaticUse.staticInvoke(
162162
_commonElements.rtiAddErasedTypesMethod,
163163
CallStructure.twoArgs,
164164
),
165165
);
166166
if (_options.enableVariance) {
167-
newRtiImpact.registerStaticUse(
167+
rtiImpact.registerStaticUse(
168168
StaticUse.staticInvoke(
169169
_commonElements.rtiAddTypeParameterVariancesMethod,
170170
CallStructure.twoArgs,
171171
),
172172
);
173173
}
174-
enqueuer.applyImpact(newRtiImpact);
175-
_isNewRtiUsed = true;
174+
enqueuer.applyImpact(rtiImpact);
175+
_isRtiUsed = true;
176176
}
177177

178178
if (_nativeData.isAllowInteropUsed) {
@@ -257,7 +257,7 @@ class CodegenEnqueuerListener extends EnqueuerListener {
257257

258258
impactBuilder.registerStaticUse(
259259
StaticUse.staticInvoke(
260-
_commonElements.instantiatedGenericFunctionTypeNewRti,
260+
_commonElements.instantiatedGenericFunctionType,
261261
CallStructure.twoArgs,
262262
),
263263
);

pkg/compiler/lib/src/js_backend/constant_emitter.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ class ConstantEmitter extends ModularConstantEmitter {
273273
.toList(growable: false);
274274
js_ast.ArrayInitializer array = js_ast.ArrayInitializer(elements);
275275
js_ast.Expression value = _makeConstantList(array);
276-
return maybeAddListTypeArgumentsNewRti(constant, constant.type, value);
276+
return maybeAddListTypeArguments(constant, constant.type, value);
277277
}
278278

279279
@override
@@ -296,7 +296,7 @@ class ConstantEmitter extends ModularConstantEmitter {
296296
_constantReferenceGenerator(constant.indexObject!),
297297
js.number(constant.length),
298298
if (_rtiNeed.classNeedsTypeArguments(classElement))
299-
_reifiedTypeNewRti(sourceType),
299+
_reifiedType(sourceType),
300300
];
301301
js_ast.Expression constructor = _emitter.constructorAccess(classElement);
302302
return js_ast.New(constructor, arguments);
@@ -313,7 +313,7 @@ class ConstantEmitter extends ModularConstantEmitter {
313313
_constantReferenceGenerator(value),
314314
]),
315315
if (_rtiNeed.classNeedsTypeArguments(classElement))
316-
_reifiedTypeNewRti(sourceType),
316+
_reifiedType(sourceType),
317317
];
318318
js_ast.Expression constructor = _emitter.constructorAccess(classElement);
319319
return js_ast.New(constructor, arguments);
@@ -412,7 +412,7 @@ class ConstantEmitter extends ModularConstantEmitter {
412412
}
413413

414414
if (_rtiNeed.classNeedsTypeArguments(classElement)) {
415-
arguments.add(_reifiedTypeNewRti(constant.type));
415+
arguments.add(_reifiedType(constant.type));
416416
}
417417

418418
js_ast.Expression constructor = _emitter.constructorAccess(classElement);
@@ -491,7 +491,7 @@ class ConstantEmitter extends ModularConstantEmitter {
491491
}
492492
});
493493
if (_rtiNeed.classNeedsTypeArguments(constant.type.element)) {
494-
fields.add(_reifiedTypeNewRti(constant.type));
494+
fields.add(_reifiedType(constant.type));
495495
}
496496
return js_ast.New(constructor, fields);
497497
}
@@ -527,7 +527,7 @@ class ConstantEmitter extends ModularConstantEmitter {
527527
_constantReferenceGenerator(constant.function),
528528
];
529529
fields.add(
530-
_reifiedTypeNewRti(
530+
_reifiedType(
531531
_commonElements.dartTypes.interfaceType(cls, constant.typeArguments),
532532
),
533533
);
@@ -539,7 +539,7 @@ class ConstantEmitter extends ModularConstantEmitter {
539539
return rawJavaScript.replaceAll(commentRE, '');
540540
}
541541

542-
js_ast.Expression maybeAddListTypeArgumentsNewRti(
542+
js_ast.Expression maybeAddListTypeArguments(
543543
ConstantValue constant,
544544
InterfaceType type,
545545
js_ast.Expression value,
@@ -548,13 +548,13 @@ class ConstantEmitter extends ModularConstantEmitter {
548548
if (_rtiNeed.classNeedsTypeArguments(type.element)) {
549549
return js_ast.Call(getHelperProperty(_commonElements.setArrayType), [
550550
value,
551-
_reifiedTypeNewRti(type),
551+
_reifiedType(type),
552552
]);
553553
}
554554
return value;
555555
}
556556

557-
js_ast.Expression _reifiedTypeNewRti(DartType type) {
557+
js_ast.Expression _reifiedType(DartType type) {
558558
assert(!type.containsTypeVariables);
559559
return TypeReference(TypeExpressionRecipe(type))..forConstant = true;
560560
}

0 commit comments

Comments
 (0)