Index: pkg/compiler/lib/src/ssa/builder_kernel.dart |
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart |
index 05cb6cb3900731b10325efdd85564b7da9cdeeba..261042e9c1ca0b99540a52bb5c170a9ef848948a 100644 |
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart |
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart |
@@ -86,7 +86,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
SourceInformationBuilder sourceInformationBuilder; |
final KernelToElementMap _elementMap; |
final KernelToTypeInferenceMap _typeInferenceMap; |
- final KernelToLocalsMap _localsMap; |
+ final KernelToLocalsMap localsMap; |
LoopHandler<ir.Node> loopHandler; |
TypeBuilder typeBuilder; |
@@ -104,7 +104,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
this.compiler, |
this._elementMap, |
this._typeInferenceMap, |
- this._localsMap, |
+ this.localsMap, |
this.closedWorld, |
this._worldBuilder, |
this.registry, |
@@ -130,7 +130,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
CommonElements get _commonElements => _elementMap.commonElements; |
HGraph build() { |
- return reporter.withCurrentElement(_localsMap.currentMember, () { |
+ return reporter.withCurrentElement(localsMap.currentMember, () { |
// TODO(het): no reason to do this here... |
HInstruction.idCounter = 0; |
if (target is ir.Procedure) { |
@@ -322,7 +322,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
ConstructorElement constructorElement = _elementMap.getConstructor(body); |
void handleParameter(ir.VariableDeclaration node) { |
- Local parameter = _localsMap.getLocal(node); |
+ Local parameter = localsMap.getLocal(node); |
// If [parameter] is boxed, it will be a field in the box passed as the |
// last parameter. So no need to directly pass it. |
if (!localsHandler.isBoxed(parameter)) { |
@@ -388,12 +388,12 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
// sourceInformationBuilder = |
// sourceInformationBuilder.forContext(resolvedAst); |
- _localsMap.enterInlinedMember(inlinedTarget); |
+ localsMap.enterInlinedMember(inlinedTarget); |
_targetStack.add(inlinedTarget); |
var result = f(); |
sourceInformationBuilder = oldSourceInformationBuilder; |
_targetStack.removeLast(); |
- _localsMap.leaveInlinedMember(inlinedTarget); |
+ localsMap.leaveInlinedMember(inlinedTarget); |
return result; |
}); |
} |
@@ -426,7 +426,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
ir.Constructor constructor, |
List<ir.Constructor> constructorChain, |
Map<FieldEntity, HInstruction> fieldValues) { |
- assert(_elementMap.getConstructor(constructor) == _localsMap.currentMember); |
+ assert(_elementMap.getConstructor(constructor) == localsMap.currentMember); |
constructorChain.add(constructor); |
var foundSuperOrRedirectCall = false; |
@@ -578,7 +578,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
ir.Constructor caller) { |
var index = 0; |
void handleParameter(ir.VariableDeclaration node) { |
- Local parameter = _localsMap.getLocal(node); |
+ Local parameter = localsMap.getLocal(node); |
HInstruction argument = arguments[index++]; |
// Because we are inlining the initializer, we must update |
// what was given as parameter. This will be used in case |
@@ -682,7 +682,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
Map<Local, TypeMask> parameterMap = <Local, TypeMask>{}; |
if (function != null) { |
void handleParameter(ir.VariableDeclaration node) { |
- Local local = _localsMap.getLocal(node); |
+ Local local = localsMap.getLocal(node); |
parameterMap[local] = |
_typeInferenceMap.getInferredTypeOfParameter(local); |
} |
@@ -901,8 +901,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
loopHandler.handleLoop( |
forStatement, |
- closureToClassMapper.getClosureRepresentationInfoForLoop( |
- astAdapter.getNode(forStatement)), |
+ localsMap.getClosureRepresentationInfoForLoop( |
+ closureToClassMapper, forStatement), |
buildInitializer, |
buildCondition, |
buildUpdate, |
@@ -1002,7 +1002,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
HInstruction value = new HIndex(array, index, null, type); |
add(value); |
- Local loopVariableLocal = _localsMap.getLocal(forInStatement.variable); |
+ Local loopVariableLocal = localsMap.getLocal(forInStatement.variable); |
localsHandler.updateLocal(loopVariableLocal, value); |
// Hint to name loop value after name of loop variable. |
if (loopVariableLocal is! SyntheticLocal) { |
@@ -1030,8 +1030,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
loopHandler.handleLoop( |
forInStatement, |
- closureToClassMapper.getClosureRepresentationInfoForLoop( |
- astAdapter.getNode(forInStatement)), |
+ localsMap.getClosureRepresentationInfoForLoop( |
+ closureToClassMapper, forInStatement), |
buildInitializer, |
buildCondition, |
buildUpdate, |
@@ -1069,7 +1069,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
TypeMask mask = _typeInferenceMap.typeOfIteratorCurrent(forInStatement); |
_pushDynamicInvocation(forInStatement, mask, [iterator], |
selector: Selectors.current); |
- Local loopVariableLocal = _localsMap.getLocal(forInStatement.variable); |
+ Local loopVariableLocal = localsMap.getLocal(forInStatement.variable); |
HInstruction value = pop(); |
localsHandler.updateLocal(loopVariableLocal, value); |
// Hint to name loop value after name of loop variable. |
@@ -1081,8 +1081,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
loopHandler.handleLoop( |
forInStatement, |
- closureToClassMapper.getClosureRepresentationInfoForLoop( |
- astAdapter.getNode(forInStatement)), |
+ localsMap.getClosureRepresentationInfoForLoop( |
+ closureToClassMapper, forInStatement), |
buildInitializer, |
buildCondition, |
() {}, |
@@ -1117,7 +1117,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
_pushDynamicInvocation(forInStatement, mask, [streamIterator], |
selector: Selectors.current); |
localsHandler.updateLocal( |
- _localsMap.getLocal(forInStatement.variable), pop()); |
+ localsMap.getLocal(forInStatement.variable), pop()); |
forInStatement.body.accept(this); |
} |
@@ -1128,8 +1128,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
// Build fake try body: |
loopHandler.handleLoop( |
forInStatement, |
- closureToClassMapper.getClosureRepresentationInfoForLoop( |
- astAdapter.getNode(forInStatement)), |
+ localsMap.getClosureRepresentationInfoForLoop( |
+ closureToClassMapper, forInStatement), |
buildInitializer, |
buildCondition, |
buildUpdate, |
@@ -1179,8 +1179,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
loopHandler.handleLoop( |
whileStatement, |
- closureToClassMapper.getClosureRepresentationInfoForLoop( |
- astAdapter.getNode(whileStatement)), |
+ localsMap.getClosureRepresentationInfoForLoop( |
+ closureToClassMapper, whileStatement), |
() {}, |
buildCondition, |
() {}, () { |
@@ -1193,14 +1193,14 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
// 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); |
- var loopClosureInfo = closureToClassMapper |
- .getClosureRepresentationInfoForLoop(astAdapter.getNode(doStatement)); |
+ LoopClosureRepresentationInfo loopClosureInfo = localsMap |
+ .getClosureRepresentationInfoForLoop(closureToClassMapper, doStatement); |
localsHandler.startLoop(loopClosureInfo); |
JumpHandler jumpHandler = loopHandler.beginLoopHeader(doStatement); |
HLoopInformation loopInfo = current.loopInformation; |
HBasicBlock loopEntryBlock = current; |
HBasicBlock bodyEntryBlock = current; |
- JumpTarget target = _localsMap.getJumpTarget(doStatement); |
+ JumpTarget target = localsMap.getJumpTarget(doStatement); |
bool hasContinues = target != null && target.isContinueTarget; |
if (hasContinues) { |
// Add extra block to hang labels on. |
@@ -1312,7 +1312,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
// Since the body of the loop has a break, we attach a synthesized label |
// to the body. |
SubGraph bodyGraph = new SubGraph(bodyEntryBlock, bodyExitBlock); |
- JumpTarget target = _localsMap.getJumpTarget(doStatement); |
+ JumpTarget target = localsMap.getJumpTarget(doStatement); |
LabelDefinition label = target.addLabel(null, 'loop'); |
label.setBreakTarget(); |
HLabeledBlockInformation info = new HLabeledBlockInformation( |
@@ -1437,14 +1437,14 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
/// to distinguish the synthesized loop created for a switch statement with |
/// continue statements from simple switch statements. |
JumpHandler createJumpHandler(ir.TreeNode node, {bool isLoopJump: false}) { |
- JumpTarget target = _localsMap.getJumpTarget(node); |
+ JumpTarget target = localsMap.getJumpTarget(node); |
assert(target is KernelJumpTarget); |
if (target == null) { |
// No breaks or continues to this node. |
return new NullJumpHandler(reporter); |
} |
if (isLoopJump && node is ir.SwitchStatement) { |
- return new KernelSwitchCaseJumpHandler(this, target, node, _localsMap); |
+ return new KernelSwitchCaseJumpHandler(this, target, node, localsMap); |
} |
return new JumpHandler(this, target); |
@@ -1454,7 +1454,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
void visitBreakStatement(ir.BreakStatement breakStatement) { |
assert(!isAborted()); |
handleInTryStatement(); |
- JumpTarget target = _localsMap.getJumpTarget(breakStatement.target); |
+ JumpTarget target = localsMap.getJumpTarget(breakStatement.target); |
assert(target != null); |
JumpHandler handler = jumpTargets[target]; |
assert(handler != null); |
@@ -1527,7 +1527,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
void visitContinueSwitchStatement( |
ir.ContinueSwitchStatement switchStatement) { |
handleInTryStatement(); |
- JumpTarget target = _localsMap.getJumpTarget(switchStatement.target); |
+ JumpTarget target = localsMap.getJumpTarget(switchStatement.target); |
assert(target != null); |
JumpHandler handler = jumpTargets[target]; |
assert(handler != null); |
@@ -1647,7 +1647,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
// This is because JS does not have this same "continue label" semantics so |
// we encode it in the form of a state machine. |
- JumpTarget switchTarget = _localsMap.getJumpTarget(switchStatement); |
+ JumpTarget switchTarget = localsMap.getJumpTarget(switchStatement); |
localsHandler.updateLocal(switchTarget, graph.addConstantNull(closedWorld)); |
var switchCases = switchStatement.cases; |
@@ -1714,8 +1714,8 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
void buildLoop() { |
loopHandler.handleLoop( |
switchStatement, |
- closureToClassMapper.getClosureRepresentationInfoForLoop( |
- astAdapter.getNode(switchStatement)), |
+ localsMap.getClosureRepresentationInfoForLoop( |
+ closureToClassMapper, switchStatement), |
() {}, |
buildCondition, |
() {}, |
@@ -2125,7 +2125,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
return; |
} |
- Local local = _localsMap.getLocal(variableGet.variable); |
+ Local local = localsMap.getLocal(variableGet.variable); |
stack.add(localsHandler.readLocal(local)); |
} |
@@ -2173,7 +2173,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
@override |
void visitVariableDeclaration(ir.VariableDeclaration declaration) { |
- Local local = _localsMap.getLocal(declaration); |
+ Local local = localsMap.getLocal(declaration); |
if (declaration.initializer == null) { |
HInstruction initialValue = graph.addConstantNull(closedWorld); |
localsHandler.updateLocal(local, initialValue); |
@@ -2189,7 +2189,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder { |
} |
void _visitLocalSetter(ir.VariableDeclaration variable, HInstruction value) { |
- Local local = _localsMap.getLocal(variable); |
+ Local local = localsMap.getLocal(variable); |
// Give the value a name if it doesn't have one already. |
if (value.sourceElement == null) { |
@@ -3414,7 +3414,7 @@ class TryCatchFinallyBuilder { |
catchesIndex++; |
if (catchBlock.exception != null) { |
LocalVariableElement exceptionVariable = |
- kernelBuilder._localsMap.getLocal(catchBlock.exception); |
+ kernelBuilder.localsMap.getLocal(catchBlock.exception); |
kernelBuilder.localsHandler |
.updateLocal(exceptionVariable, unwrappedException); |
} |
@@ -3426,7 +3426,7 @@ class TryCatchFinallyBuilder { |
kernelBuilder._commonElements.traceFromException)); |
HInstruction traceInstruction = kernelBuilder.pop(); |
LocalVariableElement traceVariable = |
- kernelBuilder._localsMap.getLocal(catchBlock.stackTrace); |
+ kernelBuilder.localsMap.getLocal(catchBlock.stackTrace); |
kernelBuilder.localsHandler |
.updateLocal(traceVariable, traceInstruction); |
} |