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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 int remaining = num_words; | 136 int remaining = num_words; |
137 do { | 137 do { |
138 remaining--; | 138 remaining--; |
139 *dst++ = *src++; | 139 *dst++ = *src++; |
140 } while (remaining > 0); | 140 } while (remaining > 0); |
141 } | 141 } |
142 } | 142 } |
143 | 143 |
144 | 144 |
145 template <typename T, typename U> | 145 template <typename T, typename U> |
146 static inline void MemsetPointer(T** dest, U* value, int counter) { | 146 inline void MemsetPointer(T** dest, U* value, int counter) { |
147 #ifdef DEBUG | 147 #ifdef DEBUG |
148 T* a = NULL; | 148 T* a = NULL; |
149 U* b = NULL; | 149 U* b = NULL; |
150 a = b; // Fake assignment to check assignability. | 150 a = b; // Fake assignment to check assignability. |
151 USE(a); | 151 USE(a); |
152 #endif // DEBUG | 152 #endif // DEBUG |
153 #if defined(V8_HOST_ARCH_IA32) | 153 #if defined(V8_HOST_ARCH_IA32) |
154 #define STOS "stosl" | 154 #define STOS "stosl" |
155 #elif defined(V8_HOST_ARCH_X64) | 155 #elif defined(V8_HOST_ARCH_X64) |
156 #define STOS "stosq" | 156 #define STOS "stosq" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 bool* exists, | 195 bool* exists, |
196 bool verbose = true); | 196 bool verbose = true); |
197 Vector<const char> ReadFile(FILE* file, | 197 Vector<const char> ReadFile(FILE* file, |
198 bool* exists, | 198 bool* exists, |
199 bool verbose = true); | 199 bool verbose = true); |
200 | 200 |
201 | 201 |
202 | 202 |
203 // Copy from ASCII/16bit chars to ASCII/16bit chars. | 203 // Copy from ASCII/16bit chars to ASCII/16bit chars. |
204 template <typename sourcechar, typename sinkchar> | 204 template <typename sourcechar, typename sinkchar> |
205 static inline void CopyChars(sinkchar* dest, const sourcechar* src, int chars) { | 205 inline void CopyChars(sinkchar* dest, const sourcechar* src, int chars) { |
206 sinkchar* limit = dest + chars; | 206 sinkchar* limit = dest + chars; |
207 #ifdef V8_HOST_CAN_READ_UNALIGNED | 207 #ifdef V8_HOST_CAN_READ_UNALIGNED |
208 if (sizeof(*dest) == sizeof(*src)) { | 208 if (sizeof(*dest) == sizeof(*src)) { |
209 if (chars >= static_cast<int>(OS::kMinComplexMemCopy / sizeof(*dest))) { | 209 if (chars >= static_cast<int>(OS::kMinComplexMemCopy / sizeof(*dest))) { |
210 OS::MemCopy(dest, src, chars * sizeof(*dest)); | 210 OS::MemCopy(dest, src, chars * sizeof(*dest)); |
211 return; | 211 return; |
212 } | 212 } |
213 // Number of characters in a uintptr_t. | 213 // Number of characters in a uintptr_t. |
214 static const int kStepSize = sizeof(uintptr_t) / sizeof(*dest); // NOLINT | 214 static const int kStepSize = sizeof(uintptr_t) / sizeof(*dest); // NOLINT |
215 while (dest <= limit - kStepSize) { | 215 while (dest <= limit - kStepSize) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 267 |
268 // Add formatted contents like printf based on a va_list. | 268 // Add formatted contents like printf based on a va_list. |
269 void AddFormattedList(const char* format, va_list list); | 269 void AddFormattedList(const char* format, va_list list); |
270 private: | 270 private: |
271 DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder); | 271 DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder); |
272 }; | 272 }; |
273 | 273 |
274 } } // namespace v8::internal | 274 } } // namespace v8::internal |
275 | 275 |
276 #endif // V8_V8UTILS_H_ | 276 #endif // V8_V8UTILS_H_ |
OLD | NEW |