Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(872)

Unified Diff: pkg/compiler/lib/src/ssa/builder.dart

Issue 2380573004: kernel->ssa: implement assert statements (Closed)
Patch Set: remove todo after discussion Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/options.dart ('k') | pkg/compiler/lib/src/ssa/builder_kernel.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/builder.dart
diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart
index fd895189164b344f6c0fa385c12c980488ee1b94..759639f67e0bc37c224808628cba3535f7678ed4 100644
--- a/pkg/compiler/lib/src/ssa/builder.dart
+++ b/pkg/compiler/lib/src/ssa/builder.dart
@@ -677,14 +677,19 @@ class SsaBuilder extends ast.Visitor
// null check.
if (name == '==') {
if (!backend.operatorEqHandlesNullArgument(functionElement)) {
- handleIf(function, visitCondition: () {
- HParameterValue parameter = parameters.values.first;
- push(new HIdentity(parameter, graph.addConstantNull(compiler), null,
- backend.boolType));
- }, visitThen: () {
- closeAndGotoExit(new HReturn(graph.addConstantBool(false, compiler),
- sourceInformationBuilder.buildImplicitReturn(functionElement)));
- },
+ handleIf(
+ node: function,
+ visitCondition: () {
+ HParameterValue parameter = parameters.values.first;
+ push(new HIdentity(parameter, graph.addConstantNull(compiler),
+ null, backend.boolType));
+ },
+ visitThen: () {
+ closeAndGotoExit(new HReturn(
+ graph.addConstantBool(false, compiler),
+ sourceInformationBuilder
+ .buildImplicitReturn(functionElement)));
+ },
visitElse: null,
sourceInformation: sourceInformationBuilder.buildIf(function.body));
}
@@ -1659,7 +1664,7 @@ class SsaBuilder extends ast.Visitor
pop();
}
- handleIf(node, visitCondition: buildCondition, visitThen: fail);
+ handleIf(node: node, visitCondition: buildCondition, visitThen: fail);
}
visitBlock(ast.Block node) {
@@ -1954,24 +1959,14 @@ class SsaBuilder extends ast.Visitor
visitIf(ast.If node) {
assert(isReachable);
- handleIf(node,
+ handleIf(
+ node: node,
visitCondition: () => visit(node.condition),
visitThen: () => visit(node.thenPart),
visitElse: node.elsePart != null ? () => visit(node.elsePart) : null,
sourceInformation: sourceInformationBuilder.buildIf(node));
}
- void handleIf(ast.Node diagnosticNode,
- {void visitCondition(),
- void visitThen(),
- void visitElse(),
- SourceInformation sourceInformation}) {
- SsaBranchBuilder branchBuilder =
- new SsaBranchBuilder(this, compiler, diagnosticNode);
- branchBuilder.handleIf(visitCondition, visitThen, visitElse,
- sourceInformation: sourceInformation);
- }
-
@override
void visitIfNull(ast.Send node, ast.Node left, ast.Node right, _) {
SsaBranchBuilder brancher = new SsaBranchBuilder(this, compiler, node);
@@ -6160,7 +6155,8 @@ class SsaBuilder extends ast.Visitor
nativeBehavior: native.NativeBehavior.PURE));
}
- handleIf(node,
+ handleIf(
+ node: node,
visitCondition: buildCondition,
visitThen: buildLoop,
visitElse: () => {});
@@ -6502,16 +6498,24 @@ class SsaBuilder extends ast.Visitor
isRethrow: true));
} else {
ast.CatchBlock newBlock = link.head;
- handleIf(node, visitCondition: () {
- pushCondition(newBlock);
- }, visitThen: visitThen, visitElse: visitElse);
+ handleIf(
+ node: node,
+ visitCondition: () {
+ pushCondition(newBlock);
+ },
+ visitThen: visitThen,
+ visitElse: visitElse);
}
}
ast.CatchBlock firstBlock = link.head;
- handleIf(node, visitCondition: () {
- pushCondition(firstBlock);
- }, visitThen: visitThen, visitElse: visitElse);
+ handleIf(
+ node: node,
+ visitCondition: () {
+ pushCondition(firstBlock);
+ },
+ visitThen: visitThen,
+ visitElse: visitElse);
if (!isAborted()) endCatchBlock = close(new HGoto());
rethrowableException = oldRethrowableException;
« no previous file with comments | « pkg/compiler/lib/src/options.dart ('k') | pkg/compiler/lib/src/ssa/builder_kernel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698