Chromium Code Reviews| Index: runtime/lib/integers_patch.dart |
| =================================================================== |
| --- runtime/lib/integers_patch.dart (revision 23246) |
| +++ runtime/lib/integers_patch.dart (working copy) |
| @@ -13,6 +13,8 @@ |
| ((9 <= codePoint) && (codePoint <= 13)); // CR, LF, TAB, etc. |
| } |
| + static bool is64Bit() => 4294967296 is _Smi; |
|
siva
2013/05/28 16:00:37
maybe 4294967296 should be a static constant so th
srdjan
2013/05/29 09:04:09
Changed to 1 << 32, so it should be clear. Let me
|
| + |
| 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; |