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 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 #if defined(V8_HOST_ARCH_ARM) | 1137 #if defined(V8_HOST_ARCH_ARM) |
1138 INLINE(void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, size_t chars)); | 1138 INLINE(void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, size_t chars)); |
1139 INLINE(void CopyCharsUnsigned(uint16_t* dest, const uint8_t* src, | 1139 INLINE(void CopyCharsUnsigned(uint16_t* dest, const uint8_t* src, |
1140 size_t chars)); | 1140 size_t chars)); |
1141 INLINE(void CopyCharsUnsigned(uint16_t* dest, const uint16_t* src, | 1141 INLINE(void CopyCharsUnsigned(uint16_t* dest, const uint16_t* src, |
1142 size_t chars)); | 1142 size_t chars)); |
1143 #elif defined(V8_HOST_ARCH_MIPS) | 1143 #elif defined(V8_HOST_ARCH_MIPS) |
1144 INLINE(void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, size_t chars)); | 1144 INLINE(void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, size_t chars)); |
1145 INLINE(void CopyCharsUnsigned(uint16_t* dest, const uint16_t* src, | 1145 INLINE(void CopyCharsUnsigned(uint16_t* dest, const uint16_t* src, |
1146 size_t chars)); | 1146 size_t chars)); |
1147 #elif defined(V8_HOST_ARCH_PPC) | 1147 #elif defined(V8_HOST_ARCH_PPC) || defined(V8_HOST_ARCH_S390) |
1148 INLINE(void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, size_t chars)); | 1148 INLINE(void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, size_t chars)); |
1149 INLINE(void CopyCharsUnsigned(uint16_t* dest, const uint16_t* src, | 1149 INLINE(void CopyCharsUnsigned(uint16_t* dest, const uint16_t* src, |
1150 size_t chars)); | 1150 size_t chars)); |
1151 #endif | 1151 #endif |
1152 | 1152 |
1153 // Copy from 8bit/16bit chars to 8bit/16bit chars. | 1153 // Copy from 8bit/16bit chars to 8bit/16bit chars. |
1154 template <typename sourcechar, typename sinkchar> | 1154 template <typename sourcechar, typename sinkchar> |
1155 INLINE(void CopyChars(sinkchar* dest, const sourcechar* src, size_t chars)); | 1155 INLINE(void CopyChars(sinkchar* dest, const sourcechar* src, size_t chars)); |
1156 | 1156 |
1157 template <typename sourcechar, typename sinkchar> | 1157 template <typename sourcechar, typename sinkchar> |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1300 } | 1300 } |
1301 } | 1301 } |
1302 | 1302 |
1303 void CopyCharsUnsigned(uint16_t* dest, const uint16_t* src, size_t chars) { | 1303 void CopyCharsUnsigned(uint16_t* dest, const uint16_t* src, size_t chars) { |
1304 if (chars < kMinComplexMemCopy) { | 1304 if (chars < kMinComplexMemCopy) { |
1305 memcpy(dest, src, chars * sizeof(*dest)); | 1305 memcpy(dest, src, chars * sizeof(*dest)); |
1306 } else { | 1306 } else { |
1307 MemCopy(dest, src, chars * sizeof(*dest)); | 1307 MemCopy(dest, src, chars * sizeof(*dest)); |
1308 } | 1308 } |
1309 } | 1309 } |
1310 #elif defined(V8_HOST_ARCH_PPC) | 1310 #elif defined(V8_HOST_ARCH_PPC) || defined(V8_HOST_ARCH_S390) |
1311 #define CASE(n) \ | 1311 #define CASE(n) \ |
1312 case n: \ | 1312 case n: \ |
1313 memcpy(dest, src, n); \ | 1313 memcpy(dest, src, n); \ |
1314 break | 1314 break |
1315 void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, size_t chars) { | 1315 void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, size_t chars) { |
1316 switch (static_cast<unsigned>(chars)) { | 1316 switch (static_cast<unsigned>(chars)) { |
1317 case 0: | 1317 case 0: |
1318 break; | 1318 break; |
1319 case 1: | 1319 case 1: |
1320 *dest = *src; | 1320 *dest = *src; |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 } | 1535 } |
1536 | 1536 |
1537 static inline void WriteUnalignedUInt32(void* p, uint32_t value) { | 1537 static inline void WriteUnalignedUInt32(void* p, uint32_t value) { |
1538 WriteUnalignedValue(p, value); | 1538 WriteUnalignedValue(p, value); |
1539 } | 1539 } |
1540 | 1540 |
1541 } // namespace internal | 1541 } // namespace internal |
1542 } // namespace v8 | 1542 } // namespace v8 |
1543 | 1543 |
1544 #endif // V8_UTILS_H_ | 1544 #endif // V8_UTILS_H_ |
OLD | NEW |