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 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 #endif // DEBUG | 1092 #endif // DEBUG |
1093 #if V8_HOST_ARCH_IA32 | 1093 #if V8_HOST_ARCH_IA32 |
1094 #define STOS "stosl" | 1094 #define STOS "stosl" |
1095 #elif V8_HOST_ARCH_X64 | 1095 #elif V8_HOST_ARCH_X64 |
1096 #if V8_HOST_ARCH_32_BIT | 1096 #if V8_HOST_ARCH_32_BIT |
1097 #define STOS "addr32 stosl" | 1097 #define STOS "addr32 stosl" |
1098 #else | 1098 #else |
1099 #define STOS "stosq" | 1099 #define STOS "stosq" |
1100 #endif | 1100 #endif |
1101 #endif | 1101 #endif |
1102 #if defined(__native_client__) | |
1103 // This STOS sequence does not validate for x86_64 Native Client. | |
1104 // Here we #undef STOS to force use of the slower C version. | |
1105 // TODO(bradchen): Profile V8 and implement a faster REP STOS | |
1106 // here if the profile indicates it matters. | |
1107 #undef STOS | |
1108 #endif | |
1109 | 1102 |
1110 #if defined(MEMORY_SANITIZER) | 1103 #if defined(MEMORY_SANITIZER) |
1111 // MemorySanitizer does not understand inline assembly. | 1104 // MemorySanitizer does not understand inline assembly. |
1112 #undef STOS | 1105 #undef STOS |
1113 #endif | 1106 #endif |
1114 | 1107 |
1115 #if defined(__GNUC__) && defined(STOS) | 1108 #if defined(__GNUC__) && defined(STOS) |
1116 asm volatile( | 1109 asm volatile( |
1117 "cld;" | 1110 "cld;" |
1118 "rep ; " STOS | 1111 "rep ; " STOS |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1576 byte* dst = reinterpret_cast<byte*>(p); | 1569 byte* dst = reinterpret_cast<byte*>(p); |
1577 for (size_t i = 0; i < sizeof(V); i++) { | 1570 for (size_t i = 0; i < sizeof(V); i++) { |
1578 dst[i] = src[sizeof(V) - i - 1]; | 1571 dst[i] = src[sizeof(V) - i - 1]; |
1579 } | 1572 } |
1580 #endif // V8_TARGET_LITTLE_ENDIAN | 1573 #endif // V8_TARGET_LITTLE_ENDIAN |
1581 } | 1574 } |
1582 } // namespace internal | 1575 } // namespace internal |
1583 } // namespace v8 | 1576 } // namespace v8 |
1584 | 1577 |
1585 #endif // V8_UTILS_H_ | 1578 #endif // V8_UTILS_H_ |
OLD | NEW |