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

Unified Diff: runtime/lib/integers_patch.dart

Issue 15670009: Check how many Smi digits are acceptable when parsing integers. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/integers_patch.dart
===================================================================
--- runtime/lib/integers_patch.dart (revision 23328)
+++ runtime/lib/integers_patch.dart (working copy)
@@ -13,6 +13,8 @@
((9 <= codePoint) && (codePoint <= 13)); // CR, LF, TAB, etc.
}
+ static bool is64Bit() => 1 << 32 is _Smi;
+
static int _tryParseSmi(String str) {
if (str.isEmpty) return null;
var ix = 0;
@@ -40,7 +42,8 @@
return null; // Empty.
}
}
- if ((endIx - ix) >= 9) {
+ int smiLimit = is64Bit() ? 18 : 9;
+ if ((endIx - ix) >= smiLimit) {
return null; // May not fit into a Smi.
}
var result = 0;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698