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

Unified Diff: pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart

Issue 2916893002: Handle int constant (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart
diff --git a/pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart b/pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart
index 479ab20c95b4a2579fd022866c47759dd516d7d9..953a30c5ea31e9a0f9067c6057df26a90226b2c5 100644
--- a/pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart
+++ b/pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart
@@ -113,9 +113,6 @@ class JavaScriptConstantTask extends ConstantCompilerTask {
*/
class JavaScriptConstantCompiler extends ConstantCompilerBase
implements BackendConstantEnvironment {
- /** Set of all registered compiled constants. */
- final Set<ConstantValue> compiledConstants = new Set<ConstantValue>();
-
// TODO(johnniwinther): Move this to the backend constant handler.
/** Caches the statics where the initial value cannot be eagerly compiled. */
final Set<FieldElement> lazyStatics = new Set<FieldElement>();
@@ -153,43 +150,10 @@ class JavaScriptConstantCompiler extends ConstantCompilerBase
lazyStatics.add(element);
}
- void addCompileTimeConstantForEmission(ConstantValue constant) {
- compiledConstants.add(constant);
- }
-
List<FieldElement> getLazilyInitializedFieldsForEmission() {
return new List<FieldElement>.from(lazyStatics);
}
- /**
- * Returns a list of constants topologically sorted so that dependencies
- * appear before the dependent constant. [preSortCompare] is a comparator
- * function that gives the constants a consistent order prior to the
- * topological sort which gives the constants an ordering that is less
- * sensitive to perturbations in the source code.
- */
- List<ConstantValue> getConstantsForEmission([preSortCompare]) {
- // We must emit dependencies before their uses.
- Set<ConstantValue> seenConstants = new Set<ConstantValue>();
- List<ConstantValue> result = new List<ConstantValue>();
-
- void addConstant(ConstantValue constant) {
- if (!seenConstants.contains(constant)) {
- constant.getDependencies().forEach(addConstant);
- assert(!seenConstants.contains(constant));
- result.add(constant);
- seenConstants.add(constant);
- }
- }
-
- List<ConstantValue> sorted = compiledConstants.toList();
- if (preSortCompare != null) {
- sorted.sort(preSortCompare);
- }
- sorted.forEach(addConstant);
- return result;
- }
-
ConstantExpression compileNode(Node node, TreeElements elements,
{bool enforceConst: true}) {
return compileNodeWithDefinitions(node, elements, isConst: enforceConst);

Powered by Google App Engine
This is Rietveld 408576698