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

Unified Diff: sdk/lib/_internal/js_runtime/lib/js_string.dart

Issue 2746033006: dart2js: replace calls to codeUnitAt when index has favourable type (Closed)
Patch Set: dartfmt Created 3 years, 9 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
« no previous file with comments | « pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/js_runtime/lib/js_string.dart
diff --git a/sdk/lib/_internal/js_runtime/lib/js_string.dart b/sdk/lib/_internal/js_runtime/lib/js_string.dart
index 9319b14898a5be09fd9dd7474eb6dcc2ad6bee32..86e2937dc0b4041c7930c1586bbfcc64bdf51299 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_string.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_string.dart
@@ -13,9 +13,14 @@ part of _interceptors;
class JSString extends Interceptor implements String, JSIndexable {
const JSString();
+ @NoInline()
int codeUnitAt(int index) {
if (index is !int) throw diagnoseIndexError(this, index);
if (index < 0) throw diagnoseIndexError(this, index);
+ return _codeUnitAt(index);
+ }
+
+ int _codeUnitAt(int index) {
if (index >= length) throw diagnoseIndexError(this, index);
return JS('JSUInt31', r'#.charCodeAt(#)', this, index);
}
« no previous file with comments | « pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698