| OLD | NEW |
| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // Enumeration for allowing octals and ignoring junk when converting | 80 // Enumeration for allowing octals and ignoring junk when converting |
| 81 // strings to numbers. | 81 // strings to numbers. |
| 82 enum ConversionFlags { | 82 enum ConversionFlags { |
| 83 NO_FLAGS = 0, | 83 NO_FLAGS = 0, |
| 84 ALLOW_HEX = 1, | 84 ALLOW_HEX = 1, |
| 85 ALLOW_OCTALS = 2, | 85 ALLOW_OCTALS = 2, |
| 86 ALLOW_TRAILING_JUNK = 4 | 86 ALLOW_TRAILING_JUNK = 4 |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 | 89 |
| 90 // Perform clamping values as defined by PixelArray semantics. |
| 91 static inline uint8_t ClampToUInt8(double number); |
| 92 |
| 90 // Convert from Number object to C integer. | 93 // Convert from Number object to C integer. |
| 91 static inline int32_t NumberToInt32(Object* number); | 94 static inline int32_t NumberToInt32(Object* number); |
| 92 static inline uint32_t NumberToUint32(Object* number); | 95 static inline uint32_t NumberToUint32(Object* number); |
| 96 static inline uint8_t NumberToClampedUInt8(Object* number); |
| 93 | 97 |
| 94 | 98 |
| 95 // Converts a string into a double value according to ECMA-262 9.3.1 | 99 // Converts a string into a double value according to ECMA-262 9.3.1 |
| 96 double StringToDouble(UnicodeCache* unicode_cache, | 100 double StringToDouble(UnicodeCache* unicode_cache, |
| 97 String* str, | 101 String* str, |
| 98 int flags, | 102 int flags, |
| 99 double empty_string_val = 0); | 103 double empty_string_val = 0); |
| 100 double StringToDouble(UnicodeCache* unicode_cache, | 104 double StringToDouble(UnicodeCache* unicode_cache, |
| 101 Vector<const char> str, | 105 Vector<const char> str, |
| 102 int flags, | 106 int flags, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 122 // Additional number to string conversions for the number type. | 126 // Additional number to string conversions for the number type. |
| 123 // The caller is responsible for calling free on the returned pointer. | 127 // The caller is responsible for calling free on the returned pointer. |
| 124 char* DoubleToFixedCString(double value, int f); | 128 char* DoubleToFixedCString(double value, int f); |
| 125 char* DoubleToExponentialCString(double value, int f); | 129 char* DoubleToExponentialCString(double value, int f); |
| 126 char* DoubleToPrecisionCString(double value, int f); | 130 char* DoubleToPrecisionCString(double value, int f); |
| 127 char* DoubleToRadixCString(double value, int radix); | 131 char* DoubleToRadixCString(double value, int radix); |
| 128 | 132 |
| 129 } } // namespace v8::internal | 133 } } // namespace v8::internal |
| 130 | 134 |
| 131 #endif // V8_CONVERSIONS_H_ | 135 #endif // V8_CONVERSIONS_H_ |
| OLD | NEW |