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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 | 71 |
72 inline double FastUI2D(unsigned x) { | 72 inline double FastUI2D(unsigned x) { |
73 // There is no rounding involved in converting an unsigned integer to a | 73 // There is no rounding involved in converting an unsigned integer to a |
74 // double, so this code should compile to a few instructions without | 74 // double, so this code should compile to a few instructions without |
75 // any FPU pipeline stalls. | 75 // any FPU pipeline stalls. |
76 return static_cast<double>(x); | 76 return static_cast<double>(x); |
77 } | 77 } |
78 | 78 |
79 | 79 |
| 80 // This function should match the exact semantics of ECMA-262 20.2.2.17. |
| 81 inline float DoubleToFloat32(double x); |
| 82 |
| 83 |
80 // This function should match the exact semantics of ECMA-262 9.4. | 84 // This function should match the exact semantics of ECMA-262 9.4. |
81 inline double DoubleToInteger(double x); | 85 inline double DoubleToInteger(double x); |
82 | 86 |
83 | 87 |
84 // This function should match the exact semantics of ECMA-262 9.5. | 88 // This function should match the exact semantics of ECMA-262 9.5. |
85 inline int32_t DoubleToInt32(double x); | 89 inline int32_t DoubleToInt32(double x); |
86 | 90 |
87 | 91 |
88 // This function should match the exact semantics of ECMA-262 9.6. | 92 // This function should match the exact semantics of ECMA-262 9.6. |
89 inline uint32_t DoubleToUint32(double x) { | 93 inline uint32_t DoubleToUint32(double x) { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 Object* number) { | 234 Object* number) { |
231 size_t result = 0; | 235 size_t result = 0; |
232 bool is_valid = TryNumberToSize(isolate, number, &result); | 236 bool is_valid = TryNumberToSize(isolate, number, &result); |
233 CHECK(is_valid); | 237 CHECK(is_valid); |
234 return result; | 238 return result; |
235 } | 239 } |
236 | 240 |
237 } } // namespace v8::internal | 241 } } // namespace v8::internal |
238 | 242 |
239 #endif // V8_CONVERSIONS_H_ | 243 #endif // V8_CONVERSIONS_H_ |
OLD | NEW |