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_INL_H_ | 5 #ifndef V8_CONVERSIONS_INL_H_ |
6 #define V8_CONVERSIONS_INL_H_ | 6 #define V8_CONVERSIONS_INL_H_ |
7 | 7 |
8 #include <float.h> // Required for DBL_MAX and on Win32 for finite() | 8 #include <float.h> // Required for DBL_MAX and on Win32 for finite() |
9 #include <limits.h> // Required for INT_MAX etc. | 9 #include <limits.h> // Required for INT_MAX etc. |
10 #include <stdarg.h> | 10 #include <stdarg.h> |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 | 154 |
155 size_t NumberToSize(Isolate* isolate, Object* number) { | 155 size_t NumberToSize(Isolate* isolate, Object* number) { |
156 size_t result = 0; | 156 size_t result = 0; |
157 bool is_valid = TryNumberToSize(isolate, number, &result); | 157 bool is_valid = TryNumberToSize(isolate, number, &result); |
158 CHECK(is_valid); | 158 CHECK(is_valid); |
159 return result; | 159 return result; |
160 } | 160 } |
161 | 161 |
162 | 162 |
| 163 uint32_t DoubleToUint32(double x) { |
| 164 return static_cast<uint32_t>(DoubleToInt32(x)); |
| 165 } |
| 166 |
| 167 |
163 template <class Iterator, class EndMark> | 168 template <class Iterator, class EndMark> |
164 bool SubStringEquals(Iterator* current, | 169 bool SubStringEquals(Iterator* current, |
165 EndMark end, | 170 EndMark end, |
166 const char* substring) { | 171 const char* substring) { |
167 DCHECK(**current == *substring); | 172 DCHECK(**current == *substring); |
168 for (substring++; *substring != '\0'; substring++) { | 173 for (substring++; *substring != '\0'; substring++) { |
169 ++*current; | 174 ++*current; |
170 if (*current == end || **current != *substring) return false; | 175 if (*current == end || **current != *substring) return false; |
171 } | 176 } |
172 ++*current; | 177 ++*current; |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 SLOW_DCHECK(buffer_pos < kBufferSize); | 753 SLOW_DCHECK(buffer_pos < kBufferSize); |
749 buffer[buffer_pos] = '\0'; | 754 buffer[buffer_pos] = '\0'; |
750 | 755 |
751 double converted = Strtod(Vector<const char>(buffer, buffer_pos), exponent); | 756 double converted = Strtod(Vector<const char>(buffer, buffer_pos), exponent); |
752 return (sign == NEGATIVE) ? -converted : converted; | 757 return (sign == NEGATIVE) ? -converted : converted; |
753 } | 758 } |
754 | 759 |
755 } } // namespace v8::internal | 760 } } // namespace v8::internal |
756 | 761 |
757 #endif // V8_CONVERSIONS_INL_H_ | 762 #endif // V8_CONVERSIONS_INL_H_ |
OLD | NEW |