| Index: pkg/compiler/lib/src/ssa/builder.dart
|
| diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart
|
| index f3e3ade6e2f78004a9e0e12e2877dec8aea392af..323609941cfd032e7548111c0ac7494a8109f4e4 100644
|
| --- a/pkg/compiler/lib/src/ssa/builder.dart
|
| +++ b/pkg/compiler/lib/src/ssa/builder.dart
|
| @@ -743,7 +743,8 @@ class SsaBuilder extends ast.Visitor
|
| parameters.values.where((p) => p.instructionType.isEmpty);
|
| if (emptyParameters.length > 0) {
|
| addComment('${emptyParameters} inferred as [empty]');
|
| - pushInvokeStatic(function.body, helpers.assertUnreachableMethod, []);
|
| + pushInvokeStatic(helpers.assertUnreachableMethod, [],
|
| + location: function.body);
|
| pop();
|
| return closeFunction();
|
| }
|
| @@ -1604,7 +1605,7 @@ class SsaBuilder extends ast.Visitor
|
| // assertHelper(condition);
|
| //
|
| visit(node.condition);
|
| - pushInvokeStatic(node, helpers.assertHelper, [pop()]);
|
| + pushInvokeStatic(helpers.assertHelper, [pop()], location: node);
|
| pop();
|
| return;
|
| }
|
| @@ -1614,12 +1615,12 @@ class SsaBuilder extends ast.Visitor
|
| //
|
| void buildCondition() {
|
| visit(node.condition);
|
| - pushInvokeStatic(node, helpers.assertTest, [pop()]);
|
| + pushInvokeStatic(helpers.assertTest, [pop()], location: node);
|
| }
|
|
|
| void fail() {
|
| visit(node.message);
|
| - pushInvokeStatic(node, helpers.assertThrow, [pop()]);
|
| + pushInvokeStatic(helpers.assertThrow, [pop()], location: node);
|
| pop();
|
| }
|
|
|
| @@ -2097,7 +2098,7 @@ class SsaBuilder extends ast.Visitor
|
| String uri = prefixElement.deferredImport.uri.toString();
|
| HInstruction uriConstant = addConstantString(uri);
|
| Element helper = helpers.checkDeferredIsLoaded;
|
| - pushInvokeStatic(location, helper, [loadIdConstant, uriConstant]);
|
| + pushInvokeStatic(helper, [loadIdConstant, uriConstant], location: location);
|
| pop();
|
| }
|
|
|
| @@ -2198,8 +2199,8 @@ class SsaBuilder extends ast.Visitor
|
| if (getter.isDeferredLoaderGetter) {
|
| generateDeferredLoaderGet(node, getter, sourceInformation);
|
| } else {
|
| - pushInvokeStatic(node, getter, <HInstruction>[],
|
| - sourceInformation: sourceInformation);
|
| + pushInvokeStatic(getter, <HInstruction>[],
|
| + sourceInformation: sourceInformation, location: node);
|
| }
|
| }
|
|
|
| @@ -2357,7 +2358,7 @@ class SsaBuilder extends ast.Visitor
|
| message: "Unexpected non instance setter: $element."));
|
| if (Elements.isStaticOrTopLevelField(element)) {
|
| if (element.isSetter) {
|
| - pushInvokeStatic(location, element, <HInstruction>[value]);
|
| + pushInvokeStatic(element, <HInstruction>[value], location: location);
|
| pop();
|
| } else {
|
| FieldElement field = element;
|
| @@ -2465,7 +2466,7 @@ class SsaBuilder extends ast.Visitor
|
| typeBuilder.addTypeVariableReference(type, sourceElement);
|
| Element helper = helpers.checkSubtypeOfRuntimeType;
|
| List<HInstruction> inputs = <HInstruction>[expression, runtimeType];
|
| - pushInvokeStatic(null, helper, inputs, typeMask: backend.boolType);
|
| + pushInvokeStatic(helper, inputs, typeMask: backend.boolType);
|
| HInstruction call = pop();
|
| return new HIs.variable(type, expression, call, backend.boolType);
|
| } else if (RuntimeTypes.hasTypeArguments(type)) {
|
| @@ -2486,7 +2487,8 @@ class SsaBuilder extends ast.Visitor
|
| representations,
|
| asFieldName
|
| ];
|
| - pushInvokeStatic(node, helper, inputs, typeMask: backend.boolType);
|
| + pushInvokeStatic(helper, inputs,
|
| + typeMask: backend.boolType, location: node);
|
| HInstruction call = pop();
|
| return new HIs.compound(type, expression, call, backend.boolType);
|
| } else {
|
| @@ -2737,7 +2739,7 @@ class SsaBuilder extends ast.Visitor
|
| if (element == null) {
|
| reporter.internalError(node, 'Isolate library and compiler mismatch.');
|
| }
|
| - pushInvokeStatic(null, element, [], typeMask: backend.dynamicType);
|
| + pushInvokeStatic(element, [], typeMask: backend.dynamicType);
|
| }
|
| }
|
|
|
| @@ -2932,7 +2934,8 @@ class SsaBuilder extends ast.Visitor
|
| }
|
| List<HInstruction> inputs = <HInstruction>[];
|
| addGenericSendArgumentsToList(link, inputs);
|
| - pushInvokeStatic(node, element, inputs, typeMask: backend.dynamicType);
|
| + pushInvokeStatic(element, inputs,
|
| + typeMask: backend.dynamicType, location: node);
|
| }
|
| }
|
|
|
| @@ -3091,7 +3094,6 @@ class SsaBuilder extends ast.Visitor
|
| constantSystem.createInt(selector.invocationMirrorKind);
|
|
|
| pushInvokeStatic(
|
| - null,
|
| createInvocationMirror,
|
| [
|
| graph.addConstant(nameConstant, compiler),
|
| @@ -3298,44 +3300,7 @@ class SsaBuilder extends ast.Visitor
|
| });
|
| // TODO(15489): Register at codegen.
|
| registry?.registerInstantiation(type);
|
| - return callSetRuntimeTypeInfoWithTypeArguments(
|
| - type.element, inputs, newObject);
|
| - }
|
| -
|
| - HInstruction callSetRuntimeTypeInfoWithTypeArguments(ClassElement element,
|
| - List<HInstruction> rtiInputs, HInstruction newObject) {
|
| - if (!backend.classNeedsRti(element)) {
|
| - return newObject;
|
| - }
|
| -
|
| - HInstruction typeInfo = new HTypeInfoExpression(
|
| - TypeInfoExpressionKind.INSTANCE,
|
| - element.thisType,
|
| - rtiInputs,
|
| - backend.dynamicType);
|
| - add(typeInfo);
|
| - return callSetRuntimeTypeInfo(typeInfo, newObject);
|
| - }
|
| -
|
| - HInstruction callSetRuntimeTypeInfo(
|
| - HInstruction typeInfo, HInstruction newObject) {
|
| - // Set the runtime type information on the object.
|
| - Element typeInfoSetterElement = helpers.setRuntimeTypeInfo;
|
| - pushInvokeStatic(
|
| - null, typeInfoSetterElement, <HInstruction>[newObject, typeInfo],
|
| - typeMask: backend.dynamicType,
|
| - sourceInformation: newObject.sourceInformation);
|
| -
|
| - // The new object will now be referenced through the
|
| - // `setRuntimeTypeInfo` call. We therefore set the type of that
|
| - // instruction to be of the object's type.
|
| - assert(invariant(CURRENT_ELEMENT_SPANNABLE,
|
| - stack.last is HInvokeStatic || stack.last == newObject,
|
| - message: "Unexpected `stack.last`: Found ${stack.last}, "
|
| - "expected ${newObject} or an HInvokeStatic. "
|
| - "State: typeInfo=$typeInfo, stack=$stack."));
|
| - stack.last.instructionType = newObject.instructionType;
|
| - return pop();
|
| + return callSetRuntimeTypeInfoWithTypeArguments(type, inputs, newObject);
|
| }
|
|
|
| void handleNewSend(ast.NewExpression node) {
|
| @@ -3514,10 +3479,11 @@ class SsaBuilder extends ast.Visitor
|
| sourceInformationBuilder.buildNew(send);
|
| potentiallyAddTypeArguments(inputs, cls, expectedType);
|
| addInlinedInstantiation(expectedType);
|
| - pushInvokeStatic(node, constructor.declaration, inputs,
|
| + pushInvokeStatic(constructor.declaration, inputs,
|
| typeMask: elementType,
|
| instanceType: expectedType,
|
| - sourceInformation: sourceInformation);
|
| + sourceInformation: sourceInformation,
|
| + location: node);
|
| removeInlinedInstantiation(expectedType);
|
| }
|
| HInstruction newInstance = stack.last;
|
| @@ -3631,9 +3597,10 @@ class SsaBuilder extends ast.Visitor
|
| new HIdentity(inputs[0], inputs[1], null, backend.boolType), node);
|
| return;
|
| } else {
|
| - pushInvokeStatic(node, function, inputs,
|
| + pushInvokeStatic(function, inputs,
|
| sourceInformation:
|
| - sourceInformationBuilder.buildCall(node, node.selector));
|
| + sourceInformationBuilder.buildCall(node, node.selector),
|
| + location: node);
|
| }
|
| }
|
|
|
| @@ -3832,9 +3799,9 @@ class SsaBuilder extends ast.Visitor
|
| DartType type = localsHandler.substInContext(typeVariable);
|
| HInstruction value = typeBuilder.analyzeTypeArgument(type, sourceElement,
|
| sourceInformation: sourceInformationBuilder.buildGet(node));
|
| - pushInvokeStatic(node, helpers.runtimeTypeToString, [value],
|
| - typeMask: backend.stringType);
|
| - pushInvokeStatic(node, helpers.createRuntimeType, [pop()]);
|
| + pushInvokeStatic(helpers.runtimeTypeToString, [value],
|
| + typeMask: backend.stringType, location: node);
|
| + pushInvokeStatic(helpers.createRuntimeType, [pop()], location: node);
|
| }
|
| }
|
|
|
| @@ -3871,7 +3838,7 @@ class SsaBuilder extends ast.Visitor
|
|
|
| void generateError(ast.Node node, String message, Element helper) {
|
| HInstruction errorMessage = addConstantString(message);
|
| - pushInvokeStatic(node, helper, [errorMessage]);
|
| + pushInvokeStatic(helper, [errorMessage], location: node);
|
| }
|
|
|
| void generateRuntimeError(ast.Node node, String message) {
|
| @@ -3921,9 +3888,8 @@ class SsaBuilder extends ast.Visitor
|
| } else {
|
| existingNamesList = graph.addConstantNull(compiler);
|
| }
|
| - pushInvokeStatic(
|
| - diagnosticNode, helper, [receiver, name, arguments, existingNamesList],
|
| - sourceInformation: sourceInformation);
|
| + pushInvokeStatic(helper, [receiver, name, arguments, existingNamesList],
|
| + sourceInformation: sourceInformation, location: diagnosticNode);
|
| }
|
|
|
| /**
|
| @@ -4164,11 +4130,11 @@ class SsaBuilder extends ast.Visitor
|
| nativeBehavior: nativeBehavior)..sourceInformation = sourceInformation;
|
| }
|
|
|
| - void pushInvokeStatic(
|
| - ast.Node location, MethodElement element, List<HInstruction> arguments,
|
| + void pushInvokeStatic(MethodElement element, List<HInstruction> arguments,
|
| {TypeMask typeMask,
|
| InterfaceType instanceType,
|
| - SourceInformation sourceInformation}) {
|
| + SourceInformation sourceInformation,
|
| + ast.Node location}) {
|
| assert(element.isDeclaration);
|
| // TODO(johnniwinther): Use [sourceInformation] instead of [location].
|
| if (tryInlineMethod(element, null, null, arguments, location,
|
| @@ -5159,7 +5125,7 @@ class SsaBuilder extends ast.Visitor
|
| inputs.add(typeBuilder.analyzeTypeArgument(argument, sourceElement));
|
| });
|
| }
|
| - pushInvokeStatic(node, targetConstructor.declaration, inputs);
|
| + pushInvokeStatic(targetConstructor.declaration, inputs, location: node);
|
| HInstruction value = pop();
|
| emitReturn(value, node);
|
| }
|
| @@ -5273,7 +5239,10 @@ class SsaBuilder extends ast.Visitor
|
| // TODO(15489): Register at codegen.
|
| registry?.registerInstantiation(type);
|
| return callSetRuntimeTypeInfoWithTypeArguments(
|
| - type.element, arguments, object);
|
| + // TODO(efortuna): this was type.element.thisType. Is this equivalent?
|
| + type,
|
| + arguments,
|
| + object);
|
| }
|
|
|
| visitLiteralList(ast.LiteralList node) {
|
| @@ -5390,8 +5359,9 @@ class SsaBuilder extends ast.Visitor
|
|
|
| visit(node.expression);
|
| HInstruction expression = pop();
|
| - pushInvokeStatic(node, helpers.streamIteratorConstructor,
|
| - [expression, graph.addConstantNull(compiler)]);
|
| + pushInvokeStatic(helpers.streamIteratorConstructor,
|
| + [expression, graph.addConstantNull(compiler)],
|
| + location: node);
|
| streamIterator = pop();
|
|
|
| void buildInitializer() {}
|
| @@ -5564,8 +5534,8 @@ class SsaBuilder extends ast.Visitor
|
| //
|
| HInstruction length = buildGetLength();
|
| push(new HIdentity(length, originalLength, null, boolType));
|
| - pushInvokeStatic(
|
| - node, helpers.checkConcurrentModificationError, [pop(), array]);
|
| + pushInvokeStatic(helpers.checkConcurrentModificationError, [pop(), array],
|
| + location: node);
|
| pop();
|
| }
|
|
|
| @@ -5749,8 +5719,8 @@ class SsaBuilder extends ast.Visitor
|
| mapType.intersection(returnTypeMask, compiler.closedWorld);
|
|
|
| addInlinedInstantiation(expectedType);
|
| - pushInvokeStatic(node, constructor, inputs,
|
| - typeMask: instructionType, instanceType: expectedType);
|
| + pushInvokeStatic(constructor, inputs,
|
| + typeMask: instructionType, instanceType: expectedType, location: node);
|
| removeInlinedInstantiation(expectedType);
|
| }
|
|
|
| @@ -6049,7 +6019,7 @@ class SsaBuilder extends ast.Visitor
|
| buildSwitchCase(switchCase);
|
| if (!isAborted()) {
|
| if (caseIterator.hasNext && isReachable) {
|
| - pushInvokeStatic(switchCase, helpers.fallThroughError, []);
|
| + pushInvokeStatic(helpers.fallThroughError, [], location: switchCase);
|
| HInstruction error = pop();
|
| closeAndGotoExit(new HThrow(error, error.sourceInformation));
|
| } else if (!isDefaultCase(switchCase)) {
|
| @@ -6269,7 +6239,7 @@ class SsaBuilder extends ast.Visitor
|
| HInstruction oldRethrowableException = rethrowableException;
|
| rethrowableException = exception;
|
|
|
| - pushInvokeStatic(node, helpers.exceptionUnwrapper, [exception]);
|
| + pushInvokeStatic(helpers.exceptionUnwrapper, [exception], location: node);
|
| HInvokeStatic unwrappedException = pop();
|
| tryInstruction.exception = exception;
|
| Link<ast.Node> link = node.catchBlocks.nodes;
|
| @@ -6314,7 +6284,8 @@ class SsaBuilder extends ast.Visitor
|
| }
|
| ast.Node trace = catchBlock.trace;
|
| if (trace != null) {
|
| - pushInvokeStatic(trace, helpers.traceFromException, [exception]);
|
| + pushInvokeStatic(helpers.traceFromException, [exception],
|
| + location: trace);
|
| HInstruction traceInstruction = pop();
|
| LocalVariableElement traceVariable = elements[trace];
|
| localsHandler.updateLocal(traceVariable, traceInstruction);
|
|
|