| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 15 matching lines...) Expand all Loading... |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include <stdarg.h> | 28 #include <stdarg.h> |
| 29 #include <limits.h> | 29 #include <limits.h> |
| 30 | 30 |
| 31 #include "v8.h" | 31 #include "v8.h" |
| 32 | 32 |
| 33 #include "conversions-inl.h" | 33 #include "conversions-inl.h" |
| 34 #include "dtoa.h" | 34 #include "dtoa.h" |
| 35 #include "factory.h" | 35 #include "factory.h" |
| 36 #include "scanner.h" | 36 #include "scanner-base.h" |
| 37 #include "strtod.h" | 37 #include "strtod.h" |
| 38 | 38 |
| 39 namespace v8 { | 39 namespace v8 { |
| 40 namespace internal { | 40 namespace internal { |
| 41 | 41 |
| 42 int HexValue(uc32 c) { | 42 int HexValue(uc32 c) { |
| 43 if ('0' <= c && c <= '9') | 43 if ('0' <= c && c <= '9') |
| 44 return c - '0'; | 44 return c - '0'; |
| 45 if ('a' <= c && c <= 'f') | 45 if ('a' <= c && c <= 'f') |
| 46 return c - 'a' + 10; | 46 return c - 'a' + 10; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 const int kMaxSignificantDigits = 772; | 114 const int kMaxSignificantDigits = 772; |
| 115 | 115 |
| 116 | 116 |
| 117 static const double JUNK_STRING_VALUE = OS::nan_value(); | 117 static const double JUNK_STRING_VALUE = OS::nan_value(); |
| 118 | 118 |
| 119 | 119 |
| 120 // Returns true if a nonspace found and false if the end has reached. | 120 // Returns true if a nonspace found and false if the end has reached. |
| 121 template <class Iterator, class EndMark> | 121 template <class Iterator, class EndMark> |
| 122 static inline bool AdvanceToNonspace(Iterator* current, EndMark end) { | 122 static inline bool AdvanceToNonspace(Iterator* current, EndMark end) { |
| 123 while (*current != end) { | 123 while (*current != end) { |
| 124 if (!Scanner::kIsWhiteSpace.get(**current)) return true; | 124 if (!ScannerConstants::kIsWhiteSpace.get(**current)) return true; |
| 125 ++*current; | 125 ++*current; |
| 126 } | 126 } |
| 127 return false; | 127 return false; |
| 128 } | 128 } |
| 129 | 129 |
| 130 | 130 |
| 131 static bool isDigit(int x, int radix) { | 131 static bool isDigit(int x, int radix) { |
| 132 return (x >= '0' && x <= '9' && x < '0' + radix) | 132 return (x >= '0' && x <= '9' && x < '0' + radix) |
| 133 || (radix > 10 && x >= 'a' && x < 'a' + radix - 10) | 133 || (radix > 10 && x >= 'a' && x < 'a' + radix - 10) |
| 134 || (radix > 10 && x >= 'A' && x < 'A' + radix - 10); | 134 || (radix > 10 && x >= 'A' && x < 'A' + radix - 10); |
| (...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1131 // Allocate result and fill in the parts. | 1131 // Allocate result and fill in the parts. |
| 1132 StringBuilder builder(result_size + 1); | 1132 StringBuilder builder(result_size + 1); |
| 1133 builder.AddSubstring(integer_buffer + integer_pos + 1, integer_part_size); | 1133 builder.AddSubstring(integer_buffer + integer_pos + 1, integer_part_size); |
| 1134 if (decimal_pos > 0) builder.AddCharacter('.'); | 1134 if (decimal_pos > 0) builder.AddCharacter('.'); |
| 1135 builder.AddSubstring(decimal_buffer, decimal_pos); | 1135 builder.AddSubstring(decimal_buffer, decimal_pos); |
| 1136 return builder.Finalize(); | 1136 return builder.Finalize(); |
| 1137 } | 1137 } |
| 1138 | 1138 |
| 1139 | 1139 |
| 1140 } } // namespace v8::internal | 1140 } } // namespace v8::internal |
| OLD | NEW |