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

Unified Diff: runtime/lib/string_patch.dart

Issue 398813002: Performance tweak on int.parse. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add comment. Created 6 years, 5 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 | « runtime/lib/integers_patch.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/string_patch.dart
diff --git a/runtime/lib/string_patch.dart b/runtime/lib/string_patch.dart
index 0550ca77a32c68c5aa44e5187f078ffc73db1958..ec793067394b7ce24877fd859874b7e07b6a02df 100644
--- a/runtime/lib/string_patch.dart
+++ b/runtime/lib/string_patch.dart
@@ -260,9 +260,9 @@ class _StringBase {
static bool _isOneByteWhitespace(int codePoint) {
return
(codePoint == 32) || // Space.
- ((9 <= codePoint) && (codePoint <= 13)) || // CR, LF, TAB, etc.
- (codePoint == 0x85) || // NEL
- (codePoint == 0xA0); // NBSP
+ ((codePoint <= 13) ? (9 <= codePoint) // CR, LF, TAB, etc.
+ : ((codePoint == 0x85) || // NEL
+ (codePoint == 0xA0))); // NBSP
}
// Characters with Whitespace property (Unicode 6.2).
@@ -281,16 +281,17 @@ class _StringBase {
//
// BOM: 0xFEFF
static bool _isTwoByteWhitespace(int codeUnit) {
- if (codeUnit < 256) return _isOneByteWhitespace(codeUnit);
- return (codeUnit == 0x1680) ||
- (codeUnit == 0x180E) ||
- ((0x2000 <= codeUnit) && (codeUnit <= 0x200A)) ||
- (codeUnit == 0x2028) ||
- (codeUnit == 0x2029) ||
- (codeUnit == 0x202F) ||
- (codeUnit == 0x205F) ||
- (codeUnit == 0x3000) ||
- (codeUnit == 0xFEFF);
+ if (codeUnit <= 0xA0) return _isOneByteWhitespace(codeUnit);
+ return (codeUnit <= 0x200A)
+ ? ((codeUnit == 0x1680) ||
+ (codeUnit == 0x180E) ||
+ (0x2000 <= codeUnit))
+ : ((codeUnit == 0x2028) ||
+ (codeUnit == 0x2029) ||
+ (codeUnit == 0x202F) ||
+ (codeUnit == 0x205F) ||
+ (codeUnit == 0x3000) ||
+ (codeUnit == 0xFEFF));
}
int _firstNonWhitespace() {
« no previous file with comments | « runtime/lib/integers_patch.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698