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

Side by Side Diff: pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart

Issue 2944843002: All strong mode cleaning of dart2js. (Closed)
Patch Set: More issues discovered during testing. Created 3 years, 6 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
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 /// Analysis to determine how to generate code for `LookupMap`s. 5 /// Analysis to determine how to generate code for `LookupMap`s.
6 library compiler.src.js_backend.lookup_map_analysis; 6 library compiler.src.js_backend.lookup_map_analysis;
7 7
8 import 'package:pub_semver/pub_semver.dart'; 8 import 'package:pub_semver/pub_semver.dart';
9 9
10 import '../common.dart'; 10 import '../common.dart';
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 return false; 300 return false;
301 } 301 }
302 302
303 /// Whether we need to preserve [key]. This is true for keys that are not 303 /// Whether we need to preserve [key]. This is true for keys that are not
304 /// candidates for tree-shaking in the first place (primitives and non-type 304 /// candidates for tree-shaking in the first place (primitives and non-type
305 /// const values overriding equals) and keys that we have seen in the program. 305 /// const values overriding equals) and keys that we have seen in the program.
306 bool _shouldKeep(ConstantValue key) => 306 bool _shouldKeep(ConstantValue key) =>
307 key.isPrimitive || _inUse.contains(key) || _overridesEquals(key); 307 key.isPrimitive || _inUse.contains(key) || _overridesEquals(key);
308 308
309 void _addClassUse(ClassEntity cls) { 309 void _addClassUse(ClassEntity cls) {
310 ConstantValue key = _typeConstants.putIfAbsent( 310 TypeConstantValue f() => _constantSystem.createType(
311 cls, 311 _commonElements, _elementEnvironment.getRawType(cls));
312 () => _constantSystem.createType( 312 ConstantValue key = _typeConstants.putIfAbsent(cls, f);
313 _commonElements, _elementEnvironment.getRawType(cls)));
314 _addUse(key); 313 _addUse(key);
315 } 314 }
316 315
317 /// Record that [key] is used and update every lookup map that contains it. 316 /// Record that [key] is used and update every lookup map that contains it.
318 void _addUse(ConstantValue key) { 317 void _addUse(ConstantValue key) {
319 if (_inUse.add(key)) { 318 if (_inUse.add(key)) {
320 _pending[key]?.forEach((info) => info._markUsed(key)); 319 _pending[key]?.forEach((info) => info._markUsed(key));
321 _pending.remove(key); 320 _pending.remove(key);
322 } 321 }
323 } 322 }
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 original.fields[analysis._valueField] = keyValuePairs[1]; 515 original.fields[analysis._valueField] = keyValuePairs[1];
517 } 516 }
518 } else { 517 } else {
519 original.fields[analysis._entriesField] = 518 original.fields[analysis._entriesField] =
520 new ListConstantValue(listType, keyValuePairs); 519 new ListConstantValue(listType, keyValuePairs);
521 } 520 }
522 } 521 }
523 } 522 }
524 523
525 final _validLookupMapVersionConstraint = new VersionConstraint.parse('^0.0.1'); 524 final _validLookupMapVersionConstraint = new VersionConstraint.parse('^0.0.1');
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/frequency_namer.dart ('k') | pkg/compiler/lib/src/js_backend/minify_namer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698