Index: lib/compiler/implementation/ssa/codegen.dart |
diff --git a/lib/compiler/implementation/ssa/codegen.dart b/lib/compiler/implementation/ssa/codegen.dart |
index f1bebc7d6573c6a3401121faf622f25e102da7f4..bd4ba4899d2cbe189bab0c22acce0f8b30152b56 100644 |
--- a/lib/compiler/implementation/ssa/codegen.dart |
+++ b/lib/compiler/implementation/ssa/codegen.dart |
@@ -1714,30 +1714,33 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor { |
} |
void generateConstant(Constant constant) { |
- Namer namer = backend.namer; |
- if (!constant.isObject()) { |
+ ConstantHandler handler = compiler.constantHandler; |
+ String name = handler.getNameForConstant(constant); |
+ if (name === null) { |
+ assert(!constant.isObject()); |
if (constant.isBool()) { |
push(new js.LiteralBool((constant as BoolConstant).value)); |
} else if (constant.isNum()) { |
// TODO(floitsch): get rid of the code buffer. |
CodeBuffer buffer = new CodeBuffer(); |
- backend.emitter.writeConstantToBuffer(constant, buffer); |
+ handler.writeConstant(buffer, constant); |
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); |
+ handler.writeConstant(buffer, constant); |
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))); |
+ push(new js.VariableUse( |
+ backend.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); |
+ handler.writeConstant(buffer, constant); |
push(new js.VariableUse(buffer.toString())); |
} else { |
compiler.internalError( |
@@ -1745,7 +1748,6 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor { |
"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)); |