| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 5030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5041 uint8_t const* data = SeqOneByteString::cast(subject)->GetChars(); | 5041 uint8_t const* data = SeqOneByteString::cast(subject)->GetChars(); |
| 5042 bool minus = (data[0] == '-'); | 5042 bool minus = (data[0] == '-'); |
| 5043 int start_pos = (minus ? 1 : 0); | 5043 int start_pos = (minus ? 1 : 0); |
| 5044 | 5044 |
| 5045 if (start_pos == len) { | 5045 if (start_pos == len) { |
| 5046 return isolate->heap()->nan_value(); | 5046 return isolate->heap()->nan_value(); |
| 5047 } else if (data[start_pos] > '9') { | 5047 } else if (data[start_pos] > '9') { |
| 5048 // Fast check for a junk value. A valid string may start from a | 5048 // Fast check for a junk value. A valid string may start from a |
| 5049 // whitespace, a sign ('+' or '-'), the decimal point, a decimal digit or | 5049 // whitespace, a sign ('+' or '-'), the decimal point, a decimal digit or |
| 5050 // the 'I' character ('Infinity'). All of that have codes not greater than | 5050 // the 'I' character ('Infinity'). All of that have codes not greater than |
| 5051 // '9' except 'I'. | 5051 // '9' except 'I' and . |
| 5052 if (data[start_pos] != 'I') { | 5052 if (data[start_pos] != 'I' && data[start_pos] != 0xa0) { |
| 5053 return isolate->heap()->nan_value(); | 5053 return isolate->heap()->nan_value(); |
| 5054 } | 5054 } |
| 5055 } else if (len - start_pos < 10 && AreDigits(data, start_pos, len)) { | 5055 } else if (len - start_pos < 10 && AreDigits(data, start_pos, len)) { |
| 5056 // The maximal/minimal smi has 10 digits. If the string has less digits we | 5056 // The maximal/minimal smi has 10 digits. If the string has less digits we |
| 5057 // know it will fit into the smi-data type. | 5057 // know it will fit into the smi-data type. |
| 5058 int d = ParseDecimalInteger(data, start_pos, len); | 5058 int d = ParseDecimalInteger(data, start_pos, len); |
| 5059 if (minus) { | 5059 if (minus) { |
| 5060 if (d == 0) return isolate->heap()->minus_zero_value(); | 5060 if (d == 0) return isolate->heap()->minus_zero_value(); |
| 5061 d = -d; | 5061 d = -d; |
| 5062 } else if (!subject->HasHashCode() && | 5062 } else if (!subject->HasHashCode() && |
| (...skipping 8653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13716 // Handle last resort GC and make sure to allow future allocations | 13716 // Handle last resort GC and make sure to allow future allocations |
| 13717 // to grow the heap without causing GCs (if possible). | 13717 // to grow the heap without causing GCs (if possible). |
| 13718 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13718 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13719 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13719 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 13720 "Runtime::PerformGC"); | 13720 "Runtime::PerformGC"); |
| 13721 } | 13721 } |
| 13722 } | 13722 } |
| 13723 | 13723 |
| 13724 | 13724 |
| 13725 } } // namespace v8::internal | 13725 } } // namespace v8::internal |
| OLD | NEW |