Parsing some kinds of integers and junk values in Runtime_NumberToString. For that values the string is converted into int and then into SMI. It lets to avoid floating point operations.

Committed: http://code.google.com/p/v8/source/detail?r=4331
Review URL: http://codereview.chromium.org/1572004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4339 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
serya@chromium.org 2010-04-05 08:00:28 +00:00
parent 560baa5eb4
commit 9877ea8b90

View File

@ -4482,7 +4482,9 @@ static Object* Runtime_StringToNumber(Arguments args) {
bool minus = (data[0] == '-');
int start_pos = (minus ? 1 : 0);
if (start_pos == len || data[start_pos] > '9') {
if (start_pos == len) {
return Heap::nan_value();
} else if (data[start_pos] > '9') {
// Fast check for a junk value. A valid string may start from a
// whitespace, a sign ('+' or '-'), the decimal point, a decimal digit or
// the 'I' character ('Infinity'). All of that have codes not greater than