[dartdevc] Removing redundant String concat operations.
These were apparently copied from Dart2JS but never inlined in DDC, so they've been pure overhead.
Change-Id: I614a94d130248bece5ba7af8c5b9a436b1196b62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164682
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
diff --git a/sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart b/sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart
index 2171a9f..5916674 100644
--- a/sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart
+++ b/sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart
@@ -732,8 +732,8 @@
@patch
String toString() => Primitives.flattenString(_contents);
- void _writeString(String str) {
- _contents = Primitives.stringConcatUnchecked(_contents, str);
+ void _writeString(@notNull String str) {
+ _contents = JS<String>('!', '# + #', _contents, str);
}
static String _writeAll(String string, Iterable objects, String separator) {
@@ -753,8 +753,8 @@
return string;
}
- static String _writeOne(String string, Object? obj) {
- return Primitives.stringConcatUnchecked(string, '$obj');
+ static String _writeOne(@notNull String string, Object? obj) {
+ return JS<String>('!', '# + #', string, '$obj');
}
}
diff --git a/sdk/lib/_internal/js_dev_runtime/private/foreign_helper.dart b/sdk/lib/_internal/js_dev_runtime/private/foreign_helper.dart
index 7f11505..6551c93 100644
--- a/sdk/lib/_internal/js_dev_runtime/private/foreign_helper.dart
+++ b/sdk/lib/_internal/js_dev_runtime/private/foreign_helper.dart
@@ -259,15 +259,6 @@
const JS_CONST(this.code);
}
-/**
- * JavaScript string concatenation. Inputs must be Strings. Corresponds to the
- * HStringConcat SSA instruction and may be constant-folded.
- */
-String JS_STRING_CONCAT(String a, String b) {
- // This body is unused, only here for type analysis.
- return JS<String>('!', '# + #', a, b);
-}
-
/// Same `@rest` annotation and `spread` function as in
/// `package:js/src/varargs.dart`.
///
diff --git a/sdk/lib/_internal/js_dev_runtime/private/js_helper.dart b/sdk/lib/_internal/js_dev_runtime/private/js_helper.dart
index 83815d9..5c5f484 100644
--- a/sdk/lib/_internal/js_dev_runtime/private/js_helper.dart
+++ b/sdk/lib/_internal/js_dev_runtime/private/js_helper.dart
@@ -6,7 +6,7 @@
import 'dart:collection';
-import 'dart:_foreign_helper' show JS, JS_STRING_CONCAT, JSExportName;
+import 'dart:_foreign_helper' show JS, JSExportName;
import 'dart:_interceptors';
import 'dart:_internal'
@@ -295,10 +295,6 @@
throw RangeError.range(charCode, 0, 0x10ffff);
}
- static String stringConcatUnchecked(String string1, String string2) {
- return JS_STRING_CONCAT(string1, string2);
- }
-
static String flattenString(String str) {
return JS<String>('!', "#.charCodeAt(0) == 0 ? # : #", str, str, str);
}