Index: sdk/lib/_internal/compiler/implementation/ssa/codegen.dart |
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart |
index 7e364c094b0b6bf319dfd1934609c1a740583e22..b397568913861727b4e025a242f7565cd9c8f769 100644 |
--- a/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart |
+++ b/sdk/lib/_internal/compiler/implementation/ssa/codegen.dart |
@@ -1812,44 +1812,11 @@ abstract class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor { |
} |
void generateConstant(Constant constant) { |
- Namer namer = backend.namer; |
- // TODO(floitsch): should we use the ConstantVisitor here? |
- if (!constant.isObject()) { |
- if (constant.isBool()) { |
- BoolConstant boolConstant = constant; |
- push(newLiteralBool(boolConstant.value)); |
- } else if (constant.isNum()) { |
- // TODO(floitsch): get rid of the code buffer. |
- CodeBuffer buffer = new CodeBuffer(); |
- backend.emitter.writeConstantToBuffer(constant, buffer); |
- push(new js.LiteralNumber(buffer.toString())); |
- } else if (constant.isNull()) { |
- push(new js.LiteralNull()); |
- } else if (constant.isString()) { |
- // TODO(floitsch): get rid of the code buffer. |
- CodeBuffer buffer = new CodeBuffer(); |
- backend.emitter.writeConstantToBuffer(constant, buffer); |
- push(new js.LiteralString(buffer.toString())); |
- } else if (constant.isFunction()) { |
- FunctionConstant function = constant; |
- world.registerStaticUse(function.element); |
- push(new js.VariableUse(namer.isolateAccess(function.element))); |
- } else if (constant.isSentinel()) { |
- // TODO(floitsch): get rid of the code buffer. |
- CodeBuffer buffer = new CodeBuffer(); |
- backend.emitter.writeConstantToBuffer(constant, buffer); |
- push(new js.VariableUse(buffer.toString())); |
- } else { |
- compiler.internalError( |
- "The compiler does not know how generate code for " |
- "constant $constant"); |
- } |
- } else { |
- String name = namer.constantName(constant); |
- js.VariableUse currentIsolateUse = |
- new js.VariableUse(backend.namer.CURRENT_ISOLATE); |
- push(new js.PropertyAccess.field(currentIsolateUse, name)); |
+ if (constant.isFunction()) { |
+ FunctionConstant function = constant; |
+ world.registerStaticUse(function.element); |
} |
+ push(backend.emitter.constantReference(constant)); |
} |
visitConstant(HConstant node) { |