| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 Vector<const char> data_; | 181 Vector<const char> data_; |
| 182 }; | 182 }; |
| 183 | 183 |
| 184 | 184 |
| 185 // Simple support to read a file into a 0-terminated C-string. | 185 // Simple support to read a file into a 0-terminated C-string. |
| 186 // The returned buffer must be freed by the caller. | 186 // The returned buffer must be freed by the caller. |
| 187 // On return, *exits tells whether the file existed. | 187 // On return, *exits tells whether the file existed. |
| 188 Vector<const char> ReadFile(const char* filename, | 188 Vector<const char> ReadFile(const char* filename, |
| 189 bool* exists, | 189 bool* exists, |
| 190 bool verbose = true); | 190 bool verbose = true); |
| 191 Vector<const char> ReadFile(FILE* file, |
| 192 bool* exists, |
| 193 bool verbose = true); |
| 191 | 194 |
| 192 | 195 |
| 193 | 196 |
| 194 // Copy from ASCII/16bit chars to ASCII/16bit chars. | 197 // Copy from ASCII/16bit chars to ASCII/16bit chars. |
| 195 template <typename sourcechar, typename sinkchar> | 198 template <typename sourcechar, typename sinkchar> |
| 196 static inline void CopyChars(sinkchar* dest, const sourcechar* src, int chars) { | 199 static inline void CopyChars(sinkchar* dest, const sourcechar* src, int chars) { |
| 197 sinkchar* limit = dest + chars; | 200 sinkchar* limit = dest + chars; |
| 198 #ifdef V8_HOST_CAN_READ_UNALIGNED | 201 #ifdef V8_HOST_CAN_READ_UNALIGNED |
| 199 if (sizeof(*dest) == sizeof(*src)) { | 202 if (sizeof(*dest) == sizeof(*src)) { |
| 200 if (chars >= static_cast<int>(OS::kMinComplexMemCopy / sizeof(*dest))) { | 203 if (chars >= static_cast<int>(OS::kMinComplexMemCopy / sizeof(*dest))) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 | 261 |
| 259 // Add formatted contents like printf based on a va_list. | 262 // Add formatted contents like printf based on a va_list. |
| 260 void AddFormattedList(const char* format, va_list list); | 263 void AddFormattedList(const char* format, va_list list); |
| 261 private: | 264 private: |
| 262 DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder); | 265 DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder); |
| 263 }; | 266 }; |
| 264 | 267 |
| 265 } } // namespace v8::internal | 268 } } // namespace v8::internal |
| 266 | 269 |
| 267 #endif // V8_V8UTILS_H_ | 270 #endif // V8_V8UTILS_H_ |
| OLD | NEW |