| Index: lib/compiler/implementation/ssa/builder.dart
|
| diff --git a/lib/compiler/implementation/ssa/builder.dart b/lib/compiler/implementation/ssa/builder.dart
|
| index fbaabf33dc42309795e95ca40a1f297b85098309..fbffcde651006065b105446665748ec054d53735 100644
|
| --- a/lib/compiler/implementation/ssa/builder.dart
|
| +++ b/lib/compiler/implementation/ssa/builder.dart
|
| @@ -948,7 +948,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| SendSet node = variable.parseNode(compiler);
|
| openFunction(variable, node);
|
| Link<Node> link = node.arguments;
|
| - assert(!link.isEmpty() && link.tail.isEmpty());
|
| + assert(!link.isEmpty && link.tail.isEmpty);
|
| visit(link.head);
|
| HInstruction value = pop();
|
| value = potentiallyCheckType(value, variable);
|
| @@ -970,12 +970,12 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| // If we know the body doesn't have any code, we don't generate it.
|
| if (node.body.asBlock() != null) {
|
| NodeList statements = node.body.asBlock().statements;
|
| - if (statements.isEmpty()) return null;
|
| + if (statements.isEmpty) return null;
|
| }
|
| ClassElement classElement = constructor.getEnclosingClass();
|
| ConstructorBodyElement bodyElement;
|
| for (Link<Element> backendMembers = classElement.backendMembers;
|
| - !backendMembers.isEmpty();
|
| + !backendMembers.isEmpty;
|
| backendMembers = backendMembers.tail) {
|
| Element backendMember = backendMembers.head;
|
| if (backendMember.isGenerativeConstructorBody()) {
|
| @@ -1187,7 +1187,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
|
|
| if (functionNode.initializers != null) {
|
| Link<Node> initializers = functionNode.initializers.nodes;
|
| - for (Link<Node> link = initializers; !link.isEmpty(); link = link.tail) {
|
| + for (Link<Node> link = initializers; !link.isEmpty; link = link.tail) {
|
| assert(link.head is Send);
|
| if (link.head is !SendSet) {
|
| // A super initializer or constructor redirection.
|
| @@ -1204,7 +1204,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| // A field initializer.
|
| SendSet init = link.head;
|
| Link<Node> arguments = init.arguments;
|
| - assert(!arguments.isEmpty() && arguments.tail.isEmpty());
|
| + assert(!arguments.isEmpty && arguments.tail.isEmpty);
|
| sourceElementStack.add(constructor);
|
| visit(arguments.head);
|
| sourceElementStack.removeLast();
|
| @@ -1595,17 +1595,17 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
|
|
| visitBlock(Block node) {
|
| for (Link<Node> link = node.statements.nodes;
|
| - !link.isEmpty();
|
| + !link.isEmpty;
|
| link = link.tail) {
|
| visit(link.head);
|
| if (isAborted()) {
|
| // The block has been aborted by a return or a throw.
|
| - if (!stack.isEmpty()) compiler.cancel('non-empty instruction stack');
|
| + if (!stack.isEmpty) compiler.cancel('non-empty instruction stack');
|
| return;
|
| }
|
| }
|
| assert(!current.isClosed());
|
| - if (!stack.isEmpty()) compiler.cancel('non-empty instruction stack');
|
| + if (!stack.isEmpty) compiler.cancel('non-empty instruction stack');
|
| }
|
|
|
| visitClassNode(ClassNode node) {
|
| @@ -1657,7 +1657,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| branchBlock.addSuccessor(loopExitBlock);
|
| open(loopExitBlock);
|
| localsHandler.endLoop(loopEntry);
|
| - if (!breakLocals.isEmpty()) {
|
| + if (!breakLocals.isEmpty) {
|
| breakLocals.add(savedLocals);
|
| localsHandler = savedLocals.mergeMultiple(breakLocals, loopExitBlock);
|
| } else {
|
| @@ -1751,7 +1751,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| HLabeledBlockInformation labelInfo;
|
| List<LabelElement> labels = jumpHandler.labels();
|
| TargetElement target = elements[loop];
|
| - if (!labels.isEmpty()) {
|
| + if (!labels.isEmpty) {
|
| beginBodyBlock.setBlockFlow(
|
| new HLabeledBlockInformation(
|
| new HSubGraphBlockInformation(bodyGraph),
|
| @@ -1873,7 +1873,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| continueLocals.add(locals);
|
| });
|
| bodyExitBlock.addSuccessor(conditionBlock);
|
| - if (!continueLocals.isEmpty()) {
|
| + if (!continueLocals.isEmpty) {
|
| continueLocals.add(localsHandler);
|
| localsHandler = savedLocals.mergeMultiple(continueLocals, conditionBlock);
|
| SubGraph bodyGraph = new SubGraph(bodyEntryBlock, bodyExitBlock);
|
| @@ -1881,7 +1881,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| HSubGraphBlockInformation bodyInfo =
|
| new HSubGraphBlockInformation(bodyGraph);
|
| HLabeledBlockInformation info;
|
| - if (!labels.isEmpty()) {
|
| + if (!labels.isEmpty) {
|
| info = new HLabeledBlockInformation(bodyInfo, labels, isContinue: true);
|
| } else {
|
| info = new HLabeledBlockInformation.implicit(bodyInfo, target,
|
| @@ -1934,7 +1934,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| compiler.enqueuer.codegen.addToWorkList(callElement, elements);
|
| // TODO(ahe): This should be registered in codegen, not here.
|
| compiler.enqueuer.codegen.registerInstantiatedClass(closureClassElement);
|
| - assert(closureClassElement.localScope.isEmpty());
|
| + assert(closureClassElement.localScope.isEmpty);
|
|
|
| List<HInstruction> capturedVariables = <HInstruction>[];
|
| for (Element member in closureClassElement.backendMembers) {
|
| @@ -2395,7 +2395,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| new Map<SourceString, HInstruction>();
|
| List<SourceString> namedArguments = selector.namedArguments;
|
| int nameIndex = 0;
|
| - for (; !arguments.isEmpty(); arguments = arguments.tail) {
|
| + for (; !arguments.isEmpty; arguments = arguments.tail) {
|
| visit(arguments.head);
|
| instructions[namedArguments[nameIndex++]] = pop();
|
| }
|
| @@ -2447,7 +2447,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| }
|
|
|
| void addGenericSendArgumentsToList(Link<Node> link, List<HInstruction> list) {
|
| - for (; !link.isEmpty(); link = link.tail) {
|
| + for (; !link.isEmpty; link = link.tail) {
|
| visit(link.head);
|
| list.add(pop());
|
| }
|
| @@ -2459,7 +2459,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
|
|
| SourceString dartMethodName;
|
| bool isNotEquals = false;
|
| - if (node.isIndex && !node.arguments.tail.isEmpty()) {
|
| + if (node.isIndex && !node.arguments.tail.isEmpty) {
|
| dartMethodName = Elements.constructOperatorName(
|
| const SourceString('[]='), false);
|
| } else if (node.selector.asOperator() != null) {
|
| @@ -2528,7 +2528,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| // If the invoke is on foreign code, don't visit the first
|
| // argument, which is the type, and the second argument,
|
| // which is the foreign code.
|
| - if (link.isEmpty() || link.tail.isEmpty()) {
|
| + if (link.isEmpty || link.tail.isEmpty) {
|
| compiler.cancel('At least two arguments expected',
|
| node: node.argumentsNode);
|
| }
|
| @@ -2559,7 +2559,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
|
|
| void handleForeignUnintercepted(Send node) {
|
| Link<Node> link = node.arguments;
|
| - if (!link.tail.isEmpty()) {
|
| + if (!link.tail.isEmpty) {
|
| compiler.cancel(
|
| 'More than one expression in UNINTERCEPTED()', node: node);
|
| }
|
| @@ -2571,7 +2571,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
|
|
| void handleForeignJsHasEquals(Send node) {
|
| List<HInstruction> inputs = <HInstruction>[];
|
| - if (!node.arguments.tail.isEmpty()) {
|
| + if (!node.arguments.tail.isEmpty) {
|
| compiler.cancel(
|
| 'More than one expression in JS_HAS_EQUALS()', node: node);
|
| }
|
| @@ -2584,7 +2584,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| }
|
|
|
| void handleForeignJsCurrentIsolate(Send node) {
|
| - if (!node.arguments.isEmpty()) {
|
| + if (!node.arguments.isEmpty) {
|
| compiler.cancel(
|
| 'Too many arguments to JS_CURRENT_ISOLATE', node: node);
|
| }
|
| @@ -2635,7 +2635,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| }
|
|
|
| void handleForeignDartClosureToJs(Send node) {
|
| - if (node.arguments.isEmpty() || !node.arguments.tail.isEmpty()) {
|
| + if (node.arguments.isEmpty || !node.arguments.tail.isEmpty) {
|
| compiler.cancel('Exactly one argument required',
|
| node: node.argumentsNode);
|
| }
|
| @@ -2806,7 +2806,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| } else if (type is InterfaceType) {
|
| bool isFirstVariable = true;
|
| InterfaceType interfaceType = type;
|
| - bool hasTypeArguments = !interfaceType.arguments.isEmpty();
|
| + bool hasTypeArguments = !interfaceType.arguments.isEmpty;
|
| if (!isInQuotes) template.add("'");
|
| template.add(rti.getName(type.element));
|
| if (hasTypeArguments) {
|
| @@ -2853,7 +2853,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| void callSetRuntimeTypeInfo(ClassElement element,
|
| List<HInstruction> rtiInputs,
|
| HInstruction newObject) {
|
| - bool needsRti = compiler.world.needsRti(element) && !rtiInputs.isEmpty();
|
| + bool needsRti = compiler.world.needsRti(element) && !rtiInputs.isEmpty;
|
| bool runtimeTypeIsUsed = compiler.enabledRuntimeType;
|
| if (!needsRti && !runtimeTypeIsUsed) return;
|
|
|
| @@ -2904,7 +2904,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| Element originalElement = elements[node];
|
| if (identical(originalElement.getEnclosingClass(), compiler.listClass)) {
|
| isListConstructor = true;
|
| - if (node.arguments.isEmpty()) {
|
| + if (node.arguments.isEmpty) {
|
| return HType.EXTENDABLE_ARRAY;
|
| } else {
|
| return HType.MUTABLE_ARRAY;
|
| @@ -3169,7 +3169,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| } else if (const SourceString("=") == op.source) {
|
| Element element = elements[node];
|
| Link<Node> link = node.arguments;
|
| - assert(!link.isEmpty() && link.tail.isEmpty());
|
| + assert(!link.isEmpty && link.tail.isEmpty);
|
| visit(link.head);
|
| HInstruction value = pop();
|
| generateSetter(node, element, value);
|
| @@ -3180,7 +3180,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| const SourceString("--") == op.source ||
|
| node.assignmentOperator.source.stringValue.endsWith("="));
|
| Element element = elements[node];
|
| - bool isCompoundAssignment = !node.arguments.isEmpty();
|
| + bool isCompoundAssignment = !node.arguments.isEmpty;
|
| bool isPrefix = !node.isPostfix; // Compound assignments are prefix.
|
|
|
| // [receiver] is only used if the node is an instance send.
|
| @@ -3248,7 +3248,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| }
|
|
|
| visitNodeList(NodeList node) {
|
| - for (Link<Node> link = node.nodes; !link.isEmpty(); link = link.tail) {
|
| + for (Link<Node> link = node.nodes; !link.isEmpty; link = link.tail) {
|
| if (isAborted()) {
|
| compiler.reportWarning(link.head, 'dead code');
|
| } else {
|
| @@ -3293,7 +3293,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| visit(node.expression);
|
| value = pop();
|
| }
|
| - if (!inliningStack.isEmpty()) {
|
| + if (!inliningStack.isEmpty) {
|
| localsHandler.updateLocal(returnElement, value);
|
| } else {
|
| close(attachPosition(new HReturn(value), node)).addSuccessor(graph.exit);
|
| @@ -3322,7 +3322,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
|
|
| visitVariableDefinitions(VariableDefinitions node) {
|
| for (Link<Node> link = node.definitions.nodes;
|
| - !link.isEmpty();
|
| + !link.isEmpty;
|
| link = link.tail) {
|
| Node definition = link.head;
|
| if (definition is Identifier) {
|
| @@ -3346,7 +3346,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
|
|
| List<HInstruction> inputs = <HInstruction>[];
|
| for (Link<Node> link = node.elements.nodes;
|
| - !link.isEmpty();
|
| + !link.isEmpty;
|
| link = link.tail) {
|
| visit(link.head);
|
| inputs.add(pop());
|
| @@ -3542,7 +3542,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| }
|
| List<HInstruction> inputs = <HInstruction>[];
|
| for (Link<Node> link = node.entries.nodes;
|
| - !link.isEmpty();
|
| + !link.isEmpty;
|
| link = link.tail) {
|
| visit(link.head);
|
| inputs.addLast(pop());
|
| @@ -3569,7 +3569,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| HBasicBlock startBlock = openNewBlock();
|
| visit(node.expression);
|
| HInstruction expression = pop();
|
| - if (node.cases.isEmpty()) {
|
| + if (node.cases.isEmpty) {
|
| return;
|
| }
|
|
|
| @@ -3668,7 +3668,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| HBasicBlock expressionStart = openNewBlock();
|
| visit(node.expression);
|
| HInstruction expression = pop();
|
| - if (node.cases.isEmpty()) {
|
| + if (node.cases.isEmpty) {
|
| return true;
|
| }
|
| HBasicBlock expressionEnd = current;
|
| @@ -3834,14 +3834,14 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| }
|
|
|
| Link<Node> skipLabels(Link<Node> labelsAndCases) {
|
| - while (!labelsAndCases.isEmpty() && labelsAndCases.head is Label) {
|
| + while (!labelsAndCases.isEmpty && labelsAndCases.head is Label) {
|
| labelsAndCases = labelsAndCases.tail;
|
| }
|
| return labelsAndCases;
|
| }
|
|
|
| Link<Node> labelsAndCases = skipLabels(node.labelsAndCases.nodes);
|
| - if (labelsAndCases.isEmpty()) {
|
| + if (labelsAndCases.isEmpty) {
|
| // Default case with no expressions.
|
| if (!node.isDefaultCase) {
|
| compiler.internalError("Case with no expression and not default",
|
| @@ -3877,7 +3877,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
|
|
| // If this is the last expression, just return it.
|
| Link<Node> tail = skipLabels(remainingCases.tail);
|
| - if (tail.isEmpty()) {
|
| + if (tail.isEmpty) {
|
| left();
|
| return;
|
| }
|
| @@ -3892,7 +3892,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
|
|
| if (node.isDefaultCase) {
|
| // Default case must be last.
|
| - assert(cases.tail.isEmpty());
|
| + assert(cases.tail.isEmpty);
|
| // Perform the tests until one of them match, but then always execute the
|
| // statements.
|
| // TODO(lrn): Stop performing tests when all expressions are compile-time
|
| @@ -3900,7 +3900,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| handleIf(node, () { buildTests(labelsAndCases); }, (){}, null);
|
| visit(node.statements);
|
| } else {
|
| - if (cases.tail.isEmpty()) {
|
| + if (cases.tail.isEmpty) {
|
| handleIf(node,
|
| () { buildTests(labelsAndCases); },
|
| () { visit(node.statements); },
|
| @@ -3951,7 +3951,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| SubGraph catchGraph = null;
|
| HParameterValue exception = null;
|
|
|
| - if (!node.catchBlocks.isEmpty()) {
|
| + if (!node.catchBlocks.isEmpty) {
|
| localsHandler = new LocalsHandler.from(savedLocals);
|
| startCatchBlock = graph.addNewBlock();
|
| open(startCatchBlock);
|
| @@ -4016,7 +4016,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
| }
|
|
|
| void visitElse() {
|
| - if (link.isEmpty()) {
|
| + if (link.isEmpty) {
|
| close(new HThrow(exception, isRethrow: true));
|
| } else {
|
| CatchBlock newBlock = link.head;
|
| @@ -4451,7 +4451,7 @@ class SsaBranchBuilder {
|
| (isAnd ? send.isLogicalAnd : send.isLogicalOr)) {
|
| Node newLeft = send.receiver;
|
| Link<Node> link = send.argumentsNode.nodes;
|
| - assert(link.tail.isEmpty());
|
| + assert(link.tail.isEmpty);
|
| Node middle = link.head;
|
| handleLogicalAndOrWithLeftNode(
|
| newLeft,
|
| @@ -4493,7 +4493,7 @@ class SsaBranchBuilder {
|
| HBasicBlock elseBlock = elseBranch.block;
|
| HBasicBlock joinBlock;
|
| // If at least one branch did not abort, open the joinBranch.
|
| - if (!joinBranch.block.predecessors.isEmpty()) {
|
| + if (!joinBranch.block.predecessors.isEmpty) {
|
| startBranch(joinBranch);
|
| joinBlock = joinBranch.block;
|
| }
|
|
|