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

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

Issue 2378063002: Remove Enqueuer argument from Backend.registerStaticUse (Closed)
Patch Set: Updated cf. comments. Created 4 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
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 /// entry with that key. 121 /// entry with that key.
122 final _pending = <ConstantValue, List<_LookupMapInfo>>{}; 122 final _pending = <ConstantValue, List<_LookupMapInfo>>{};
123 123
124 final StagedWorldImpactBuilder impactBuilder = new StagedWorldImpactBuilder(); 124 final StagedWorldImpactBuilder impactBuilder = new StagedWorldImpactBuilder();
125 125
126 /// Whether the backend is currently processing the codegen queue. 126 /// Whether the backend is currently processing the codegen queue.
127 bool _inCodegen = false; 127 bool _inCodegen = false;
128 128
129 LookupMapAnalysis(this.backend, this.reporter); 129 LookupMapAnalysis(this.backend, this.reporter);
130 130
131 void onQueueEmpty(Enqueuer enqueuer) { 131 /// Compute the [WorldImpact] for the constants registered since last flush.
132 if (enqueuer.isResolutionQueue) return; 132 WorldImpact flush({bool forResolution}) {
133 enqueuer.applyImpact(null, impactBuilder.flush()); 133 if (forResolution) return const WorldImpact();
134 return impactBuilder.flush();
134 } 135 }
135 136
136 /// Whether this analysis and optimization is enabled. 137 /// Whether this analysis and optimization is enabled.
137 bool get _isEnabled { 138 bool get _isEnabled {
138 // `lookupMap==off` kept here to make it easy to test disabling this feature 139 // `lookupMap==off` kept here to make it easy to test disabling this feature
139 if (const String.fromEnvironment('lookupMap') == 'off') return false; 140 if (const String.fromEnvironment('lookupMap') == 'off') return false;
140 return typeLookupMapClass != null; 141 return typeLookupMapClass != null;
141 } 142 }
142 143
143 /// Initializes this analysis by providing the resolved library. This is 144 /// Initializes this analysis by providing the resolved library. This is
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 original.fields[analysis.valueField] = keyValuePairs[1]; 440 original.fields[analysis.valueField] = keyValuePairs[1];
440 } 441 }
441 } else { 442 } else {
442 original.fields[analysis.entriesField] = 443 original.fields[analysis.entriesField] =
443 new ListConstantValue(listType, keyValuePairs); 444 new ListConstantValue(listType, keyValuePairs);
444 } 445 }
445 } 446 }
446 } 447 }
447 448
448 final _validLookupMapVersionConstraint = new VersionConstraint.parse('^0.0.1'); 449 final _validLookupMapVersionConstraint = new VersionConstraint.parse('^0.0.1');
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/enqueuer.dart ('k') | pkg/compiler/lib/src/js_backend/type_variable_handler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698