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

Unified Diff: pkg/compiler/lib/src/native/behavior.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/native/behavior.dart
diff --git a/pkg/compiler/lib/src/native/behavior.dart b/pkg/compiler/lib/src/native/behavior.dart
index 9f825de381c324302e01e65ad72c6238acfae0d6..742cf0d8e9eb7f9725deb32398f093e2af864b3d 100644
--- a/pkg/compiler/lib/src/native/behavior.dart
+++ b/pkg/compiler/lib/src/native/behavior.dart
@@ -31,6 +31,22 @@ class NativeThrowBehavior {
bool get canThrow => this != NEVER;
+ /// Does this behavior always throw a noSuchMethod check on a null first
+ /// argument before any side effect or other exception?
+ // TODO(sra): Extend NativeThrowBehavior with the concept of NSM guard
+ // followed by other potential behavior.
+ bool get isNullNSMGuard => this == MAY_THROW_ONLY_ON_FIRST_ARGUMENT_ACCESS;
+
+ /// Does this behavior always act as a null noSuchMethod check, and has no
+ /// other throwing behavior?
+ bool get onlyNullNSMGuard => this == MAY_THROW_ONLY_ON_FIRST_ARGUMENT_ACCESS;
floitsch 2015/04/13 08:07:14 nit: isOnlyNullNSMGuard
sra1 2015/04/13 23:59:05 Done.
+
+ /// Returns the behavior if we assume the first argument is not null.
+ NativeThrowBehavior get onNonNull {
+ if (this == MAY_THROW_ONLY_ON_FIRST_ARGUMENT_ACCESS) return NEVER;
+ return this;
+ }
+
String toString() {
if (this == NEVER) return 'never';
if (this == MAY) return 'may';
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/nodes.dart » ('j') | tests/compiler/dart2js/js_spec_optimization_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698