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

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

Issue 1079253002: Use native behavior for dead code elimination (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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/optimize.dart
diff --git a/pkg/compiler/lib/src/ssa/optimize.dart b/pkg/compiler/lib/src/ssa/optimize.dart
index 0692383acd7320c1f05fc5fd1473c87f5f496630..5dd8092f656518ee44e04df59a96f36f5b2afad5 100644
--- a/pkg/compiler/lib/src/ssa/optimize.dart
+++ b/pkg/compiler/lib/src/ssa/optimize.dart
@@ -1004,6 +1004,13 @@ class SsaDeadCodeEliminator extends HGraphVisitor implements OptimizationPhase {
/// Returns true of [foreign] will throw an noSuchMethod error if
/// receiver is `null` before having any other side-effects.
bool templateThrowsNSMonNull(HForeignCode foreign, HInstruction receiver) {
+ if (foreign.inputs.length < 1) return false;
+ if (foreign.inputs.first != receiver) return false;
+ if (foreign.throwBehavior.isNullNSMGuard) return true;
+
+ // TODO(sra): Fix NativeThrowBehavior to distinguish MAY from
+ // throws-nsm-on-null-followed-by-MAY and remove all the code below.
+
// We look for a template of the form
//
// #.something -or- #.something()
@@ -1022,7 +1029,7 @@ class SsaDeadCodeEliminator extends HGraphVisitor implements OptimizationPhase {
js.PropertyAccess access = node;
if (access.receiver is js.InterpolatedExpression) {
js.InterpolatedExpression hole = access.receiver;
- return hole.isPositional && foreign.inputs.first == receiver;
+ return hole.isPositional && hole.nameOrPosition == 0;
}
}
return false;

Powered by Google App Engine
This is Rietveld 408576698