Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1092)

Side by Side Diff: pkg/compiler/lib/src/cps_ir/type_mask_system.dart

Issue 1407743002: dart2js cps: Narrow the receiver mask on InvokeMethod. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/type_propagation.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart2js.type_mask_system; 5 library dart2js.type_mask_system;
6 6
7 import '../common/names.dart' show Selectors, Identifiers; 7 import '../common/names.dart' show Selectors, Identifiers;
8 import '../compiler.dart' as dart2js show Compiler; 8 import '../compiler.dart' as dart2js show Compiler;
9 import '../constants/values.dart'; 9 import '../constants/values.dart';
10 import '../dart_types.dart' as types; 10 import '../dart_types.dart' as types;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 } 126 }
127 127
128 TypeMask getFieldType(FieldElement field) { 128 TypeMask getFieldType(FieldElement field) {
129 return inferrer.getGuaranteedTypeOfElement(field); 129 return inferrer.getGuaranteedTypeOfElement(field);
130 } 130 }
131 131
132 TypeMask join(TypeMask a, TypeMask b) { 132 TypeMask join(TypeMask a, TypeMask b) {
133 return a.union(b, classWorld); 133 return a.union(b, classWorld);
134 } 134 }
135 135
136 TypeMask intersection(TypeMask a, TypeMask b) {
137 if (a == null) return b;
138 if (b == null) return a;
139 return a.intersection(b, classWorld);
140 }
141
136 TypeMask getTypeOf(ConstantValue constant) { 142 TypeMask getTypeOf(ConstantValue constant) {
137 return computeTypeMask(inferrer.compiler, constant); 143 return computeTypeMask(inferrer.compiler, constant);
138 } 144 }
139 145
140 // Returns the constant value if a TypeMask represents a single value. 146 // Returns the constant value if a TypeMask represents a single value.
141 // Returns `null` if [mask] is not a constant. 147 // Returns `null` if [mask] is not a constant.
142 ConstantValue getConstantOf(TypeMask mask) { 148 ConstantValue getConstantOf(TypeMask mask) {
143 if (!mask.isValue) return null; 149 if (!mask.isValue) return null;
144 if (mask.isNullable) return null; // e.g. 'true or null'. 150 if (mask.isNullable) return null; // e.g. 'true or null'.
145 ValueTypeMask valueMask = mask; 151 ValueTypeMask valueMask = mask;
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 389
384 /// The length of something of [type], or `null` if unknown. 390 /// The length of something of [type], or `null` if unknown.
385 int getContainerLength(TypeMask type) { 391 int getContainerLength(TypeMask type) {
386 if (type is ContainerTypeMask) { 392 if (type is ContainerTypeMask) {
387 return type.length; 393 return type.length;
388 } else { 394 } else {
389 return null; 395 return null;
390 } 396 }
391 } 397 }
392 } 398 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/type_propagation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698