Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: src/conversions.h

Issue 225823003: Implement handlified String::Equals and Name::Equals. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: refactored StringToDouble Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/contexts.cc ('k') | src/conversions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 ALLOW_HEX = 1, 115 ALLOW_HEX = 1,
116 ALLOW_OCTAL = 2, 116 ALLOW_OCTAL = 2,
117 ALLOW_IMPLICIT_OCTAL = 4, 117 ALLOW_IMPLICIT_OCTAL = 4,
118 ALLOW_BINARY = 8, 118 ALLOW_BINARY = 8,
119 ALLOW_TRAILING_JUNK = 16 119 ALLOW_TRAILING_JUNK = 16
120 }; 120 };
121 121
122 122
123 // Converts a string into a double value according to ECMA-262 9.3.1 123 // Converts a string into a double value according to ECMA-262 9.3.1
124 double StringToDouble(UnicodeCache* unicode_cache, 124 double StringToDouble(UnicodeCache* unicode_cache,
125 Vector<const char> str, 125 Vector<const uint8_t> str,
126 int flags, 126 int flags,
127 double empty_string_val = 0); 127 double empty_string_val = 0);
128 double StringToDouble(UnicodeCache* unicode_cache, 128 double StringToDouble(UnicodeCache* unicode_cache,
129 Vector<const uc16> str, 129 Vector<const uc16> str,
130 int flags, 130 int flags,
131 double empty_string_val = 0); 131 double empty_string_val = 0);
132 // This version expects a zero-terminated character array. 132 // This version expects a zero-terminated character array.
133 double StringToDouble(UnicodeCache* unicode_cache, 133 double StringToDouble(UnicodeCache* unicode_cache,
134 const char* str, 134 const char* str,
135 int flags, 135 int flags,
136 double empty_string_val = 0); 136 double empty_string_val = 0);
137 137
138 // Converts a string into an integer.
139 double StringToInt(UnicodeCache* unicode_cache,
140 Vector<const uint8_t> vector,
141 int radix);
142
143
144 double StringToInt(UnicodeCache* unicode_cache,
145 Vector<const uc16> vector,
146 int radix);
147
138 const int kDoubleToCStringMinBufferSize = 100; 148 const int kDoubleToCStringMinBufferSize = 100;
139 149
140 // Converts a double to a string value according to ECMA-262 9.8.1. 150 // Converts a double to a string value according to ECMA-262 9.8.1.
141 // The buffer should be large enough for any floating point number. 151 // The buffer should be large enough for any floating point number.
142 // 100 characters is enough. 152 // 100 characters is enough.
143 const char* DoubleToCString(double value, Vector<char> buffer); 153 const char* DoubleToCString(double value, Vector<char> buffer);
144 154
145 // Convert an int to a null-terminated string. The returned string is 155 // Convert an int to a null-terminated string. The returned string is
146 // located inside the buffer, but not necessarily at the start. 156 // located inside the buffer, but not necessarily at the start.
147 const char* IntToCString(int n, Vector<char> buffer); 157 const char* IntToCString(int n, Vector<char> buffer);
148 158
149 // Additional number to string conversions for the number type. 159 // Additional number to string conversions for the number type.
150 // The caller is responsible for calling free on the returned pointer. 160 // The caller is responsible for calling free on the returned pointer.
151 char* DoubleToFixedCString(double value, int f); 161 char* DoubleToFixedCString(double value, int f);
152 char* DoubleToExponentialCString(double value, int f); 162 char* DoubleToExponentialCString(double value, int f);
153 char* DoubleToPrecisionCString(double value, int f); 163 char* DoubleToPrecisionCString(double value, int f);
154 char* DoubleToRadixCString(double value, int radix); 164 char* DoubleToRadixCString(double value, int radix);
155 165
156 } } // namespace v8::internal 166 } } // namespace v8::internal
157 167
158 #endif // V8_CONVERSIONS_H_ 168 #endif // V8_CONVERSIONS_H_
OLDNEW
« no previous file with comments | « src/contexts.cc ('k') | src/conversions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698