[ddc] Cleaning up extraneous null checks in runtime.

Change-Id: Ia32b15ec9ac572332da7904e94ec9c9615bf3de1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324842
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Auto-Submit: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
diff --git a/sdk/lib/_internal/js_dev_runtime/patch/collection_patch.dart b/sdk/lib/_internal/js_dev_runtime/patch/collection_patch.dart
index dcf12ab..b36947b 100644
--- a/sdk/lib/_internal/js_dev_runtime/patch/collection_patch.dart
+++ b/sdk/lib/_internal/js_dev_runtime/patch/collection_patch.dart
@@ -214,7 +214,7 @@
   bool add(E key) {
     var map = _map;
     if (key == null) {
-      if (JS('', '#.has(null)', map)) return false;
+      if (JS<bool>('!', '#.has(null)', map)) return false;
       // Convert undefined to null, if needed.
       JS('', '# = null', key);
     } else if (JS<bool>('!', '#[#] !== #', key, dart.extensionSymbol('_equals'),
@@ -233,7 +233,7 @@
         }
         JS('', '#.push(#)', buckets, key);
       }
-    } else if (JS('', '#.has(#)', map, key)) {
+    } else if (JS<bool>('!', '#.has(#)', map, key)) {
       return false;
     }
     JS('', '#.add(#)', map, key);
diff --git a/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart b/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
index f6b1fc3..f9fa7fd 100644
--- a/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
+++ b/sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart
@@ -1068,7 +1068,7 @@
 @notNull
 String Function() toStringTearoff(obj) {
   if (obj == null ||
-      JS<bool>('', '#[#] !== void 0', obj, extensionSymbol('toString'))) {
+      JS<bool>('!', '#[#] !== void 0', obj, extensionSymbol('toString'))) {
     // The bind helper can handle finding the toString method for null or Dart
     // Objects.
     return bind(obj, extensionSymbol('toString'), null);
@@ -1143,7 +1143,7 @@
 @notNull
 dynamic Function(Invocation) noSuchMethodTearoff(obj) {
   if (obj == null ||
-      JS<bool>('', '#[#] !== void 0', obj, extensionSymbol('noSuchMethod'))) {
+      JS<bool>('!', '#[#] !== void 0', obj, extensionSymbol('noSuchMethod'))) {
     // The bind helper can handle finding the toString method for null or Dart
     // Objects.
     return bind(obj, extensionSymbol('noSuchMethod'), null);
@@ -1252,7 +1252,7 @@
     @notNull String importPrefix, @notNull String targetModule) {
   if (!_ddcDeferredLoading) {
     var result = JS('', '#.get(#)', deferredImports, libraryUri);
-    if (JS<bool>('', '# === void 0', result)) {
+    if (JS<bool>('!', '# === void 0', result)) {
       JS('', '#.set(#, # = new Set())', deferredImports, libraryUri, result);
     }
     JS('', '#.add(#)', result, importPrefix);
@@ -1263,7 +1263,7 @@
     if (targetModule.isEmpty) {
       throw ArgumentError('Empty module passed for deferred load: $loadId.');
     }
-    if (JS('', r'#.deferred_loader.isLoaded(#)', global_, loadId)) {
+    if (JS<bool>('!', r'#.deferred_loader.isLoaded(#)', global_, loadId)) {
       return Future.value();
     }
     var completer = Completer();
@@ -1293,14 +1293,14 @@
     @notNull String libraryUri, @notNull String importPrefix) {
   if (!_ddcDeferredLoading) {
     var loaded = JS('', '#.get(#)', deferredImports, libraryUri);
-    if (JS<bool>('', '# === void 0', loaded) ||
-        JS<bool>('', '!#.has(#)', loaded, importPrefix)) {
+    if (JS<bool>('!', '# === void 0', loaded) ||
+        JS<bool>('!', '!#.has(#)', loaded, importPrefix)) {
       throwDeferredIsLoadedError(libraryUri, importPrefix);
     }
   } else {
     var loadId = '$libraryUri::$importPrefix';
     var loaded =
-        JS<bool>('', r'#.deferred_loader.loadIds.has(#)', global_, loadId);
+        JS<bool>('!', r'#.deferred_loader.loadIds.has(#)', global_, loadId);
     if (!loaded) throwDeferredIsLoadedError(libraryUri, importPrefix);
   }
 }