| 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 #ifndef V8_V8CONVERSIONS_H_ | 28 #ifndef V8_V8CONVERSIONS_H_ |
| 29 #define V8_V8CONVERSIONS_H_ | 29 #define V8_V8CONVERSIONS_H_ |
| 30 | 30 |
| 31 #include "conversions.h" | 31 #include "conversions.h" |
| 32 | 32 |
| 33 namespace v8 { | 33 namespace v8 { |
| 34 namespace internal { | 34 namespace internal { |
| 35 | 35 |
| 36 // Convert from Number object to C integer. | 36 // Convert from Number object to C integer. |
| 37 static inline int32_t NumberToInt32(Object* number) { | 37 inline int32_t NumberToInt32(Object* number) { |
| 38 if (number->IsSmi()) return Smi::cast(number)->value(); | 38 if (number->IsSmi()) return Smi::cast(number)->value(); |
| 39 return DoubleToInt32(number->Number()); | 39 return DoubleToInt32(number->Number()); |
| 40 } | 40 } |
| 41 | 41 |
| 42 | 42 |
| 43 static inline uint32_t NumberToUint32(Object* number) { | 43 inline uint32_t NumberToUint32(Object* number) { |
| 44 if (number->IsSmi()) return Smi::cast(number)->value(); | 44 if (number->IsSmi()) return Smi::cast(number)->value(); |
| 45 return DoubleToUint32(number->Number()); | 45 return DoubleToUint32(number->Number()); |
| 46 } | 46 } |
| 47 | 47 |
| 48 | 48 |
| 49 // Converts a string into a double value according to ECMA-262 9.3.1 | 49 // Converts a string into a double value according to ECMA-262 9.3.1 |
| 50 double StringToDouble(UnicodeCache* unicode_cache, | 50 double StringToDouble(UnicodeCache* unicode_cache, |
| 51 String* str, | 51 String* str, |
| 52 int flags, | 52 int flags, |
| 53 double empty_string_val = 0); | 53 double empty_string_val = 0); |
| 54 | 54 |
| 55 // Converts a string into an integer. | 55 // Converts a string into an integer. |
| 56 double StringToInt(UnicodeCache* unicode_cache, String* str, int radix); | 56 double StringToInt(UnicodeCache* unicode_cache, String* str, int radix); |
| 57 | 57 |
| 58 } } // namespace v8::internal | 58 } } // namespace v8::internal |
| 59 | 59 |
| 60 #endif // V8_V8CONVERSIONS_H_ | 60 #endif // V8_V8CONVERSIONS_H_ |
| OLD | NEW |