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

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

Issue 2954123002: Remove special casing of == null (Closed)
Patch Set: Created 3 years, 6 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
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 9fc1be611ce7de8a39ace6520164826ccf51a7f0..a924a681ca2111a170502ec701844acf55468748 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -719,12 +719,6 @@ class KernelSsaGraphBuilder extends ir.Visitor
graph.finalize();
}
- /// Pushes a boolean checking [expression] against null.
- pushCheckNull(HInstruction expression) {
- push(new HIdentity(expression, graph.addConstantNull(closedWorld), null,
- commonMasks.boolType));
- }
-
@override
void defaultExpression(ir.Expression expression) {
// TODO(het): This is only to get tests working.
@@ -2888,9 +2882,6 @@ class KernelSsaGraphBuilder extends ir.Visitor
// TODO(het): Decide when to inline
@override
void visitMethodInvocation(ir.MethodInvocation invocation) {
- // Handle `x == null` specially. When these come from null-aware operators,
- // there is no mapping in the astAdapter.
- if (_handleEqualsNull(invocation)) return;
invocation.receiver.accept(this);
HInstruction receiver = pop();
Selector selector = _elementMap.getSelector(invocation);
@@ -2901,27 +2892,6 @@ class KernelSsaGraphBuilder extends ir.Visitor
_visitArgumentsForDynamicTarget(selector, invocation.arguments)));
}
- bool _handleEqualsNull(ir.MethodInvocation invocation) {
- if (invocation.name.name == '==') {
- ir.Arguments arguments = invocation.arguments;
- if (arguments.types.isEmpty &&
- arguments.positional.length == 1 &&
- arguments.named.isEmpty) {
- bool finish(ir.Expression comparand) {
- comparand.accept(this);
- pushCheckNull(pop());
- return true;
- }
-
- ir.Expression receiver = invocation.receiver;
- ir.Expression argument = arguments.positional.first;
- if (argument is ir.NullLiteral) return finish(receiver);
- if (receiver is ir.NullLiteral) return finish(argument);
- }
- }
- return false;
- }
-
HInterceptor _interceptorFor(HInstruction intercepted) {
HInterceptor interceptor =
new HInterceptor(intercepted, commonMasks.nonNullType);
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart » ('j') | pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698