| 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 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 StringInputBuffer buffer(str); | 726 StringInputBuffer buffer(str); |
| 727 return InternalStringToInt(StringInputBufferIterator(&buffer), | 727 return InternalStringToInt(StringInputBufferIterator(&buffer), |
| 728 StringInputBufferIterator::EndMarker(), | 728 StringInputBufferIterator::EndMarker(), |
| 729 radix); | 729 radix); |
| 730 } | 730 } |
| 731 } | 731 } |
| 732 | 732 |
| 733 | 733 |
| 734 double StringToDouble(const char* str, int flags, double empty_string_val) { | 734 double StringToDouble(const char* str, int flags, double empty_string_val) { |
| 735 const char* end = str + StrLength(str); | 735 const char* end = str + StrLength(str); |
| 736 return InternalStringToDouble(str, end, flags, empty_string_val); |
| 737 } |
| 736 | 738 |
| 737 return InternalStringToDouble(str, end, flags, empty_string_val); | 739 |
| 740 double StringToDouble(Vector<const char> str, |
| 741 int flags, |
| 742 double empty_string_val) { |
| 743 const char* end = str.start() + str.length(); |
| 744 return InternalStringToDouble(str.start(), end, flags, empty_string_val); |
| 738 } | 745 } |
| 739 | 746 |
| 740 | 747 |
| 741 extern "C" char* dtoa(double d, int mode, int ndigits, | 748 extern "C" char* dtoa(double d, int mode, int ndigits, |
| 742 int* decpt, int* sign, char** rve); | 749 int* decpt, int* sign, char** rve); |
| 743 | 750 |
| 744 extern "C" void freedtoa(char* s); | 751 extern "C" void freedtoa(char* s); |
| 745 | 752 |
| 746 const char* DoubleToCString(double v, Vector<char> buffer) { | 753 const char* DoubleToCString(double v, Vector<char> buffer) { |
| 747 StringBuilder builder(buffer.start(), buffer.length()); | 754 StringBuilder builder(buffer.start(), buffer.length()); |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 // Allocate result and fill in the parts. | 1117 // Allocate result and fill in the parts. |
| 1111 StringBuilder builder(result_size + 1); | 1118 StringBuilder builder(result_size + 1); |
| 1112 builder.AddSubstring(integer_buffer + integer_pos + 1, integer_part_size); | 1119 builder.AddSubstring(integer_buffer + integer_pos + 1, integer_part_size); |
| 1113 if (decimal_pos > 0) builder.AddCharacter('.'); | 1120 if (decimal_pos > 0) builder.AddCharacter('.'); |
| 1114 builder.AddSubstring(decimal_buffer, decimal_pos); | 1121 builder.AddSubstring(decimal_buffer, decimal_pos); |
| 1115 return builder.Finalize(); | 1122 return builder.Finalize(); |
| 1116 } | 1123 } |
| 1117 | 1124 |
| 1118 | 1125 |
| 1119 } } // namespace v8::internal | 1126 } } // namespace v8::internal |
| OLD | NEW |