Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(688)

Side by Side Diff: src/utils.h

Issue 2291773002: The function CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, size_t chars) is now a specializa…
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 bool* exists, 1147 bool* exists,
1148 bool verbose = true); 1148 bool verbose = true);
1149 Vector<const char> ReadFile(FILE* file, 1149 Vector<const char> ReadFile(FILE* file,
1150 bool* exists, 1150 bool* exists,
1151 bool verbose = true); 1151 bool verbose = true);
1152 1152
1153 1153
1154 template <typename sourcechar, typename sinkchar> 1154 template <typename sourcechar, typename sinkchar>
1155 INLINE(static void CopyCharsUnsigned(sinkchar* dest, const sourcechar* src, 1155 INLINE(static void CopyCharsUnsigned(sinkchar* dest, const sourcechar* src,
1156 size_t chars)); 1156 size_t chars));
1157 #if defined(V8_HOST_ARCH_ARM) 1157 #if defined(V8_HOST_ARCH_X64)
1158 INLINE(void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, size_t chars));
1159 #elif defined(V8_HOST_ARCH_ARM)
1158 INLINE(void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, size_t chars)); 1160 INLINE(void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, size_t chars));
1159 INLINE(void CopyCharsUnsigned(uint16_t* dest, const uint8_t* src, 1161 INLINE(void CopyCharsUnsigned(uint16_t* dest, const uint8_t* src,
1160 size_t chars)); 1162 size_t chars));
1161 INLINE(void CopyCharsUnsigned(uint16_t* dest, const uint16_t* src, 1163 INLINE(void CopyCharsUnsigned(uint16_t* dest, const uint16_t* src,
1162 size_t chars)); 1164 size_t chars));
1163 #elif defined(V8_HOST_ARCH_MIPS) 1165 #elif defined(V8_HOST_ARCH_MIPS)
1164 INLINE(void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, size_t chars)); 1166 INLINE(void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, size_t chars));
1165 INLINE(void CopyCharsUnsigned(uint16_t* dest, const uint16_t* src, 1167 INLINE(void CopyCharsUnsigned(uint16_t* dest, const uint16_t* src,
1166 size_t chars)); 1168 size_t chars));
1167 #elif defined(V8_HOST_ARCH_PPC) || defined(V8_HOST_ARCH_S390) 1169 #elif defined(V8_HOST_ARCH_PPC) || defined(V8_HOST_ARCH_S390)
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 sinkchar* limit = dest + chars; 1208 sinkchar* limit = dest + chars;
1207 if ((sizeof(*dest) == sizeof(*src)) && 1209 if ((sizeof(*dest) == sizeof(*src)) &&
1208 (chars >= static_cast<int>(kMinComplexMemCopy / sizeof(*dest)))) { 1210 (chars >= static_cast<int>(kMinComplexMemCopy / sizeof(*dest)))) {
1209 MemCopy(dest, src, chars * sizeof(*dest)); 1211 MemCopy(dest, src, chars * sizeof(*dest));
1210 } else { 1212 } else {
1211 while (dest < limit) *dest++ = static_cast<sinkchar>(*src++); 1213 while (dest < limit) *dest++ = static_cast<sinkchar>(*src++);
1212 } 1214 }
1213 } 1215 }
1214 1216
1215 1217
1216 #if defined(V8_HOST_ARCH_ARM) 1218 #if defined(V8_HOST_ARCH_X64)
1219 void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, size_t chars) {
1220 uint8_t* limit = dest + chars;
1221 if (sizeof(*dest) == sizeof(*src)) {
Jakob Kummerow 2016/08/30 13:29:28 Well, this check is pretty pointless, because alwa
1222 MemCopy(dest, src, chars * sizeof(*dest));
1223 } else {
1224 while (dest < limit) *dest++ = *src++;
1225 }
1226 }
1227 #elif defined(V8_HOST_ARCH_ARM)
1217 void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, size_t chars) { 1228 void CopyCharsUnsigned(uint8_t* dest, const uint8_t* src, size_t chars) {
1218 switch (static_cast<unsigned>(chars)) { 1229 switch (static_cast<unsigned>(chars)) {
1219 case 0: 1230 case 0:
1220 break; 1231 break;
1221 case 1: 1232 case 1:
1222 *dest = *src; 1233 *dest = *src;
1223 break; 1234 break;
1224 case 2: 1235 case 2:
1225 memcpy(dest, src, 2); 1236 memcpy(dest, src, 2);
1226 break; 1237 break;
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 byte* dst = reinterpret_cast<byte*>(p); 1598 byte* dst = reinterpret_cast<byte*>(p);
1588 for (size_t i = 0; i < sizeof(V); i++) { 1599 for (size_t i = 0; i < sizeof(V); i++) {
1589 dst[i] = src[sizeof(V) - i - 1]; 1600 dst[i] = src[sizeof(V) - i - 1];
1590 } 1601 }
1591 #endif // V8_TARGET_LITTLE_ENDIAN 1602 #endif // V8_TARGET_LITTLE_ENDIAN
1592 } 1603 }
1593 } // namespace internal 1604 } // namespace internal
1594 } // namespace v8 1605 } // namespace v8
1595 1606
1596 #endif // V8_UTILS_H_ 1607 #endif // V8_UTILS_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698