OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // The returned buffer must be freed by the caller. | 192 // The returned buffer must be freed by the caller. |
193 // On return, *exits tells whether the file existed. | 193 // On return, *exits tells whether the file existed. |
194 Vector<const char> ReadFile(const char* filename, | 194 Vector<const char> ReadFile(const char* filename, |
195 bool* exists, | 195 bool* exists, |
196 bool verbose = true); | 196 bool verbose = true); |
197 Vector<const char> ReadFile(FILE* file, | 197 Vector<const char> ReadFile(FILE* file, |
198 bool* exists, | 198 bool* exists, |
199 bool verbose = true); | 199 bool verbose = true); |
200 | 200 |
201 | 201 |
202 | |
203 // Copy from ASCII/16bit chars to ASCII/16bit chars. | 202 // Copy from ASCII/16bit chars to ASCII/16bit chars. |
204 template <typename sourcechar, typename sinkchar> | 203 template <typename sourcechar, typename sinkchar> |
205 inline void CopyChars(sinkchar* dest, const sourcechar* src, int chars) { | 204 INLINE(void CopyChars(sinkchar* dest, const sourcechar* src, int chars)); |
| 205 |
| 206 |
| 207 template <typename sourcechar, typename sinkchar> |
| 208 void CopyChars(sinkchar* dest, const sourcechar* src, int chars) { |
206 sinkchar* limit = dest + chars; | 209 sinkchar* limit = dest + chars; |
207 #ifdef V8_HOST_CAN_READ_UNALIGNED | 210 #ifdef V8_HOST_CAN_READ_UNALIGNED |
208 if (sizeof(*dest) == sizeof(*src)) { | 211 if (sizeof(*dest) == sizeof(*src)) { |
209 if (chars >= static_cast<int>(OS::kMinComplexMemCopy / sizeof(*dest))) { | 212 if (chars >= static_cast<int>(OS::kMinComplexMemCopy / sizeof(*dest))) { |
210 OS::MemCopy(dest, src, chars * sizeof(*dest)); | 213 OS::MemCopy(dest, src, chars * sizeof(*dest)); |
211 return; | 214 return; |
212 } | 215 } |
213 // Number of characters in a uintptr_t. | 216 // Number of characters in a uintptr_t. |
214 static const int kStepSize = sizeof(uintptr_t) / sizeof(*dest); // NOLINT | 217 static const int kStepSize = sizeof(uintptr_t) / sizeof(*dest); // NOLINT |
215 while (dest <= limit - kStepSize) { | 218 while (dest <= limit - kStepSize) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 270 |
268 // Add formatted contents like printf based on a va_list. | 271 // Add formatted contents like printf based on a va_list. |
269 void AddFormattedList(const char* format, va_list list); | 272 void AddFormattedList(const char* format, va_list list); |
270 private: | 273 private: |
271 DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder); | 274 DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder); |
272 }; | 275 }; |
273 | 276 |
274 } } // namespace v8::internal | 277 } } // namespace v8::internal |
275 | 278 |
276 #endif // V8_V8UTILS_H_ | 279 #endif // V8_V8UTILS_H_ |
OLD | NEW |