OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_CONVERSIONS_H_ | 5 #ifndef V8_CONVERSIONS_H_ |
6 #define V8_CONVERSIONS_H_ | 6 #define V8_CONVERSIONS_H_ |
7 | 7 |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "src/base/logging.h" | 10 #include "src/base/logging.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 165 |
166 // UInteger32 is an integer that can be represented as an unsigned 32-bit | 166 // UInteger32 is an integer that can be represented as an unsigned 32-bit |
167 // integer. It has to be in the range [0, 2^32 - 1]. | 167 // integer. It has to be in the range [0, 2^32 - 1]. |
168 // We also have to check for negative 0 as it is not a UInteger32. | 168 // We also have to check for negative 0 as it is not a UInteger32. |
169 inline bool IsUint32Double(double value); | 169 inline bool IsUint32Double(double value); |
170 | 170 |
171 | 171 |
172 // Convert from Number object to C integer. | 172 // Convert from Number object to C integer. |
173 inline int32_t NumberToInt32(Object* number); | 173 inline int32_t NumberToInt32(Object* number); |
174 inline uint32_t NumberToUint32(Object* number); | 174 inline uint32_t NumberToUint32(Object* number); |
175 | 175 inline int64_t NumberToInt64(Object* number); |
176 | 176 |
177 double StringToDouble(UnicodeCache* unicode_cache, Handle<String> string, | 177 double StringToDouble(UnicodeCache* unicode_cache, Handle<String> string, |
178 int flags, double empty_string_val = 0.0); | 178 int flags, double empty_string_val = 0.0); |
179 | 179 |
180 | 180 |
181 inline bool TryNumberToSize(Isolate* isolate, Object* number, size_t* result); | 181 inline bool TryNumberToSize(Isolate* isolate, Object* number, size_t* result); |
182 | 182 |
183 | 183 |
184 // Converts a number into size_t. | 184 // Converts a number into size_t. |
185 inline size_t NumberToSize(Isolate* isolate, Object* number); | 185 inline size_t NumberToSize(Isolate* isolate, Object* number); |
186 | 186 |
187 | 187 |
188 // returns DoubleToString(StringToDouble(string)) == string | 188 // returns DoubleToString(StringToDouble(string)) == string |
189 bool IsSpecialIndex(UnicodeCache* unicode_cache, String* string); | 189 bool IsSpecialIndex(UnicodeCache* unicode_cache, String* string); |
190 | 190 |
191 } // namespace internal | 191 } // namespace internal |
192 } // namespace v8 | 192 } // namespace v8 |
193 | 193 |
194 #endif // V8_CONVERSIONS_H_ | 194 #endif // V8_CONVERSIONS_H_ |
OLD | NEW |