remove HIf.hasElse.
An HIf always has an else. It might be empty, though. Review URL: https://chromiumcodereview.appspot.com//10693059 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9285 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
@@ -454,10 +454,8 @@ class SsaBailoutPropagator extends HBaseVisitor {
|
||||
HIfBlockInformation info = instruction.blockInformation.body;
|
||||
visitStatements(info.thenGraph);
|
||||
preVisitedBlocks++;
|
||||
if (instruction.hasElse) {
|
||||
visitStatements(info.elseGraph);
|
||||
preVisitedBlocks++;
|
||||
}
|
||||
visitStatements(info.elseGraph);
|
||||
preVisitedBlocks++;
|
||||
|
||||
HBasicBlock joinBlock = instruction.joinBlock;
|
||||
if (joinBlock !== null
|
||||
|
||||
@@ -1578,7 +1578,7 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
|
||||
SubExpression conditionGraph =
|
||||
new SubExpression(conditionStartBlock, lastOpenedBlock);
|
||||
HInstruction condition = popBoolified();
|
||||
HIf branch = new HIf(condition, true);
|
||||
HIf branch = new HIf(condition);
|
||||
HBasicBlock conditionBlock = close(branch);
|
||||
|
||||
LocalsHandler savedLocals = new LocalsHandler.from(localsHandler);
|
||||
|
||||
@@ -1703,7 +1703,7 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor {
|
||||
// Depending on how the then/else branches terminate
|
||||
// (e.g., return/throw/break) there can be any number of these.
|
||||
List<HBasicBlock> dominated = node.block.dominatedBlocks;
|
||||
for (int i = node.hasElse ? 2 : 1; i < dominated.length; i++) {
|
||||
for (int i = 2; i < dominated.length; i++) {
|
||||
visitBasicBlock(dominated[i]);
|
||||
}
|
||||
}
|
||||
@@ -3048,15 +3048,15 @@ class SsaUnoptimizedCodeGenerator extends SsaCodeGenerator {
|
||||
HStatementInformation thenGraph = info.thenGraph;
|
||||
HStatementInformation elseGraph = info.elseGraph;
|
||||
bool thenHasGuards = thenGraph.start.hasGuards();
|
||||
bool elseHasGuards = node.hasElse && elseGraph.start.hasGuards();
|
||||
bool elseHasGuards = elseGraph.start.hasGuards();
|
||||
bool hasGuards = thenHasGuards || elseHasGuards;
|
||||
if (!hasGuards) return super.generateIf(node, info);
|
||||
|
||||
int elseKind = analyzeGraphForCodegen(elseGraph);
|
||||
bool emptyElse = !node.hasElse || elseKind == SsaCodeGenerator.EMPTY;
|
||||
bool emptyElse = elseKind == SsaCodeGenerator.EMPTY;
|
||||
|
||||
startBailoutCase(thenGraph.start.guards,
|
||||
node.hasElse ? elseGraph.start.guards : const <HTypeGuard>[]);
|
||||
emptyElse ? const <HTypeGuard>[] : elseGraph.start.guards);
|
||||
|
||||
addIndented('if (');
|
||||
int precedence = JSPrecedence.EXPRESSION_PRECEDENCE;
|
||||
|
||||
@@ -1748,9 +1748,8 @@ class HTry extends HControlFlow {
|
||||
}
|
||||
|
||||
class HIf extends HConditionalBranch {
|
||||
bool hasElse;
|
||||
HBlockFlow blockInformation = null;
|
||||
HIf(HInstruction condition, this.hasElse) : super(<HInstruction>[condition]);
|
||||
HIf(HInstruction condition) : super(<HInstruction>[condition]);
|
||||
toString() => 'if';
|
||||
accept(HVisitor visitor) => visitor.visitIf(this);
|
||||
|
||||
@@ -1760,12 +1759,8 @@ class HIf extends HConditionalBranch {
|
||||
}
|
||||
|
||||
HBasicBlock get elseBlock() {
|
||||
if (hasElse) {
|
||||
assert(block.dominatedBlocks[1] === block.successors[1]);
|
||||
return block.successors[1];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
assert(block.dominatedBlocks[1] === block.successors[1]);
|
||||
return block.successors[1];
|
||||
}
|
||||
|
||||
HBasicBlock get joinBlock() => blockInformation.continuation;
|
||||
|
||||
@@ -1168,15 +1168,7 @@ class SsaTypeConversionInserter extends HBaseVisitor
|
||||
}
|
||||
|
||||
for (HIf ifUser in notIfUsers) {
|
||||
if (ifUser.hasElse) {
|
||||
changeUsesDominatedBy(ifUser.elseBlock, input, convertedType);
|
||||
} else if (ifUser.joinBlock.predecessors.length == 1) {
|
||||
// If the join block has only one predecessor, then we know
|
||||
// the if block terminates. So any use of the instruction
|
||||
// after the join block should be changed to the new
|
||||
// instruction.
|
||||
changeUsesDominatedBy(ifUser.joinBlock, input, convertedType);
|
||||
}
|
||||
changeUsesDominatedBy(ifUser.elseBlock, input, convertedType);
|
||||
// TODO(ngeoffray): Also change uses for the then block on a HType
|
||||
// that knows it is not of a specific Type.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user