Skip to content

Commit b529afd

Browse files
rakudramacommit-bot@chromium.org
authored andcommitted
[dart2js] rename setRuntimeTypeInfo to _setArrayType
For a long time now this is used only to put types on JSArray. Change-Id: I31f15d313d7e131eecac76697a8938c197f83e7d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195940 Reviewed-by: Mayank Patke <[email protected]> Commit-Queue: Stephen Adams <[email protected]>
1 parent 2d632d0 commit b529afd

20 files changed

+118
-116
lines changed

pkg/compiler/lib/src/common_elements.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ abstract class CommonElements {
455455

456456
// From dart:_rti
457457

458-
FunctionEntity get setRuntimeTypeInfo;
458+
FunctionEntity get setArrayType;
459459

460460
FunctionEntity get findType;
461461
FunctionEntity get instanceType;
@@ -1848,10 +1848,10 @@ class CommonElementsImpl
18481848
FunctionEntity _findRtiFunction(String name) =>
18491849
_findLibraryMember(rtiLibrary, name);
18501850

1851-
FunctionEntity _setRuntimeTypeInfo;
1851+
FunctionEntity _setArrayType;
18521852
@override
1853-
FunctionEntity get setRuntimeTypeInfo =>
1854-
_setRuntimeTypeInfo ??= _findRtiFunction('setRuntimeTypeInfo');
1853+
FunctionEntity get setArrayType =>
1854+
_setArrayType ??= _findRtiFunction('_setArrayType');
18551855

18561856
FunctionEntity _findType;
18571857
@override

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class BackendImpacts {
108108

109109
BackendImpact get computeSignature {
110110
return _computeSignature ??= new BackendImpact(globalUses: [
111-
_commonElements.setRuntimeTypeInfo,
111+
_commonElements.setArrayType,
112112
], otherImpacts: [
113113
listValues
114114
]);
@@ -443,7 +443,7 @@ class BackendImpacts {
443443

444444
BackendImpact get typeVariableExpression {
445445
return _typeVariableExpression ??= new BackendImpact(staticUses: [
446-
_commonElements.setRuntimeTypeInfo,
446+
_commonElements.setArrayType,
447447
_commonElements.createRuntimeType
448448
], otherImpacts: [
449449
listValues,
@@ -464,7 +464,7 @@ class BackendImpacts {
464464
BackendImpact get genericTypeCheck {
465465
return _genericTypeCheck ??= new BackendImpact(staticUses: [
466466
// TODO(johnniwinther): Investigate why this is needed.
467-
_commonElements.setRuntimeTypeInfo,
467+
_commonElements.setArrayType,
468468
], otherImpacts: [
469469
listValues,
470470
getRuntimeTypeArgument,
@@ -654,7 +654,7 @@ class BackendImpacts {
654654
// Literal lists can be translated into calls to these functions:
655655
globalUses: [
656656
_commonElements.jsArrayTypedConstructor,
657-
_commonElements.setRuntimeTypeInfo,
657+
_commonElements.setArrayType,
658658
]);
659659
}
660660

@@ -688,7 +688,7 @@ class BackendImpacts {
688688
return _runtimeTypeSupport ??= new BackendImpact(globalClasses: [
689689
_commonElements.listClass
690690
], globalUses: [
691-
_commonElements.setRuntimeTypeInfo,
691+
_commonElements.setArrayType,
692692
], otherImpacts: [
693693
getRuntimeTypeArgument,
694694
computeSignature

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ class CodegenEnqueuerListener extends EnqueuerListener {
202202
if (type is InterfaceType) {
203203
impactBuilder.registerTypeUse(new TypeUse.instantiation(type));
204204
if (_rtiNeed.classNeedsTypeArguments(type.element)) {
205-
FunctionEntity helper = _commonElements.setRuntimeTypeInfo;
205+
FunctionEntity helper = _commonElements.setArrayType;
206206
impactBuilder.registerStaticUse(new StaticUse.staticInvoke(
207207
helper, helper.parameterStructure.callStructure));
208208
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,7 @@ class ConstantEmitter extends ModularConstantEmitter {
437437
ConstantValue constant, InterfaceType type, jsAst.Expression value) {
438438
assert(type.element == _commonElements.jsArrayClass);
439439
if (_rtiNeed.classNeedsTypeArguments(type.element)) {
440-
return new jsAst.Call(
441-
getHelperProperty(_commonElements.setRuntimeTypeInfo),
440+
return new jsAst.Call(getHelperProperty(_commonElements.setArrayType),
442441
[value, _reifiedTypeNewRti(type)]);
443442
}
444443
return value;

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class MinifyNamer extends Namer
178178
r'JSArray',
179179
r'createInvocationMirror',
180180
r'String',
181-
r'setRuntimeTypeInfo',
181+
r'setArrayType',
182182
r'createRuntimeType'
183183
]);
184184
}
@@ -389,8 +389,11 @@ abstract class _MinifiedOneShotInterceptorNamer implements Namer {
389389
String root = selector.isOperator
390390
? operatorNameToIdentifier(selector.name)
391391
: privateName(selector.memberName);
392-
String prefix =
393-
selector.isGetter ? r"$get" : selector.isSetter ? r"$set" : "";
392+
String prefix = selector.isGetter
393+
? r"$get"
394+
: selector.isSetter
395+
? r"$set"
396+
: "";
394397
String callSuffix = selector.isCall
395398
? Namer.callSuffixForStructure(selector.callStructure).join()
396399
: "";

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2200,14 +2200,14 @@ class KernelSsaGraphBuilder extends ir.Visitor<void> with ir.VisitorVoidMixin {
22002200
HInstruction _callSetRuntimeTypeInfo(HInstruction typeInfo,
22012201
HInstruction newObject, SourceInformation sourceInformation) {
22022202
// Set the runtime type information on the object.
2203-
FunctionEntity typeInfoSetterFn = _commonElements.setRuntimeTypeInfo;
2203+
FunctionEntity typeInfoSetterFn = _commonElements.setArrayType;
22042204
// TODO(efortuna): Insert source information in this static invocation.
22052205
_pushStaticInvocation(typeInfoSetterFn, <HInstruction>[newObject, typeInfo],
22062206
_abstractValueDomain.dynamicType, const <DartType>[],
22072207
sourceInformation: sourceInformation);
22082208

22092209
// The new object will now be referenced through the
2210-
// `setRuntimeTypeInfo` call. We therefore set the type of that
2210+
// `setArrayType` call. We therefore set the type of that
22112211
// instruction to be of the object's type.
22122212
assert(
22132213
stack.last is HInvokeStatic || stack.last == newObject,

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ class SsaInstructionSimplifier extends HBaseVisitor
721721
// t1 = s.split(pattern);
722722
// t2 = String;
723723
// t3 = JSArray<t2>;
724-
// t4 = setRuntimeTypeInfo(t1, t3);
724+
// t4 = setArrayType(t1, t3);
725725
//
726726

727727
AbstractValue resultMask = _abstractValueDomain.growableListType;
@@ -751,7 +751,7 @@ class SsaInstructionSimplifier extends HBaseVisitor
751751
node.block.addBefore(node, typeInfo);
752752

753753
HInvokeStatic tagInstruction = new HInvokeStatic(
754-
commonElements.setRuntimeTypeInfo,
754+
commonElements.setArrayType,
755755
<HInstruction>[splitInstruction, typeInfo],
756756
resultMask,
757757
const <DartType>[]);
@@ -1368,8 +1368,8 @@ class SsaInstructionSimplifier extends HBaseVisitor
13681368
// Can we find the length as an input to an allocation?
13691369
HInstruction potentialAllocation = receiver;
13701370
if (receiver is HInvokeStatic &&
1371-
receiver.element == commonElements.setRuntimeTypeInfo) {
1372-
// Look through `setRuntimeTypeInfo(new Array(), ...)`
1371+
receiver.element == commonElements.setArrayType) {
1372+
// Look through `setArrayType(new Array(), ...)`
13731373
potentialAllocation = receiver.inputs.first;
13741374
}
13751375
if (_graph.allocatedFixedLists.contains(potentialAllocation)) {
@@ -1619,7 +1619,7 @@ class SsaInstructionSimplifier extends HBaseVisitor
16191619
node.inputs[0], node.inputs[1], _abstractValueDomain.boolType)
16201620
..sourceInformation = node.sourceInformation;
16211621
}
1622-
} else if (element == commonElements.setRuntimeTypeInfo) {
1622+
} else if (element == commonElements.setArrayType) {
16231623
if (node.inputs.length == 2) {
16241624
return handleArrayTypeInfo(node);
16251625
}
@@ -2066,7 +2066,7 @@ class SsaInstructionSimplifier extends HBaseVisitor
20662066
}
20672067

20682068
if (instance is HInvokeStatic &&
2069-
instance.element == commonElements.setRuntimeTypeInfo) {
2069+
instance.element == commonElements.setArrayType) {
20702070
// TODO(sra): What is the 'instantiated type' we should be registering as
20712071
// discussed above? Perhaps it should be carried on HLiteralList.
20722072
return instance.inputs.last;
@@ -3527,7 +3527,7 @@ class SsaLoadElimination extends HBaseVisitor implements OptimizationPhase {
35273527
// have it escape or store it into an object that escapes.
35283528
return false;
35293529
// TODO(sra): Handle library functions that we know do not modify or
3530-
// leak the inputs. For example `setRuntimeTypeInfo` is used to mark
3530+
// leak the inputs. For example `setArrayType` is used to mark
35313531
// list literals with type information.
35323532
}
35333533
if (use is HPhi) {

pkg/compiler/test/codegen/data/array_add.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// TODO(sra): Lower when type of input does not need a generic covariant check.
88
@pragma('dart2js:noInline')
99
/*spec.member: test1:function() {
10-
var t1 = H.setRuntimeTypeInfo([], type$.JSArray_int);
10+
var t1 = H._setArrayType([], type$.JSArray_int);
1111
C.JSArray_methods.add$1(t1, 1);
1212
return t1;
1313
}*/

pkg/compiler/test/impact/data/async.dart

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ testAsyncStar() async* {}
7272
_IterationMarker.uncaughtError(1),
7373
_IterationMarker.yieldStar(1),
7474
_makeSyncStarIterable<Null>(1),
75-
def:local,
76-
setRuntimeTypeInfo(2)],
75+
_setArrayType(2),
76+
def:local],
7777
type=[
7878
inst:Function,
7979
inst:JSArray<dynamic>,
@@ -95,9 +95,9 @@ testLocalSyncStar() {
9595
_asyncReturn(2),
9696
_asyncStartSync(2),
9797
_makeAsyncAwaitCompleter<Null>(0),
98+
_setArrayType(2),
9899
_wrapJsFunctionForAsync(1),
99-
def:local,
100-
setRuntimeTypeInfo(2)],
100+
def:local],
101101
type=[
102102
inst:Function,
103103
inst:JSArray<dynamic>,
@@ -118,10 +118,10 @@ testLocalAsync() {
118118
_IterationMarker.yieldStar(1),
119119
_asyncStarHelper(3),
120120
_makeAsyncStarStreamController<Null>(1),
121+
_setArrayType(2),
121122
_streamOfController(1),
122123
_wrapJsFunctionForAsync(1),
123-
def:local,
124-
setRuntimeTypeInfo(2)],
124+
def:local],
125125
type=[
126126
inst:Function,
127127
inst:JSArray<dynamic>,
@@ -141,8 +141,8 @@ testLocalAsyncStar() {
141141
_IterationMarker.uncaughtError(1),
142142
_IterationMarker.yieldStar(1),
143143
_makeSyncStarIterable<Null>(1),
144-
def:<anonymous>,
145-
setRuntimeTypeInfo(2)],
144+
_setArrayType(2),
145+
def:<anonymous>],
146146
type=[
147147
inst:Function,
148148
inst:JSArray<dynamic>,
@@ -163,9 +163,9 @@ testAnonymousSyncStar() {
163163
_asyncReturn(2),
164164
_asyncStartSync(2),
165165
_makeAsyncAwaitCompleter<Null>(0),
166+
_setArrayType(2),
166167
_wrapJsFunctionForAsync(1),
167-
def:<anonymous>,
168-
setRuntimeTypeInfo(2)],
168+
def:<anonymous>],
169169
type=[
170170
inst:Function,
171171
inst:JSArray<dynamic>,
@@ -185,10 +185,10 @@ testAnonymousAsync() {
185185
_IterationMarker.yieldStar(1),
186186
_asyncStarHelper(3),
187187
_makeAsyncStarStreamController<Null>(1),
188+
_setArrayType(2),
188189
_streamOfController(1),
189190
_wrapJsFunctionForAsync(1),
190-
def:<anonymous>,
191-
setRuntimeTypeInfo(2)],
191+
def:<anonymous>],
192192
type=[
193193
inst:Function,
194194
inst:JSArray<dynamic>,

pkg/compiler/test/impact/data/classes.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,9 @@ class ForwardingConstructorGenericSuperClass<T> {
231231
_isObject(1),
232232
_isString(1),
233233
_isTop(1),
234+
_setArrayType(2),
234235
findType(1),
235-
instanceType(1),
236-
setRuntimeTypeInfo(2)],
236+
instanceType(1)],
237237
type=[
238238
inst:Closure,
239239
inst:JSArray<dynamic>,
@@ -313,9 +313,9 @@ testEnum() => Enum.A;
313313
_isObject(1),
314314
_isString(1),
315315
_isTop(1),
316+
_setArrayType(2),
316317
findType(1),
317-
instanceType(1),
318-
setRuntimeTypeInfo(2)],
318+
instanceType(1)],
319319
type=[
320320
inst:Closure,
321321
inst:JSArray<dynamic>,
@@ -419,9 +419,9 @@ class GenericClass<X, Y> {
419419
_isObject(1),
420420
_isString(1),
421421
_isTop(1),
422+
_setArrayType(2),
422423
findType(1),
423-
instanceType(1),
424-
setRuntimeTypeInfo(2)],
424+
instanceType(1)],
425425
type=[
426426
inst:Closure,
427427
inst:JSArray<dynamic>,

pkg/compiler/test/impact/data/constants/lib.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ const typeLiteralField = String;
7979
_isObject(1),
8080
_isString(1),
8181
_isTop(1),
82+
_setArrayType(2),
8283
findType(1),
83-
instanceType(1),
84-
setRuntimeTypeInfo(2)],
84+
instanceType(1)],
8585
type=[
8686
inst:Closure,
8787
inst:JSArray<dynamic>,

pkg/compiler/test/impact/data/expressions.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,9 @@ testAs(dynamic o) => o as Class;
253253
_isObject(1),
254254
_isString(1),
255255
_isTop(1),
256+
_setArrayType(2),
256257
findType(1),
257-
instanceType(1),
258-
setRuntimeTypeInfo(2)],
258+
instanceType(1)],
259259
type=[
260260
as:GenericClass<int*,String*>*,
261261
inst:Closure,

pkg/compiler/test/impact/data/extract_type_arguments.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ class C implements A<int>, B<String, bool> {}
5050
_isObject(1),
5151
_isString(1),
5252
_isTop(1),
53+
_setArrayType(2),
5354
extractTypeArguments<A<dynamic>*>(2),
5455
findType(1),
55-
instanceType(1),
56-
setRuntimeTypeInfo(2)],
56+
instanceType(1)],
5757
type=[
5858
impl:A<dynamic>*,
5959
impl:Function,
@@ -104,10 +104,10 @@ testA(c, f) => extractTypeArguments<A>(c, f);
104104
_isObject(1),
105105
_isString(1),
106106
_isTop(1),
107+
_setArrayType(2),
107108
extractTypeArguments<B<dynamic,dynamic>*>(2),
108109
findType(1),
109-
instanceType(1),
110-
setRuntimeTypeInfo(2)],
110+
instanceType(1)],
111111
type=[
112112
impl:B<dynamic,dynamic>*,
113113
impl:Function,

pkg/compiler/test/impact/data/initializers.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,9 @@ class ClassGeneric<T> {
343343
_isObject(1),
344344
_isString(1),
345345
_isTop(1),
346+
_setArrayType(2),
346347
findType(1),
347-
instanceType(1),
348-
setRuntimeTypeInfo(2)],
348+
instanceType(1)],
349349
type=[
350350
inst:Closure,
351351
inst:JSArray<dynamic>,

0 commit comments

Comments
 (0)