| Index: pkg/compiler/lib/src/ssa/builder_kernel.dart
|
| diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
|
| index f53eddf9aac93f36d60f222eaa7c1a40e8dddc15..f3e651b44c269fbbf63bd0f6413df449807f18b9 100644
|
| --- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
|
| +++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
|
| @@ -32,6 +32,7 @@ import '../universe/call_structure.dart' show CallStructure;
|
| import '../universe/selector.dart';
|
| import '../universe/use.dart' show StaticUse, TypeUse;
|
| import '../universe/side_effects.dart' show SideEffects;
|
| +import '../world.dart' show ClosedWorld;
|
| import 'graph_builder.dart';
|
| import 'kernel_ast_adapter.dart';
|
| import 'kernel_string_builder.dart';
|
| @@ -207,7 +208,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| value, compiler.coreTypes.boolType,
|
| kind: HTypeConversion.BOOLEAN_CONVERSION_CHECK);
|
| }
|
| - HInstruction result = new HBoolify(value, backend.boolType);
|
| + HInstruction result = new HBoolify(value, commonMasks.boolType);
|
| add(result);
|
| return result;
|
| }
|
| @@ -244,8 +245,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| astAdapter.getClass(constructor.enclosingClass),
|
| constructorArguments,
|
| new TypeMask.nonNullExact(
|
| - astAdapter.getClass(constructor.enclosingClass),
|
| - compiler.closedWorld),
|
| + astAdapter.getClass(constructor.enclosingClass), closedWorld),
|
| instantiatedTypes: <DartType>[
|
| astAdapter.getClass(constructor.enclosingClass).thisType
|
| ],
|
| @@ -426,8 +426,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
|
|
| /// Pushes a boolean checking [expression] against null.
|
| pushCheckNull(HInstruction expression) {
|
| - push(new HIdentity(
|
| - expression, graph.addConstantNull(compiler), null, backend.boolType));
|
| + push(new HIdentity(expression, graph.addConstantNull(compiler), null,
|
| + commonMasks.boolType));
|
| }
|
|
|
| @override
|
| @@ -447,7 +447,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| HInstruction errorMessage =
|
| graph.addConstantString(new DartString.literal(message), compiler);
|
| HInstruction trap = new HForeignCode(js.js.parseForeignJS("#.#"),
|
| - backend.dynamicType, <HInstruction>[nullValue, errorMessage]);
|
| + commonMasks.dynamicType, <HInstruction>[nullValue, errorMessage]);
|
| trap.sideEffects
|
| ..setAllSideEffects()
|
| ..setDependsOnSomething();
|
| @@ -590,7 +590,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
|
|
| HInstruction buildGetLength() {
|
| HFieldGet result = new HFieldGet(
|
| - astAdapter.jsIndexableLength, array, backend.positiveIntType,
|
| + astAdapter.jsIndexableLength, array, commonMasks.positiveIntType,
|
| isAssignable: !isFixed);
|
| add(result);
|
| return result;
|
| @@ -604,7 +604,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| // array.length == _end || throwConcurrentModificationError(array)
|
| //
|
| HInstruction length = buildGetLength();
|
| - push(new HIdentity(length, originalLength, null, backend.boolType));
|
| + push(new HIdentity(length, originalLength, null, commonMasks.boolType));
|
| _pushStaticInvocation(
|
| astAdapter.checkConcurrentModificationError,
|
| [pop(), array],
|
| @@ -624,7 +624,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| HInstruction buildCondition() {
|
| HInstruction index = localsHandler.readLocal(indexVariable);
|
| HInstruction length = buildGetLength();
|
| - HInstruction compare = new HLess(index, length, null, backend.boolType);
|
| + HInstruction compare =
|
| + new HLess(index, length, null, commonMasks.boolType);
|
| add(compare);
|
| return compare;
|
| }
|
| @@ -663,7 +664,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| HInstruction index = localsHandler.readLocal(indexVariable);
|
| HInstruction one = graph.addConstantInt(1, compiler);
|
| HInstruction addInstruction =
|
| - new HAdd(index, one, null, backend.positiveIntType);
|
| + new HAdd(index, one, null, commonMasks.positiveIntType);
|
| add(addInstruction);
|
| localsHandler.updateLocal(indexVariable, addInstruction);
|
| }
|
| @@ -718,7 +719,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| ir.Procedure typeInfoSetterFn = astAdapter.setRuntimeTypeInfo;
|
| // TODO(efortuna): Insert source information in this static invocation.
|
| _pushStaticInvocation(typeInfoSetterFn, <HInstruction>[newObject, typeInfo],
|
| - backend.dynamicType);
|
| + commonMasks.dynamicType);
|
|
|
| // The new object will now be referenced through the
|
| // `setRuntimeTypeInfo` call. We therefore set the type of that
|
| @@ -895,14 +896,15 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| element.accept(this);
|
| elements.add(pop());
|
| }
|
| - listInstruction = new HLiteralList(elements, backend.extendableArrayType);
|
| + listInstruction =
|
| + new HLiteralList(elements, commonMasks.extendableArrayType);
|
| add(listInstruction);
|
| listInstruction =
|
| setListRuntimeTypeInfoIfNeeded(listInstruction, listLiteral);
|
| }
|
|
|
| TypeMask type = astAdapter.typeOfListLiteral(targetElement, listLiteral);
|
| - if (!type.containsAll(compiler.closedWorld)) {
|
| + if (!type.containsAll(closedWorld)) {
|
| listInstruction.instructionType = type;
|
| }
|
| stack.add(listInstruction);
|
| @@ -932,7 +934,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| } else {
|
| constructor = astAdapter.mapLiteralConstructor;
|
| HLiteralList argList =
|
| - new HLiteralList(constructorArgs, backend.extendableArrayType);
|
| + new HLiteralList(constructorArgs, commonMasks.extendableArrayType);
|
| add(argList);
|
| inputs.add(argList);
|
| }
|
| @@ -973,12 +975,11 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| // type inference might discover a more specific type, or find nothing (in
|
| // dart2js unit tests).
|
| TypeMask mapType = new TypeMask.nonNullSubtype(
|
| - astAdapter.getElement(astAdapter.mapLiteralClass),
|
| - compiler.closedWorld);
|
| + astAdapter.getElement(astAdapter.mapLiteralClass), closedWorld);
|
| TypeMask returnTypeMask = TypeMaskFactory.inferredReturnTypeForElement(
|
| astAdapter.getElement(constructor), compiler);
|
| TypeMask instructionType =
|
| - mapType.intersection(returnTypeMask, compiler.closedWorld);
|
| + mapType.intersection(returnTypeMask, closedWorld);
|
|
|
| addImplicitInstantiation(type);
|
| _pushStaticInvocation(constructor, inputs, instructionType);
|
| @@ -1009,7 +1010,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| dartType, sourceElement,
|
| sourceInformation: null);
|
| _pushStaticInvocation(astAdapter.runtimeTypeToString,
|
| - <HInstruction>[value], backend.stringType);
|
| + <HInstruction>[value], commonMasks.stringType);
|
| _pushStaticInvocation(astAdapter.createRuntimeType, <HInstruction>[pop()],
|
| astAdapter.createRuntimeTypeReturnType);
|
| return;
|
| @@ -1374,7 +1375,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| // to fetch the static state.
|
| String name = backend.namer.staticStateHolder;
|
| push(new HForeignCode(
|
| - js.js.parseForeignJS(name), backend.dynamicType, <HInstruction>[],
|
| + js.js.parseForeignJS(name), commonMasks.dynamicType, <HInstruction>[],
|
| nativeBehavior: native.NativeBehavior.DEPENDS_OTHER));
|
| } else {
|
| // Call a helper method from the isolate library. The isolate library uses
|
| @@ -1385,7 +1386,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| compiler.reporter.internalError(astAdapter.getNode(invocation),
|
| 'Isolate library and compiler mismatch.');
|
| }
|
| - _pushStaticInvocation(target, <HInstruction>[], backend.dynamicType);
|
| + _pushStaticInvocation(target, <HInstruction>[], commonMasks.dynamicType);
|
| }
|
| }
|
|
|
| @@ -1401,7 +1402,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| // If the isolate library is not used, we ignore the isolate argument and
|
| // just invoke the closure.
|
| push(new HInvokeClosure(new Selector.callClosure(0),
|
| - <HInstruction>[inputs[1]], backend.dynamicType));
|
| + <HInstruction>[inputs[1]], commonMasks.dynamicType));
|
| } else {
|
| // Call a helper method from the isolate library.
|
| ir.Procedure callInIsolate = astAdapter.callInIsolate;
|
| @@ -1409,7 +1410,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| compiler.reporter.internalError(astAdapter.getNode(invocation),
|
| 'Isolate library and compiler mismatch.');
|
| }
|
| - _pushStaticInvocation(callInIsolate, inputs, backend.dynamicType);
|
| + _pushStaticInvocation(callInIsolate, inputs, commonMasks.dynamicType);
|
| }
|
| }
|
|
|
| @@ -1443,7 +1444,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| push(new HForeignCode(
|
| js.js.expressionTemplateYielding(backend.emitter
|
| .staticFunctionAccess(astAdapter.getMember(staticTarget))),
|
| - backend.dynamicType,
|
| + commonMasks.dynamicType,
|
| <HInstruction>[],
|
| nativeBehavior: native.NativeBehavior.PURE));
|
| return;
|
| @@ -1470,8 +1471,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| String isolateName = backend.namer.staticStateHolder;
|
| SideEffects sideEffects = new SideEffects.empty();
|
| sideEffects.setAllSideEffects();
|
| - push(new HForeignCode(
|
| - js.js.parseForeignJS("$isolateName = #"), backend.dynamicType, inputs,
|
| + push(new HForeignCode(js.js.parseForeignJS("$isolateName = #"),
|
| + commonMasks.dynamicType, inputs,
|
| nativeBehavior: native.NativeBehavior.CHANGES_OTHER,
|
| effects: sideEffects));
|
| }
|
| @@ -1483,7 +1484,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| }
|
|
|
| push(new HForeignCode(js.js.parseForeignJS(backend.namer.staticStateHolder),
|
| - backend.dynamicType, <HInstruction>[],
|
| + commonMasks.dynamicType, <HInstruction>[],
|
| nativeBehavior: native.NativeBehavior.DEPENDS_OTHER));
|
| }
|
|
|
| @@ -1670,7 +1671,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| return;
|
| }
|
| List<HInstruction> inputs = _visitPositionalArguments(invocation.arguments);
|
| - push(new HStringConcat(inputs[0], inputs[1], backend.stringType));
|
| + push(new HStringConcat(inputs[0], inputs[1], commonMasks.stringType));
|
| }
|
|
|
| void _pushStaticInvocation(
|
| @@ -1736,8 +1737,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| capturedVariables.add(localsHandler.readLocal(capturedLocal));
|
| });
|
|
|
| - TypeMask type =
|
| - new TypeMask.nonNullExact(closureClassElement, compiler.closedWorld);
|
| + TypeMask type = new TypeMask.nonNullExact(closureClassElement, closedWorld);
|
| // TODO(efortuna): Add source information here.
|
| push(new HCreate(closureClassElement, capturedVariables, type));
|
|
|
| @@ -1798,7 +1798,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
|
|
| HInterceptor _interceptorFor(HInstruction intercepted) {
|
| HInterceptor interceptor =
|
| - new HInterceptor(intercepted, backend.nonNullType);
|
| + new HInterceptor(intercepted, commonMasks.nonNullType);
|
| add(interceptor);
|
| return interceptor;
|
| }
|
| @@ -1835,7 +1835,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| null,
|
| isSetter: selector.isSetter || selector.isIndexSet);
|
| instruction.sideEffects =
|
| - compiler.closedWorld.getSideEffectsOfSelector(selector, null);
|
| + closedWorld.getSideEffectsOfSelector(selector, null);
|
| push(instruction);
|
| }
|
|
|
| @@ -1846,7 +1846,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| List<HInstruction> arguments =
|
| _visitArgumentsForStaticTarget(target.function, invocation.arguments);
|
| TypeMask typeMask = new TypeMask.nonNullExact(
|
| - astAdapter.getElement(target.enclosingClass), compiler.closedWorld);
|
| + astAdapter.getElement(target.enclosingClass), closedWorld);
|
| _pushStaticInvocation(target, arguments, typeMask);
|
| }
|
|
|
| @@ -1868,17 +1868,17 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| if (type is MalformedType) {
|
| ErroneousElement element = type.element;
|
| generateTypeError(isExpression, element.message);
|
| - push(new HIs.compound(type, expression, pop(), backend.boolType));
|
| + push(new HIs.compound(type, expression, pop(), commonMasks.boolType));
|
| return;
|
| }
|
|
|
| if (type.isFunctionType) {
|
| List arguments = <HInstruction>[buildFunctionType(type), expression];
|
| - _pushDynamicInvocation(isExpression, backend.boolType, arguments,
|
| + _pushDynamicInvocation(isExpression, commonMasks.boolType, arguments,
|
| selector: new Selector.call(
|
| new PrivateName('_isTest', astAdapter.jsHelperLibrary),
|
| CallStructure.ONE_ARG));
|
| - push(new HIs.compound(type, expression, pop(), backend.boolType));
|
| + push(new HIs.compound(type, expression, pop(), commonMasks.boolType));
|
| return;
|
| }
|
|
|
| @@ -1886,22 +1886,22 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| HInstruction runtimeType =
|
| typeBuilder.addTypeVariableReference(type, sourceElement);
|
| _pushStaticInvocation(astAdapter.checkSubtypeOfRuntimeType,
|
| - <HInstruction>[expression, runtimeType], backend.boolType);
|
| - push(new HIs.variable(type, expression, pop(), backend.boolType));
|
| + <HInstruction>[expression, runtimeType], commonMasks.boolType);
|
| + push(new HIs.variable(type, expression, pop(), commonMasks.boolType));
|
| return;
|
| }
|
|
|
| // TODO(sra): Type with type parameters.
|
|
|
| if (backend.hasDirectCheckFor(type)) {
|
| - push(new HIs.direct(type, expression, backend.boolType));
|
| + push(new HIs.direct(type, expression, commonMasks.boolType));
|
| return;
|
| }
|
|
|
| // The interceptor is not always needed. It is removed by optimization
|
| // when the receiver type or tested type permit.
|
| HInterceptor interceptor = _interceptorFor(expression);
|
| - push(new HIs.raw(type, expression, interceptor, backend.boolType));
|
| + push(new HIs.raw(type, expression, interceptor, commonMasks.boolType));
|
| }
|
|
|
| @override
|
| @@ -1931,7 +1931,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
|
| @override
|
| void visitNot(ir.Not not) {
|
| not.operand.accept(this);
|
| - push(new HNot(popBoolified(), backend.boolType));
|
| + push(new HNot(popBoolified(), commonMasks.boolType));
|
| }
|
|
|
| @override
|
|
|