| Index: sdk/lib/_internal/compiler/implementation/ssa/nodes.dart
|
| ===================================================================
|
| --- sdk/lib/_internal/compiler/implementation/ssa/nodes.dart (revision 23841)
|
| +++ sdk/lib/_internal/compiler/implementation/ssa/nodes.dart (working copy)
|
| @@ -162,29 +162,26 @@
|
| return result;
|
| }
|
|
|
| - static HType mapConstantTypeToSsaType(Constant constant) {
|
| + static HType mapConstantTypeToSsaType(Constant constant, Compiler compiler) {
|
| + JavaScriptBackend backend = compiler.backend;
|
| if (constant.isNull()) return HType.NULL;
|
| if (constant.isBool()) return HType.BOOLEAN;
|
| if (constant.isInt()) return HType.INTEGER;
|
| if (constant.isDouble()) return HType.DOUBLE;
|
| - if (constant.isString()) return HType.STRING;
|
| - if (constant.isList()) return HType.READABLE_ARRAY;
|
| + if (constant.isString()) return backend.stringType;
|
| + if (constant.isList()) return backend.readableArrayType;
|
| if (constant.isFunction()) return HType.UNKNOWN;
|
| if (constant.isSentinel()) return HType.UNKNOWN;
|
| // TODO(sra): What is the type of the prototype of an interceptor?
|
| if (constant.isInterceptor()) return HType.UNKNOWN;
|
| - // TODO(kasperl): This seems a bit fishy, but we do not have the
|
| - // compiler at hand so we cannot use the usual HType factory
|
| - // methods. At some point this should go away.
|
| ObjectConstant objectConstant = constant;
|
| - TypeMask mask = new TypeMask.nonNullExact(objectConstant.type);
|
| - return new HBoundedType(mask);
|
| + return new HBoundedType(new TypeMask.nonNullExact(objectConstant.type));
|
| }
|
|
|
| - HConstant addConstant(Constant constant) {
|
| + HConstant addConstant(Constant constant, Compiler compiler) {
|
| HConstant result = constants[constant];
|
| if (result == null) {
|
| - HType type = mapConstantTypeToSsaType(constant);
|
| + HType type = mapConstantTypeToSsaType(constant, compiler);
|
| result = new HConstant.internal(constant, type);
|
| entry.addAtExit(result);
|
| constants[constant] = result;
|
| @@ -195,26 +192,30 @@
|
| return result;
|
| }
|
|
|
| - HConstant addConstantInt(int i, ConstantSystem constantSystem) {
|
| - return addConstant(constantSystem.createInt(i));
|
| + HConstant addConstantInt(int i, Compiler compiler) {
|
| + return addConstant(compiler.backend.constantSystem.createInt(i), compiler);
|
| }
|
|
|
| - HConstant addConstantDouble(double d, ConstantSystem constantSystem) {
|
| - return addConstant(constantSystem.createDouble(d));
|
| + HConstant addConstantDouble(double d, Compiler compiler) {
|
| + return addConstant(
|
| + compiler.backend.constantSystem.createDouble(d), compiler);
|
| }
|
|
|
| HConstant addConstantString(DartString str,
|
| Node diagnosticNode,
|
| - ConstantSystem constantSystem) {
|
| - return addConstant(constantSystem.createString(str, diagnosticNode));
|
| + Compiler compiler) {
|
| + return addConstant(
|
| + compiler.backend.constantSystem.createString(str, diagnosticNode),
|
| + compiler);
|
| }
|
|
|
| - HConstant addConstantBool(bool value, ConstantSystem constantSystem) {
|
| - return addConstant(constantSystem.createBool(value));
|
| + HConstant addConstantBool(bool value, Compiler compiler) {
|
| + return addConstant(
|
| + compiler.backend.constantSystem.createBool(value), compiler);
|
| }
|
|
|
| - HConstant addConstantNull(ConstantSystem constantSystem) {
|
| - return addConstant(constantSystem.createNull());
|
| + HConstant addConstantNull(Compiler compiler) {
|
| + return addConstant(compiler.backend.constantSystem.createNull(), compiler);
|
| }
|
|
|
| void finalize() {
|
| @@ -836,6 +837,12 @@
|
| instructionType.isExtendableArray(compiler);
|
| bool isFixedArray(Compiler compiler) =>
|
| instructionType.isFixedArray(compiler);
|
| + bool isString(Compiler compiler) =>
|
| + instructionType.isString(compiler);
|
| + bool isPrimitive(Compiler compiler) =>
|
| + instructionType.isPrimitive(compiler);
|
| + bool isPrimitiveOrNull(Compiler compiler) =>
|
| + instructionType.isPrimitiveOrNull(compiler);
|
| bool isBoolean() => instructionType.isBoolean();
|
| bool isInteger() => instructionType.isInteger();
|
| bool isIntegerOrNull() => instructionType.isIntegerOrNull();
|
| @@ -843,9 +850,6 @@
|
| bool isDoubleOrNull() => instructionType.isDoubleOrNull();
|
| bool isNumber() => instructionType.isNumber();
|
| bool isNumberOrNull() => instructionType.isNumberOrNull();
|
| - bool isString() => instructionType.isString();
|
| - bool isPrimitive() => instructionType.isPrimitive();
|
| - bool isPrimitiveOrNull() => instructionType.isPrimitiveOrNull();
|
| bool isNull() => instructionType.isNull();
|
| bool canBeNull() => instructionType.canBeNull();
|
| bool canBePrimitive(Compiler compiler) =>
|
| @@ -2137,8 +2141,8 @@
|
| }
|
|
|
| class HLiteralList extends HInstruction {
|
| - HLiteralList(inputs) : super(inputs) {
|
| - instructionType = HType.EXTENDABLE_ARRAY;
|
| + HLiteralList(List<HInstruction> inputs, HType type) : super(inputs) {
|
| + instructionType = type;
|
| }
|
| toString() => 'literal list';
|
| accept(HVisitor visitor) => visitor.visitLiteralList(this);
|
| @@ -2310,13 +2314,13 @@
|
|
|
| class HStringConcat extends HInstruction {
|
| final Node node;
|
| - HStringConcat(HInstruction left, HInstruction right, this.node)
|
| + HStringConcat(HInstruction left, HInstruction right, this.node, HType type)
|
| : super(<HInstruction>[left, right]) {
|
| // TODO(sra): Until Issue 9293 is fixed, this false dependency keeps the
|
| // concats bunched with stringified inputs for much better looking code with
|
| // fewer temps.
|
| sideEffects.setDependsOnSomething();
|
| - instructionType = HType.STRING;
|
| + instructionType = type;
|
| }
|
|
|
| HInstruction get left => inputs[0];
|
| @@ -2332,10 +2336,11 @@
|
| */
|
| class HStringify extends HInstruction {
|
| final Node node;
|
| - HStringify(HInstruction input, this.node) : super(<HInstruction>[input]) {
|
| + HStringify(HInstruction input, this.node, HType type)
|
| + : super(<HInstruction>[input]) {
|
| sideEffects.setAllSideEffects();
|
| sideEffects.setDependsOnSomething();
|
| - instructionType = HType.STRING;
|
| + instructionType = type;
|
| }
|
|
|
| accept(HVisitor visitor) => visitor.visitStringify(this);
|
|
|