Version 2.15.0-114.0.dev
Merge commit '63f21ac34c9590247814e3b55ac791426dd85c20' into 'dev'
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index 87d4094..69edbdd 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -85,7 +85,7 @@
class KernelSsaGraphBuilder extends ir.Visitor<void> with ir.VisitorVoidMixin {
/// Holds the resulting SSA graph.
- final HGraph graph = new HGraph();
+ final HGraph graph = HGraph();
/// True if the builder is processing nodes inside a try statement. This is
/// important for generating control flow out of a try block like returns or
@@ -176,12 +176,12 @@
_memberContextNode =
_elementMap.getMemberContextNode(_initialTargetElement) {
_enterFrame(targetElement, null);
- this._loopHandler = new KernelLoopHandler(this);
- _typeBuilder = new KernelTypeBuilder(this, _elementMap);
+ this._loopHandler = KernelLoopHandler(this);
+ _typeBuilder = KernelTypeBuilder(this, _elementMap);
graph.element = targetElement;
graph.sourceInformation =
_sourceInformationBuilder.buildVariableDeclaration();
- this.localsHandler = new LocalsHandler(this, targetElement, targetElement,
+ this.localsHandler = LocalsHandler(this, targetElement, targetElement,
instanceType, _nativeData, _interceptorData);
}
@@ -229,7 +229,7 @@
/// Pushes a boolean checking [expression] against null.
pushCheckNull(HInstruction expression) {
- push(new HIdentity(expression, graph.addConstantNull(closedWorld),
+ push(HIdentity(expression, graph.addConstantNull(closedWorld),
_abstractValueDomain.boolType));
}
@@ -290,7 +290,7 @@
}
void goto(HBasicBlock from, HBasicBlock to) {
- from.close(new HGoto(_abstractValueDomain));
+ from.close(HGoto(_abstractValueDomain));
from.addSuccessor(to);
}
@@ -312,10 +312,10 @@
}
HLocalValue addParameter(Entity parameter, AbstractValue type,
- {bool isElided: false}) {
+ {bool isElided = false}) {
HLocalValue result = isElided
- ? new HLocalValue(parameter, type)
- : new HParameterValue(parameter, type);
+ ? HLocalValue(parameter, type)
+ : HParameterValue(parameter, type);
if (lastAddedParameter == null) {
graph.entry.addBefore(graph.entry.first, result);
} else {
@@ -327,23 +327,23 @@
HSubGraphBlockInformation wrapStatementGraph(SubGraph statements) {
if (statements == null) return null;
- return new HSubGraphBlockInformation(statements);
+ return HSubGraphBlockInformation(statements);
}
HSubExpressionBlockInformation wrapExpressionGraph(SubExpression expression) {
if (expression == null) return null;
- return new HSubExpressionBlockInformation(expression);
+ return HSubExpressionBlockInformation(expression);
}
HLiteralList _buildLiteralList(List<HInstruction> inputs) {
- return new HLiteralList(inputs, _abstractValueDomain.growableListType);
+ return HLiteralList(inputs, _abstractValueDomain.growableListType);
}
/// Called when control flow is about to change, in which case we need to
/// specify special successors if we are already in a try/catch/finally block.
void _handleInTryStatement() {
if (!_inTryStatement) return;
- HBasicBlock block = close(new HExitTry(_abstractValueDomain));
+ HBasicBlock block = close(HExitTry(_abstractValueDomain));
HBasicBlock newBlock = graph.addNewBlock();
block.addSuccessor(newBlock);
open(newBlock);
@@ -381,7 +381,7 @@
// TODO(johnniwinther): Substitute the type by the this type and type
// arguments of the current frame.
ir.DartType type = _currentFrame.staticTypeProvider.getStaticType(node);
- return new StaticType(
+ return StaticType(
_elementMap.getDartType(type), computeClassRelationFromType(type));
}
@@ -390,7 +390,7 @@
// arguments of the current frame.
ir.DartType type =
_currentFrame.staticTypeProvider.getForInIteratorType(node);
- return new StaticType(
+ return StaticType(
_elementMap.getDartType(type), computeClassRelationFromType(type));
}
@@ -406,13 +406,13 @@
if (function != null) {
asyncMarker = getAsyncMarker(function);
}
- _currentFrame = new StackFrame(
+ _currentFrame = StackFrame(
_currentFrame,
member,
asyncMarker,
_globalLocalsMap.getLocalsMap(member),
{},
- new KernelToTypeInferenceMapImpl(member, globalInferenceResults),
+ KernelToTypeInferenceMapImpl(member, globalInferenceResults),
_currentFrame != null
? _currentFrame.sourceInformationBuilder
.forContext(member, callSourceInformation)
@@ -449,7 +449,7 @@
if (fieldData.initialValue != null) {
registry.registerConstantUse(
- new ConstantUse.init(fieldData.initialValue));
+ ConstantUse.init(fieldData.initialValue));
if (targetElement.isStatic || targetElement.isTopLevel) {
/// No code is created for this field: All references inline the
/// constant value.
@@ -458,10 +458,10 @@
} else if (fieldData.isLazy) {
// The generated initializer needs be wrapped in the cyclic-error
// helper.
- registry.registerStaticUse(new StaticUse.staticInvoke(
+ registry.registerStaticUse(StaticUse.staticInvoke(
closedWorld.commonElements.cyclicThrowHelper,
CallStructure.ONE_ARG));
- registry.registerStaticUse(new StaticUse.staticInvoke(
+ registry.registerStaticUse(StaticUse.staticInvoke(
closedWorld.commonElements.throwLateFieldADI,
CallStructure.ONE_ARG));
}
@@ -565,7 +565,7 @@
constantValue != null,
failedAt(_elementMap.getMethod(function.parent),
'No constant computed for $node'));
- registry?.registerConstantUse(new ConstantUse.init(constantValue));
+ registry?.registerConstantUse(ConstantUse.init(constantValue));
}
function.positionalParameters
@@ -782,7 +782,7 @@
_addImplicitInstantiation(thisType);
List<DartType> instantiatedTypes =
- new List<InterfaceType>.from(_currentImplicitInstantiations);
+ List<InterfaceType>.from(_currentImplicitInstantiations);
HInstruction newObject;
if (isCustomElement) {
@@ -810,7 +810,7 @@
sourceInformation: sourceInformation);
constructorArguments.add(typeArgument);
}
- newObject = new HCreate(cls, constructorArguments,
+ newObject = HCreate(cls, constructorArguments,
_abstractValueDomain.createNonNullExact(cls), sourceInformation,
instantiatedTypes: instantiatedTypes,
hasRtiInput: needsTypeArguments);
@@ -827,7 +827,7 @@
List<HInstruction> bodyCallInputs = <HInstruction>[];
if (isCustomElement) {
if (interceptor == null) {
- ConstantValue constant = new InterceptorConstantValue(cls);
+ ConstantValue constant = InterceptorConstantValue(cls);
interceptor = graph.addConstant(constant, closedWorld);
}
bodyCallInputs.add(interceptor);
@@ -894,7 +894,7 @@
if (_inliningStack.isEmpty) {
_closeAndGotoExit(
- new HReturn(_abstractValueDomain, newObject, sourceInformation));
+ HReturn(_abstractValueDomain, newObject, sourceInformation));
_closeFunction();
} else {
localsHandler.updateLocal(_returnLocal, newObject,
@@ -911,7 +911,7 @@
void _invokeConstructorBody(ir.Constructor constructor,
List<HInstruction> inputs, SourceInformation sourceInformation) {
MemberEntity constructorBody = _elementMap.getConstructorBody(constructor);
- HInvokeConstructorBody invoke = new HInvokeConstructorBody(constructorBody,
+ HInvokeConstructorBody invoke = HInvokeConstructorBody(constructorBody,
inputs, _abstractValueDomain.nonNullType, sourceInformation);
add(invoke);
}
@@ -1247,7 +1247,7 @@
.isDefinitelyTrue);
if (emptyParameters.length > 0) {
_addComment('${emptyParameters} inferred as [empty]');
- add(new HInvokeStatic(
+ add(HInvokeStatic(
_commonElements.assertUnreachableMethod,
<HInstruction>[],
_abstractValueDomain.dynamicType,
@@ -1266,7 +1266,7 @@
/// having side effects which will inhibit code motion.
// TODO(sra): Figure out how to keep comment anchored without effects.
void _addComment(String text) {
- add(new HForeignCode(js.js.statementTemplateYielding(new js.Comment(text)),
+ add(HForeignCode(js.js.statementTemplateYielding(js.Comment(text)),
_abstractValueDomain.dynamicType, <HInstruction>[],
isStatement: true));
}
@@ -1331,7 +1331,7 @@
}
JGeneratorBody body = _elementMap.getGeneratorBody(function);
- push(new HInvokeGeneratorBody(
+ push(HInvokeGeneratorBody(
body,
inputs,
_abstractValueDomain.dynamicType, // TODO: better type.
@@ -1424,7 +1424,7 @@
}
function.positionalParameters.forEach(_handleParameter);
- function.namedParameters.toList()..forEach(_handleParameter);
+ function.namedParameters.toList().forEach(_handleParameter);
}
void _checkTypeVariableBounds(FunctionEntity method) {
@@ -1433,8 +1433,8 @@
ir.FunctionNode function = getFunctionNode(_elementMap, method);
for (ir.TypeParameter typeParameter in function.typeParameters) {
Local local = _localsMap.getLocalTypeVariableEntity(_elementMap
- .getTypeVariableType(new ir.TypeParameterType(
- typeParameter, ir.Nullability.nonNullable))
+ .getTypeVariableType(
+ ir.TypeParameterType(typeParameter, ir.Nullability.nonNullable))
.element);
HInstruction newParameter = localsHandler.directLocals[local];
DartType bound = _getDartTypeIfValid(typeParameter.bound);
@@ -1611,7 +1611,7 @@
Map<Local, AbstractValue> parameterMap = {};
List<ir.VariableDeclaration> elidedParameters = [];
- Set<Local> elidedParameterSet = new Set();
+ Set<Local> elidedParameterSet = Set();
if (functionNode != null) {
assert(parameterStructure != null);
@@ -1638,7 +1638,7 @@
// but cannot receive constants before it has been closed. By closing it
// here, we can use constants in the code that sets up the function.
open(graph.entry);
- close(new HGoto(_abstractValueDomain)).addSuccessor(block);
+ close(HGoto(_abstractValueDomain)).addSuccessor(block);
open(block);
localsHandler.startFunction(targetElement, parameterMap, elidedParameterSet,
@@ -1664,7 +1664,7 @@
_handleIf(
visitCondition: () {
HParameterValue parameter = parameters.values.first;
- push(new HIdentity(parameter, graph.addConstantNull(closedWorld),
+ push(HIdentity(parameter, graph.addConstantNull(closedWorld),
_abstractValueDomain.boolType));
},
visitThen: () {
@@ -1685,13 +1685,13 @@
}
void _closeFunction() {
- if (!isAborted()) _closeAndGotoExit(new HGoto(_abstractValueDomain));
+ if (!isAborted()) _closeAndGotoExit(HGoto(_abstractValueDomain));
graph.finalize(_abstractValueDomain);
}
@override
void defaultNode(ir.Node node) {
- throw new UnsupportedError("Unhandled node $node (${node.runtimeType})");
+ throw UnsupportedError("Unhandled node $node (${node.runtimeType})");
}
/// Returns the current source element. This is used by the type builder.
@@ -1721,7 +1721,7 @@
_elementMap.getSpannable(targetElement, loadLibrary),
_elementMap.getImport(loadLibrary.import));
// TODO(efortuna): Source information!
- push(new HInvokeStatic(
+ push(HInvokeStatic(
_commonElements.loadDeferredLibrary,
<HInstruction>[graph.addConstantString(loadId, closedWorld)],
_abstractValueDomain.nonNullType,
@@ -1769,8 +1769,7 @@
_handleInTryStatement();
SourceInformation sourceInformation =
_sourceInformationBuilder.buildThrow(node.expression);
- _closeAndGotoExit(
- new HThrow(_abstractValueDomain, pop(), sourceInformation));
+ _closeAndGotoExit(HThrow(_abstractValueDomain, pop(), sourceInformation));
} else {
expression.accept(this);
pop();
@@ -1788,8 +1787,8 @@
OutputUnit outputUnit =
closedWorld.outputUnitData.outputUnitForConstant(value);
ConstantValue deferredConstant =
- new DeferredGlobalConstantValue(value, outputUnit);
- registry.registerConstantUse(new ConstantUse.deferred(deferredConstant));
+ DeferredGlobalConstantValue(value, outputUnit);
+ registry.registerConstantUse(ConstantUse.deferred(deferredConstant));
stack.add(graph.addDeferredConstant(
deferredConstant, sourceInformation, closedWorld));
} else {
@@ -1913,7 +1912,7 @@
HInstruction originalLength = null; // Set for growable lists.
HInstruction buildGetLength(SourceInformation sourceInformation) {
- HGetLength result = new HGetLength(
+ HGetLength result = HGetLength(
array, _abstractValueDomain.positiveIntType,
isAssignable: !isFixed)
..sourceInformation = sourceInformation;
@@ -1931,7 +1930,7 @@
SourceInformation sourceInformation =
_sourceInformationBuilder.buildForInMoveNext(node);
HInstruction length = buildGetLength(sourceInformation);
- push(new HIdentity(length, originalLength, _abstractValueDomain.boolType)
+ push(HIdentity(length, originalLength, _abstractValueDomain.boolType)
..sourceInformation = sourceInformation);
_pushStaticInvocation(
_commonElements.checkConcurrentModificationError,
@@ -1964,9 +1963,8 @@
HInstruction index = localsHandler.readLocal(indexVariable,
sourceInformation: sourceInformation);
HInstruction length = buildGetLength(sourceInformation);
- HInstruction compare =
- new HLess(index, length, _abstractValueDomain.boolType)
- ..sourceInformation = sourceInformation;
+ HInstruction compare = HLess(index, length, _abstractValueDomain.boolType)
+ ..sourceInformation = sourceInformation;
add(compare);
return compare;
}
@@ -1990,7 +1988,7 @@
sourceInformation: sourceInformation);
// No bound check is necessary on indexer as it is immediately guarded by
// the condition.
- HInstruction value = new HIndex(array, index, type)
+ HInstruction value = HIndex(array, index, type)
..sourceInformation = sourceInformation;
add(value);
@@ -2019,7 +2017,7 @@
sourceInformation: sourceInformation);
HInstruction one = graph.addConstantInt(1, closedWorld);
HInstruction addInstruction =
- new HAdd(index, one, _abstractValueDomain.positiveIntType)
+ HAdd(index, one, _abstractValueDomain.positiveIntType)
..sourceInformation = sourceInformation;
add(addInstruction);
localsHandler.updateLocal(indexVariable, addInstruction,
@@ -2122,7 +2120,7 @@
localsHandler.substInContext(dartTypes.interfaceType(cls, [typeArg]));
// TODO(johnniwinther): This should be the exact type.
StaticType staticInstanceType =
- new StaticType(instanceType, ClassRelation.subtype);
+ StaticType(instanceType, ClassRelation.subtype);
_addImplicitInstantiation(instanceType);
SourceInformation sourceInformation =
_sourceInformationBuilder.buildForInIterator(node);
@@ -2152,7 +2150,7 @@
const <DartType>[],
_sourceInformationBuilder.buildForInMoveNext(node));
HInstruction future = pop();
- push(new HAwait(future, _abstractValueDomain.dynamicType));
+ push(HAwait(future, _abstractValueDomain.dynamicType));
return popBoolified();
}
@@ -2175,8 +2173,8 @@
void buildUpdate() {}
// Creates a synthetic try/finally block in case anything async goes amiss.
- TryCatchFinallyBuilder tryBuilder = new TryCatchFinallyBuilder(
- this, _sourceInformationBuilder.buildLoop(node));
+ TryCatchFinallyBuilder tryBuilder =
+ TryCatchFinallyBuilder(this, _sourceInformationBuilder.buildLoop(node));
// Build fake try body:
_loopHandler.handleLoop(
node,
@@ -2199,7 +2197,7 @@
_sourceInformationBuilder
// ignore:deprecated_member_use_from_same_package
.buildGeneric(node));
- add(new HAwait(pop(), _abstractValueDomain.dynamicType));
+ add(HAwait(pop(), _abstractValueDomain.dynamicType));
}
tryBuilder
@@ -2256,7 +2254,7 @@
_sourceInformationBuilder.buildLoop(node);
// TODO(efortuna): I think this can be rewritten using
// LoopHandler.handleLoop with some tricks about when the "update" happens.
- LocalsHandler savedLocals = new LocalsHandler.from(localsHandler);
+ LocalsHandler savedLocals = LocalsHandler.from(localsHandler);
CapturedLoopScope loopClosureInfo =
_closureDataLookup.getCapturedLoopScope(node);
localsHandler.startLoop(loopClosureInfo, sourceInformation);
@@ -2284,7 +2282,7 @@
HBasicBlock bodyExitBlock;
bool isAbortingBody = false;
if (current != null) {
- bodyExitBlock = close(new HGoto(_abstractValueDomain));
+ bodyExitBlock = close(HGoto(_abstractValueDomain));
} else {
isAbortingBody = true;
bodyExitBlock = lastOpenedBlock;
@@ -2310,16 +2308,15 @@
if (!isAbortingBody) continueHandlers.add(localsHandler);
localsHandler =
savedLocals.mergeMultiple(continueHandlers, conditionBlock);
- SubGraph bodyGraph = new SubGraph(bodyEntryBlock, bodyExitBlock);
+ SubGraph bodyGraph = SubGraph(bodyEntryBlock, bodyExitBlock);
List<LabelDefinition> labels = jumpHandler.labels;
HSubGraphBlockInformation bodyInfo =
- new HSubGraphBlockInformation(bodyGraph);
+ HSubGraphBlockInformation(bodyGraph);
HLabeledBlockInformation info;
if (!labels.isEmpty) {
- info =
- new HLabeledBlockInformation(bodyInfo, labels, isContinue: true);
+ info = HLabeledBlockInformation(bodyInfo, labels, isContinue: true);
} else {
- info = new HLabeledBlockInformation.implicit(bodyInfo, target,
+ info = HLabeledBlockInformation.implicit(bodyInfo, target,
isContinue: true);
}
bodyEntryBlock.setBlockFlow(info, conditionBlock);
@@ -2329,32 +2326,29 @@
node.condition.accept(this);
assert(!isAborted());
HInstruction conditionInstruction = popBoolified();
- HBasicBlock conditionEndBlock = close(new HLoopBranch(
- _abstractValueDomain,
- conditionInstruction,
- HLoopBranch.DO_WHILE_LOOP));
+ HBasicBlock conditionEndBlock = close(HLoopBranch(_abstractValueDomain,
+ conditionInstruction, HLoopBranch.DO_WHILE_LOOP));
HBasicBlock avoidCriticalEdge = addNewBlock();
conditionEndBlock.addSuccessor(avoidCriticalEdge);
open(avoidCriticalEdge);
- close(new HGoto(_abstractValueDomain));
+ close(HGoto(_abstractValueDomain));
avoidCriticalEdge.addSuccessor(loopEntryBlock); // The back-edge.
- conditionExpression =
- new SubExpression(conditionBlock, conditionEndBlock);
+ conditionExpression = SubExpression(conditionBlock, conditionEndBlock);
// Avoid a critical edge from the condition to the loop-exit body.
HBasicBlock conditionExitBlock = addNewBlock();
open(conditionExitBlock);
- close(new HGoto(_abstractValueDomain));
+ close(HGoto(_abstractValueDomain));
conditionEndBlock.addSuccessor(conditionExitBlock);
_loopHandler.endLoop(
loopEntryBlock, conditionExitBlock, jumpHandler, localsHandler);
loopEntryBlock.postProcessLoopHeader();
- SubGraph bodyGraph = new SubGraph(loopEntryBlock, bodyExitBlock);
- HLoopBlockInformation loopBlockInfo = new HLoopBlockInformation(
+ SubGraph bodyGraph = SubGraph(loopEntryBlock, bodyExitBlock);
+ HLoopBlockInformation loopBlockInfo = HLoopBlockInformation(
HLoopBlockInformation.DO_WHILE_LOOP,
null,
wrapExpressionGraph(conditionExpression),
@@ -2377,16 +2371,16 @@
// Since the body of the loop has a break, we attach a synthesized label
// to the body.
- SubGraph bodyGraph = new SubGraph(bodyEntryBlock, bodyExitBlock);
+ SubGraph bodyGraph = SubGraph(bodyEntryBlock, bodyExitBlock);
JumpTarget target = _localsMap.getJumpTargetForDo(node);
LabelDefinition label = target.addLabel('loop', isBreakTarget: true);
- HLabeledBlockInformation info = new HLabeledBlockInformation(
- new HSubGraphBlockInformation(bodyGraph), <LabelDefinition>[label]);
+ HLabeledBlockInformation info = HLabeledBlockInformation(
+ HSubGraphBlockInformation(bodyGraph), <LabelDefinition>[label]);
loopEntryBlock.setBlockFlow(info, current);
jumpHandler.forEachBreak((HBreak breakInstruction, _) {
HBasicBlock block = breakInstruction.block;
- block.addAtExit(new HBreak.toLabel(
- _abstractValueDomain, label, sourceInformation));
+ block.addAtExit(
+ HBreak.toLabel(_abstractValueDomain, label, sourceInformation));
block.remove(breakInstruction);
});
}
@@ -2409,7 +2403,7 @@
void visitThen(),
void visitElse(),
SourceInformation sourceInformation}) {
- SsaBranchBuilder branchBuilder = new SsaBranchBuilder(this,
+ SsaBranchBuilder branchBuilder = SsaBranchBuilder(this,
node == null ? null : _elementMap.getSpannable(targetElement, node));
branchBuilder.handleIf(visitCondition, visitThen, visitElse,
sourceInformation: sourceInformation);
@@ -2545,16 +2539,16 @@
/// to distinguish the synthesized loop created for a switch statement with
/// continue statements from simple switch statements.
JumpHandler createJumpHandler(ir.TreeNode node, JumpTarget target,
- {bool isLoopJump: false}) {
+ {bool isLoopJump = false}) {
if (target == null) {
// No breaks or continues to this node.
- return new NullJumpHandler(reporter);
+ return NullJumpHandler(reporter);
}
if (isLoopJump && node is ir.SwitchStatement) {
- return new KernelSwitchCaseJumpHandler(this, target, node, _localsMap);
+ return KernelSwitchCaseJumpHandler(this, target, node, _localsMap);
}
- return new JumpHandler(this, target);
+ return JumpHandler(this, target);
}
@override
@@ -2599,11 +2593,11 @@
JumpHandler handler = createJumpHandler(node, jumpTarget);
- LocalsHandler beforeLocals = new LocalsHandler.from(localsHandler);
+ LocalsHandler beforeLocals = LocalsHandler.from(localsHandler);
HBasicBlock newBlock = openNewBlock();
body.accept(this);
- SubGraph bodyGraph = new SubGraph(newBlock, lastOpenedBlock);
+ SubGraph bodyGraph = SubGraph(newBlock, lastOpenedBlock);
HBasicBlock joinBlock = graph.addNewBlock();
List<LocalsHandler> breakHandlers = <LocalsHandler>[];
@@ -2622,8 +2616,8 @@
// There was at least one reachable break, so the label is needed.
newBlock.setBlockFlow(
- new HLabeledBlockInformation(
- new HSubGraphBlockInformation(bodyGraph), handler.labels),
+ HLabeledBlockInformation(
+ HSubGraphBlockInformation(bodyGraph), handler.labels),
joinBlock);
handler.close();
}
@@ -2633,7 +2627,7 @@
Map<ir.Expression, ConstantValue> _buildSwitchCaseConstants(
ir.SwitchStatement switchStatement) {
Map<ir.Expression, ConstantValue> constants =
- new Map<ir.Expression, ConstantValue>();
+ Map<ir.Expression, ConstantValue>();
for (ir.SwitchCase switchCase in switchStatement.cases) {
for (ir.Expression caseExpression in switchCase.expressions) {
ConstantValue constant =
@@ -2663,7 +2657,7 @@
// The switch case indices must match those computed in
// [KernelSwitchCaseJumpHandler].
bool hasContinue = false;
- Map<ir.SwitchCase, int> caseIndex = new Map<ir.SwitchCase, int>();
+ Map<ir.SwitchCase, int> caseIndex = Map<ir.SwitchCase, int>();
int switchIndex = 1;
bool hasDefault = false;
for (ir.SwitchCase switchCase in node.cases) {
@@ -2782,7 +2776,7 @@
// Use null as the marker for a synthetic default clause.
// The synthetic default is added because otherwise there would be no
// good place to give a default value to the local.
- switchCases = new List<ir.SwitchCase>.from(switchCases);
+ switchCases = List<ir.SwitchCase>.from(switchCases);
switchCases.add(null);
}
@@ -2843,7 +2837,7 @@
// in the call to [handleLoop] below.
_handleSwitch(
switchStatement, // nor is buildExpression.
- new NullJumpHandler(reporter),
+ NullJumpHandler(reporter),
buildExpression,
switchStatement.cases,
getConstants,
@@ -2873,7 +2867,7 @@
// null, so we don't drop into the while loop.
void buildCondition() {
js.Template code = js.js.parseForeignJS('#');
- push(new HForeignCode(code, _abstractValueDomain.boolType,
+ push(HForeignCode(code, _abstractValueDomain.boolType,
[localsHandler.readLocal(switchTarget)],
nativeBehavior: NativeBehavior.PURE));
}
@@ -2909,7 +2903,7 @@
}
HSwitch switchInstruction =
- new HSwitch(_abstractValueDomain, <HInstruction>[expression]);
+ HSwitch(_abstractValueDomain, <HInstruction>[expression]);
HBasicBlock expressionEnd = close(switchInstruction);
LocalsHandler savedLocals = localsHandler;
@@ -2932,7 +2926,7 @@
hasDefault = true;
}
open(block);
- localsHandler = new LocalsHandler.from(savedLocals);
+ localsHandler = LocalsHandler.from(savedLocals);
buildSwitchCase(switchCase);
if (!isAborted() &&
// TODO(johnniwinther): Reinsert this if `isReachable` is no longer
@@ -2945,8 +2939,8 @@
// sure the last case does not fall through to the default case.
jumpHandler.generateBreak(sourceInformation);
}
- statements.add(
- new HSubGraphBlockInformation(new SubGraph(block, lastOpenedBlock)));
+ statements
+ .add(HSubGraphBlockInformation(SubGraph(block, lastOpenedBlock)));
}
// Add a join-block if necessary.
@@ -2956,7 +2950,7 @@
// to create the phis in [joinBlock].
// If we never jump to the join block, [caseHandlers] will stay empty, and
// the join block is never added to the graph.
- HBasicBlock joinBlock = new HBasicBlock();
+ HBasicBlock joinBlock = HBasicBlock();
List<LocalsHandler> caseHandlers = <LocalsHandler>[];
jumpHandler.forEachBreak((HBreak instruction, LocalsHandler locals) {
instruction.block.addSuccessor(joinBlock);
@@ -2969,7 +2963,7 @@
'Continue cannot target a switch.'));
});
if (!isAborted()) {
- current.close(new HGoto(_abstractValueDomain));
+ current.close(HGoto(_abstractValueDomain));
lastOpenedBlock.addSuccessor(joinBlock);
caseHandlers.add(localsHandler);
}
@@ -2979,11 +2973,11 @@
HBasicBlock defaultCase = addNewBlock();
expressionEnd.addSuccessor(defaultCase);
open(defaultCase);
- close(new HGoto(_abstractValueDomain));
+ close(HGoto(_abstractValueDomain));
defaultCase.addSuccessor(joinBlock);
caseHandlers.add(savedLocals);
- statements.add(new HSubGraphBlockInformation(
- new SubGraph(defaultCase, defaultCase)));
+ statements
+ .add(HSubGraphBlockInformation(SubGraph(defaultCase, defaultCase)));
}
assert(caseHandlers.length == joinBlock.predecessors.length);
if (caseHandlers.isNotEmpty) {
@@ -3000,11 +2994,11 @@
}
HSubExpressionBlockInformation expressionInfo =
- new HSubExpressionBlockInformation(
- new SubExpression(expressionStart, expressionEnd));
+ HSubExpressionBlockInformation(
+ SubExpression(expressionStart, expressionEnd));
expressionStart.setBlockFlow(
- new HSwitchBlockInformation(expressionInfo, statements,
- jumpHandler.target, jumpHandler.labels, sourceInformation),
+ HSwitchBlockInformation(expressionInfo, statements, jumpHandler.target,
+ jumpHandler.labels, sourceInformation),
joinBlock);
jumpHandler.close();
@@ -3012,14 +3006,14 @@
@override
void visitConditionalExpression(ir.ConditionalExpression node) {
- SsaBranchBuilder brancher = new SsaBranchBuilder(this);
+ SsaBranchBuilder brancher = SsaBranchBuilder(this);
brancher.handleConditional(() => node.condition.accept(this),
() => node.then.accept(this), () => node.otherwise.accept(this));
}
@override
void visitLogicalExpression(ir.LogicalExpression node) {
- SsaBranchBuilder brancher = new SsaBranchBuilder(this);
+ SsaBranchBuilder brancher = SsaBranchBuilder(this);
_handleLogicalExpression(node.left, () => node.right.accept(this), brancher,
node.operatorEnum, _sourceInformationBuilder.buildBinary(node));
}
@@ -3348,7 +3342,7 @@
FieldEntity field = _elementMap.getField(staticTarget);
FieldAnalysisData fieldData = _fieldAnalysis.getFieldData(field);
if (fieldData.isEager) {
- push(new HStatic(field, _typeInferenceMap.getInferredTypeOf(field),
+ push(HStatic(field, _typeInferenceMap.getInferredTypeOf(field),
sourceInformation));
} else if (fieldData.isEffectivelyConstant) {
OutputUnit outputUnit =
@@ -3359,10 +3353,9 @@
// unit, the old FE would still generate a deferred wrapper here.
if (!closedWorld.outputUnitData
.hasOnlyNonDeferredImportPaths(targetElement, field)) {
- ConstantValue deferredConstant = new DeferredGlobalConstantValue(
- fieldData.initialValue, outputUnit);
- registry
- .registerConstantUse(new ConstantUse.deferred(deferredConstant));
+ ConstantValue deferredConstant =
+ DeferredGlobalConstantValue(fieldData.initialValue, outputUnit);
+ registry.registerConstantUse(ConstantUse.deferred(deferredConstant));
stack.add(graph.addDeferredConstant(
deferredConstant, sourceInformation, closedWorld));
} else {
@@ -3372,7 +3365,7 @@
} else {
assert(
fieldData.isLazy, "Unexpected field data for $field: $fieldData");
- push(new HLazyStatic(field, _typeInferenceMap.getInferredTypeOf(field),
+ push(HLazyStatic(field, _typeInferenceMap.getInferredTypeOf(field),
sourceInformation));
}
} else {
@@ -3380,7 +3373,7 @@
// created a constant value instead. Remove this case when we use CFE
// constants.
FunctionEntity member = _elementMap.getMember(staticTarget);
- push(new HStatic(member, _typeInferenceMap.getInferredTypeOf(member),
+ push(HStatic(member, _typeInferenceMap.getInferredTypeOf(member),
sourceInformation));
}
}
@@ -3394,7 +3387,7 @@
SourceInformation sourceInformation =
_sourceInformationBuilder.buildGet(node);
FunctionEntity member = _elementMap.getMember(staticTarget);
- push(new HStatic(member, _typeInferenceMap.getInferredTypeOf(member),
+ push(HStatic(member, _typeInferenceMap.getInferredTypeOf(member),
sourceInformation));
}
@@ -3414,7 +3407,7 @@
} else {
MemberEntity target = _elementMap.getMember(staticTarget);
if (!_fieldAnalysis.getFieldData(target).isElided) {
- add(new HStaticStore(
+ add(HStaticStore(
_abstractValueDomain,
target,
_typeBuilder.potentiallyCheckOrTrustTypeOfAssignment(
@@ -3432,7 +3425,7 @@
node,
_getStaticType(receiver),
_typeInferenceMap.receiverTypeOfGet(node),
- new Selector.getter(_elementMap.getName(name)),
+ Selector.getter(_elementMap.getName(name)),
<HInstruction>[receiverInstruction],
const <DartType>[],
_sourceInformationBuilder.buildGet(node));
@@ -3483,7 +3476,7 @@
node,
_getStaticType(receiver),
_typeInferenceMap.receiverTypeOfSet(node, _abstractValueDomain),
- new Selector.setter(_elementMap.getName(name)),
+ Selector.setter(_elementMap.getName(name)),
<HInstruction>[receiverInstruction, valueInstruction],
const <DartType>[],
_sourceInformationBuilder.buildAssignment(node));
@@ -4015,7 +4008,7 @@
"Expected 1-2 argument, actual: $arguments."));
HInstruction lengthInput = arguments.first;
if (lengthInput.isNumber(_abstractValueDomain).isPotentiallyFalse) {
- HPrimitiveCheck conversion = new HPrimitiveCheck(
+ HPrimitiveCheck conversion = HPrimitiveCheck(
_commonElements.numType,
HPrimitiveCheck.ARGUMENT_TYPE_CHECK,
_abstractValueDomain.numType,
@@ -4025,7 +4018,7 @@
lengthInput = conversion;
}
js.Template code = js.js.parseForeignJS('new Array(#)');
- var behavior = new NativeBehavior();
+ var behavior = NativeBehavior();
DartType expectedType = _getStaticType(invocation).type;
behavior.typesInstantiated.add(expectedType);
@@ -4043,7 +4036,7 @@
var resultType = globalInferenceResults.typeOfNewList(invocation) ??
_abstractValueDomain.fixedListType;
- HForeignCode foreign = new HForeignCode(
+ HForeignCode foreign = HForeignCode(
code, resultType, <HInstruction>[lengthInput],
nativeBehavior: behavior,
throwBehavior:
@@ -4057,7 +4050,7 @@
js.Template code = js.js.parseForeignJS(r'#.fixed$length = Array');
// We set the instruction as [canThrow] to avoid it being dead code.
// We need a finer grained side effect.
- add(new HForeignCode(code, _abstractValueDomain.nullType, [stack.last],
+ add(HForeignCode(code, _abstractValueDomain.nullType, [stack.last],
throwBehavior: NativeThrowBehavior.MAY));
}
@@ -4127,7 +4120,7 @@
TypeVariableType variable = _typeVariable;
typeArguments.add(variable);
TypeRecipe recipe = TypeExpressionRecipe(variable);
- HInstruction typeEval = new HTypeEval(
+ HInstruction typeEval = HTypeEval(
instanceType, envStructure, recipe, _abstractValueDomain.dynamicType);
add(typeEval);
inputs.add(typeEval);
@@ -4137,14 +4130,14 @@
// function of N type arguments.
Selector selector =
- new Selector.callClosure(0, const <String>[], typeArguments.length);
+ Selector.callClosure(0, const <String>[], typeArguments.length);
StaticType receiverStaticType =
_getStaticType(invocation.arguments.positional[1]);
AbstractValue receiverType = _abstractValueDomain
.createFromStaticType(receiverStaticType.type,
classRelation: receiverStaticType.relation, nullable: true)
.abstractValue;
- push(new HInvokeClosure(selector, receiverType, inputs,
+ push(HInvokeClosure(selector, receiverType, inputs,
_abstractValueDomain.dynamicType, typeArguments));
return true;
@@ -4245,20 +4238,20 @@
Map<String, ir.Expression> namedArguments = {};
int kind = _readIntLiteral(invocation.arguments.positional[4]);
- Name memberName = new Name(name, _currentFrame.member.library);
+ Name memberName = Name(name, _currentFrame.member.library);
Selector selector;
switch (kind) {
case invocationMirrorGetterKind:
- selector = new Selector.getter(memberName);
+ selector = Selector.getter(memberName);
break;
case invocationMirrorSetterKind:
- selector = new Selector.setter(memberName);
+ selector = Selector.setter(memberName);
break;
case invocationMirrorMethodKind:
if (memberName == Names.INDEX_NAME) {
- selector = new Selector.index();
+ selector = Selector.index();
} else if (memberName == Names.INDEX_SET_NAME) {
- selector = new Selector.indexSet();
+ selector = Selector.indexSet();
} else {
if (namedArgumentsLiteral is ir.MapLiteral) {
namedArgumentsLiteral.entries.forEach((ir.MapLiteralEntry entry) {
@@ -4270,8 +4263,7 @@
ir.MapConstant constant = namedArgumentsLiteral.constant;
for (ir.ConstantMapEntry entry in constant.entries) {
ir.StringConstant key = entry.key;
- namedArguments[key.value] =
- new ir.ConstantExpression(entry.value);
+ namedArguments[key.value] = ir.ConstantExpression(entry.value);
}
} else {
reporter.internalError(
@@ -4279,15 +4271,15 @@
"Unexpected named arguments value in createInvocationMirrror: "
"${namedArgumentsLiteral}.");
}
- CallStructure callStructure = new CallStructure(
+ CallStructure callStructure = CallStructure(
positionalArgumentsLiteral.expressions.length,
namedArguments.keys.toList(),
typeArguments.length);
if (Selector.isOperatorName(name)) {
selector =
- new Selector(SelectorKind.OPERATOR, memberName, callStructure);
+ Selector(SelectorKind.OPERATOR, memberName, callStructure);
} else {
- selector = new Selector.call(memberName, callStructure);
+ selector = Selector.call(memberName, callStructure);
}
}
break;
@@ -4557,7 +4549,7 @@
AbstractValue ssaType =
_typeInferenceMap.typeFromNativeBehavior(nativeBehavior, closedWorld);
- push(new HForeignCode(expr, ssaType, const <HInstruction>[],
+ push(HForeignCode(expr, ssaType, const <HInstruction>[],
nativeBehavior: nativeBehavior));
}
@@ -4603,7 +4595,7 @@
AbstractValue ssaType =
_typeInferenceMap.typeFromNativeBehavior(nativeBehavior, closedWorld);
- push(new HForeignCode(template, ssaType, inputs,
+ push(HForeignCode(template, ssaType, inputs,
nativeBehavior: nativeBehavior));
}
@@ -4690,7 +4682,7 @@
InterfaceType type =
argumentConstant.representedType.withoutNullability;
// TODO(sra): Check that type is a subclass of [Interceptor].
- ConstantValue constant = new InterceptorConstantValue(type.element);
+ ConstantValue constant = InterceptorConstantValue(type.element);
HInstruction instruction = graph.addConstant(constant, closedWorld);
stack.add(instruction);
return;
@@ -4789,7 +4781,7 @@
_typeInferenceMap.typeFromNativeBehavior(nativeBehavior, closedWorld);
SourceInformation sourceInformation = null;
- HInstruction code = new HForeignCode(
+ HInstruction code = HForeignCode(
nativeBehavior.codeTemplate, ssaType, inputs,
isStatement: !nativeBehavior.codeTemplate.isExpression,
effects: nativeBehavior.sideEffects,
@@ -4824,7 +4816,7 @@
closedWorld.dartTypes
.isNonNullableIfSound(_getStaticType(invocation).type)) {
HInstruction code = pop();
- push(new HNullCheck(
+ push(HNullCheck(
code, _abstractValueDomain.excludeNull(code.instructionType),
sticky: true));
}
@@ -4838,8 +4830,7 @@
return;
}
List<HInstruction> inputs = _visitPositionalArguments(invocation.arguments);
- push(new HStringConcat(
- inputs[0], inputs[1], _abstractValueDomain.stringType));
+ push(HStringConcat(inputs[0], inputs[1], _abstractValueDomain.stringType));
}
void _handleForeignTypeRef(ir.StaticInvocation invocation) {
@@ -4904,14 +4895,14 @@
return;
}
- HInvokeStatic instruction = new HInvokeStatic(
+ HInvokeStatic instruction = HInvokeStatic(
target, arguments, typeMask, typeArguments,
targetCanThrow: !_inferredData.getCannotThrow(target))
..sourceInformation = sourceInformation;
if (_currentImplicitInstantiations.isNotEmpty) {
instruction.instantiatedTypes =
- new List<InterfaceType>.from(_currentImplicitInstantiations);
+ List<InterfaceType>.from(_currentImplicitInstantiations);
}
instruction.sideEffects = _inferredData.getSideEffectsOfElement(target);
push(instruction);
@@ -5034,7 +5025,7 @@
int i = 0;
int positions = 0;
var filteredArguments = <HInstruction>[];
- var parameterNameMap = new Map<String, js.Expression>();
+ var parameterNameMap = Map<String, js.Expression>();
// Note: we don't use `constructor.parameterStructure` here because
// we don't elide parameters to js-interop external static targets
@@ -5053,17 +5044,16 @@
if (argument != null) {
filteredArguments.add(argument);
var jsName = _nativeData.computeUnescapedJSInteropName(parameterName);
- parameterNameMap[jsName] = new js.InterpolatedExpression(positions++);
+ parameterNameMap[jsName] = js.InterpolatedExpression(positions++);
}
i++;
}
- var codeTemplate =
- new js.Template(null, js.objectLiteral(parameterNameMap));
+ var codeTemplate = js.Template(null, js.objectLiteral(parameterNameMap));
- var nativeBehavior = new NativeBehavior()..codeTemplate = codeTemplate;
+ var nativeBehavior = NativeBehavior()..codeTemplate = codeTemplate;
registry.registerNativeMethod(element);
// TODO(efortuna): Source information.
- return new HForeignCode(
+ return HForeignCode(
codeTemplate, _abstractValueDomain.dynamicType, filteredArguments,
nativeBehavior: nativeBehavior);
}
@@ -5074,7 +5064,7 @@
// the factory constructor case.
List<HInstruction> inputs = arguments.where((arg) => arg != null).toList();
- var nativeBehavior = new NativeBehavior()..sideEffects.setAllSideEffects();
+ var nativeBehavior = NativeBehavior()..sideEffects.setAllSideEffects();
DartType type = element is ConstructorEntity
? _elementEnvironment.getThisType(element.enclosingClass)
@@ -5126,8 +5116,7 @@
AbstractValue type =
_abstractValueDomain.createNonNullExact(closureClassEntity);
// TODO(efortuna): Add source information here.
- push(new HCreate(
- closureClassEntity, capturedVariables, type, sourceInformation,
+ push(HCreate(closureClassEntity, capturedVariables, type, sourceInformation,
callMethod: closureInfo.callMethod));
}
@@ -5159,7 +5148,7 @@
: _commonElements.dynamicType)
.toList();
registry.registerGenericInstantiation(
- new GenericInstantiation(functionType, typeArguments));
+ GenericInstantiation(functionType, typeArguments));
// TODO(johnniwinther): Can we avoid creating the instantiation object?
for (DartType type in typeArguments) {
HInstruction instruction =
@@ -5178,7 +5167,7 @@
stack.add(graph.addConstantNull(closedWorld));
return;
}
- HInstruction instruction = new HInvokeStatic(
+ HInstruction instruction = HInvokeStatic(
target, arguments, _abstractValueDomain.functionType, <DartType>[],
targetCanThrow: targetCanThrow);
// TODO(sra): ..sourceInformation = sourceInformation
@@ -5285,7 +5274,7 @@
HInterceptor _interceptorFor(
HInstruction intercepted, SourceInformation sourceInformation) {
HInterceptor interceptor =
- new HInterceptor(intercepted, _abstractValueDomain.nonNullType)
+ HInterceptor(intercepted, _abstractValueDomain.nonNullType)
..sourceInformation = sourceInformation;
add(interceptor);
return interceptor;
@@ -5374,15 +5363,8 @@
} else {
typeMask = _abstractValueDomain.dynamicType;
}
- HInstruction instruction = new HInvokeSuper(
- target,
- containingClass,
- selector,
- inputs,
- isIntercepted,
- typeMask,
- typeArguments,
- sourceInformation,
+ HInstruction instruction = HInvokeSuper(target, containingClass, selector,
+ inputs, isIntercepted, typeMask, typeArguments, sourceInformation,
isSetter: selector.isSetter || selector.isIndexSet);
instruction.sideEffects =
_inferredData.getSideEffectsOfSelector(selector, null);
@@ -5478,7 +5460,7 @@
variableNameInstruction,
methodNameInstruction,
];
- HInstruction checkBound = new HInvokeStatic(
+ HInstruction checkBound = HInvokeStatic(
element, inputs, typeInstruction.instructionType, const <DartType>[]);
add(checkBound);
}
@@ -5572,8 +5554,7 @@
SourceInformation sourceInformation =
_sourceInformationBuilder.buildThrow(node);
_handleInTryStatement();
- push(
- new HThrowExpression(_abstractValueDomain, pop(), sourceInformation));
+ push(HThrowExpression(_abstractValueDomain, pop(), sourceInformation));
_isReachable = false;
}
}
@@ -5591,7 +5572,7 @@
@override
void visitYieldStatement(ir.YieldStatement node) {
node.expression.accept(this);
- add(new HYield(_abstractValueDomain, pop(), node.isYieldStar,
+ add(HYield(_abstractValueDomain, pop(), node.isYieldStar,
_sourceInformationBuilder.buildYield(node)));
}
@@ -5600,7 +5581,7 @@
node.operand.accept(this);
HInstruction awaited = pop();
// TODO(herhut): Improve this type.
- push(new HAwait(awaited, _abstractValueDomain.dynamicType)
+ push(HAwait(awaited, _abstractValueDomain.dynamicType)
..sourceInformation = _sourceInformationBuilder.buildAwait(node));
}
@@ -5615,8 +5596,7 @@
_handleInTryStatement();
SourceInformation sourceInformation =
_sourceInformationBuilder.buildThrow(node);
- _closeAndGotoExit(new HThrow(
- _abstractValueDomain, exception, sourceInformation,
+ _closeAndGotoExit(HThrow(_abstractValueDomain, exception, sourceInformation,
isRethrow: true));
// ir.Rethrow is an expression so we need to push a value - a constant with
// no type.
@@ -5632,21 +5612,21 @@
@override
void visitNot(ir.Not node) {
node.operand.accept(this);
- push(new HNot(popBoolified(), _abstractValueDomain.boolType)
+ push(HNot(popBoolified(), _abstractValueDomain.boolType)
..sourceInformation = _sourceInformationBuilder.buildUnary(node));
}
@override
void visitStringConcatenation(ir.StringConcatenation stringConcat) {
- KernelStringBuilder stringBuilder = new KernelStringBuilder(this);
+ KernelStringBuilder stringBuilder = KernelStringBuilder(this);
stringConcat.accept(stringBuilder);
stack.add(stringBuilder.result);
}
@override
void visitTryCatch(ir.TryCatch node) {
- TryCatchFinallyBuilder tryBuilder = new TryCatchFinallyBuilder(
- this, _sourceInformationBuilder.buildTry(node));
+ TryCatchFinallyBuilder tryBuilder =
+ TryCatchFinallyBuilder(this, _sourceInformationBuilder.buildTry(node));
node.body.accept(this);
tryBuilder
..closeTryBody()
@@ -5664,8 +5644,8 @@
/// recursion.
@override
void visitTryFinally(ir.TryFinally node) {
- TryCatchFinallyBuilder tryBuilder = new TryCatchFinallyBuilder(
- this, _sourceInformationBuilder.buildTry(node));
+ TryCatchFinallyBuilder tryBuilder =
+ TryCatchFinallyBuilder(this, _sourceInformationBuilder.buildTry(node));
// We do these shenanigans to produce better looking code that doesn't
// have nested try statements.
@@ -5879,12 +5859,12 @@
void doInlining() {
if (function.isConstructor) {
registry.registerStaticUse(
- new StaticUse.constructorInlining(function, instanceType));
+ StaticUse.constructorInlining(function, instanceType));
} else {
assert(instanceType == null,
"Unexpected instance type for $function: $instanceType");
registry.registerStaticUse(
- new StaticUse.methodInlining(function, typeArguments));
+ StaticUse.methodInlining(function, typeArguments));
}
// Add an explicit null check on the receiver before doing the inlining.
@@ -5969,7 +5949,7 @@
ParameterStructure parameterStructure = function.parameterStructure;
List<String> selectorArgumentNames =
selector.callStructure.getOrderedNamedArguments();
- List<HInstruction> compiledArguments = new List<HInstruction>.filled(
+ List<HInstruction> compiledArguments = List<HInstruction>.filled(
parameterStructure.totalParameters +
parameterStructure.typeParameters +
1,
@@ -6062,7 +6042,7 @@
/// [SsaGraphBuilder].
void _enterInlinedMethod(FunctionEntity function,
List<HInstruction> compiledArguments, InterfaceType instanceType) {
- KernelInliningState state = new KernelInliningState(
+ KernelInliningState state = KernelInliningState(
function,
_returnLocal,
_returnType,
@@ -6088,7 +6068,7 @@
/// stores it in the [_returnLocal] field.
void _setupStateForInlining(FunctionEntity function,
List<HInstruction> compiledArguments, InterfaceType instanceType) {
- localsHandler = new LocalsHandler(
+ localsHandler = LocalsHandler(
this,
function,
function,
@@ -6100,7 +6080,7 @@
CapturedScope scopeData = _closureDataLookup.getCapturedScope(function);
bool forGenerativeConstructorBody = function is ConstructorBodyEntity;
- _returnLocal = new SyntheticLocal("result", function, function);
+ _returnLocal = SyntheticLocal("result", function, function);
localsHandler.updateLocal(_returnLocal, graph.addConstantNull(closedWorld));
_inTryStatement = false; // TODO(lry): why? Document.
@@ -6331,7 +6311,7 @@
String name = "${n(element.library)}:${n(element.enclosingClass)}."
"${n(element)}";
HConstant nameConstant = graph.addConstantString(name, closedWorld);
- add(new HInvokeStatic(
+ add(HInvokeStatic(
_commonElements.traceHelper,
<HInstruction>[idConstant, nameConstant],
_abstractValueDomain.dynamicType,
@@ -6349,7 +6329,7 @@
<FieldEntity, HInstruction>{};
/// Classes for which type variables have been prepared.
- final Set<ClassEntity> includedClasses = new Set<ClassEntity>();
+ final Set<ClassEntity> includedClasses = Set<ClassEntity>();
}
class KernelInliningState {
@@ -6410,8 +6390,8 @@
LocalsHandler originalSavedLocals;
TryCatchFinallyBuilder(this.kernelBuilder, this.trySourceInformation) {
- tryInstruction = new HTry(kernelBuilder._abstractValueDomain);
- originalSavedLocals = new LocalsHandler.from(kernelBuilder.localsHandler);
+ tryInstruction = HTry(kernelBuilder._abstractValueDomain);
+ originalSavedLocals = LocalsHandler.from(kernelBuilder.localsHandler);
enterBlock = kernelBuilder.openNewBlock();
kernelBuilder.close(tryInstruction);
previouslyInTryStatement = kernelBuilder._inTryStatement;
@@ -6476,17 +6456,16 @@
/// Build the finally{} clause of a try/{catch}/finally statement. Note this
/// does not examine the body of the try clause, only the finally portion.
void buildFinallyBlock(void buildFinalizer()) {
- kernelBuilder.localsHandler = new LocalsHandler.from(originalSavedLocals);
+ kernelBuilder.localsHandler = LocalsHandler.from(originalSavedLocals);
startFinallyBlock = kernelBuilder.graph.addNewBlock();
kernelBuilder.open(startFinallyBlock);
buildFinalizer();
if (!kernelBuilder.isAborted()) {
endFinallyBlock =
- kernelBuilder.close(new HGoto(kernelBuilder._abstractValueDomain));
+ kernelBuilder.close(HGoto(kernelBuilder._abstractValueDomain));
}
tryInstruction.finallyBlock = startFinallyBlock;
- finallyGraph =
- new SubGraph(startFinallyBlock, kernelBuilder.lastOpenedBlock);
+ finallyGraph = SubGraph(startFinallyBlock, kernelBuilder.lastOpenedBlock);
}
void closeTryBody() {
@@ -6495,19 +6474,19 @@
// the catch or finally block.
if (!kernelBuilder.isAborted()) {
endTryBlock =
- kernelBuilder.close(new HExitTry(kernelBuilder._abstractValueDomain));
+ kernelBuilder.close(HExitTry(kernelBuilder._abstractValueDomain));
}
- bodyGraph = new SubGraph(startTryBlock, kernelBuilder.lastOpenedBlock);
+ bodyGraph = SubGraph(startTryBlock, kernelBuilder.lastOpenedBlock);
}
void buildCatch(ir.TryCatch tryCatch) {
- kernelBuilder.localsHandler = new LocalsHandler.from(originalSavedLocals);
+ kernelBuilder.localsHandler = LocalsHandler.from(originalSavedLocals);
startCatchBlock = kernelBuilder.graph.addNewBlock();
kernelBuilder.open(startCatchBlock);
// Note that the name of this local is irrelevant.
SyntheticLocal local = kernelBuilder.localsHandler.createLocal('exception');
exception =
- new HLocalValue(local, kernelBuilder._abstractValueDomain.nonNullType)
+ HLocalValue(local, kernelBuilder._abstractValueDomain.nonNullType)
..sourceInformation = trySourceInformation;
kernelBuilder.add(exception);
HInstruction oldRethrowableException = kernelBuilder._rethrowableException;
@@ -6571,7 +6550,7 @@
void visitElse() {
if (catchesIndex >= tryCatch.catches.length) {
- kernelBuilder._closeAndGotoExit(new HThrow(
+ kernelBuilder._closeAndGotoExit(HThrow(
kernelBuilder._abstractValueDomain,
exception,
exception.sourceInformation,
@@ -6600,12 +6579,12 @@
kernelBuilder._sourceInformationBuilder.buildCatch(firstBlock));
if (!kernelBuilder.isAborted()) {
endCatchBlock =
- kernelBuilder.close(new HGoto(kernelBuilder._abstractValueDomain));
+ kernelBuilder.close(HGoto(kernelBuilder._abstractValueDomain));
}
kernelBuilder._rethrowableException = oldRethrowableException;
tryInstruction.catchBlock = startCatchBlock;
- catchGraph = new SubGraph(startCatchBlock, kernelBuilder.lastOpenedBlock);
+ catchGraph = SubGraph(startCatchBlock, kernelBuilder.lastOpenedBlock);
}
void cleanUp() {
@@ -6617,7 +6596,7 @@
kernelBuilder.localsHandler = originalSavedLocals;
kernelBuilder.open(exitBlock);
enterBlock.setBlockFlow(
- new HTryBlockInformation(
+ HTryBlockInformation(
kernelBuilder.wrapStatementGraph(bodyGraph),
exception,
kernelBuilder.wrapStatementGraph(catchGraph),
@@ -6648,7 +6627,7 @@
// TODO(30809): Use const constructor.
static bool check(ir.Initializer initializer) =>
- initializer.accept(new _ErroneousInitializerVisitor());
+ initializer.accept(_ErroneousInitializerVisitor());
@override
bool defaultInitializer(ir.Node node) => false;
@@ -6750,13 +6729,14 @@
this.regularNodeCount,
this.callCount});
- bool canBeInlined({int maxInliningNodes, bool allowLoops: false}) {
+ bool canBeInlined({int maxInliningNodes, bool allowLoops = false}) {
return cannotBeInlinedReason(
maxInliningNodes: maxInliningNodes, allowLoops: allowLoops) ==
null;
}
- String cannotBeInlinedReason({int maxInliningNodes, bool allowLoops: false}) {
+ String cannotBeInlinedReason(
+ {int maxInliningNodes, bool allowLoops = false}) {
if (hasLoop && !allowLoops) {
return 'loop';
} else if (hasTry) {
@@ -6824,7 +6804,7 @@
@override
String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
sb.write('InlineData(');
String comma = '';
if (isConstructor) {
@@ -6910,7 +6890,7 @@
final bool omitImplicitCasts;
InlineDataCache(
- {this.enableUserAssertions: false, this.omitImplicitCasts: false});
+ {this.enableUserAssertions = false, this.omitImplicitCasts = false});
Map<FunctionEntity, InlineData> _cache = {};
@@ -6963,12 +6943,12 @@
bool discountParameters = false;
InlineWeeder(
- {this.enableUserAssertions: false, this.omitImplicitCasts: false});
+ {this.enableUserAssertions = false, this.omitImplicitCasts = false});
static InlineData computeInlineData(
JsToElementMap elementMap, FunctionEntity function,
- {bool enableUserAssertions: false, bool omitImplicitCasts: false}) {
- InlineWeeder visitor = new InlineWeeder(
+ {bool enableUserAssertions = false, bool omitImplicitCasts = false}) {
+ InlineWeeder visitor = InlineWeeder(
enableUserAssertions: enableUserAssertions,
omitImplicitCasts: omitImplicitCasts);
ir.FunctionNode node = getFunctionNode(elementMap, function);
diff --git a/pkg/compiler/lib/src/ssa/codegen.dart b/pkg/compiler/lib/src/ssa/codegen.dart
index 8cf8ed8..e4737ff 100644
--- a/pkg/compiler/lib/src/ssa/codegen.dart
+++ b/pkg/compiler/lib/src/ssa/codegen.dart
@@ -68,7 +68,7 @@
js.Fun buildJavaScriptFunction(bool needsAsyncRewrite, FunctionEntity element,
List<js.Parameter> parameters, js.Block body) {
js.Fun finish(js.AsyncModifier asyncModifier) {
- return new js.Fun(parameters, body, asyncModifier: asyncModifier)
+ return js.Fun(parameters, body, asyncModifier: asyncModifier)
.withSourceInformation(sourceInformationStrategy
.createBuilderForContext(element)
.buildDeclaration(element));
@@ -129,7 +129,7 @@
closedWorld,
registry);
codeGenerator.visitGraph(graph);
- return new js.Fun(codeGenerator.parameters, codeGenerator.body)
+ return js.Fun(codeGenerator.parameters, codeGenerator.body)
.withSourceInformation(sourceInformation);
});
}
@@ -277,17 +277,17 @@
this._closedWorld,
this._registry,
{SourceInformation sourceInformation})
- : declaredLocals = new Set<String>(),
- collectedVariableDeclarations = new Set<String>(),
- currentContainer = new js.Block.empty(),
+ : declaredLocals = Set<String>(),
+ collectedVariableDeclarations = Set<String>(),
+ currentContainer = js.Block.empty(),
parameters = <js.Parameter>[],
expressionStack = <js.Expression>[],
oldContainerStack = <js.Block>[],
- generateAtUseSite = new Set<HInstruction>(),
- controlFlowOperators = new Set<HInstruction>(),
- breakAction = new Set<JumpTarget>(),
- continueAction = new Set<LabelDefinition>(),
- implicitContinueAction = new Set<JumpTarget>();
+ generateAtUseSite = Set<HInstruction>(),
+ controlFlowOperators = Set<HInstruction>(),
+ breakAction = Set<JumpTarget>(),
+ continueAction = Set<LabelDefinition>(),
+ implicitContinueAction = Set<JumpTarget>();
JCommonElements get _commonElements => _closedWorld.commonElements;
@@ -373,7 +373,7 @@
if (bitWidth(instruction) <= 31) return false;
// If the result of a bit-operation is only used by other bit
// operations, we do not have to convert to an unsigned integer.
- return hasNonBitOpUser(instruction, new Set<HPhi>());
+ return hasNonBitOpUser(instruction, Set<HPhi>());
}
/// If the [instruction] is not `null` it will be used to attach the position
@@ -391,7 +391,7 @@
/// to the [expression].
pushExpressionAsStatement(
js.Expression expression, SourceInformation sourceInformation) {
- pushStatement(new js.ExpressionStatement(expression)
+ pushStatement(js.ExpressionStatement(expression)
.withSourceInformation(sourceInformation));
}
@@ -414,18 +414,18 @@
assert(graph.isValid(), 'Graph not valid after ${phase.name}');
}
- runPhase(new SsaInstructionSelection(_options, _closedWorld));
- runPhase(new SsaTypeKnownRemover());
- runPhase(new SsaTrustedCheckRemover(_options));
- runPhase(new SsaAssignmentChaining(_closedWorld));
- runPhase(new SsaInstructionMerger(_abstractValueDomain, generateAtUseSite));
- runPhase(new SsaConditionMerger(generateAtUseSite, controlFlowOperators));
- runPhase(new SsaShareRegionConstants());
+ runPhase(SsaInstructionSelection(_options, _closedWorld));
+ runPhase(SsaTypeKnownRemover());
+ runPhase(SsaTrustedCheckRemover(_options));
+ runPhase(SsaAssignmentChaining(_closedWorld));
+ runPhase(SsaInstructionMerger(_abstractValueDomain, generateAtUseSite));
+ runPhase(SsaConditionMerger(generateAtUseSite, controlFlowOperators));
+ runPhase(SsaShareRegionConstants());
SsaLiveIntervalBuilder intervalBuilder =
- new SsaLiveIntervalBuilder(generateAtUseSite, controlFlowOperators);
+ SsaLiveIntervalBuilder(generateAtUseSite, controlFlowOperators);
runPhase(intervalBuilder, traceGraph: false);
- SsaVariableAllocator allocator = new SsaVariableAllocator(
+ SsaVariableAllocator allocator = SsaVariableAllocator(
_namer,
intervalBuilder.liveInstructions,
intervalBuilder.liveIntervals,
@@ -456,9 +456,9 @@
js.Expression value = expression.value;
if (_safeInInitializer(value) &&
collectedVariableDeclarations.remove(name)) {
- var initialization = new js.VariableInitialization(
- new js.VariableDeclaration(name), value)
- .withSourceInformation(expression.sourceInformation);
+ var initialization =
+ js.VariableInitialization(js.VariableDeclaration(name), value)
+ .withSourceInformation(expression.sourceInformation);
declarations.add(initialization);
++nextStatement;
continue;
@@ -471,14 +471,14 @@
List<js.VariableInitialization> uninitialized = [];
for (String name in collectedVariableDeclarations) {
- uninitialized.add(new js.VariableInitialization(
- new js.VariableDeclaration(name), null));
+ uninitialized
+ .add(js.VariableInitialization(js.VariableDeclaration(name), null));
}
var declarationList =
- new js.VariableDeclarationList(uninitialized + declarations)
+ js.VariableDeclarationList(uninitialized + declarations)
.withSourceInformation(sourceInformation);
statements.replaceRange(
- 0, nextStatement, [new js.ExpressionStatement(declarationList)]);
+ 0, nextStatement, [js.ExpressionStatement(declarationList)]);
}
// An expression is safe to be pulled into a 'var' initializer if it does not
@@ -489,7 +489,7 @@
visitGraph(HGraph graph) {
preGenerateMethod(graph);
currentGraph = graph;
- visitSubGraph(new SubGraph(graph.entry, graph.exit));
+ visitSubGraph(SubGraph(graph.entry, graph.exit));
handleDelayedVariableDeclarations(graph.sourceInformation);
}
@@ -497,7 +497,7 @@
SubGraph oldSubGraph = subGraph;
Queue<HBasicBlock> oldBlockQueue = blockQueue;
subGraph = newSubGraph;
- blockQueue = new Queue<HBasicBlock>();
+ blockQueue = Queue<HBasicBlock>();
enterSubGraph(subGraph.start);
blockQueue = oldBlockQueue;
subGraph = oldSubGraph;
@@ -586,7 +586,7 @@
}
js.Block generateStatementsInNewBlock(HBlockInformation block) {
- js.Block result = new js.Block.empty();
+ js.Block result = js.Block.empty();
js.Block oldContainer = currentContainer;
currentContainer = result;
generateStatements(block);
@@ -600,7 +600,7 @@
/// If the block is empty, returns a new instance of [js.NOP].
js.Statement unwrapStatement(js.Block block) {
int len = block.statements.length;
- if (len == 0) return new js.EmptyStatement();
+ if (len == 0) return js.EmptyStatement();
if (len == 1) {
js.Statement result = block.statements[0];
if (result is js.Block) return unwrapStatement(result);
@@ -631,7 +631,7 @@
} else {
js.Expression result = sequenceElements.removeLast();
while (sequenceElements.isNotEmpty) {
- result = new js.Binary(',', sequenceElements.removeLast(), result);
+ result = js.Binary(',', sequenceElements.removeLast(), result);
}
return result;
}
@@ -639,10 +639,10 @@
/// Only visits the arguments starting at inputs[HInvoke.ARGUMENTS_OFFSET].
List<js.Expression> visitArguments(List<HInstruction> inputs,
- {int start: HInvoke.ARGUMENTS_OFFSET}) {
+ {int start = HInvoke.ARGUMENTS_OFFSET}) {
assert(inputs.length >= start);
List<js.Expression> result =
- new List<js.Expression>.filled(inputs.length - start, null);
+ List<js.Expression>.filled(inputs.length - start, null);
for (int i = start; i < inputs.length; i++) {
use(inputs[i]);
result[i - start] = pop();
@@ -679,13 +679,13 @@
if ((op == '+' || op == '-') &&
right is js.LiteralNumber &&
right.value == "1") {
- return new js.Prefix(op == '+' ? '++' : '--', left);
+ return js.Prefix(op == '+' ? '++' : '--', left);
}
- return new js.Assignment.compound(binary.left, op, binary.right);
+ return js.Assignment.compound(binary.left, op, binary.right);
}
}
}
- return new js.Assignment(new js.VariableUse(variableName), value)
+ return js.Assignment(js.VariableUse(variableName), value)
.withSourceInformation(value.sourceInformation ?? sourceInformation);
}
@@ -706,12 +706,12 @@
// It may be necessary to remove it from the ones to be declared later.
collectedVariableDeclarations.remove(variableName);
declaredLocals.add(variableName);
- js.VariableDeclaration decl = new js.VariableDeclaration(variableName);
+ js.VariableDeclaration decl = js.VariableDeclaration(variableName);
js.VariableInitialization initialization =
- new js.VariableInitialization(decl, value);
+ js.VariableInitialization(decl, value);
pushExpressionAsStatement(
- new js.VariableDeclarationList(
+ js.VariableDeclarationList(
<js.VariableInitialization>[initialization]),
sourceInformation);
} else {
@@ -818,15 +818,15 @@
}
void continueAsBreak(LabelDefinition target) {
- pushStatement(new js.Break(_namer.continueLabelName(target)));
+ pushStatement(js.Break(_namer.continueLabelName(target)));
}
void implicitContinueAsBreak(JumpTarget target) {
- pushStatement(new js.Break(_namer.implicitContinueLabelName(target)));
+ pushStatement(js.Break(_namer.implicitContinueLabelName(target)));
}
void implicitBreakWithLabel(JumpTarget target) {
- pushStatement(new js.Break(_namer.implicitBreakLabelName(target)));
+ pushStatement(js.Break(_namer.implicitBreakLabelName(target)));
}
js.Statement wrapIntoLabels(
@@ -834,7 +834,7 @@
for (LabelDefinition label in labels) {
if (label.isTarget) {
String breakLabelString = _namer.breakLabelName(label);
- result = new js.LabeledStatement(breakLabelString, result);
+ result = js.LabeledStatement(breakLabelString, result);
}
}
return result;
@@ -873,8 +873,8 @@
if (successor.isLive) {
do {
visit(inputs[inputIndex]);
- currentContainer = new js.Block.empty();
- cases.add(new js.Case(pop(), currentContainer));
+ currentContainer = js.Block.empty();
+ cases.add(js.Case(pop(), currentContainer));
inputIndex++;
} while ((successors[inputIndex - 1] == successor) &&
(inputIndex < inputs.length));
@@ -882,8 +882,8 @@
// If this is the last statement, then these cases also belong to the
// default block.
if (statementIndex == info.statements.length - 1) {
- currentContainer = new js.Block.empty();
- cases.add(new js.Default(currentContainer));
+ currentContainer = js.Block.empty();
+ cases.add(js.Default(currentContainer));
handledDefault = true;
}
@@ -901,17 +901,17 @@
// If the default case is dead, we omit it. Likewise, if it is an
// empty block, we omit it, too.
if (info.statements.last.start.isLive && !handledDefault) {
- currentContainer = new js.Block.empty();
+ currentContainer = js.Block.empty();
generateStatements(info.statements.last);
if (currentContainer.statements.isNotEmpty) {
- cases.add(new js.Default(currentContainer));
+ cases.add(js.Default(currentContainer));
}
}
currentContainer = oldContainer;
js.Statement result =
- new js.Switch(key, cases).withSourceInformation(info.sourceInformation);
+ js.Switch(key, cases).withSourceInformation(info.sourceInformation);
pushStatement(wrapIntoLabels(result, info.labels));
return true;
}
@@ -956,14 +956,14 @@
HLocalValue exception = info.catchVariable;
String name = variableNames.getName(exception);
- js.VariableDeclaration decl = new js.VariableDeclaration(name);
+ js.VariableDeclaration decl = js.VariableDeclaration(name);
js.Block catchBlock = generateStatementsInNewBlock(info.catchBlock);
- catchPart = new js.Catch(decl, catchBlock);
+ catchPart = js.Catch(decl, catchBlock);
}
if (info.finallyBlock != null) {
finallyPart = generateStatementsInNewBlock(info.finallyBlock);
}
- pushStatement(new js.Try(body, catchPart, finallyPart));
+ pushStatement(js.Try(body, catchPart, finallyPart));
return true;
}
@@ -1004,7 +1004,7 @@
// We inserted a basic block to avoid critical edges. This block is
// part of the LoopBlockInformation and must therefore be handled here.
js.Block oldContainer = currentContainer;
- js.Block avoidContainer = new js.Block.empty();
+ js.Block avoidContainer = js.Block.empty();
currentContainer = avoidContainer;
assignPhisOfSuccessors(condition.end.successors.last);
bool hasPhiUpdates = !avoidContainer.statements.isEmpty;
@@ -1052,13 +1052,13 @@
<js.VariableInitialization>[];
for (js.Assignment assignment in assignments) {
String id = (assignment.leftHandSide as js.VariableUse).name;
- js.Node declaration = new js.VariableDeclaration(id);
- inits.add(new js.VariableInitialization(
- declaration, assignment.value));
+ js.Node declaration = js.VariableDeclaration(id);
+ inits.add(
+ js.VariableInitialization(declaration, assignment.value));
collectedVariableDeclarations.remove(id);
declaredLocals.add(id);
}
- jsInitialization = new js.VariableDeclarationList(inits);
+ jsInitialization = js.VariableDeclarationList(inits);
}
}
}
@@ -1069,12 +1069,12 @@
// TODO(lrn): Remove this extra labeling when handling all loops
// using subgraphs.
oldContainer = currentContainer;
- js.Statement body = new js.Block.empty();
+ js.Statement body = js.Block.empty();
currentContainer = body;
visitBodyIgnoreLabels(info);
currentContainer = oldContainer;
body = unwrapStatement(body);
- loop = new js.For(jsInitialization, jsCondition, jsUpdates, body)
+ loop = js.For(jsInitialization, jsCondition, jsUpdates, body)
.withSourceInformation(info.sourceInformation);
} else {
// We have either no update graph, or it's too complex to
@@ -1084,7 +1084,7 @@
}
js.Expression jsCondition;
js.Block oldContainer = currentContainer;
- js.Statement body = new js.Block.empty();
+ js.Statement body = js.Block.empty();
if (isConditionExpression && !hasPhiUpdates) {
jsCondition = generateExpression(condition);
currentContainer = body;
@@ -1093,8 +1093,8 @@
currentContainer = body;
generateStatements(condition);
use(condition.conditionExpression);
- js.Expression ifTest = new js.Prefix("!", pop());
- js.Statement jsBreak = new js.Break(null);
+ js.Expression ifTest = js.Prefix("!", pop());
+ js.Statement jsBreak = js.Break(null);
js.Statement exitLoop;
if (avoidContainer.statements.isEmpty) {
exitLoop = jsBreak;
@@ -1102,7 +1102,7 @@
avoidContainer.statements.add(jsBreak);
exitLoop = avoidContainer;
}
- pushStatement(new js.If.noElse(ifTest, exitLoop));
+ pushStatement(js.If.noElse(ifTest, exitLoop));
}
if (info.updates != null) {
wrapLoopBodyForContinue(info);
@@ -1112,7 +1112,7 @@
}
currentContainer = oldContainer;
body = unwrapStatement(body);
- loop = new js.While(jsCondition, body)
+ loop = js.While(jsCondition, body)
.withSourceInformation(info.sourceInformation);
}
break;
@@ -1123,14 +1123,14 @@
// We inserted a basic block to avoid critical edges. This block is
// part of the LoopBlockInformation and must therefore be handled here.
js.Block oldContainer = currentContainer;
- js.Block exitAvoidContainer = new js.Block.empty();
+ js.Block exitAvoidContainer = js.Block.empty();
currentContainer = exitAvoidContainer;
assignPhisOfSuccessors(condition.end.successors.last);
bool hasExitPhiUpdates = !exitAvoidContainer.statements.isEmpty;
currentContainer = oldContainer;
oldContainer = currentContainer;
- js.Block body = new js.Block.empty();
+ js.Block body = js.Block.empty();
// If there are phi copies in the block that jumps to the
// loop entry, we must emit the condition like this:
// do {
@@ -1143,7 +1143,7 @@
// }
// } while (true);
HBasicBlock avoidEdge = info.end.successors[0];
- js.Block updateBody = new js.Block.empty();
+ js.Block updateBody = js.Block.empty();
currentContainer = updateBody;
assignPhisOfSuccessors(avoidEdge);
bool hasPhiUpdates = !updateBody.statements.isEmpty;
@@ -1163,13 +1163,13 @@
// If the condition is dead code, we turn the do-while into
// a simpler while because we will never reach the condition
// at the end of the loop anyway.
- loop = new js.While(newLiteralBool(true, info.sourceInformation),
+ loop = js.While(newLiteralBool(true, info.sourceInformation),
unwrapStatement(body))
.withSourceInformation(info.sourceInformation);
} else {
if (hasPhiUpdates || hasExitPhiUpdates) {
- updateBody.statements.add(new js.Continue(null));
- js.Statement jsBreak = new js.Break(null);
+ updateBody.statements.add(js.Continue(null));
+ js.Statement jsBreak = js.Break(null);
js.Statement exitLoop;
if (exitAvoidContainer.statements.isEmpty) {
exitLoop = jsBreak;
@@ -1177,10 +1177,10 @@
exitAvoidContainer.statements.add(jsBreak);
exitLoop = exitAvoidContainer;
}
- body.statements.add(new js.If(jsCondition, updateBody, exitLoop));
+ body.statements.add(js.If(jsCondition, updateBody, exitLoop));
jsCondition = newLiteralBool(true, info.sourceInformation);
}
- loop = new js.Do(unwrapStatement(body), jsCondition)
+ loop = js.Do(unwrapStatement(body), jsCondition)
.withSourceInformation(info.sourceInformation);
}
currentContainer = oldContainer;
@@ -1193,7 +1193,7 @@
if (info.kind == HLoopBlockInformation.SWITCH_CONTINUE_LOOP) {
String continueLabelString =
_namer.implicitContinueLabelName(info.target);
- result = new js.LabeledStatement(continueLabelString, result);
+ result = js.LabeledStatement(continueLabelString, result);
}
pushStatement(wrapIntoLabels(result, info.labels));
return true;
@@ -1204,7 +1204,7 @@
Link<Entity> continueOverrides = const Link<Entity>();
js.Block oldContainer = currentContainer;
- js.Block body = new js.Block.empty();
+ js.Block body = js.Block.empty();
js.Statement result = body;
currentContainer = body;
@@ -1217,7 +1217,7 @@
for (LabelDefinition label in labeledBlockInfo.labels) {
if (label.isContinueTarget) {
String labelName = _namer.continueLabelName(label);
- result = new js.LabeledStatement(labelName, result);
+ result = js.LabeledStatement(labelName, result);
continueAction.add(label);
continueOverrides = continueOverrides.prepend(label);
}
@@ -1227,14 +1227,14 @@
// a target of an unlabeled continue, and not generate this if it isn't.
JumpTarget target = labeledBlockInfo.target;
String labelName = _namer.implicitContinueLabelName(target);
- result = new js.LabeledStatement(labelName, result);
+ result = js.LabeledStatement(labelName, result);
implicitContinueAction.add(target);
continueOverrides = continueOverrides.prepend(target);
} else {
for (LabelDefinition label in labeledBlockInfo.labels) {
if (label.isBreakTarget) {
String labelName = _namer.breakLabelName(label);
- result = new js.LabeledStatement(labelName, result);
+ result = js.LabeledStatement(labelName, result);
}
}
}
@@ -1244,7 +1244,7 @@
// as a nested if/else chain. We add an extra break target
// so that case code can break.
String labelName = _namer.implicitBreakLabelName(target);
- result = new js.LabeledStatement(labelName, result);
+ result = js.LabeledStatement(labelName, result);
breakAction.add(target);
}
@@ -1272,18 +1272,18 @@
JumpTarget target = info.target;
if (target != null && target.isContinueTarget) {
js.Block oldContainer = currentContainer;
- js.Block body = new js.Block.empty();
+ js.Block body = js.Block.empty();
currentContainer = body;
js.Statement result = body;
for (LabelDefinition label in info.labels) {
if (label.isContinueTarget) {
String labelName = _namer.continueLabelName(label);
- result = new js.LabeledStatement(labelName, result);
+ result = js.LabeledStatement(labelName, result);
continueAction.add(label);
}
}
String labelName = _namer.implicitContinueLabelName(target);
- result = new js.LabeledStatement(labelName, result);
+ result = js.LabeledStatement(labelName, result);
implicitContinueAction.add(info.target);
visitBodyIgnoreLabels(info);
implicitContinueAction.remove(info.target);
@@ -1352,7 +1352,7 @@
void emitAssignment(
String destination, String source, SourceInformation sourceInformation) {
- assignVariable(destination, new js.VariableUse(source), sourceInformation);
+ assignVariable(destination, js.VariableUse(source), sourceInformation);
}
/// Sequentialize a list of conceptually parallel copies. Parallel
@@ -1372,15 +1372,15 @@
sourceInformationMap[sourceName] = copy.source.sourceInformation;
String destinationName = variableNames.getName(copy.destination);
sourceInformationMap[sourceName] = copy.destination.sourceInformation;
- return new Copy<String>(sourceName, destinationName);
+ return Copy<String>(sourceName, destinationName);
});
// Map to keep track of the current location (ie the variable that
// holds the initial value) of a variable.
- Map<String, String> currentLocation = new Map<String, String>();
+ Map<String, String> currentLocation = Map<String, String>();
// Map to keep track of the initial value of a variable.
- Map<String, String> initialValue = new Map<String, String>();
+ Map<String, String> initialValue = Map<String, String>();
// List of variables to assign a value.
List<String> worklist = <String>[];
@@ -1482,8 +1482,7 @@
use(node.left);
js.Expression jsLeft = pop();
use(node.right);
- push(new js.Binary(op, jsLeft, pop())
- .withSourceInformation(sourceInformation));
+ push(js.Binary(op, jsLeft, pop()).withSourceInformation(sourceInformation));
}
@override
@@ -1504,15 +1503,14 @@
visitBitInvokeBinary(HBinaryBitOp node, String op) {
visitInvokeBinary(node, op);
if (op != '>>>' && requiresUintConversion(node)) {
- push(new js.Binary(">>>", pop(), new js.LiteralNumber("0"))
+ push(js.Binary(">>>", pop(), js.LiteralNumber("0"))
.withSourceInformation(node.sourceInformation));
}
}
visitInvokeUnary(HInvokeUnary node, String op) {
use(node.operand);
- push(
- new js.Prefix(op, pop()).withSourceInformation(node.sourceInformation));
+ push(js.Prefix(op, pop()).withSourceInformation(node.sourceInformation));
}
// We want the outcome of bit-operations to be positive. We use the unsigned
@@ -1520,14 +1518,14 @@
visitBitInvokeUnary(HInvokeUnary node, String op) {
visitInvokeUnary(node, op);
if (requiresUintConversion(node)) {
- push(new js.Binary(">>>", pop(), new js.LiteralNumber("0"))
+ push(js.Binary(">>>", pop(), js.LiteralNumber("0"))
.withSourceInformation(node.sourceInformation));
}
}
void emitIdentityComparison(
HIdentity instruction, SourceInformation sourceInformation,
- {bool inverse: false}) {
+ {bool inverse = false}) {
String op = instruction.singleComparisonOp;
HInstruction left = instruction.left;
HInstruction right = instruction.right;
@@ -1535,22 +1533,21 @@
use(left);
js.Expression jsLeft = pop();
use(right);
- push(new js.Binary(mapRelationalOperator(op, inverse), jsLeft, pop())
+ push(js.Binary(mapRelationalOperator(op, inverse), jsLeft, pop())
.withSourceInformation(sourceInformation));
} else {
assert(NullConstantValue.JsNull == 'null');
use(left);
- js.Binary leftEqualsNull =
- new js.Binary("==", pop(), new js.LiteralNull());
+ js.Binary leftEqualsNull = js.Binary("==", pop(), js.LiteralNull());
use(right);
- js.Binary rightEqualsNull = new js.Binary(
- mapRelationalOperator("==", inverse), pop(), new js.LiteralNull());
+ js.Binary rightEqualsNull = js.Binary(
+ mapRelationalOperator("==", inverse), pop(), js.LiteralNull());
use(right);
use(left);
js.Binary tripleEq =
- new js.Binary(mapRelationalOperator("===", inverse), pop(), pop());
+ js.Binary(mapRelationalOperator("===", inverse), pop(), pop());
- push(new js.Conditional(leftEqualsNull, rightEqualsNull, tripleEq)
+ push(js.Conditional(leftEqualsNull, rightEqualsNull, tripleEq)
.withSourceInformation(sourceInformation));
}
}
@@ -1591,9 +1588,9 @@
use(node.left);
js.Expression jsLeft = pop();
use(node.right);
- push(new js.Binary('/', jsLeft, pop())
+ push(js.Binary('/', jsLeft, pop())
.withSourceInformation(node.sourceInformation));
- push(new js.Binary('|', pop(), new js.LiteralNumber("0"))
+ push(js.Binary('|', pop(), js.LiteralNumber("0"))
.withSourceInformation(node.sourceInformation));
}
@@ -1669,7 +1666,7 @@
if (breakAction.contains(label.target)) {
implicitBreakWithLabel(label.target);
} else {
- pushStatement(new js.Break(_namer.breakLabelName(label))
+ pushStatement(js.Break(_namer.breakLabelName(label))
.withSourceInformation(node.sourceInformation));
}
} else {
@@ -1678,11 +1675,11 @@
implicitBreakWithLabel(target);
} else {
if (node.breakSwitchContinueLoop) {
- pushStatement(new js.Break(_namer.implicitContinueLabelName(target))
+ pushStatement(js.Break(_namer.implicitContinueLabelName(target))
.withSourceInformation(node.sourceInformation));
} else {
pushStatement(
- new js.Break(null).withSourceInformation(node.sourceInformation));
+ js.Break(null).withSourceInformation(node.sourceInformation));
}
}
}
@@ -1697,7 +1694,7 @@
continueAsBreak(label);
} else {
// TODO(floitsch): should this really be the breakLabelName?
- pushStatement(new js.Continue(_namer.breakLabelName(label))
+ pushStatement(js.Continue(_namer.breakLabelName(label))
.withSourceInformation(node.sourceInformation));
}
} else {
@@ -1706,12 +1703,11 @@
implicitContinueAsBreak(target);
} else {
if (target.isSwitch) {
- pushStatement(
- new js.Continue(_namer.implicitContinueLabelName(target))
- .withSourceInformation(node.sourceInformation));
- } else {
- pushStatement(new js.Continue(null)
+ pushStatement(js.Continue(_namer.implicitContinueLabelName(target))
.withSourceInformation(node.sourceInformation));
+ } else {
+ pushStatement(
+ js.Continue(null).withSourceInformation(node.sourceInformation));
}
}
}
@@ -1936,8 +1932,8 @@
push(js
.propertyCall(object, methodName, arguments)
.withSourceInformation(node.sourceInformation));
- _registry.registerStaticUse(new StaticUse.constructorBodyInvoke(
- node.element, new CallStructure.unnamed(arguments.length)));
+ _registry.registerStaticUse(StaticUse.constructorBodyInvoke(
+ node.element, CallStructure.unnamed(arguments.length)));
}
@override
@@ -1954,12 +1950,11 @@
} else {
push(_emitter.staticFunctionAccess(element));
List<js.Expression> arguments = visitArguments(node.inputs, start: 0);
- push(new js.Call(pop(), arguments,
- sourceInformation: node.sourceInformation));
+ push(
+ js.Call(pop(), arguments, sourceInformation: node.sourceInformation));
}
- _registry
- .registerStaticUse(new StaticUse.generatorBodyInvoke(node.element));
+ _registry.registerStaticUse(StaticUse.generatorBodyInvoke(node.element));
}
@override
@@ -2028,9 +2023,8 @@
// TODO(kasperl): If we have a typed selector for the call, we
// may know something about the types of closures that need
// the specific closure call method.
- Selector call = new Selector.callClosureFrom(selector);
- _registry
- .registerDynamicUse(new DynamicUse(call, null, node.typeArguments));
+ Selector call = Selector.callClosureFrom(selector);
+ _registry.registerDynamicUse(DynamicUse(call, null, node.typeArguments));
}
if (target != null) {
// This is a dynamic invocation which we have found to have a single
@@ -2041,29 +2035,29 @@
failedAt(node, '$selector does not apply to $target'));
assert(!selector.isGetter && !selector.isSetter,
"Unexpected direct invocation selector: $selector.");
- _registry.registerStaticUse(new StaticUse.directInvoke(
+ _registry.registerStaticUse(StaticUse.directInvoke(
target, selector.callStructure, node.typeArguments));
} else {
AbstractValue mask =
getOptimizedSelectorFor(node, selector, node.receiverType);
- _registry.registerDynamicUse(
- new DynamicUse(selector, mask, node.typeArguments));
+ _registry
+ .registerDynamicUse(DynamicUse(selector, mask, node.typeArguments));
}
}
- void registerSetter(HInvokeDynamic node, {bool needsCheck: false}) {
+ void registerSetter(HInvokeDynamic node, {bool needsCheck = false}) {
if (node.element is FieldEntity && !needsCheck) {
// This is a dynamic update which we have found to have a single
// target but for some reason haven't inlined. We are _still_ accessing
// the target dynamically but we don't need to enqueue more than target
// for this to work.
- _registry.registerStaticUse(new StaticUse.directSet(node.element));
+ _registry.registerStaticUse(StaticUse.directSet(node.element));
} else {
Selector selector = node.selector;
AbstractValue mask =
getOptimizedSelectorFor(node, selector, node.receiverType);
- _registry.registerDynamicUse(
- new DynamicUse(selector, mask, node.typeArguments));
+ _registry
+ .registerDynamicUse(DynamicUse(selector, mask, node.typeArguments));
}
}
@@ -2075,13 +2069,13 @@
// dynamically but we don't need to enqueue more than target for this to
// work. The test above excludes non-getter functions since the element
// represents two targets - a tearoff getter and the torn-off method.
- _registry.registerStaticUse(new StaticUse.directGet(node.element));
+ _registry.registerStaticUse(StaticUse.directGet(node.element));
} else {
Selector selector = node.selector;
AbstractValue mask =
getOptimizedSelectorFor(node, selector, node.receiverType);
- _registry.registerDynamicUse(
- new DynamicUse(selector, mask, node.typeArguments));
+ _registry
+ .registerDynamicUse(DynamicUse(selector, mask, node.typeArguments));
}
}
@@ -2107,7 +2101,7 @@
@override
visitInvokeClosure(HInvokeClosure node) {
- Selector call = new Selector.callClosureFrom(node.selector);
+ Selector call = Selector.callClosureFrom(node.selector);
use(node.receiver);
push(js
.propertyCall(
@@ -2116,8 +2110,7 @@
// TODO(kasperl): If we have a typed selector for the call, we
// may know something about the types of closures that need
// the specific closure call method.
- _registry
- .registerDynamicUse(new DynamicUse(call, null, node.typeArguments));
+ _registry.registerDynamicUse(DynamicUse(call, null, node.typeArguments));
}
@override
@@ -2143,7 +2136,7 @@
FunctionEntity throwFunction =
_commonElements.throwConcurrentModificationError;
_registry.registerStaticUse(
- new StaticUse.staticInvoke(throwFunction, CallStructure.ONE_ARG));
+ StaticUse.staticInvoke(throwFunction, CallStructure.ONE_ARG));
// Calling using `(0, #)(#)` instead of `#(#)` separates the property load
// of the static function access from the call. For some reason this
@@ -2164,24 +2157,24 @@
} else {
StaticUse staticUse;
if (element.isConstructor) {
- CallStructure callStructure = new CallStructure.unnamed(
- arguments.length, node.typeArguments.length);
- staticUse = new StaticUse.constructorInvoke(element, callStructure);
+ CallStructure callStructure =
+ CallStructure.unnamed(arguments.length, node.typeArguments.length);
+ staticUse = StaticUse.constructorInvoke(element, callStructure);
} else if (element.isGetter) {
- staticUse = new StaticUse.staticGet(element);
+ staticUse = StaticUse.staticGet(element);
} else if (element.isSetter) {
- staticUse = new StaticUse.staticSet(element);
+ staticUse = StaticUse.staticSet(element);
} else {
assert(element.isFunction);
- CallStructure callStructure = new CallStructure.unnamed(
- arguments.length, node.typeArguments.length);
- staticUse = new StaticUse.staticInvoke(
- element, callStructure, node.typeArguments);
+ CallStructure callStructure =
+ CallStructure.unnamed(arguments.length, node.typeArguments.length);
+ staticUse =
+ StaticUse.staticInvoke(element, callStructure, node.typeArguments);
}
_registry.registerStaticUse(staticUse);
push(_emitter.staticFunctionAccess(element));
- push(new js.Call(pop(), arguments,
- sourceInformation: node.sourceInformation));
+ push(
+ js.Call(pop(), arguments, sourceInformation: node.sourceInformation));
}
}
@@ -2193,24 +2186,24 @@
bool useAliasedSuper = canUseAliasedSuperMember(superElement, selector);
if (selector.isGetter) {
if (superElement.isField || superElement.isGetter) {
- _registry.registerStaticUse(new StaticUse.superGet(superElement));
+ _registry.registerStaticUse(StaticUse.superGet(superElement));
} else {
- _registry.registerStaticUse(new StaticUse.superTearOff(node.element));
+ _registry.registerStaticUse(StaticUse.superTearOff(node.element));
}
} else if (selector.isSetter) {
if (superElement.isField) {
- _registry.registerStaticUse(new StaticUse.superFieldSet(superElement));
+ _registry.registerStaticUse(StaticUse.superFieldSet(superElement));
} else {
assert(superElement.isSetter);
- _registry.registerStaticUse(new StaticUse.superSetterSet(superElement));
+ _registry.registerStaticUse(StaticUse.superSetterSet(superElement));
}
} else {
if (useAliasedSuper) {
- _registry.registerStaticUse(new StaticUse.superInvoke(
- superElement, new CallStructure.unnamed(node.inputs.length)));
+ _registry.registerStaticUse(StaticUse.superInvoke(
+ superElement, CallStructure.unnamed(node.inputs.length)));
} else {
- _registry.registerStaticUse(new StaticUse.superInvoke(
- superElement, new CallStructure.unnamed(node.inputs.length - 1)));
+ _registry.registerStaticUse(StaticUse.superInvoke(
+ superElement, CallStructure.unnamed(node.inputs.length - 1)));
}
}
@@ -2218,11 +2211,11 @@
// TODO(sra): We can lower these in the simplifier.
js.Name fieldName = _namer.instanceFieldPropertyName(superElement);
use(node.getDartReceiver(_closedWorld));
- js.PropertyAccess access = new js.PropertyAccess(pop(), fieldName)
+ js.PropertyAccess access = js.PropertyAccess(pop(), fieldName)
.withSourceInformation(node.sourceInformation);
if (node.isSetter) {
use(node.value);
- push(new js.Assignment(access, pop())
+ push(js.Assignment(access, pop())
.withSourceInformation(node.sourceInformation));
} else {
push(access);
@@ -2235,9 +2228,9 @@
// will be created, and that this tear-off must bypass ordinary
// dispatch to ensure the super method is invoked.
FunctionEntity helper = _commonElements.closureFromTearOff;
- _registry.registerStaticUse(new StaticUse.staticInvoke(
+ _registry.registerStaticUse(StaticUse.staticInvoke(
helper,
- new CallStructure.unnamed(
+ CallStructure.unnamed(
node.inputs.length, node.typeArguments.length),
node.typeArguments));
methodName = _namer.invocationName(selector);
@@ -2279,13 +2272,13 @@
@override
visitFieldSet(HFieldSet node) {
FieldEntity element = node.element;
- _registry.registerStaticUse(new StaticUse.fieldSet(element));
+ _registry.registerStaticUse(StaticUse.fieldSet(element));
js.Name name = _namer.instanceFieldPropertyName(element);
use(node.receiver);
js.Expression receiver = pop();
use(node.value);
- push(new js.Assignment(
- new js.PropertyAccess(receiver, name)
+ push(js.Assignment(
+ js.PropertyAccess(receiver, name)
.withSourceInformation(node.sourceInformation),
pop())
.withSourceInformation(node.sourceInformation));
@@ -2294,27 +2287,27 @@
@override
visitGetLength(HGetLength node) {
use(node.receiver);
- push(new js.PropertyAccess.field(pop(), 'length')
+ push(js.PropertyAccess.field(pop(), 'length')
.withSourceInformation(node.sourceInformation));
}
@override
visitReadModifyWrite(HReadModifyWrite node) {
FieldEntity element = node.element;
- _registry.registerStaticUse(new StaticUse.fieldGet(element));
- _registry.registerStaticUse(new StaticUse.fieldSet(element));
+ _registry.registerStaticUse(StaticUse.fieldGet(element));
+ _registry.registerStaticUse(StaticUse.fieldSet(element));
js.Name name = _namer.instanceFieldPropertyName(element);
use(node.receiver);
- js.Expression fieldReference = new js.PropertyAccess(pop(), name);
+ js.Expression fieldReference = js.PropertyAccess(pop(), name);
if (node.isPreOp) {
- push(new js.Prefix(node.jsOp, fieldReference)
+ push(js.Prefix(node.jsOp, fieldReference)
.withSourceInformation(node.sourceInformation));
} else if (node.isPostOp) {
- push(new js.Postfix(node.jsOp, fieldReference)
+ push(js.Postfix(node.jsOp, fieldReference)
.withSourceInformation(node.sourceInformation));
} else {
use(node.value);
- push(new js.Assignment.compound(fieldReference, node.jsOp, pop())
+ push(js.Assignment.compound(fieldReference, node.jsOp, pop())
.withSourceInformation(node.sourceInformation));
}
}
@@ -2457,7 +2450,7 @@
visitCreate(HCreate node) {
js.Expression jsClassReference = _emitter.constructorAccess(node.element);
List<js.Expression> arguments = visitArguments(node.inputs, start: 0);
- push(new js.New(jsClassReference, arguments)
+ push(js.New(jsClassReference, arguments)
.withSourceInformation(node.sourceInformation));
// We also use HCreate to instantiate closure classes that belong to
// function expressions. We have to register their use here, as otherwise
@@ -2469,25 +2462,24 @@
}
node.instantiatedTypes?.forEach(_registry.registerInstantiation);
if (node.callMethod != null) {
- _registry
- ?.registerStaticUse(new StaticUse.implicitInvoke(node.callMethod));
+ _registry?.registerStaticUse(StaticUse.implicitInvoke(node.callMethod));
_registry?.registerInstantiatedClosure(node.callMethod);
}
}
@override
visitCreateBox(HCreateBox node) {
- push(new js.ObjectInitializer(<js.Property>[]));
+ push(js.ObjectInitializer(<js.Property>[]));
}
js.Expression newLiteralBool(
bool value, SourceInformation sourceInformation) {
if (_options.enableMinification) {
// Use !0 for true, !1 for false.
- return new js.Prefix("!", new js.LiteralNumber(value ? "0" : "1"))
+ return js.Prefix("!", js.LiteralNumber(value ? "0" : "1"))
.withSourceInformation(sourceInformation);
} else {
- return new js.LiteralBool(value).withSourceInformation(sourceInformation);
+ return js.LiteralBool(value).withSourceInformation(sourceInformation);
}
}
@@ -2506,11 +2498,11 @@
assert(isGenerateAtUseSite(node));
generateConstant(node.constant, node.sourceInformation);
- _registry.registerConstantUse(new ConstantUse.literal(node.constant));
+ _registry.registerConstantUse(ConstantUse.literal(node.constant));
if (node.constant.isType) {
TypeConstantValue typeConstant = node.constant;
_registry.registerTypeUse(
- new TypeUse.constTypeLiteral(typeConstant.representedType));
+ TypeUse.constTypeLiteral(typeConstant.representedType));
}
}
@@ -2575,7 +2567,7 @@
}
if (!handledBySpecialCase) {
use(input);
- push(new js.Prefix("!", pop()).withSourceInformation(sourceInformation));
+ push(js.Prefix("!", pop()).withSourceInformation(sourceInformation));
}
}
@@ -2583,7 +2575,7 @@
visitParameterValue(HParameterValue node) {
assert(!isGenerateAtUseSite(node));
String name = variableNames.getName(node);
- parameters.add(new js.Parameter(name));
+ parameters.add(js.Parameter(name));
declaredLocals.add(name);
}
@@ -2615,14 +2607,14 @@
}
js.Expression left = pop();
use(node.inputs[0]);
- push(new js.Binary(operation, left, pop()));
+ push(js.Binary(operation, left, pop()));
} else {
use(input);
js.Expression test = pop();
use(node.inputs[0]);
js.Expression then = pop();
use(node.inputs[1]);
- push(new js.Conditional(test, then, pop()));
+ push(js.Conditional(test, then, pop()));
}
}
@@ -2639,7 +2631,7 @@
@override
visitThis(HThis node) {
- push(new js.This());
+ push(js.This());
}
@override
@@ -2659,13 +2651,13 @@
@override
visitAwait(HAwait node) {
use(node.inputs[0]);
- push(new js.Await(pop()).withSourceInformation(node.sourceInformation));
+ push(js.Await(pop()).withSourceInformation(node.sourceInformation));
}
@override
visitYield(HYield node) {
use(node.inputs[0]);
- pushStatement(new js.DartYield(pop(), node.hasStar)
+ pushStatement(js.DartYield(pop(), node.hasStar)
.withSourceInformation(node.sourceInformation));
}
@@ -2834,31 +2826,31 @@
push(_emitter
.staticClosureAccess(element)
.withSourceInformation(node.sourceInformation));
- _registry.registerStaticUse(new StaticUse.staticTearOff(element));
+ _registry.registerStaticUse(StaticUse.staticTearOff(element));
} else {
push(_emitter
.staticFieldAccess(element)
.withSourceInformation(node.sourceInformation));
- _registry.registerStaticUse(new StaticUse.staticGet(element));
+ _registry.registerStaticUse(StaticUse.staticGet(element));
}
}
@override
void visitLazyStatic(HLazyStatic node) {
FieldEntity element = node.element;
- _registry.registerStaticUse(new StaticUse.staticInit(element));
+ _registry.registerStaticUse(StaticUse.staticInit(element));
js.Expression lazyGetter = _emitter.isolateLazyInitializerAccess(element);
- js.Call call = new js.Call(lazyGetter, <js.Expression>[],
+ js.Call call = js.Call(lazyGetter, <js.Expression>[],
sourceInformation: node.sourceInformation);
push(call);
}
@override
void visitStaticStore(HStaticStore node) {
- _registry.registerStaticUse(new StaticUse.staticSet(node.element));
+ _registry.registerStaticUse(StaticUse.staticSet(node.element));
js.Node variable = _emitter.staticFieldAccess(node.element);
use(node.inputs[0]);
- push(new js.Assignment(variable, pop())
+ push(js.Assignment(variable, pop())
.withSourceInformation(node.sourceInformation));
}
@@ -2867,7 +2859,7 @@
use(node.left);
js.Expression jsLeft = pop();
use(node.right);
- push(new js.Binary('+', jsLeft, pop())
+ push(js.Binary('+', jsLeft, pop())
.withSourceInformation(node.sourceInformation));
}
@@ -2887,17 +2879,17 @@
// The context is already <string> + value.
} else {
// Force an empty string for the first operand.
- push(new js.Binary('+', js.string(""), pop())
+ push(js.Binary('+', js.string(""), pop())
.withSourceInformation(node.sourceInformation));
}
} else {
FunctionEntity convertToString =
_commonElements.stringInterpolationHelper;
_registry.registerStaticUse(
- new StaticUse.staticInvoke(convertToString, CallStructure.ONE_ARG));
+ StaticUse.staticInvoke(convertToString, CallStructure.ONE_ARG));
js.Expression jsHelper = _emitter.staticFunctionAccess(convertToString);
use(input);
- push(new js.Call(jsHelper, <js.Expression>[pop()],
+ push(js.Call(jsHelper, <js.Expression>[pop()],
sourceInformation: node.sourceInformation));
}
}
@@ -2915,7 +2907,7 @@
use(input);
return pop();
}).toList();
- push(new js.ArrayInitializer(elements)
+ push(js.ArrayInitializer(elements)
.withSourceInformation(node.sourceInformation));
}
@@ -2924,7 +2916,7 @@
use(node.receiver);
js.Expression receiver = pop();
use(node.index);
- push(new js.PropertyAccess(receiver, pop())
+ push(js.PropertyAccess(receiver, pop())
.withSourceInformation(node.sourceInformation));
}
@@ -2935,15 +2927,15 @@
use(node.index);
js.Expression index = pop();
use(node.value);
- push(new js.Assignment(new js.PropertyAccess(receiver, index), pop())
+ push(js.Assignment(js.PropertyAccess(receiver, index), pop())
.withSourceInformation(node.sourceInformation));
}
void checkTypeOf(HInstruction input, String cmp, String typeName,
SourceInformation sourceInformation) {
use(input);
- js.Expression typeOf = new js.Prefix("typeof", pop());
- push(new js.Binary(cmp, typeOf, js.string(typeName))
+ js.Expression typeOf = js.Prefix("typeof", pop());
+ push(js.Binary(cmp, typeOf, js.string(typeName))
.withSourceInformation(sourceInformation));
}
@@ -3008,7 +3000,7 @@
@override
void visitBoolConversion(HBoolConversion node) {
- _registry.registerTypeUse(new TypeUse.isCheck(_commonElements.boolType));
+ _registry.registerTypeUse(TypeUse.isCheck(_commonElements.boolType));
CheckedModeHelper helper = const CheckedModeHelper('boolConversionCheck');
StaticUse staticUse = helper.getStaticUse(_commonElements);
_registry.registerStaticUse(staticUse);
@@ -3046,7 +3038,7 @@
@override
visitIsTest(HIsTest node) {
- _registry.registerTypeUse(new TypeUse.isCheck(node.dartType));
+ _registry.registerTypeUse(TypeUse.isCheck(node.dartType));
use(node.typeInput);
js.Expression first = pop();
@@ -3065,7 +3057,7 @@
_emitIsTestSimple(node);
}
- _emitIsTestSimple(HIsTestSimple node, {bool negative: false}) {
+ _emitIsTestSimple(HIsTestSimple node, {bool negative = false}) {
use(node.checkedInput);
js.Expression value = pop();
String relation = negative ? '!=' : '==';
@@ -3181,7 +3173,7 @@
void useHelper(FunctionEntity helper) {
_registry.registerStaticUse(
- new StaticUse.staticInvoke(helper, CallStructure.ONE_ARG));
+ StaticUse.staticInvoke(helper, CallStructure.ONE_ARG));
js.Expression helperAccess = _emitter.staticFunctionAccess(helper);
push(js.js(r'#(#)', [helperAccess, receiver]).withSourceInformation(
node.sourceInformation));
@@ -3291,7 +3283,7 @@
]).withSourceInformation(node.sourceInformation));
_registry.registerStaticUse(
- new StaticUse.directInvoke(method, selector.callStructure, null));
+ StaticUse.directInvoke(method, selector.callStructure, null));
}
@override
@@ -3313,11 +3305,11 @@
]).withSourceInformation(node.sourceInformation));
_registry.registerStaticUse(
- new StaticUse.directInvoke(method, selector.callStructure, null));
+ StaticUse.directInvoke(method, selector.callStructure, null));
}
_emitIsLateSentinel(HIsLateSentinel node, SourceInformation sourceInformation,
- {inverse: false}) {
+ {inverse = false}) {
use(node.inputs[0]);
js.Expression value = pop();
js.Expression sentinel =
diff --git a/pkg/compiler/lib/src/ssa/codegen_helpers.dart b/pkg/compiler/lib/src/ssa/codegen_helpers.dart
index 5bf162b..3305b11 100644
--- a/pkg/compiler/lib/src/ssa/codegen_helpers.dart
+++ b/pkg/compiler/lib/src/ssa/codegen_helpers.dart
@@ -266,18 +266,18 @@
if (isMatchingRead(left)) {
if (left.usedBy.length == 1) {
if (right is HConstant && right.constant.isOne) {
- HInstruction rmw = new HReadModifyWrite.preOp(
+ HInstruction rmw = HReadModifyWrite.preOp(
setter.element, incrementOp, receiver, op.instructionType);
return replaceOp(rmw, left);
} else {
- HInstruction rmw = new HReadModifyWrite.assignOp(
+ HInstruction rmw = HReadModifyWrite.assignOp(
setter.element, assignOp, receiver, right, op.instructionType);
return replaceOp(rmw, left);
}
} else if (op.usedBy.length == 1 &&
right is HConstant &&
right.constant.isOne) {
- HInstruction rmw = new HReadModifyWrite.postOp(
+ HInstruction rmw = HReadModifyWrite.postOp(
setter.element, incrementOp, receiver, op.instructionType);
block.addAfter(left, rmw);
block.remove(setter);
@@ -294,7 +294,7 @@
String assignOp, HInstruction left, HInstruction right) {
if (isMatchingRead(left)) {
if (left.usedBy.length == 1) {
- HInstruction rmw = new HReadModifyWrite.assignOp(
+ HInstruction rmw = HReadModifyWrite.assignOp(
setter.element, assignOp, receiver, right, op.instructionType);
return replaceOp(rmw, left);
}
@@ -810,7 +810,7 @@
// The expectedInputs list holds non-trivial instructions that may
// be generated at their use site, if they occur in the correct order.
if (expectedInputs == null) expectedInputs = <HInstruction>[];
- if (pureInputs == null) pureInputs = new Set<HInstruction>();
+ if (pureInputs == null) pureInputs = Set<HInstruction>();
// Pop instructions from expectedInputs until instruction is found.
// Return true if it is found, or false if not.
@@ -1133,7 +1133,7 @@
_cache(
HInstruction node, bool Function(HInstruction) cacheable, String name) {
var users = node.usedBy.toList();
- var reference = new HLateValue(node);
+ var reference = HLateValue(node);
// TODO(sra): The sourceInformation should really be from the function
// entry, not the use of `this`.
reference.sourceInformation = node.sourceInformation;
diff --git a/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart b/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart
index c0b6254..4def583 100644
--- a/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart
+++ b/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart
@@ -117,7 +117,7 @@
return _graph.thisInstruction;
}
- ConstantValue constant = new InterceptorConstantValue(constantInterceptor);
+ ConstantValue constant = InterceptorConstantValue(constantInterceptor);
return _graph.addConstant(constant, _closedWorld);
}
@@ -340,7 +340,7 @@
interceptedClasses);
if (interceptorClass != null) {
HInstruction constantInstruction = _graph.addConstant(
- new InterceptorConstantValue(interceptorClass), _closedWorld);
+ InterceptorConstantValue(interceptorClass), _closedWorld);
node.conditionalConstantInterceptor = constantInstruction;
constantInstruction.usedBy.add(node);
return false;
diff --git a/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart b/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart
index ba133a6..2ceac61 100644
--- a/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart
+++ b/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart
@@ -374,7 +374,7 @@
OptimizationTestLog log) {
HInstruction input = instruction.inputs[1];
if (input.isNumber(closedWorld.abstractValueDomain).isDefinitelyTrue) {
- HBitNot converted = new HBitNot(
+ HBitNot converted = HBitNot(
input, computeTypeFromInputTypes(instruction, results, closedWorld));
log?.registerBitNot(instruction, converted);
return converted;
@@ -420,7 +420,7 @@
OptimizationTestLog log) {
HInstruction input = instruction.inputs[1];
if (input.isNumber(closedWorld.abstractValueDomain).isDefinitelyTrue) {
- HNegate converted = new HNegate(
+ HNegate converted = HNegate(
input, computeTypeFromInputTypes(instruction, results, closedWorld));
log?.registerUnaryNegate(instruction, converted);
return converted;
@@ -459,7 +459,7 @@
OptimizationTestLog log) {
HInstruction input = instruction.inputs[1];
if (input.isNumber(closedWorld.abstractValueDomain).isDefinitelyTrue) {
- HAbs converted = new HAbs(
+ HAbs converted = HAbs(
input, computeTypeFromInputTypes(instruction, results, closedWorld));
log?.registerAbs(instruction, converted);
return converted;
@@ -585,7 +585,7 @@
@override
HInstruction newBuiltinVariant(HInvokeDynamic instruction,
GlobalTypeInferenceResults results, JClosedWorld closedWorld) {
- return new HAdd(instruction.inputs[1], instruction.inputs[2],
+ return HAdd(instruction.inputs[1], instruction.inputs[2],
computeTypeFromInputTypes(instruction, results, closedWorld));
}
@@ -617,7 +617,7 @@
@override
HInstruction newBuiltinVariant(HInvokeDynamic instruction,
GlobalTypeInferenceResults results, JClosedWorld closedWorld) {
- return new HDivide(instruction.inputs[1], instruction.inputs[2],
+ return HDivide(instruction.inputs[1], instruction.inputs[2],
closedWorld.abstractValueDomain.numType);
}
@@ -658,7 +658,7 @@
HInstruction receiver = instruction.getDartReceiver(closedWorld);
if (inputsArePositiveIntegers(instruction, closedWorld) &&
!canBeNegativeZero(receiver)) {
- return new HRemainder(instruction.inputs[1], instruction.inputs[2],
+ return HRemainder(instruction.inputs[1], instruction.inputs[2],
computeTypeFromInputTypes(instruction, results, closedWorld));
}
// TODO(sra):
@@ -700,7 +700,7 @@
@override
HInstruction newBuiltinVariant(HInvokeDynamic instruction,
GlobalTypeInferenceResults results, JClosedWorld closedWorld) {
- return new HRemainder(instruction.inputs[1], instruction.inputs[2],
+ return HRemainder(instruction.inputs[1], instruction.inputs[2],
computeTypeFromInputTypes(instruction, results, closedWorld));
}
@@ -731,7 +731,7 @@
@override
HInstruction newBuiltinVariant(HInvokeDynamic instruction,
GlobalTypeInferenceResults results, JClosedWorld closedWorld) {
- return new HMultiply(instruction.inputs[1], instruction.inputs[2],
+ return HMultiply(instruction.inputs[1], instruction.inputs[2],
computeTypeFromInputTypes(instruction, results, closedWorld));
}
@@ -753,7 +753,7 @@
@override
HInstruction newBuiltinVariant(HInvokeDynamic instruction,
GlobalTypeInferenceResults results, JClosedWorld closedWorld) {
- return new HSubtract(instruction.inputs[1], instruction.inputs[2],
+ return HSubtract(instruction.inputs[1], instruction.inputs[2],
computeTypeFromInputTypes(instruction, results, closedWorld));
}
@@ -858,7 +858,7 @@
@override
HInstruction newBuiltinVariant(HInvokeDynamic instruction,
GlobalTypeInferenceResults results, JClosedWorld closedWorld) {
- return new HTruncatingDivide(instruction.inputs[1], instruction.inputs[2],
+ return HTruncatingDivide(instruction.inputs[1], instruction.inputs[2],
computeTypeFromInputTypes(instruction, results, closedWorld));
}
@@ -893,8 +893,7 @@
HConstant rightConstant = instruction;
IntConstantValue intConstant = rightConstant.constant;
int value = intConstant.intValue.toInt();
- assert(intConstant.intValue ==
- new BigInt.from(intConstant.intValue.toInt()));
+ assert(intConstant.intValue == BigInt.from(intConstant.intValue.toInt()));
return value >= low && value <= high;
}
// TODO(sra): Integrate with the bit-width analysis in codegen.dart.
@@ -959,7 +958,7 @@
@override
HInstruction newBuiltinVariant(HInvokeDynamic instruction,
GlobalTypeInferenceResults results, JClosedWorld closedWorld) {
- return new HShiftLeft(instruction.inputs[1], instruction.inputs[2],
+ return HShiftLeft(instruction.inputs[1], instruction.inputs[2],
computeTypeFromInputTypes(instruction, results, closedWorld));
}
@@ -1030,7 +1029,7 @@
@override
HInstruction newBuiltinVariant(HInvokeDynamic instruction,
GlobalTypeInferenceResults results, JClosedWorld closedWorld) {
- return new HShiftRight(instruction.inputs[1], instruction.inputs[2],
+ return HShiftRight(instruction.inputs[1], instruction.inputs[2],
computeTypeFromInputTypes(instruction, results, closedWorld));
}
@@ -1134,7 +1133,7 @@
@override
HInstruction newBuiltinVariant(HInvokeDynamic instruction,
GlobalTypeInferenceResults results, JClosedWorld closedWorld) {
- return new HBitOr(instruction.inputs[1], instruction.inputs[2],
+ return HBitOr(instruction.inputs[1], instruction.inputs[2],
computeTypeFromInputTypes(instruction, results, closedWorld));
}
@@ -1171,7 +1170,7 @@
@override
HInstruction newBuiltinVariant(HInvokeDynamic instruction,
GlobalTypeInferenceResults results, JClosedWorld closedWorld) {
- return new HBitAnd(instruction.inputs[1], instruction.inputs[2],
+ return HBitAnd(instruction.inputs[1], instruction.inputs[2],
computeTypeFromInputTypes(instruction, results, closedWorld));
}
@@ -1205,7 +1204,7 @@
@override
HInstruction newBuiltinVariant(HInvokeDynamic instruction,
GlobalTypeInferenceResults results, JClosedWorld closedWorld) {
- return new HBitXor(instruction.inputs[1], instruction.inputs[2],
+ return HBitXor(instruction.inputs[1], instruction.inputs[2],
computeTypeFromInputTypes(instruction, results, closedWorld));
}
@@ -1310,7 +1309,7 @@
@override
HInstruction newBuiltinVariant(
HInvokeDynamic instruction, JClosedWorld closedWorld) {
- return new HIdentity(instruction.inputs[1], instruction.inputs[2],
+ return HIdentity(instruction.inputs[1], instruction.inputs[2],
closedWorld.abstractValueDomain.boolType);
}
@@ -1332,7 +1331,7 @@
@override
HInstruction newBuiltinVariant(
HInvokeDynamic instruction, JClosedWorld closedWorld) {
- return new HLess(instruction.inputs[1], instruction.inputs[2],
+ return HLess(instruction.inputs[1], instruction.inputs[2],
closedWorld.abstractValueDomain.boolType);
}
@@ -1354,7 +1353,7 @@
@override
HInstruction newBuiltinVariant(
HInvokeDynamic instruction, JClosedWorld closedWorld) {
- return new HGreater(instruction.inputs[1], instruction.inputs[2],
+ return HGreater(instruction.inputs[1], instruction.inputs[2],
closedWorld.abstractValueDomain.boolType);
}
@@ -1376,7 +1375,7 @@
@override
HInstruction newBuiltinVariant(
HInvokeDynamic instruction, JClosedWorld closedWorld) {
- return new HGreaterEqual(instruction.inputs[1], instruction.inputs[2],
+ return HGreaterEqual(instruction.inputs[1], instruction.inputs[2],
closedWorld.abstractValueDomain.boolType);
}
@@ -1398,7 +1397,7 @@
@override
HInstruction newBuiltinVariant(
HInvokeDynamic instruction, JClosedWorld closedWorld) {
- return new HLessEqual(instruction.inputs[1], instruction.inputs[2],
+ return HLessEqual(instruction.inputs[1], instruction.inputs[2],
closedWorld.abstractValueDomain.boolType);
}
diff --git a/pkg/compiler/lib/src/ssa/jump_handler.dart b/pkg/compiler/lib/src/ssa/jump_handler.dart
index 767df33..24faf54 100644
--- a/pkg/compiler/lib/src/ssa/jump_handler.dart
+++ b/pkg/compiler/lib/src/ssa/jump_handler.dart
@@ -22,7 +22,7 @@
abstract class JumpHandler {
factory JumpHandler(KernelSsaGraphBuilder builder, JumpTarget target) {
- return new TargetJumpHandler(builder, target);
+ return TargetJumpHandler(builder, target);
}
void generateBreak(SourceInformation sourceInformation,
[LabelDefinition label]);
@@ -103,14 +103,14 @@
HInstruction breakInstruction;
if (label == null) {
breakInstruction =
- new HBreak(_abstractValueDomain, target, sourceInformation);
+ HBreak(_abstractValueDomain, target, sourceInformation);
} else {
breakInstruction =
- new HBreak.toLabel(_abstractValueDomain, label, sourceInformation);
+ HBreak.toLabel(_abstractValueDomain, label, sourceInformation);
}
- LocalsHandler locals = new LocalsHandler.from(builder.localsHandler);
+ LocalsHandler locals = LocalsHandler.from(builder.localsHandler);
builder.close(breakInstruction);
- jumps.add(new _JumpHandlerEntry(breakInstruction, locals));
+ jumps.add(_JumpHandlerEntry(breakInstruction, locals));
}
@override
@@ -119,17 +119,17 @@
HInstruction continueInstruction;
if (label == null) {
continueInstruction =
- new HContinue(_abstractValueDomain, target, sourceInformation);
+ HContinue(_abstractValueDomain, target, sourceInformation);
} else {
continueInstruction =
- new HContinue.toLabel(_abstractValueDomain, label, sourceInformation);
+ HContinue.toLabel(_abstractValueDomain, label, sourceInformation);
// Switch case continue statements must be handled by the
// [SwitchCaseJumpHandler].
assert(!label.target.isSwitchCase);
}
- LocalsHandler locals = new LocalsHandler.from(builder.localsHandler);
+ LocalsHandler locals = LocalsHandler.from(builder.localsHandler);
builder.close(continueInstruction);
- jumps.add(new _JumpHandlerEntry(continueInstruction, locals));
+ jumps.add(_JumpHandlerEntry(continueInstruction, locals));
}
@override
@@ -184,7 +184,7 @@
abstract class SwitchCaseJumpHandler extends TargetJumpHandler {
/// Map from switch case targets to indices used to encode the flow of the
/// switch case loop.
- final Map<JumpTarget, int> targetIndexMap = new Map<JumpTarget, int>();
+ final Map<JumpTarget, int> targetIndexMap = Map<JumpTarget, int>();
SwitchCaseJumpHandler(KernelSsaGraphBuilder builder, JumpTarget target)
: super(builder, target);
@@ -197,12 +197,12 @@
// for a switch statement with continue statements. See
// [SsaFromAstMixin.buildComplexSwitchStatement] for detail.
- HInstruction breakInstruction = new HBreak(
+ HInstruction breakInstruction = HBreak(
_abstractValueDomain, target, sourceInformation,
breakSwitchContinueLoop: true);
- LocalsHandler locals = new LocalsHandler.from(builder.localsHandler);
+ LocalsHandler locals = LocalsHandler.from(builder.localsHandler);
builder.close(breakInstruction);
- jumps.add(new _JumpHandlerEntry(breakInstruction, locals));
+ jumps.add(_JumpHandlerEntry(breakInstruction, locals));
} else {
super.generateBreak(sourceInformation, label);
}
@@ -227,10 +227,10 @@
assert(label.target.labels.contains(label));
HInstruction continueInstruction =
- new HContinue(_abstractValueDomain, target, sourceInformation);
- LocalsHandler locals = new LocalsHandler.from(builder.localsHandler);
+ HContinue(_abstractValueDomain, target, sourceInformation);
+ LocalsHandler locals = LocalsHandler.from(builder.localsHandler);
builder.close(continueInstruction);
- jumps.add(new _JumpHandlerEntry(continueInstruction, locals));
+ jumps.add(_JumpHandlerEntry(continueInstruction, locals));
} else {
super.generateContinue(sourceInformation, label);
}
diff --git a/pkg/compiler/lib/src/ssa/kernel_string_builder.dart b/pkg/compiler/lib/src/ssa/kernel_string_builder.dart
index b6f69b6..c21bc69 100644
--- a/pkg/compiler/lib/src/ssa/kernel_string_builder.dart
+++ b/pkg/compiler/lib/src/ssa/kernel_string_builder.dart
@@ -61,14 +61,14 @@
HInstruction concat(HInstruction left, HInstruction right) {
HInstruction instruction =
- new HStringConcat(left, right, _abstractValueDomain.stringType);
+ HStringConcat(left, right, _abstractValueDomain.stringType);
builder.add(instruction);
return instruction;
}
HInstruction stringify(HInstruction expression) {
HInstruction instruction =
- new HStringify(expression, _abstractValueDomain.stringType)
+ HStringify(expression, _abstractValueDomain.stringType)
..sourceInformation = expression.sourceInformation;
builder.add(instruction);
return instruction;
diff --git a/pkg/compiler/lib/src/ssa/locals_handler.dart b/pkg/compiler/lib/src/ssa/locals_handler.dart
index 502d335..37da289 100644
--- a/pkg/compiler/lib/src/ssa/locals_handler.dart
+++ b/pkg/compiler/lib/src/ssa/locals_handler.dart
@@ -32,8 +32,8 @@
/// iteration order a function only of insertions and not a function of
/// e.g. Element hash codes. I'd prefer to use a SortedMap but some elements
/// don't have source locations for [Elements.compareByPosition].
- Map<Local, HInstruction> directLocals = new Map<Local, HInstruction>();
- Map<Local, FieldEntity> redirectionMapping = new Map<Local, FieldEntity>();
+ Map<Local, HInstruction> directLocals = Map<Local, HInstruction>();
+ Map<Local, FieldEntity> redirectionMapping = Map<Local, FieldEntity>();
final KernelSsaGraphBuilder builder;
MemberEntity _scopeInfoMember;
@@ -41,7 +41,7 @@
KernelToLocalsMap _localsMap;
Map<TypeVariableEntity, TypeVariableLocal> typeVariableLocals =
- new Map<TypeVariableEntity, TypeVariableLocal>();
+ Map<TypeVariableEntity, TypeVariableLocal>();
final Entity executableContext;
final MemberEntity memberContext;
@@ -106,7 +106,7 @@
/// copy the [directLocals], since the other fields can be shared
/// throughout the AST visit.
LocalsHandler.from(LocalsHandler other)
- : directLocals = new Map<Local, HInstruction>.from(other.directLocals),
+ : directLocals = Map<Local, HInstruction>.from(other.directLocals),
redirectionMapping = other.redirectionMapping,
executableContext = other.executableContext,
memberContext = other.memberContext,
@@ -148,7 +148,7 @@
}
HInstruction createBox(SourceInformation sourceInformation) {
- HInstruction box = new HCreateBox(_abstractValueDomain.nonNullType)
+ HInstruction box = HCreateBox(_abstractValueDomain.nonNullType)
..sourceInformation = sourceInformation;
builder.add(box);
return box;
@@ -158,7 +158,7 @@
/// method creates a box and sets up the redirections.
void enterScope(
CapturedScope closureInfo, SourceInformation sourceInformation,
- {bool forGenerativeConstructorBody: false, HInstruction inlinedBox}) {
+ {bool forGenerativeConstructorBody = false, HInstruction inlinedBox}) {
// See if any variable in the top-scope of the function is captured. If yes
// we need to create a box-object.
if (!closureInfo.requiresContextBox) return;
@@ -261,7 +261,7 @@
});
// Inside closure redirect references to itself to [:this:].
HThis thisInstruction =
- new HThis(closureData.thisLocal, _abstractValueDomain.nonNullType);
+ HThis(closureData.thisLocal, _abstractValueDomain.nonNullType);
builder.graph.thisInstruction = thisInstruction;
builder.graph.entry.addAtEntry(thisInstruction);
updateLocal(closureData.getClosureEntity(_localsMap), thisInstruction);
@@ -269,7 +269,7 @@
// Once closures have been mapped to classes their instance members might
// not have any thisElement if the closure was created inside a static
// context.
- HThis thisInstruction = new HThis(scopeInfo.thisLocal, getTypeOfThis());
+ HThis thisInstruction = HThis(scopeInfo.thisLocal, getTypeOfThis());
builder.graph.thisInstruction = thisInstruction;
builder.graph.entry.addAtEntry(thisInstruction);
directLocals[scopeInfo.thisLocal] = thisInstruction;
@@ -289,7 +289,7 @@
_nativeData.isNativeOrExtendsNative(cls);
if (_interceptorData.isInterceptedMethod(element)) {
SyntheticLocal parameter = createLocal('receiver');
- HParameterValue value = new HParameterValue(parameter, getTypeOfThis());
+ HParameterValue value = HParameterValue(parameter, getTypeOfThis());
builder.graph.explicitReceiverParameter = value;
builder.graph.entry.addAfter(directLocals[scopeInfo.thisLocal], value);
if (builder.lastAddedParameter == null) {
@@ -301,7 +301,7 @@
SyntheticLocal parameter = createLocal('receiver');
// Unlike `this`, receiver is nullable since direct calls to generative
// constructor call the constructor with `null`.
- HParameterValue value = new HParameterValue(
+ HParameterValue value = HParameterValue(
parameter, _closedWorld.abstractValueDomain.createNullableExact(cls));
builder.graph.explicitReceiverParameter = value;
builder.graph.entry.addAtEntry(value);
@@ -359,7 +359,7 @@
}
HInstruction value = directLocals[local];
if (sourceInformation != null) {
- value = new HRef(value, sourceInformation);
+ value = HRef(value, sourceInformation);
builder.add(value);
}
return value;
@@ -372,7 +372,7 @@
? _abstractValueDomain.nonNullType
: getTypeOfCapturedVariable(redirect);
HInstruction fieldGet =
- new HFieldGet(redirect, receiver, type, sourceInformation);
+ HFieldGet(redirect, receiver, type, sourceInformation);
builder.add(fieldGet);
return fieldGet;
} else if (isBoxed(local)) {
@@ -389,14 +389,14 @@
assert(localBox != null);
HInstruction box = readLocal(localBox);
- HInstruction lookup = new HFieldGet(redirect, box,
+ HInstruction lookup = HFieldGet(redirect, box,
getTypeOfCapturedVariable(redirect), sourceInformation);
builder.add(lookup);
return lookup;
} else {
assert(_isUsedInTryOrGenerator(local));
HLocalValue localValue = getLocal(local);
- HInstruction instruction = new HLocalGet(local, localValue,
+ HInstruction instruction = HLocalGet(local, localValue,
_abstractValueDomain.dynamicType, sourceInformation);
builder.add(instruction);
return instruction;
@@ -424,7 +424,7 @@
return activationVariables.putIfAbsent(local, () {
HLocalValue localValue =
- new HLocalValue(local, _abstractValueDomain.nonNullType)
+ HLocalValue(local, _abstractValueDomain.nonNullType)
..sourceInformation = sourceInformation;
builder.graph.entry.addAtExit(localValue);
return localValue;
@@ -432,8 +432,7 @@
}
Local getTypeVariableAsLocal(TypeVariableType type) {
- return typeVariableLocals[type.element] ??=
- new TypeVariableLocal(type.element);
+ return typeVariableLocals[type.element] ??= TypeVariableLocal(type.element);
}
/// Sets the [element] to [value]. If the element is boxed or stored in a
@@ -462,12 +461,12 @@
// Inside the closure the box is stored in a closure-field and cannot
// be accessed directly.
HInstruction box = readLocal(localBox);
- builder.add(new HFieldSet(_abstractValueDomain, redirect, box, value)
+ builder.add(HFieldSet(_abstractValueDomain, redirect, box, value)
..sourceInformation = sourceInformation);
} else {
assert(_isUsedInTryOrGenerator(local));
HLocalValue localValue = getLocal(local);
- builder.add(new HLocalSet(_abstractValueDomain, local, localValue, value)
+ builder.add(HLocalSet(_abstractValueDomain, local, localValue, value)
..sourceInformation = sourceInformation);
}
}
@@ -532,14 +531,14 @@
void beginLoopHeader(HBasicBlock loopEntry) {
// Create a copy because we modify the map while iterating over it.
Map<Local, HInstruction> savedDirectLocals =
- new Map<Local, HInstruction>.from(directLocals);
+ Map<Local, HInstruction>.from(directLocals);
// Create phis for all elements in the definitions environment.
savedDirectLocals.forEach((Local local, HInstruction instruction) {
if (isAccessedDirectly(local)) {
// We know 'this' cannot be modified.
if (local != _scopeInfo.thisLocal) {
- HPhi phi = new HPhi.singleInput(
+ HPhi phi = HPhi.singleInput(
local, instruction, _abstractValueDomain.dynamicType);
loopEntry.addPhi(phi);
directLocals[local] = phi;
@@ -595,7 +594,7 @@
// block. Since variable declarations are scoped the declared
// variable cannot be alive outside the block. Note: this is only
// true for nodes where we do joins.
- Map<Local, HInstruction> joinedLocals = new Map<Local, HInstruction>();
+ Map<Local, HInstruction> joinedLocals = Map<Local, HInstruction>();
otherLocals.directLocals.forEach((Local local, HInstruction instruction) {
// We know 'this' cannot be modified.
if (local == _scopeInfo.thisLocal) {
@@ -607,7 +606,7 @@
if (identical(instruction, mine)) {
joinedLocals[local] = instruction;
} else {
- HInstruction phi = new HPhi.manyInputs(
+ HInstruction phi = HPhi.manyInputs(
local,
<HInstruction>[mine, instruction],
_abstractValueDomain.dynamicType);
@@ -628,11 +627,11 @@
List<LocalsHandler> localsHandlers, HBasicBlock joinBlock) {
assert(localsHandlers.length > 0);
if (localsHandlers.length == 1) return localsHandlers.single;
- Map<Local, HInstruction> joinedLocals = new Map<Local, HInstruction>();
+ Map<Local, HInstruction> joinedLocals = Map<Local, HInstruction>();
HInstruction thisValue = null;
directLocals.forEach((Local local, HInstruction instruction) {
if (local != _scopeInfo.thisLocal) {
- HPhi phi = new HPhi.noInputs(local, _abstractValueDomain.dynamicType);
+ HPhi phi = HPhi.noInputs(local, _abstractValueDomain.dynamicType);
joinedLocals[local] = phi;
joinBlock.addPhi(phi);
} else {
@@ -656,7 +655,7 @@
}
// Remove locals that are not in all handlers.
- directLocals = new Map<Local, HInstruction>();
+ directLocals = Map<Local, HInstruction>();
joinedLocals.forEach((Local local, HInstruction instruction) {
if (local != _scopeInfo.thisLocal &&
instruction.inputs.length != localsHandlers.length) {
@@ -690,7 +689,7 @@
}
Map<FieldEntity, AbstractValue> cachedTypesOfCapturedVariables =
- new Map<FieldEntity, AbstractValue>();
+ Map<FieldEntity, AbstractValue>();
AbstractValue getTypeOfCapturedVariable(FieldEntity element) {
return cachedTypesOfCapturedVariables.putIfAbsent(element, () {
@@ -705,7 +704,7 @@
Map<Local, HLocalValue> activationVariables = <Local, HLocalValue>{};
SyntheticLocal createLocal(String name) {
- return new SyntheticLocal(name, executableContext, memberContext);
+ return SyntheticLocal(name, executableContext, memberContext);
}
}
diff --git a/pkg/compiler/lib/src/ssa/logging.dart b/pkg/compiler/lib/src/ssa/logging.dart
index 77c888e..fcbb3ab 100644
--- a/pkg/compiler/lib/src/ssa/logging.dart
+++ b/pkg/compiler/lib/src/ssa/logging.dart
@@ -26,14 +26,14 @@
return null;
}
}
- Features features = new Features();
+ Features features = Features();
f(features);
- entries.add(new OptimizationLogEntry(tag, features));
+ entries.add(OptimizationLogEntry(tag, features));
return features;
}
void registerNullCheck(HInstruction original, HNullCheck check) {
- Features features = new Features();
+ Features features = Features();
if (check.selector != null) {
features['selector'] = check.selector.name;
}
@@ -41,12 +41,12 @@
features['field'] =
'${check.field.enclosingClass.name}.${check.field.name}';
}
- entries.add(new OptimizationLogEntry('NullCheck', features));
+ entries.add(OptimizationLogEntry('NullCheck', features));
}
void registerConditionValue(
HInstruction original, bool value, String where, int count) {
- Features features = new Features();
+ Features features = Features();
features['value'] = '$value';
features['where'] = where;
features['count'] = '$count';
@@ -54,52 +54,52 @@
}
void registerFieldGet(HInvokeDynamicGetter original, HFieldGet converted) {
- Features features = new Features();
+ Features features = Features();
if (converted.element != null) {
features['name'] =
'${converted.element.enclosingClass.name}.${converted.element.name}';
} else {
features['name'] = '<null-guard>';
}
- entries.add(new OptimizationLogEntry('FieldGet', features));
+ entries.add(OptimizationLogEntry('FieldGet', features));
}
void registerFieldSet(HInvokeDynamicSetter original, [HFieldSet converted]) {
- Features features = new Features();
+ Features features = Features();
if (converted != null) {
features['name'] =
'${converted.element.enclosingClass.name}.${converted.element.name}';
} else {
features['removed'] = original.selector.name;
}
- entries.add(new OptimizationLogEntry('FieldSet', features));
+ entries.add(OptimizationLogEntry('FieldSet', features));
}
void registerFieldCall(HInvokeDynamicMethod original, HFieldGet converted) {
- Features features = new Features();
+ Features features = Features();
if (converted.element != null) {
features['name'] =
'${converted.element.enclosingClass.name}.${converted.element.name}';
} else {
features['name'] = '<null-guard>';
}
- entries.add(new OptimizationLogEntry('FieldCall', features));
+ entries.add(OptimizationLogEntry('FieldCall', features));
}
void registerConstantFieldGet(
HInvokeDynamicGetter original, FieldEntity field, HConstant converted) {
- Features features = new Features();
+ Features features = Features();
features['name'] = '${field.enclosingClass.name}.${field.name}';
features['value'] = converted.constant.toStructuredText(_dartTypes);
- entries.add(new OptimizationLogEntry('ConstantFieldGet', features));
+ entries.add(OptimizationLogEntry('ConstantFieldGet', features));
}
void registerConstantFieldCall(
HInvokeDynamicMethod original, FieldEntity field, HConstant converted) {
- Features features = new Features();
+ Features features = Features();
features['name'] = '${field.enclosingClass.name}.${field.name}';
features['value'] = converted.constant.toStructuredText(_dartTypes);
- entries.add(new OptimizationLogEntry('ConstantFieldCall', features));
+ entries.add(OptimizationLogEntry('ConstantFieldCall', features));
}
Features _registerSpecializer(
@@ -218,17 +218,17 @@
}
void registerCodeUnitAt(HInvokeDynamic original) {
- Features features = new Features();
+ Features features = Features();
features['name'] = original.selector.name;
- entries.add(new OptimizationLogEntry('CodeUnitAt', features));
+ entries.add(OptimizationLogEntry('CodeUnitAt', features));
}
void registerCompareTo(HInvokeDynamic original, [HConstant converted]) {
- Features features = new Features();
+ Features features = Features();
if (converted != null) {
features['constant'] = converted.constant.toDartText(_dartTypes);
}
- entries.add(new OptimizationLogEntry('CompareTo', features));
+ entries.add(OptimizationLogEntry('CompareTo', features));
}
void registerSubstring(HInvokeDynamic original) {
@@ -252,7 +252,7 @@
}
void registerPrimitiveCheck(HInstruction original, HPrimitiveCheck check) {
- Features features = new Features();
+ Features features = Features();
if (check.isReceiverTypeCheck) {
features['kind'] = 'receiver';
@@ -262,7 +262,7 @@
if (check.typeExpression != null) {
features['type'] = '${check.typeExpression}';
}
- entries.add(new OptimizationLogEntry('PrimitiveCheck', features));
+ entries.add(OptimizationLogEntry('PrimitiveCheck', features));
}
String getText() {
diff --git a/pkg/compiler/lib/src/ssa/loop_handler.dart b/pkg/compiler/lib/src/ssa/loop_handler.dart
index d729fef..73e96e9 100644
--- a/pkg/compiler/lib/src/ssa/loop_handler.dart
+++ b/pkg/compiler/lib/src/ssa/loop_handler.dart
@@ -56,7 +56,7 @@
startBlock = initializerBlock;
initialize();
assert(!builder.isAborted());
- initializerGraph = new SubExpression(initializerBlock, builder.current);
+ initializerGraph = SubExpression(initializerBlock, builder.current);
}
builder.loopDepth++;
@@ -66,15 +66,15 @@
if (startBlock == null) startBlock = conditionBlock;
HInstruction conditionInstruction = condition();
- HBasicBlock conditionEndBlock = builder
- .close(new HLoopBranch(_abstractValueDomain, conditionInstruction));
+ HBasicBlock conditionEndBlock =
+ builder.close(HLoopBranch(_abstractValueDomain, conditionInstruction));
SubExpression conditionExpression =
- new SubExpression(conditionBlock, conditionEndBlock);
+ SubExpression(conditionBlock, conditionEndBlock);
// Save the values of the local variables at the end of the condition
// block. These are the values that will flow to the loop exit if the
// condition fails.
- LocalsHandler savedLocals = new LocalsHandler.from(builder.localsHandler);
+ LocalsHandler savedLocals = LocalsHandler.from(builder.localsHandler);
// The body.
HBasicBlock beginBodyBlock = builder.addNewBlock();
@@ -84,9 +84,9 @@
builder.localsHandler.enterLoopBody(loopClosureInfo, sourceInformation);
body();
- SubGraph bodyGraph = new SubGraph(beginBodyBlock, builder.lastOpenedBlock);
+ SubGraph bodyGraph = SubGraph(beginBodyBlock, builder.lastOpenedBlock);
HBasicBlock bodyBlock = builder.current;
- if (builder.current != null) builder.close(new HGoto(_abstractValueDomain));
+ if (builder.current != null) builder.close(HGoto(_abstractValueDomain));
SubExpression updateGraph;
@@ -117,14 +117,14 @@
List<LabelDefinition> labels = jumpHandler.labels;
if (labels.isNotEmpty) {
beginBodyBlock.setBlockFlow(
- new HLabeledBlockInformation(
- new HSubGraphBlockInformation(bodyGraph), jumpHandler.labels,
+ HLabeledBlockInformation(
+ HSubGraphBlockInformation(bodyGraph), jumpHandler.labels,
isContinue: true),
updateBlock);
} else if (jumpTarget != null && jumpTarget.isContinueTarget) {
beginBodyBlock.setBlockFlow(
- new HLabeledBlockInformation.implicit(
- new HSubGraphBlockInformation(bodyGraph), jumpTarget,
+ HLabeledBlockInformation.implicit(
+ HSubGraphBlockInformation(bodyGraph), jumpTarget,
isContinue: true),
updateBlock);
}
@@ -134,22 +134,21 @@
update();
- HBasicBlock updateEndBlock =
- builder.close(new HGoto(_abstractValueDomain));
+ HBasicBlock updateEndBlock = builder.close(HGoto(_abstractValueDomain));
// The back-edge completing the cycle.
updateEndBlock.addSuccessor(conditionBlock);
- updateGraph = new SubExpression(updateBlock, updateEndBlock);
+ updateGraph = SubExpression(updateBlock, updateEndBlock);
// Avoid a critical edge from the condition to the loop-exit body.
HBasicBlock conditionExitBlock = builder.addNewBlock();
builder.open(conditionExitBlock);
- builder.close(new HGoto(_abstractValueDomain));
+ builder.close(HGoto(_abstractValueDomain));
conditionEndBlock.addSuccessor(conditionExitBlock);
endLoop(conditionBlock, conditionExitBlock, jumpHandler, savedLocals);
conditionBlock.postProcessLoopHeader();
- HLoopBlockInformation info = new HLoopBlockInformation(
+ HLoopBlockInformation info = HLoopBlockInformation(
loopKind(loop),
builder.wrapExpressionGraph(initializerGraph),
builder.wrapExpressionGraph(conditionExpression),
@@ -174,22 +173,22 @@
// label to the if.
HBasicBlock elseBlock = builder.addNewBlock();
builder.open(elseBlock);
- builder.close(new HGoto(_abstractValueDomain));
+ builder.close(HGoto(_abstractValueDomain));
// Pass the elseBlock as the branchBlock, because that's the block we go
// to just before leaving the 'loop'.
endLoop(conditionBlock, elseBlock, jumpHandler, savedLocals);
- SubGraph elseGraph = new SubGraph(elseBlock, elseBlock);
+ SubGraph elseGraph = SubGraph(elseBlock, elseBlock);
// Remove the loop information attached to the header.
conditionBlock.loopInformation = null;
// Remove the [HLoopBranch] instruction and replace it with
// [HIf].
HInstruction condition = conditionEndBlock.last.inputs[0];
- conditionEndBlock.addAtExit(new HIf(_abstractValueDomain, condition));
+ conditionEndBlock.addAtExit(HIf(_abstractValueDomain, condition));
conditionEndBlock.addSuccessor(elseBlock);
conditionEndBlock.remove(conditionEndBlock.last);
- HIfBlockInformation info = new HIfBlockInformation(
+ HIfBlockInformation info = HIfBlockInformation(
builder.wrapExpressionGraph(conditionExpression),
builder.wrapStatementGraph(bodyGraph),
builder.wrapStatementGraph(elseGraph));
@@ -203,17 +202,16 @@
if (jumpHandler.hasAnyBreak()) {
LabelDefinition label =
jumpTarget.addLabel('loop', isBreakTarget: true);
- SubGraph labelGraph = new SubGraph(conditionBlock, builder.current);
- HLabeledBlockInformation labelInfo = new HLabeledBlockInformation(
- new HSubGraphBlockInformation(labelGraph),
- <LabelDefinition>[label]);
+ SubGraph labelGraph = SubGraph(conditionBlock, builder.current);
+ HLabeledBlockInformation labelInfo = HLabeledBlockInformation(
+ HSubGraphBlockInformation(labelGraph), <LabelDefinition>[label]);
conditionBlock.setBlockFlow(labelInfo, builder.current);
jumpHandler.forEachBreak((HBreak breakInstruction, _) {
HBasicBlock block = breakInstruction.block;
- block.addAtExit(new HBreak.toLabel(
- _abstractValueDomain, label, sourceInformation));
+ block.addAtExit(
+ HBreak.toLabel(_abstractValueDomain, label, sourceInformation));
block.remove(breakInstruction);
});
}
@@ -227,7 +225,7 @@
/// Also notifies the locals handler that we're entering a loop.
JumpHandler beginLoopHeader(ir.TreeNode node, JumpTarget jumpTarget) {
assert(!builder.isAborted());
- HBasicBlock previousBlock = builder.close(new HGoto(_abstractValueDomain));
+ HBasicBlock previousBlock = builder.close(HGoto(_abstractValueDomain));
JumpHandler jumpHandler =
createJumpHandler(node, jumpTarget, isLoopJump: true);
@@ -326,7 +324,7 @@
builder.createJumpHandler(node, jumpTarget, isLoopJump: isLoopJump);
@override
- int loopKind(ir.TreeNode node) => node.accept(new _KernelLoopTypeVisitor());
+ int loopKind(ir.TreeNode node) => node.accept(_KernelLoopTypeVisitor());
}
class _KernelLoopTypeVisitor extends ir.Visitor<int>
diff --git a/pkg/compiler/lib/src/ssa/nodes.dart b/pkg/compiler/lib/src/ssa/nodes.dart
index a01c6bf..a136378 100644
--- a/pkg/compiler/lib/src/ssa/nodes.dart
+++ b/pkg/compiler/lib/src/ssa/nodes.dart
@@ -131,7 +131,7 @@
// }
// visitBasicBlockAndSuccessors(graph.entry);
- _Frame frame = new _Frame(null);
+ _Frame frame = _Frame(null);
frame.block = graph.entry;
frame.index = 0;
@@ -142,7 +142,7 @@
int index = frame.index;
if (index < block.dominatedBlocks.length) {
frame.index = index + 1;
- frame = frame.next ??= new _Frame(frame);
+ frame = frame.next ??= _Frame(frame);
frame.block = block.dominatedBlocks[index];
frame.index = 0;
visitBasicBlock(frame.block);
@@ -164,7 +164,7 @@
// }
// visitBasicBlockAndSuccessors(graph.entry);
- _Frame frame = new _Frame(null);
+ _Frame frame = _Frame(null);
frame.block = graph.entry;
frame.index = frame.block.dominatedBlocks.length;
@@ -173,7 +173,7 @@
int index = frame.index;
if (index > 0) {
frame.index = index - 1;
- frame = frame.next ??= new _Frame(frame);
+ frame = frame.next ??= _Frame(frame);
frame.block = block.dominatedBlocks[index - 1];
frame.index = frame.block.dominatedBlocks.length;
continue;
@@ -240,19 +240,19 @@
/// Nodes containing list allocations for which there is a known fixed length.
// TODO(sigmund,sra): consider not storing this explicitly here (e.g. maybe
// store it on HInstruction, or maybe this can be computed on demand).
- final Set<HInstruction> allocatedFixedLists = new Set<HInstruction>();
+ final Set<HInstruction> allocatedFixedLists = Set<HInstruction>();
SourceInformation sourceInformation;
// We canonicalize all constants used within a graph so we do not
// have to worry about them for global value numbering.
- Map<ConstantValue, HConstant> constants = new Map<ConstantValue, HConstant>();
+ Map<ConstantValue, HConstant> constants = Map<ConstantValue, HConstant>();
HGraph() {
entry = addNewBlock();
// The exit block will be added later, so it has an id that is
// after all others in the system.
- exit = new HBasicBlock();
+ exit = HBasicBlock();
}
void addBlock(HBasicBlock block) {
@@ -263,7 +263,7 @@
}
HBasicBlock addNewBlock() {
- HBasicBlock result = new HBasicBlock();
+ HBasicBlock result = HBasicBlock();
addBlock(result);
return result;
}
@@ -271,7 +271,7 @@
HBasicBlock addNewLoopHeaderBlock(
JumpTarget target, List<LabelDefinition> labels) {
HBasicBlock result = addNewBlock();
- result.loopInformation = new HLoopInformation(result, target, labels);
+ result.loopInformation = HLoopInformation(result, target, labels);
return result;
}
@@ -286,7 +286,7 @@
}
AbstractValue type = closedWorld.abstractValueDomain
.computeAbstractValueForConstant(constant);
- result = new HConstant.internal(constant, type)
+ result = HConstant.internal(constant, type)
..sourceInformation = sourceInformation;
entry.addAtExit(result);
constants[constant] = result;
@@ -309,8 +309,7 @@
HConstant addConstantIntAsUnsigned(int i, JClosedWorld closedWorld) {
return addConstant(
- constant_system.createInt(new BigInt.from(i).toUnsigned(64)),
- closedWorld);
+ constant_system.createInt(BigInt.from(i).toUnsigned(64)), closedWorld);
}
HConstant addConstantDouble(double d, JClosedWorld closedWorld) {
@@ -322,8 +321,7 @@
}
HConstant addConstantStringFromName(js.Name name, JClosedWorld closedWorld) {
- return addConstant(
- new JsNameConstantValue(js.quoteName(name)), closedWorld);
+ return addConstant(JsNameConstantValue(js.quoteName(name)), closedWorld);
}
HConstant addConstantBool(bool value, JClosedWorld closedWorld) {
@@ -348,7 +346,7 @@
void finalize(AbstractValueDomain domain) {
addBlock(exit);
exit.open();
- exit.close(new HExit(domain));
+ exit.close(HExit(domain));
assignDominators();
}
@@ -375,7 +373,7 @@
// blocks. A dominator has a dfs-in..dfs-out range that includes the range
// of the dominated block. See [HGraphVisitor.visitDominatorTree] for
// recursion-free schema.
- _Frame frame = new _Frame(null);
+ _Frame frame = _Frame(null);
frame.block = entry;
frame.index = 0;
@@ -387,7 +385,7 @@
int index = frame.index;
if (index < block.dominatedBlocks.length) {
frame.index = index + 1;
- frame = frame.next ??= new _Frame(frame);
+ frame = frame.next ??= _Frame(frame);
frame.block = block.dominatedBlocks[index];
frame.index = 0;
frame.block.dominatorDfsIn = ++dfsNumber;
@@ -399,7 +397,7 @@
}
bool isValid() {
- HValidator validator = new HValidator();
+ HValidator validator = HValidator();
validator.visitGraph(this);
return validator.isValid;
}
@@ -765,7 +763,7 @@
HBasicBlock() : this.withId(null);
HBasicBlock.withId(this.id)
- : phis = new HInstructionList(),
+ : phis = HInstructionList(),
predecessors = <HBasicBlock>[],
successors = const <HBasicBlock>[],
dominatedBlocks = <HBasicBlock>[];
@@ -782,7 +780,7 @@
}
void setBlockFlow(HBlockInformation blockInfo, HBasicBlock continuation) {
- blockFlow = new HBlockFlow(blockInfo, continuation);
+ blockFlow = HBlockFlow(blockInfo, continuation);
}
bool isLabeledBlock() =>
@@ -1017,7 +1015,7 @@
bool isValid() {
assert(isClosed());
- HValidator validator = new HValidator();
+ HValidator validator = HValidator();
validator.visitBasicBlock(this);
return validator.isValid;
}
@@ -1045,7 +1043,7 @@
HInstruction previous = null;
HInstruction next = null;
- SideEffects sideEffects = new SideEffects.empty();
+ SideEffects sideEffects = SideEffects.empty();
bool _useGvn = false;
// Type codes.
@@ -1360,7 +1358,7 @@
bool isInterceptor(JClosedWorld closedWorld) => false;
bool isValid() {
- HValidator validator = new HValidator();
+ HValidator validator = HValidator();
validator.currentBlock = block;
validator.visitInstruction(this);
return validator.isValid;
@@ -1424,8 +1422,8 @@
/// of a loop with many break statements). If [excludePhiOutEdges] is `true`
/// then these edge uses are not included.
static DominatedUses of(HInstruction source, HInstruction dominator,
- {bool excludeDominator: false, bool excludePhiOutEdges: false}) {
- return new DominatedUses._(source)
+ {bool excludeDominator = false, bool excludePhiOutEdges = false}) {
+ return DominatedUses._(source)
.._compute(source, dominator, excludeDominator, excludePhiOutEdges);
}
@@ -1466,8 +1464,8 @@
bool excludeDominator, bool excludePhiOutEdges) {
// Keep track of all instructions that we have to deal with later and count
// the number of them that are in the current block.
- Set<HInstruction> users = new Setlet<HInstruction>();
- Set<HInstruction> seen = new Setlet<HInstruction>();
+ Set<HInstruction> users = Setlet<HInstruction>();
+ Set<HInstruction> seen = Setlet<HInstruction>();
int usersInCurrentBlock = 0;
HBasicBlock dominatorBlock = dominator.block;
@@ -1655,7 +1653,7 @@
HCreate(this.element, List<HInstruction> inputs, AbstractValue type,
SourceInformation sourceInformation,
- {this.instantiatedTypes, this.hasRtiInput: false, this.callMethod})
+ {this.instantiatedTypes, this.hasRtiInput = false, this.callMethod})
: super(inputs, type) {
this.sourceInformation = sourceInformation;
}
@@ -1834,7 +1832,7 @@
AbstractValue resultType,
this.typeArguments,
SourceInformation sourceInformation,
- {bool isIntercepted: false})
+ {bool isIntercepted = false})
: super(selector, receiverType, null, inputs, isIntercepted, resultType) {
this.sourceInformation = sourceInformation;
assert(selector.callStructure.typeArgumentCount == typeArguments.length);
@@ -1946,7 +1944,7 @@
/// The first input must be the target.
HInvokeStatic(this.element, inputs, AbstractValue type, this.typeArguments,
- {this.targetCanThrow: true, bool isIntercepted: false})
+ {this.targetCanThrow = true, bool isIntercepted = false})
: super(inputs, type) {
isInterceptedCall = isIntercepted;
}
@@ -2411,7 +2409,7 @@
NativeThrowBehavior throwBehavior;
HForeignCode(this.codeTemplate, AbstractValue type, List<HInstruction> inputs,
- {this.isStatement: false,
+ {this.isStatement = false,
SideEffects effects,
NativeBehavior nativeBehavior,
NativeThrowBehavior throwBehavior})
@@ -2813,7 +2811,7 @@
HBreak(AbstractValueDomain domain, JumpTarget target,
SourceInformation sourceInformation,
- {bool this.breakSwitchContinueLoop: false})
+ {bool this.breakSwitchContinueLoop = false})
: super(domain, target, sourceInformation);
HBreak.toLabel(AbstractValueDomain domain, LabelDefinition label,
@@ -3207,7 +3205,7 @@
@override
bool canThrow(AbstractValueDomain domain) => true;
@override
- SideEffects sideEffects = new SideEffects();
+ SideEffects sideEffects = SideEffects();
}
class HYield extends HInstruction {
@@ -3224,14 +3222,14 @@
@override
bool canThrow(AbstractValueDomain domain) => false;
@override
- SideEffects sideEffects = new SideEffects();
+ SideEffects sideEffects = SideEffects();
}
class HThrow extends HControlFlow {
final bool isRethrow;
HThrow(AbstractValueDomain domain, HInstruction value,
SourceInformation sourceInformation,
- {this.isRethrow: false})
+ {this.isRethrow = false})
: super(domain, <HInstruction>[value]) {
this.sourceInformation = sourceInformation;
}
@@ -3927,12 +3925,12 @@
final bool isContinue;
HLabeledBlockInformation(this.body, List<LabelDefinition> labels,
- {this.isContinue: false})
+ {this.isContinue = false})
: this.labels = labels,
this.target = labels[0].target;
HLabeledBlockInformation.implicit(this.body, this.target,
- {this.isContinue: false})
+ {this.isContinue = false})
: this.labels = const <LabelDefinition>[];
@override
diff --git a/pkg/compiler/lib/src/ssa/optimize.dart b/pkg/compiler/lib/src/ssa/optimize.dart
index fde9609..5bbc0ec 100644
--- a/pkg/compiler/lib/src/ssa/optimize.dart
+++ b/pkg/compiler/lib/src/ssa/optimize.dart
@@ -82,83 +82,83 @@
if (retainDataForTesting) {
loggersForTesting ??= {};
loggersForTesting[member] =
- log = new OptimizationTestLog(closedWorld.dartTypes);
+ log = OptimizationTestLog(closedWorld.dartTypes);
}
measure(() {
List<OptimizationPhase> phases = <OptimizationPhase>[
// Run trivial instruction simplification first to optimize
// some patterns useful for type conversion.
- new SsaInstructionSimplifier(globalInferenceResults, _options,
- closedWorld, typeRecipeDomain, registry, log),
- new SsaTypeConversionInserter(closedWorld),
- new SsaRedundantPhiEliminator(),
- new SsaDeadPhiEliminator(),
- new SsaTypePropagator(globalInferenceResults,
- closedWorld.commonElements, closedWorld, log),
+ SsaInstructionSimplifier(globalInferenceResults, _options, closedWorld,
+ typeRecipeDomain, registry, log),
+ SsaTypeConversionInserter(closedWorld),
+ SsaRedundantPhiEliminator(),
+ SsaDeadPhiEliminator(),
+ SsaTypePropagator(globalInferenceResults, closedWorld.commonElements,
+ closedWorld, log),
// After type propagation, more instructions can be
// simplified.
- new SsaInstructionSimplifier(globalInferenceResults, _options,
- closedWorld, typeRecipeDomain, registry, log),
- new SsaInstructionSimplifier(globalInferenceResults, _options,
- closedWorld, typeRecipeDomain, registry, log),
- new SsaTypePropagator(globalInferenceResults,
- closedWorld.commonElements, closedWorld, log),
+ SsaInstructionSimplifier(globalInferenceResults, _options, closedWorld,
+ typeRecipeDomain, registry, log),
+ SsaInstructionSimplifier(globalInferenceResults, _options, closedWorld,
+ typeRecipeDomain, registry, log),
+ SsaTypePropagator(globalInferenceResults, closedWorld.commonElements,
+ closedWorld, log),
// Run a dead code eliminator before LICM because dead
// interceptors are often in the way of LICM'able instructions.
- new SsaDeadCodeEliminator(closedWorld, this),
- new SsaGlobalValueNumberer(closedWorld.abstractValueDomain),
+ SsaDeadCodeEliminator(closedWorld, this),
+ SsaGlobalValueNumberer(closedWorld.abstractValueDomain),
// After GVN, some instructions might need their type to be
// updated because they now have different inputs.
- new SsaTypePropagator(globalInferenceResults,
- closedWorld.commonElements, closedWorld, log),
- codeMotion = new SsaCodeMotion(closedWorld.abstractValueDomain),
- loadElimination = new SsaLoadElimination(closedWorld),
- new SsaRedundantPhiEliminator(),
- new SsaDeadPhiEliminator(),
+ SsaTypePropagator(globalInferenceResults, closedWorld.commonElements,
+ closedWorld, log),
+ codeMotion = SsaCodeMotion(closedWorld.abstractValueDomain),
+ loadElimination = SsaLoadElimination(closedWorld),
+ SsaRedundantPhiEliminator(),
+ SsaDeadPhiEliminator(),
// After GVN and load elimination the same value may be used in code
// controlled by a test on the value, so redo 'conversion insertion' to
// learn from the refined type.
- new SsaTypeConversionInserter(closedWorld),
- new SsaTypePropagator(globalInferenceResults,
- closedWorld.commonElements, closedWorld, log),
- new SsaValueRangeAnalyzer(closedWorld, this),
+ SsaTypeConversionInserter(closedWorld),
+ SsaTypePropagator(globalInferenceResults, closedWorld.commonElements,
+ closedWorld, log),
+ SsaValueRangeAnalyzer(closedWorld, this),
// Previous optimizations may have generated new
// opportunities for instruction simplification.
- new SsaInstructionSimplifier(globalInferenceResults, _options,
- closedWorld, typeRecipeDomain, registry, log),
+ SsaInstructionSimplifier(globalInferenceResults, _options, closedWorld,
+ typeRecipeDomain, registry, log),
];
phases.forEach(runPhase);
// Simplifying interceptors is just an optimization, it is required for
// implementation correctness because the code generator assumes it is
// always performed to compute the intercepted classes sets.
- runPhase(new SsaSimplifyInterceptors(closedWorld, member.enclosingClass));
+ runPhase(SsaSimplifyInterceptors(closedWorld, member.enclosingClass));
- SsaDeadCodeEliminator dce = new SsaDeadCodeEliminator(closedWorld, this);
+ SsaDeadCodeEliminator dce = SsaDeadCodeEliminator(closedWorld, this);
runPhase(dce);
if (codeMotion.movedCode ||
dce.eliminatedSideEffects ||
dce.newGvnCandidates ||
loadElimination.newGvnCandidates) {
phases = <OptimizationPhase>[
- new SsaTypePropagator(globalInferenceResults,
- closedWorld.commonElements, closedWorld, log),
- new SsaGlobalValueNumberer(closedWorld.abstractValueDomain),
- new SsaCodeMotion(closedWorld.abstractValueDomain),
- new SsaValueRangeAnalyzer(closedWorld, this),
- new SsaInstructionSimplifier(globalInferenceResults, _options,
+ SsaTypePropagator(globalInferenceResults, closedWorld.commonElements,
+ closedWorld, log),
+ SsaGlobalValueNumberer(closedWorld.abstractValueDomain),
+ SsaCodeMotion(closedWorld.abstractValueDomain),
+ SsaValueRangeAnalyzer(closedWorld, this),
+ SsaInstructionSimplifier(globalInferenceResults, _options,
closedWorld, typeRecipeDomain, registry, log),
- new SsaSimplifyInterceptors(closedWorld, member.enclosingClass),
- new SsaDeadCodeEliminator(closedWorld, this),
+ SsaSimplifyInterceptors(closedWorld, member.enclosingClass),
+ SsaDeadCodeEliminator(closedWorld, this),
];
} else {
phases = <OptimizationPhase>[
- new SsaTypePropagator(globalInferenceResults,
- closedWorld.commonElements, closedWorld, log),
+ SsaTypePropagator(globalInferenceResults, closedWorld.commonElements,
+ closedWorld, log),
// Run the simplifier to remove unneeded type checks inserted by
// type propagation.
- new SsaInstructionSimplifier(globalInferenceResults, _options,
+ SsaInstructionSimplifier(globalInferenceResults, _options,
closedWorld, typeRecipeDomain, registry, log),
];
}
@@ -375,7 +375,7 @@
_mostlyEmpty(whenNotNullBlock)) {
HInstruction trueConstant = _graph.addConstantBool(true, _closedWorld);
HInstruction replacement =
- new HIdentity(tested, trueConstant, _abstractValueDomain.boolType)
+ HIdentity(tested, trueConstant, _abstractValueDomain.boolType)
..sourceElement = phi.sourceElement
..sourceInformation = phi.sourceInformation;
block.rewrite(phi, replacement);
@@ -397,12 +397,11 @@
_mostlyEmpty(whenNotNullBlock)) {
HInstruction falseConstant = _graph.addConstantBool(false, _closedWorld);
HInstruction compare =
- new HIdentity(tested, falseConstant, _abstractValueDomain.boolType);
+ HIdentity(tested, falseConstant, _abstractValueDomain.boolType);
block.addAtEntry(compare);
- HInstruction replacement =
- new HNot(compare, _abstractValueDomain.boolType)
- ..sourceElement = phi.sourceElement
- ..sourceInformation = phi.sourceInformation;
+ HInstruction replacement = HNot(compare, _abstractValueDomain.boolType)
+ ..sourceElement = phi.sourceElement
+ ..sourceInformation = phi.sourceInformation;
block.rewrite(phi, replacement);
block.addAfter(compare, replacement);
block.removePhi(phi);
@@ -607,7 +606,7 @@
resultType = _abstractValueDomain.uint32Type;
}
HGetLength result =
- new HGetLength(actualReceiver, resultType, isAssignable: !isFixed);
+ HGetLength(actualReceiver, resultType, isAssignable: !isFixed);
return result;
} else if (actualReceiver.isConstantMap()) {
HConstant constantInput = actualReceiver;
@@ -673,7 +672,7 @@
HInstruction argument = node.inputs[2];
if (argument.isString(_abstractValueDomain).isDefinitelyTrue &&
input.isNull(_abstractValueDomain).isDefinitelyFalse) {
- return new HStringConcat(input, argument, node.instructionType);
+ return HStringConcat(input, argument, node.instructionType);
}
} else if (applies(commonElements.jsStringToString) &&
input.isNull(_abstractValueDomain).isDefinitelyFalse) {
@@ -690,7 +689,7 @@
// bounds check will become explicit, so we won't need this
// optimization.
// TODO(sra): Fix comment - SsaCheckInserter is deleted.
- HInvokeDynamicMethod result = new HInvokeDynamicMethod(
+ HInvokeDynamicMethod result = HInvokeDynamicMethod(
node.selector,
node.receiverType,
node.inputs.sublist(1), // Drop interceptor.
@@ -727,7 +726,7 @@
AbstractValue resultMask = _abstractValueDomain.growableListType;
- HInvokeDynamicMethod splitInstruction = new HInvokeDynamicMethod(
+ HInvokeDynamicMethod splitInstruction = HInvokeDynamicMethod(
node.selector,
node.receiverType,
node.inputs.sublist(1), // Drop interceptor.
@@ -751,7 +750,7 @@
_abstractValueDomain.dynamicType);
node.block.addBefore(node, typeInfo);
- HInvokeStatic tagInstruction = new HInvokeStatic(
+ HInvokeStatic tagInstruction = HInvokeStatic(
commonElements.setArrayType,
<HInstruction>[splitInstruction, typeInfo],
resultMask,
@@ -839,12 +838,12 @@
node.block.addBefore(node, load);
insertionPoint = load;
}
- Selector callSelector = new Selector.callClosureFrom(node.selector);
+ Selector callSelector = Selector.callClosureFrom(node.selector);
List<HInstruction> inputs = <HInstruction>[load]
..addAll(node.inputs.skip(node.isInterceptedCall ? 2 : 1));
DartType fieldType =
_closedWorld.elementEnvironment.getFieldType(field);
- HInstruction closureCall = new HInvokeClosure(
+ HInstruction closureCall = HInvokeClosure(
callSelector,
_abstractValueDomain
.createFromStaticType(fieldType, nullable: true)
@@ -1129,7 +1128,7 @@
if (constant.constant.isTrue) {
return input;
} else {
- return new HNot(input, _abstractValueDomain.boolType);
+ return HNot(input, _abstractValueDomain.boolType);
}
}
@@ -1398,8 +1397,7 @@
isFixedLength(receiver.instructionType, _closedWorld)) {
// The input type has changed to fixed-length so change to an unassignable
// HGetLength to allow more GVN optimizations.
- return new HGetLength(receiver, node.instructionType,
- isAssignable: false);
+ return HGetLength(receiver, node.instructionType, isAssignable: false);
}
return node;
}
@@ -1599,7 +1597,7 @@
if (parameterStructure.callStructure == node.selector.callStructure) {
// TODO(sra): Handle adding optional arguments default values.
assert(!node.isInterceptedCall);
- return new HInvokeStatic(target, node.inputs.skip(1).toList(),
+ return HInvokeStatic(target, node.inputs.skip(1).toList(),
node.instructionType, node.typeArguments)
..sourceInformation = node.sourceInformation;
}
@@ -1615,7 +1613,7 @@
if (element == commonElements.identicalFunction) {
if (node.inputs.length == 2) {
- return new HIdentity(
+ return HIdentity(
node.inputs[0], node.inputs[1], _abstractValueDomain.boolType)
..sourceInformation = node.sourceInformation;
}
@@ -1759,7 +1757,7 @@
.createString(leftString.stringValue + rightString.stringValue),
_closedWorld);
if (prefix == null) return folded;
- return new HStringConcat(prefix, folded, _abstractValueDomain.stringType);
+ return HStringConcat(prefix, folded, _abstractValueDomain.stringType);
}
@override
@@ -1825,7 +1823,7 @@
.isInterceptor(input.instructionType)
.isDefinitelyFalse) {
var inputs = <HInstruction>[input, input]; // [interceptor, receiver].
- HInstruction result = new HInvokeDynamicMethod(
+ HInstruction result = HInvokeDynamicMethod(
selector,
input.instructionType, // receiver type.
inputs,
@@ -2311,7 +2309,7 @@
HGraph _graph;
SsaLiveBlockAnalyzer analyzer;
Map<HInstruction, bool> trivialDeadStoreReceivers =
- new Maplet<HInstruction, bool>();
+ Maplet<HInstruction, bool>();
bool eliminatedSideEffects = false;
bool newGvnCandidates = false;
@@ -2425,7 +2423,7 @@
@override
void visitGraph(HGraph graph) {
_graph = graph;
- analyzer = new SsaLiveBlockAnalyzer(graph, closedWorld, optimizer);
+ analyzer = SsaLiveBlockAnalyzer(graph, closedWorld, optimizer);
analyzer.analyze();
visitPostDominatorTree(graph);
cleanPhis();
@@ -2627,7 +2625,7 @@
class SsaLiveBlockAnalyzer extends HBaseVisitor {
final HGraph graph;
- final Set<HBasicBlock> live = new Set<HBasicBlock>();
+ final Set<HBasicBlock> live = Set<HBasicBlock>();
final List<HBasicBlock> worklist = <HBasicBlock>[];
final SsaOptimizerTask optimizer;
final JClosedWorld closedWorld;
@@ -2686,7 +2684,7 @@
IntValue upperValue = switchRange.upper;
BigInt lower = lowerValue.value;
BigInt upper = upperValue.value;
- Set<BigInt> liveLabels = new Set<BigInt>();
+ Set<BigInt> liveLabels = Set<BigInt>();
for (int pos = 1; pos < node.inputs.length; pos++) {
HConstant input = node.inputs[pos];
if (!input.isConstantInteger()) continue;
@@ -2697,7 +2695,7 @@
liveLabels.add(label);
}
}
- if (new BigInt.from(liveLabels.length) != upper - lower + BigInt.one) {
+ if (BigInt.from(liveLabels.length) != upper - lower + BigInt.one) {
markBlockLive(node.defaultTarget);
}
return;
@@ -2715,7 +2713,7 @@
void visitGraph(HGraph graph) {
final List<HPhi> worklist = <HPhi>[];
// A set to keep track of the live phis that we found.
- final Set<HPhi> livePhis = new Set<HPhi>();
+ final Set<HPhi> livePhis = Set<HPhi>();
// Add to the worklist all live phis: phis referenced by non-phi
// instructions.
@@ -2835,14 +2833,14 @@
List<int> blockChangesFlags;
List<int> loopChangesFlags;
- SsaGlobalValueNumberer(this._abstractValueDomain) : visited = new Set<int>();
+ SsaGlobalValueNumberer(this._abstractValueDomain) : visited = Set<int>();
@override
void visitGraph(HGraph graph) {
computeChangesFlags(graph);
moveLoopInvariantCode(graph);
List<GvnWorkItem> workQueue = <GvnWorkItem>[
- new GvnWorkItem(graph.entry, new ValueSet())
+ GvnWorkItem(graph.entry, ValueSet())
];
do {
GvnWorkItem item = workQueue.removeLast();
@@ -2976,7 +2974,7 @@
} while (!workQueue.isEmpty);
successorValues.kill(changesFlags);
}
- workQueue.add(new GvnWorkItem(dominated, successorValues));
+ workQueue.add(GvnWorkItem(dominated, successorValues));
}
}
@@ -2985,8 +2983,8 @@
// loop changes flags list to zero so we can use bitwise or when
// propagating loop changes upwards.
final int length = graph.blocks.length;
- blockChangesFlags = new List<int>.filled(length, null);
- loopChangesFlags = new List<int>.filled(length, null);
+ blockChangesFlags = List<int>.filled(length, null);
+ loopChangesFlags = List<int>.filled(length, null);
for (int i = 0; i < length; i++) loopChangesFlags[i] = 0;
// Run through all the basic blocks in the graph and fill in the
@@ -3067,9 +3065,9 @@
@override
void visitGraph(HGraph graph) {
- values = new List<ValueSet>.filled(graph.blocks.length, null);
+ values = List<ValueSet>.filled(graph.blocks.length, null);
for (int i = 0; i < graph.blocks.length; i++) {
- values[graph.blocks[i].id] = new ValueSet();
+ values[graph.blocks[i].id] = ValueSet();
}
visitPostDominatorTree(graph);
}
@@ -3198,7 +3196,7 @@
}
}
- HTypeKnown newInput = new HTypeKnown.pinned(convertedType, input);
+ HTypeKnown newInput = HTypeKnown.pinned(convertedType, input);
dominator.addBefore(dominator.first, newInput);
dominatedUses.replaceWith(newInput);
}
@@ -3344,7 +3342,7 @@
@override
void visitGraph(HGraph graph) {
_graph = graph;
- memories = new List<MemorySet>.filled(graph.blocks.length, null);
+ memories = List<MemorySet>.filled(graph.blocks.length, null);
List<HBasicBlock> blocks = graph.blocks;
for (int i = 0; i < blocks.length; i++) {
HBasicBlock block = blocks[i];
@@ -3366,7 +3364,7 @@
final indegree = predecessors.length;
if (indegree == 0) {
// Entry block.
- memorySet = new MemorySet(_closedWorld);
+ memorySet = MemorySet(_closedWorld);
} else if (indegree == 1 && predecessors[0].successors.length == 1) {
// No need to clone, there is no other successor for
// `block.predecessors[0]`, and this block has only one predecessor. Since
@@ -3693,7 +3691,7 @@
<HInstruction, Map<HInstruction, HInstruction>>{};
/// Set of objects that we know don't escape the current function.
- final Setlet<HInstruction> nonEscapingReceivers = new Setlet<HInstruction>();
+ final Setlet<HInstruction> nonEscapingReceivers = Setlet<HInstruction>();
MemorySet(this.closedWorld);
@@ -3948,7 +3946,7 @@
phi.instructionType = phiType;
return phi;
} else {
- HPhi phi = new HPhi.noInputs(null, phiType);
+ HPhi phi = HPhi.noInputs(null, phiType);
block.addPhi(phi);
// Previous predecessors had the same input. A phi must have
// the same number of inputs as its block has predecessors.
@@ -3963,7 +3961,7 @@
/// Returns the intersection between [this] and the [other] memory set.
MemorySet intersectionFor(
MemorySet other, HBasicBlock block, int predecessorIndex) {
- MemorySet result = new MemorySet(closedWorld);
+ MemorySet result = MemorySet(closedWorld);
if (other == null) {
// This is the first visit to a loop header ([other] is `null` because we
// have not visited the back edge). Copy the nonEscapingReceivers that are
@@ -4043,16 +4041,16 @@
/// Returns a copy of [this] memory set.
MemorySet clone() {
- MemorySet result = new MemorySet(closedWorld);
+ MemorySet result = MemorySet(closedWorld);
fieldValues.forEach((element, values) {
result.fieldValues[element] =
- new Map<HInstruction, HInstruction>.from(values);
+ Map<HInstruction, HInstruction>.from(values);
});
keyedValues.forEach((receiver, values) {
result.keyedValues[receiver] =
- new Map<HInstruction, HInstruction>.from(values);
+ Map<HInstruction, HInstruction>.from(values);
});
result.nonEscapingReceivers.addAll(nonEscapingReceivers);
diff --git a/pkg/compiler/lib/src/ssa/ssa.dart b/pkg/compiler/lib/src/ssa/ssa.dart
index 9fd8e25..179b946 100644
--- a/pkg/compiler/lib/src/ssa/ssa.dart
+++ b/pkg/compiler/lib/src/ssa/ssa.dart
@@ -47,11 +47,11 @@
BackendStrategy backendStrategy,
Measurer measurer,
this.sourceInformationStrategy)
- : generator = new SsaCodeGeneratorTask(
- measurer, _options, sourceInformationStrategy),
- _builder = new SsaBuilderTask(
+ : generator =
+ SsaCodeGeneratorTask(measurer, _options, sourceInformationStrategy),
+ _builder = SsaBuilderTask(
measurer, backendStrategy, sourceInformationStrategy),
- optimizer = new SsaOptimizerTask(measurer, _options);
+ optimizer = SsaOptimizerTask(measurer, _options);
@override
void initialize(GlobalTypeInferenceResults globalInferenceResults,
@@ -67,10 +67,10 @@
CodegenResult compile(MemberEntity member) {
JClosedWorld closedWorld = _globalInferenceResults.closedWorld;
CodegenRegistry registry =
- new CodegenRegistry(closedWorld.elementEnvironment, member);
- ModularNamer namer = new ModularNamerImpl(
+ CodegenRegistry(closedWorld.elementEnvironment, member);
+ ModularNamer namer = ModularNamerImpl(
registry, closedWorld.commonElements, _codegen.fixedNames);
- ModularEmitter emitter = new ModularEmitterImpl(namer, registry, _options);
+ ModularEmitter emitter = ModularEmitterImpl(namer, registry, _options);
if (member.isConstructor &&
member.enclosingClass == closedWorld.commonElements.jsNullClass) {
// Work around a problem compiling JSNull's constructor.
@@ -202,7 +202,7 @@
List<js.Expression> itemTypeExpression =
_fetchItemTypeNewRti(commonElements, registry, elementType);
- AsyncRewriter rewriter = new AsyncRewriter(_reporter, element,
+ AsyncRewriter rewriter = AsyncRewriter(_reporter, element,
asyncStart: emitter.staticFunctionAccess(startFunction),
asyncAwait:
emitter.staticFunctionAccess(commonElements.asyncHelperAwait),
@@ -216,7 +216,7 @@
safeVariableName: namer.safeVariablePrefixForAsyncRewrite,
bodyName: namer.deriveAsyncBodyName(name));
- registry.registerStaticUse(new StaticUse.staticInvoke(
+ registry.registerStaticUse(StaticUse.staticInvoke(
completerFactory,
const CallStructure.unnamed(0, 1),
[elementEnvironment.getFunctionAsyncOrSyncStarElementType(element)]));
@@ -238,7 +238,7 @@
List<js.Expression> itemTypeExpression =
_fetchItemTypeNewRti(commonElements, registry, asyncTypeParameter);
- SyncStarRewriter rewriter = new SyncStarRewriter(_reporter, element,
+ SyncStarRewriter rewriter = SyncStarRewriter(_reporter, element,
endOfIteration:
emitter.staticFunctionAccess(commonElements.endOfIteration),
iterableFactory: emitter
@@ -251,7 +251,7 @@
safeVariableName: namer.safeVariablePrefixForAsyncRewrite,
bodyName: namer.deriveAsyncBodyName(name));
- registry.registerStaticUse(new StaticUse.staticInvoke(
+ registry.registerStaticUse(StaticUse.staticInvoke(
commonElements.syncStarIterableFactory,
const CallStructure.unnamed(1, 1),
[elementEnvironment.getFunctionAsyncOrSyncStarElementType(element)]));
@@ -273,7 +273,7 @@
List<js.Expression> itemTypeExpression =
_fetchItemTypeNewRti(commonElements, registry, asyncTypeParameter);
- AsyncStarRewriter rewriter = new AsyncStarRewriter(_reporter, element,
+ AsyncStarRewriter rewriter = AsyncStarRewriter(_reporter, element,
asyncStarHelper:
emitter.staticFunctionAccess(commonElements.asyncStarHelper),
streamOfController:
@@ -289,7 +289,7 @@
emitter.staticFunctionAccess(commonElements.yieldStar),
bodyName: namer.deriveAsyncBodyName(name));
- registry.registerStaticUse(new StaticUse.staticInvoke(
+ registry.registerStaticUse(StaticUse.staticInvoke(
commonElements.asyncStarStreamControllerFactory,
const CallStructure.unnamed(1, 1),
[elementEnvironment.getFunctionAsyncOrSyncStarElementType(element)]));
diff --git a/pkg/compiler/lib/src/ssa/ssa_branch_builder.dart b/pkg/compiler/lib/src/ssa/ssa_branch_builder.dart
index 9383983..76d72c0 100644
--- a/pkg/compiler/lib/src/ssa/ssa_branch_builder.dart
+++ b/pkg/compiler/lib/src/ssa/ssa_branch_builder.dart
@@ -17,7 +17,7 @@
LocalsHandler exitLocals;
SubGraph graph;
- SsaBranch(this.branchBuilder) : block = new HBasicBlock();
+ SsaBranch(this.branchBuilder) : block = HBasicBlock();
}
class SsaBranchBuilder {
@@ -46,7 +46,7 @@
checkNotAborted();
assert(identical(builder.current, builder.lastOpenedBlock));
HInstruction conditionValue = builder.popBoolified();
- HIf branch = new HIf(_abstractValueDomain, conditionValue)
+ HIf branch = HIf(_abstractValueDomain, conditionValue)
..sourceInformation = sourceInformation;
HBasicBlock conditionExitBlock = builder.current;
builder.close(branch);
@@ -59,7 +59,7 @@
mayReuseFromLocals: conditionBranchLocalsCanBeReused);
conditionBranch.graph =
- new SubExpression(conditionBranch.block, conditionExitBlock);
+ SubExpression(conditionBranch.block, conditionExitBlock);
}
/// Returns true if the locals of the [fromBranch] may be reused. A [:true:]
@@ -72,7 +72,7 @@
toBranch.startLocals = fromLocals;
return false;
} else {
- toBranch.startLocals = new LocalsHandler.from(fromLocals);
+ toBranch.startLocals = LocalsHandler.from(fromLocals);
return true;
}
} else {
@@ -91,7 +91,7 @@
SsaBranch joinBranch, bool isExpression) {
startBranch(branch);
visitBranch();
- branch.graph = new SubGraph(branch.block, builder.lastOpenedBlock);
+ branch.graph = SubGraph(branch.block, builder.lastOpenedBlock);
branch.exitLocals = builder.localsHandler;
if (!builder.isAborted()) {
builder.goto(builder.current, joinBranch.block);
@@ -163,7 +163,7 @@
boolifiedLeft = builder.popBoolified();
builder.stack.add(boolifiedLeft);
if (!isAnd) {
- builder.push(new HNot(builder.pop(), _abstractValueDomain.boolType)
+ builder.push(HNot(builder.pop(), _abstractValueDomain.boolType)
..sourceInformation = sourceInformation);
}
}
@@ -177,7 +177,7 @@
sourceInformation: sourceInformation);
HConstant notIsAnd =
builder.graph.addConstantBool(!isAnd, builder.closedWorld);
- HPhi result = new HPhi.manyInputs(
+ HPhi result = HPhi.manyInputs(
null,
<HInstruction>[boolifiedRight, notIsAnd],
_abstractValueDomain.dynamicType)
@@ -189,10 +189,10 @@
void _handleDiamondBranch(
void visitCondition(), void visitThen(), void visitElse(),
{bool isExpression, SourceInformation sourceInformation}) {
- SsaBranch conditionBranch = new SsaBranch(this);
- SsaBranch thenBranch = new SsaBranch(this);
- SsaBranch elseBranch = new SsaBranch(this);
- SsaBranch joinBranch = new SsaBranch(this);
+ SsaBranch conditionBranch = SsaBranch(this);
+ SsaBranch thenBranch = SsaBranch(this);
+ SsaBranch elseBranch = SsaBranch(this);
+ SsaBranch joinBranch = SsaBranch(this);
conditionBranch.startLocals = builder.localsHandler;
builder.goto(builder.current, conditionBranch.block);
@@ -206,7 +206,7 @@
if (isExpression) {
assert(thenValue != null && elseValue != null);
- HPhi phi = new HPhi.manyInputs(null, <HInstruction>[thenValue, elseValue],
+ HPhi phi = HPhi.manyInputs(null, <HInstruction>[thenValue, elseValue],
_abstractValueDomain.dynamicType);
joinBranch.block.addPhi(phi);
builder.stack.add(phi);
@@ -219,10 +219,10 @@
joinBlock = joinBranch.block;
}
- HIfBlockInformation info = new HIfBlockInformation(
- new HSubExpressionBlockInformation(conditionBranch.graph),
- new HSubGraphBlockInformation(thenBranch.graph),
- new HSubGraphBlockInformation(elseBranch.graph));
+ HIfBlockInformation info = HIfBlockInformation(
+ HSubExpressionBlockInformation(conditionBranch.graph),
+ HSubGraphBlockInformation(thenBranch.graph),
+ HSubGraphBlockInformation(elseBranch.graph));
HBasicBlock conditionStartBlock = conditionBranch.block;
conditionStartBlock.setBlockFlow(info, joinBlock);
diff --git a/pkg/compiler/lib/src/ssa/ssa_tracer.dart b/pkg/compiler/lib/src/ssa/ssa_tracer.dart
index 24ac86f..8887610 100644
--- a/pkg/compiler/lib/src/ssa/ssa_tracer.dart
+++ b/pkg/compiler/lib/src/ssa/ssa_tracer.dart
@@ -75,7 +75,7 @@
@override
void visitBasicBlock(HBasicBlock block) {
HInstructionStringifier stringifier =
- new HInstructionStringifier(block, closedWorld);
+ HInstructionStringifier(block, closedWorld);
assert(block.id != null);
tag("block", () {
printProperty("name", "B${block.id}");
@@ -94,7 +94,7 @@
printProperty("method", "None");
block.forEachPhi((phi) {
String phiId = stringifier.temporaryId(phi);
- StringBuffer inputIds = new StringBuffer();
+ StringBuffer inputIds = StringBuffer();
for (int i = 0; i < phi.inputs.length; i++) {
inputIds.write(stringifier.temporaryId(phi.inputs[i]));
inputIds.write(" ");
@@ -326,7 +326,7 @@
String handleGenericInvoke(
String invokeType, String functionName, List<HInstruction> arguments) {
- StringBuffer argumentsString = new StringBuffer();
+ StringBuffer argumentsString = StringBuffer();
for (int i = 0; i < arguments.length; i++) {
if (i != 0) argumentsString.write(", ");
argumentsString.write(temporaryId(arguments[i]));
@@ -445,7 +445,7 @@
@override
String visitLiteralList(HLiteralList node) {
- StringBuffer elementsString = new StringBuffer();
+ StringBuffer elementsString = StringBuffer();
for (int i = 0; i < node.inputs.length; i++) {
if (i != 0) elementsString.write(", ");
elementsString.write(temporaryId(node.inputs[i]));
@@ -485,7 +485,7 @@
@override
String visitPhi(HPhi phi) {
- StringBuffer buffer = new StringBuffer();
+ StringBuffer buffer = StringBuffer();
buffer.write("Phi: ");
for (int i = 0; i < phi.inputs.length; i++) {
if (i > 0) buffer.write(", ");
@@ -546,7 +546,7 @@
@override
String visitSwitch(HSwitch node) {
- StringBuffer buf = new StringBuffer();
+ StringBuffer buf = StringBuffer();
buf.write("Switch: (");
buf.write(temporaryId(node.inputs[0]));
buf.write(") ");
diff --git a/pkg/compiler/lib/src/ssa/switch_continue_analysis.dart b/pkg/compiler/lib/src/ssa/switch_continue_analysis.dart
index 776a5d5..bf99220 100644
--- a/pkg/compiler/lib/src/ssa/switch_continue_analysis.dart
+++ b/pkg/compiler/lib/src/ssa/switch_continue_analysis.dart
@@ -12,7 +12,7 @@
SwitchContinueAnalysis._();
static bool containsContinue(ir.Statement switchCaseBody) {
- return switchCaseBody.accept(new SwitchContinueAnalysis._());
+ return switchCaseBody.accept(SwitchContinueAnalysis._());
}
@override
diff --git a/pkg/compiler/lib/src/ssa/type_builder.dart b/pkg/compiler/lib/src/ssa/type_builder.dart
index 84a46b6..e7e0a25 100644
--- a/pkg/compiler/lib/src/ssa/type_builder.dart
+++ b/pkg/compiler/lib/src/ssa/type_builder.dart
@@ -49,7 +49,7 @@
/// Create a type mask for 'trusting' a DartType. Returns `null` if there is
/// no approximating type mask (i.e. the type mask would be `dynamic`).
- AbstractValue trustTypeMask(DartType type, {bool hasLateSentinel: false}) {
+ AbstractValue trustTypeMask(DartType type, {bool hasLateSentinel = false}) {
if (type == null) return null;
type = builder.localsHandler.substInContext(type);
if (_closedWorld.dartTypes.isTopType(type)) return null;
@@ -74,7 +74,7 @@
.isPotentiallyTrue;
AbstractValue mask = trustTypeMask(type, hasLateSentinel: hasLateSentinel);
if (mask == null) return original;
- return new HTypeKnown.pinned(mask, original);
+ return HTypeKnown.pinned(mask, original);
}
/// Produces code that checks the runtime type is actually the type specified
@@ -87,7 +87,7 @@
// If it is needed then it seems likely that similar invocations of
// `buildAsCheck` in `SsaBuilder.visitAs` should also be followed by a
// similar operation on `registry`; otherwise, this one might not be needed.
- builder.registry?.registerTypeUse(new TypeUse.isCheck(type));
+ builder.registry?.registerTypeUse(TypeUse.isCheck(type));
if (other is HAsCheck &&
other.isRedundant(builder.closedWorld, builder.options)) {
return original;
@@ -104,7 +104,7 @@
return original;
}
DartType boolType = _closedWorld.commonElements.boolType;
- builder.registry?.registerTypeUse(new TypeUse.isCheck(boolType));
+ builder.registry?.registerTypeUse(TypeUse.isCheck(boolType));
return checkInstruction;
}
diff --git a/pkg/compiler/lib/src/ssa/types_propagation.dart b/pkg/compiler/lib/src/ssa/types_propagation.dart
index 92a35e1..f6909df 100644
--- a/pkg/compiler/lib/src/ssa/types_propagation.dart
+++ b/pkg/compiler/lib/src/ssa/types_propagation.dart
@@ -30,10 +30,10 @@
// TODO(sra): The InvokeDynamicSpecializer should be consulted for better
// targeted conditioning checks.
class SsaTypePropagator extends HBaseVisitor implements OptimizationPhase {
- final Map<int, HInstruction> workmap = new Map<int, HInstruction>();
+ final Map<int, HInstruction> workmap = Map<int, HInstruction>();
final List<int> worklist = <int>[];
final Map<HInstruction, Function> pendingOptimizations =
- new Map<HInstruction, Function>();
+ Map<HInstruction, Function>();
final GlobalTypeInferenceResults results;
final CommonElements commonElements;
@@ -248,7 +248,7 @@
Selector selector = (kind == HPrimitiveCheck.RECEIVER_TYPE_CHECK)
? instruction.selector
: null;
- HPrimitiveCheck converted = new HPrimitiveCheck(
+ HPrimitiveCheck converted = HPrimitiveCheck(
typeExpression, kind, type, input, instruction.sourceInformation,
receiverTypeCheckSelector: selector);
instruction.block.addBefore(instruction, converted);
@@ -418,7 +418,7 @@
// dominated by the call to use that node instead of [receiver].
AbstractValue newType = abstractValueDomain.excludeNull(receiverType);
HTypeKnown converted =
- new HTypeKnown.witnessed(newType, receiver, instruction);
+ HTypeKnown.witnessed(newType, receiver, instruction);
instruction.block.addBefore(instruction.next, converted);
uses.replaceWith(converted);
addDependentInstructionsToWorkList(converted);
diff --git a/pkg/compiler/lib/src/ssa/validate.dart b/pkg/compiler/lib/src/ssa/validate.dart
index 6bce627..251368b 100644
--- a/pkg/compiler/lib/src/ssa/validate.dart
+++ b/pkg/compiler/lib/src/ssa/validate.dart
@@ -157,7 +157,7 @@
static bool everyInstruction(
List<HInstruction> instructions, bool Function(HInstruction, int) f) {
if (instructions.length > kMaxValidatedInstructionListLength) return true;
- var copy = new List<HInstruction>.from(instructions);
+ var copy = List<HInstruction>.from(instructions);
// TODO(floitsch): there is currently no way to sort HInstructions before
// we have assigned an ID. The loop is therefore O(n^2) for now.
for (int i = 0; i < copy.length; i++) {
diff --git a/pkg/compiler/lib/src/ssa/value_range_analyzer.dart b/pkg/compiler/lib/src/ssa/value_range_analyzer.dart
index a0af6be..1c4c554 100644
--- a/pkg/compiler/lib/src/ssa/value_range_analyzer.dart
+++ b/pkg/compiler/lib/src/ssa/value_range_analyzer.dart
@@ -18,40 +18,39 @@
}
Value newIntValue(BigInt value) {
- return new IntValue(value, this);
+ return IntValue(value, this);
}
Value newInstructionValue(HInstruction instruction) {
- return new InstructionValue(instruction, this);
+ return InstructionValue(instruction, this);
}
Value newPositiveValue(HInstruction instruction) {
- return new PositiveValue(instruction, this);
+ return PositiveValue(instruction, this);
}
Value newAddValue(Value left, Value right) {
- return new AddValue(left, right, this);
+ return AddValue(left, right, this);
}
Value newSubtractValue(Value left, Value right) {
- return new SubtractValue(left, right, this);
+ return SubtractValue(left, right, this);
}
Value newNegateValue(Value value) {
- return new NegateValue(value, this);
+ return NegateValue(value, this);
}
Range newUnboundRange() {
- return new Range.unbound(this);
+ return Range.unbound(this);
}
Range newNormalizedRange(Value low, Value up) {
- return new Range.normalize(low, up, this);
+ return Range.normalize(low, up, this);
}
Range newMarkerRange() {
- return new Range(
- new MarkerValue(false, this), new MarkerValue(true, this), this);
+ return Range(MarkerValue(false, this), MarkerValue(true, this), this);
}
}
@@ -184,7 +183,7 @@
}
@override
- int get hashCode => throw new UnsupportedError('IntValue.hashCode');
+ int get hashCode => throw UnsupportedError('IntValue.hashCode');
@override
String toString() => 'IntValue $value';
@@ -274,7 +273,7 @@
}
@override
- int get hashCode => throw new UnsupportedError('InstructionValue.hashCode');
+ int get hashCode => throw UnsupportedError('InstructionValue.hashCode');
@override
Value operator +(Value other) {
@@ -347,7 +346,7 @@
}
@override
- int get hashCode => throw new UnsupportedError('AddValue.hashCode');
+ int get hashCode => throw UnsupportedError('AddValue.hashCode');
@override
Value operator -() => -left - right;
@@ -402,7 +401,7 @@
}
@override
- int get hashCode => throw new UnsupportedError('SubtractValue.hashCode');
+ int get hashCode => throw UnsupportedError('SubtractValue.hashCode');
@override
Value operator -() => right - left;
@@ -458,7 +457,7 @@
}
@override
- int get hashCode => throw new UnsupportedError('Negate.hashCode');
+ int get hashCode => throw UnsupportedError('Negate.hashCode');
@override
Value operator +(other) {
@@ -602,7 +601,7 @@
}
@override
- int get hashCode => throw new UnsupportedError('Range.hashCode');
+ int get hashCode => throw UnsupportedError('Range.hashCode');
bool operator <(Range other) {
return upper != other.lower && upper.min(other.lower) == upper;
@@ -642,7 +641,7 @@
/// Value ranges for integer instructions. This map gets populated by
/// the dominator tree visit.
- final Map<HInstruction, Range> ranges = new Map<HInstruction, Range>();
+ final Map<HInstruction, Range> ranges = Map<HInstruction, Range>();
final JClosedWorld closedWorld;
final ValueRangeInfo info;
@@ -651,7 +650,7 @@
HGraph graph;
SsaValueRangeAnalyzer(JClosedWorld closedWorld, this.optimizer)
- : info = new ValueRangeInfo(),
+ : info = ValueRangeInfo(),
this.closedWorld = closedWorld;
@override
@@ -719,8 +718,7 @@
return info.newUnboundRange();
}
if (phi.block.isLoopHeader()) {
- Range range =
- new LoopUpdateRecognizer(closedWorld, ranges, info).run(phi);
+ Range range = LoopUpdateRecognizer(closedWorld, ranges, info).run(phi);
if (range == null) return info.newUnboundRange();
return range;
}
@@ -750,12 +748,12 @@
return info.newUnboundRange();
}
if (constantNum.isMinusZero) {
- constantNum = new IntConstantValue(BigInt.zero);
+ constantNum = IntConstantValue(BigInt.zero);
}
BigInt intValue = constantNum is IntConstantValue
? constantNum.intValue
- : new BigInt.from(constantNum.doubleValue.toInt());
+ : BigInt.from(constantNum.doubleValue.toInt());
Value value = info.newIntValue(intValue);
return info.newNormalizedRange(value, value);
}
@@ -1018,8 +1016,8 @@
HInstruction createRangeConversion(
HInstruction cursor, HInstruction instruction) {
- HRangeConversion newInstruction = new HRangeConversion(
- instruction, closedWorld.abstractValueDomain.intType);
+ HRangeConversion newInstruction =
+ HRangeConversion(instruction, closedWorld.abstractValueDomain.intType);
conversions.add(newInstruction);
cursor.block.addBefore(cursor, newInstruction);
// Update the users of the instruction dominated by [cursor] to
diff --git a/pkg/compiler/lib/src/ssa/value_set.dart b/pkg/compiler/lib/src/ssa/value_set.dart
index f2a6148..9382934 100644
--- a/pkg/compiler/lib/src/ssa/value_set.dart
+++ b/pkg/compiler/lib/src/ssa/value_set.dart
@@ -9,7 +9,7 @@
int size = 0;
List<HInstruction> table;
ValueSetNode collisions;
- ValueSet() : table = new List<HInstruction>.filled(8, null);
+ ValueSet() : table = List<HInstruction>.filled(8, null);
bool get isEmpty => size == 0;
int get length => size;
@@ -28,7 +28,7 @@
if (table[index] == null) {
table[index] = instruction;
} else {
- collisions = new ValueSetNode(instruction, hashCode, collisions);
+ collisions = ValueSetNode(instruction, hashCode, collisions);
}
size++;
}
@@ -81,7 +81,7 @@
}
ValueSet copy() {
- return copyTo(new ValueSet(), table, collisions);
+ return copyTo(ValueSet(), table, collisions);
}
List<HInstruction> toList() {
@@ -111,7 +111,7 @@
ValueSet intersection(ValueSet other) {
if (size > other.size) return other.intersection(this);
- ValueSet result = new ValueSet();
+ ValueSet result = ValueSet();
// Look in the hash table.
for (int index = 0, length = table.length; index < length; index++) {
HInstruction instruction = table[index];
@@ -138,7 +138,7 @@
// Reset the table with a bigger capacity.
assert(capacity > table.length);
size = 0;
- table = new List<HInstruction>.filled(capacity, null);
+ table = List<HInstruction>.filled(capacity, null);
collisions = null;
// Add the old instructions to the new table.
copyTo(this, oldTable, oldCollisions);
diff --git a/pkg/compiler/lib/src/ssa/variable_allocator.dart b/pkg/compiler/lib/src/ssa/variable_allocator.dart
index a544500..4f90aa5 100644
--- a/pkg/compiler/lib/src/ssa/variable_allocator.dart
+++ b/pkg/compiler/lib/src/ssa/variable_allocator.dart
@@ -92,18 +92,18 @@
final Map<HInstruction, LiveInterval> liveIntervals;
LiveEnvironment(this.liveIntervals, this.endId)
- : liveInstructions = new Map<HInstruction, int>(),
- loopMarkers = new Map<HBasicBlock, int>();
+ : liveInstructions = Map<HInstruction, int>(),
+ loopMarkers = Map<HBasicBlock, int>();
/// Remove an instruction from the liveIn set. This method also
/// updates the live interval of [instruction] to contain the new
/// range: [id, / id contained in [liveInstructions] /].
void remove(HInstruction instruction, int id) {
LiveInterval interval =
- liveIntervals.putIfAbsent(instruction, () => new LiveInterval());
+ liveIntervals.putIfAbsent(instruction, () => LiveInterval());
int lastId = liveInstructions[instruction];
// If [lastId] is null, then this instruction is not being used.
- interval.add(new LiveRange(id, lastId == null ? id : lastId));
+ interval.add(LiveRange(id, lastId == null ? id : lastId));
// The instruction is defined at [id].
interval.start = id;
liveInstructions.remove(instruction);
@@ -128,8 +128,8 @@
// being used in the join block and defined before the if/else.
if (existingId == endId) return;
LiveInterval range =
- liveIntervals.putIfAbsent(instruction, () => new LiveInterval());
- range.add(new LiveRange(other.startId, existingId));
+ liveIntervals.putIfAbsent(instruction, () => LiveInterval());
+ range.add(LiveRange(other.startId, existingId));
liveInstructions[instruction] = endId;
});
other.loopMarkers.forEach((k, v) {
@@ -260,11 +260,11 @@
HCheck check = instruction;
HInstruction checked = checkedInstructionOrNonGenerateAtUseSite(check);
if (!generateAtUseSite.contains(checked)) {
- liveIntervals.putIfAbsent(checked, () => new LiveInterval());
+ liveIntervals.putIfAbsent(checked, () => LiveInterval());
// Unconditionally force the live ranges of the HCheck to
// be the live ranges of the instruction it is checking.
liveIntervals[instruction] =
- new LiveInterval.forCheck(instructionId, liveIntervals[checked]);
+ LiveInterval.forCheck(instructionId, liveIntervals[checked]);
}
}
}
@@ -330,7 +330,7 @@
// range that covers the loop.
env.liveInstructions.forEach((HInstruction instruction, int id) {
LiveInterval range =
- env.liveIntervals.putIfAbsent(instruction, () => new LiveInterval());
+ env.liveIntervals.putIfAbsent(instruction, () => LiveInterval());
range.loopUpdate(env.startId, lastId);
env.liveInstructions[instruction] = lastId;
});
@@ -380,11 +380,11 @@
assignments = <Copy<HInstruction>>[];
void addCopy(HInstruction source, HInstruction destination) {
- copies.add(new Copy<HInstruction>(source, destination));
+ copies.add(Copy<HInstruction>(source, destination));
}
void addAssignment(HInstruction source, HInstruction destination) {
- assignments.add(new Copy<HInstruction>(source, destination));
+ assignments.add(Copy<HInstruction>(source, destination));
}
@override
@@ -413,9 +413,9 @@
}
VariableNames()
- : ownName = new Map<HInstruction, String>(),
- copyHandlers = new Map<HBasicBlock, CopyHandler>(),
- allUsedNames = new Set<String>(),
+ : ownName = Map<HInstruction, String>(),
+ copyHandlers = Map<HBasicBlock, CopyHandler>(),
+ allUsedNames = Set<String>(),
swapTemp = 't0';
int get numberOfVariables => allUsedNames.length;
@@ -435,14 +435,12 @@
bool hasName(HInstruction instruction) => ownName.containsKey(instruction);
void addCopy(HBasicBlock block, HInstruction source, HPhi destination) {
- CopyHandler handler =
- copyHandlers.putIfAbsent(block, () => new CopyHandler());
+ CopyHandler handler = copyHandlers.putIfAbsent(block, () => CopyHandler());
handler.addCopy(source, destination);
}
void addAssignment(HBasicBlock block, HInstruction source, HPhi destination) {
- CopyHandler handler =
- copyHandlers.putIfAbsent(block, () => new CopyHandler());
+ CopyHandler handler = copyHandlers.putIfAbsent(block, () => CopyHandler());
handler.addAssignment(source, destination);
}
}
@@ -454,10 +452,10 @@
final Set<String> usedNames;
final List<String> freeTemporaryNames;
int temporaryIndex = 0;
- static final RegExp regexp = new RegExp('t[0-9]+');
+ static final RegExp regexp = RegExp('t[0-9]+');
VariableNamer(LiveEnvironment environment, this.names, this._namer)
- : usedNames = new Set<String>(),
+ : usedNames = Set<String>(),
freeTemporaryNames = <String>[] {
// [VariableNames.swapTemp] is used when there is a cycle in a copy handler.
// Therefore we make sure no one uses it.
@@ -579,7 +577,7 @@
SsaVariableAllocator(this._namer, this.liveInstructions, this.liveIntervals,
this.generateAtUseSite)
- : this.names = new VariableNames();
+ : this.names = VariableNames();
@override
void visitGraph(HGraph graph) {
@@ -589,7 +587,7 @@
@override
void visitBasicBlock(HBasicBlock block) {
VariableNamer variableNamer =
- new VariableNamer(liveInstructions[block], names, _namer);
+ VariableNamer(liveInstructions[block], names, _namer);
block.forEachPhi((HPhi phi) {
handlePhi(phi, variableNamer);
diff --git a/tools/VERSION b/tools/VERSION
index 8c0370f..77009c4 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 15
PATCH 0
-PRERELEASE 113
+PRERELEASE 114
PRERELEASE_PATCH 0
\ No newline at end of file