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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/builder.dart

Issue 574683002: Use ConstExp for storing constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes and further implementation. Created 6 years, 3 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: sdk/lib/_internal/compiler/implementation/ssa/builder.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
index 21355108daa9298abb2d1d0fd26fd589d9253455..9e9558ea089fa2822e96b6b75a9af94758834b62 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
@@ -59,7 +59,7 @@ class SsaBuilderTask extends CompilerTask {
signature.forEachOptionalParameter((ParameterElement parameter) {
// This ensures the default value will be computed.
Constant constant =
- backend.constants.getConstantForVariable(parameter);
+ backend.constants.getConstantForVariable(parameter).value;
CodegenRegistry registry = work.registry;
registry.registerCompileTimeConstant(constant);
});
@@ -1346,11 +1346,11 @@ class SsaBuilder extends ResolvedVisitor {
}
HInstruction handleConstantForOptionalParameter(Element parameter) {
- Constant constant =
+ ConstExp constant =
backend.constants.getConstantForVariable(parameter);
assert(invariant(parameter, constant != null,
message: 'No constant computed for $parameter'));
- return graph.addConstant(constant, compiler);
+ return graph.addConstant(constant.value, compiler);
}
Element get currentNonClosureClass {
@@ -1386,11 +1386,11 @@ class SsaBuilder extends ResolvedVisitor {
bool inTryStatement = false;
Constant getConstantForNode(ast.Node node) {
- Constant constant =
+ ConstExp constant =
backend.constants.getConstantForNode(node, elements);
assert(invariant(node, constant != null,
message: 'No constant computed for $node'));
- return constant;
+ return constant.value;
}
HInstruction addConstant(ast.Node node) {
@@ -1398,7 +1398,7 @@ class SsaBuilder extends ResolvedVisitor {
}
bool isLazilyInitialized(VariableElement element) {
- Constant initialValue =
+ ConstExp initialValue =
backend.constants.getConstantForVariable(element);
return initialValue == null;
}
@@ -3073,13 +3073,14 @@ class SsaBuilder extends ResolvedVisitor {
if (element != null && element.isForeign(backend)) {
visitForeignGetter(send);
} else if (Elements.isStaticOrTopLevelField(element)) {
- Constant value;
+ ConstExp constant;
if (element.isField && !element.isAssignable) {
// A static final or const. Get its constant value and inline it if
// the value can be compiled eagerly.
- value = backend.constants.getConstantForVariable(element);
+ constant = backend.constants.getConstantForVariable(element);
}
- if (value != null) {
+ if (constant != null) {
+ Constant value = constant.value;
HConstant instruction;
// Constants that are referred via a deferred prefix should be referred
// by reference.

Powered by Google App Engine
This is Rietveld 408576698