OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_UTILS_H_ | 5 #ifndef V8_UTILS_H_ |
6 #define V8_UTILS_H_ | 6 #define V8_UTILS_H_ |
7 | 7 |
8 #include <limits.h> | 8 #include <limits.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 } | 1143 } |
1144 #endif | 1144 #endif |
1145 | 1145 |
1146 #undef STOS | 1146 #undef STOS |
1147 } | 1147 } |
1148 | 1148 |
1149 | 1149 |
1150 // Simple support to read a file into a 0-terminated C-string. | 1150 // Simple support to read a file into a 0-terminated C-string. |
1151 // The returned buffer must be freed by the caller. | 1151 // The returned buffer must be freed by the caller. |
1152 // On return, *exits tells whether the file existed. | 1152 // On return, *exits tells whether the file existed. |
1153 Vector<const char> ReadFile(const char* filename, | 1153 V8_EXPORT_PRIVATE Vector<const char> ReadFile(const char* filename, |
1154 bool* exists, | 1154 bool* exists, |
1155 bool verbose = true); | 1155 bool verbose = true); |
1156 Vector<const char> ReadFile(FILE* file, | 1156 Vector<const char> ReadFile(FILE* file, |
1157 bool* exists, | 1157 bool* exists, |
1158 bool verbose = true); | 1158 bool verbose = true); |
1159 | 1159 |
1160 | 1160 |
1161 template <typename sourcechar, typename sinkchar> | 1161 template <typename sourcechar, typename sinkchar> |
1162 INLINE(static void CopyCharsUnsigned(sinkchar* dest, const sourcechar* src, | 1162 INLINE(static void CopyCharsUnsigned(sinkchar* dest, const sourcechar* src, |
1163 size_t chars)); | 1163 size_t chars)); |
1164 #if defined(V8_HOST_ARCH_ARM) | 1164 #if defined(V8_HOST_ARCH_ARM) |
1165 INLINE(void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, size_t chars)); | 1165 INLINE(void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, size_t chars)); |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1594 byte* dst = reinterpret_cast<byte*>(p); | 1594 byte* dst = reinterpret_cast<byte*>(p); |
1595 for (size_t i = 0; i < sizeof(V); i++) { | 1595 for (size_t i = 0; i < sizeof(V); i++) { |
1596 dst[i] = src[sizeof(V) - i - 1]; | 1596 dst[i] = src[sizeof(V) - i - 1]; |
1597 } | 1597 } |
1598 #endif // V8_TARGET_LITTLE_ENDIAN | 1598 #endif // V8_TARGET_LITTLE_ENDIAN |
1599 } | 1599 } |
1600 } // namespace internal | 1600 } // namespace internal |
1601 } // namespace v8 | 1601 } // namespace v8 |
1602 | 1602 |
1603 #endif // V8_UTILS_H_ | 1603 #endif // V8_UTILS_H_ |
OLD | NEW |