| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // integer. It has to be in the range [-2^31, 2^31 - 1]. | 161 // integer. It has to be in the range [-2^31, 2^31 - 1]. |
| 162 // We also have to check for negative 0 as it is not an Integer32. | 162 // We also have to check for negative 0 as it is not an Integer32. |
| 163 inline bool IsInt32Double(double value); | 163 inline bool IsInt32Double(double value); |
| 164 | 164 |
| 165 // UInteger32 is an integer that can be represented as an unsigned 32-bit | 165 // UInteger32 is an integer that can be represented as an unsigned 32-bit |
| 166 // integer. It has to be in the range [0, 2^32 - 1]. | 166 // integer. It has to be in the range [0, 2^32 - 1]. |
| 167 // We also have to check for negative 0 as it is not a UInteger32. | 167 // We also have to check for negative 0 as it is not a UInteger32. |
| 168 inline bool IsUint32Double(double value); | 168 inline bool IsUint32Double(double value); |
| 169 | 169 |
| 170 // Convert from Number object to C integer. | 170 // Convert from Number object to C integer. |
| 171 inline uint32_t PositiveNumberToUint32(Object* number); |
| 171 inline int32_t NumberToInt32(Object* number); | 172 inline int32_t NumberToInt32(Object* number); |
| 172 inline uint32_t NumberToUint32(Object* number); | 173 inline uint32_t NumberToUint32(Object* number); |
| 173 inline int64_t NumberToInt64(Object* number); | 174 inline int64_t NumberToInt64(Object* number); |
| 174 | 175 |
| 175 double StringToDouble(UnicodeCache* unicode_cache, Handle<String> string, | 176 double StringToDouble(UnicodeCache* unicode_cache, Handle<String> string, |
| 176 int flags, double empty_string_val = 0.0); | 177 int flags, double empty_string_val = 0.0); |
| 177 | 178 |
| 178 inline bool TryNumberToSize(Object* number, size_t* result); | 179 inline bool TryNumberToSize(Object* number, size_t* result); |
| 179 | 180 |
| 180 // Converts a number into size_t. | 181 // Converts a number into size_t. |
| 181 inline size_t NumberToSize(Object* number); | 182 inline size_t NumberToSize(Object* number); |
| 182 | 183 |
| 183 // returns DoubleToString(StringToDouble(string)) == string | 184 // returns DoubleToString(StringToDouble(string)) == string |
| 184 bool IsSpecialIndex(UnicodeCache* unicode_cache, String* string); | 185 bool IsSpecialIndex(UnicodeCache* unicode_cache, String* string); |
| 185 | 186 |
| 186 } // namespace internal | 187 } // namespace internal |
| 187 } // namespace v8 | 188 } // namespace v8 |
| 188 | 189 |
| 189 #endif // V8_CONVERSIONS_H_ | 190 #endif // V8_CONVERSIONS_H_ |
| OLD | NEW |