Chromium Code Reviews| 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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 338 typedef void (*MemMoveFunction)(void* dest, const void* src, size_t size); | 338 typedef void (*MemMoveFunction)(void* dest, const void* src, size_t size); |
| 339 | 339 |
| 340 // Keep the distinction of "move" vs. "copy" for the benefit of other | 340 // Keep the distinction of "move" vs. "copy" for the benefit of other |
| 341 // architectures. | 341 // architectures. |
| 342 V8_INLINE void MemCopy(void* dest, const void* src, size_t size) { | 342 V8_INLINE void MemCopy(void* dest, const void* src, size_t size) { |
| 343 MemMove(dest, src, size); | 343 MemMove(dest, src, size); |
| 344 } | 344 } |
| 345 #elif defined(V8_HOST_ARCH_ARM) | 345 #elif defined(V8_HOST_ARCH_ARM) |
| 346 typedef void (*MemCopyUint8Function)(uint8_t* dest, const uint8_t* src, | 346 typedef void (*MemCopyUint8Function)(uint8_t* dest, const uint8_t* src, |
| 347 size_t size); | 347 size_t size); |
| 348 MemCopyUint8Function memcopy_uint8_function; | 348 extern MemCopyUint8Function memcopy_uint8_function; |
|
Jakob Kummerow
2014/05/27 07:38:46
Before your refactoring, these guys were marked "s
| |
| 349 void MemCopyUint8Wrapper(uint8_t* dest, const uint8_t* src, size_t chars) { | 349 void MemCopyUint8Wrapper(uint8_t* dest, const uint8_t* src, size_t chars) { |
|
jochen (gone - plz use gerrit)
2014/05/27 07:48:25
no, I just forgot to add V8_INLINE here. I'm just
| |
| 350 memcpy(dest, src, chars); | 350 memcpy(dest, src, chars); |
| 351 } | 351 } |
| 352 // For values < 16, the assembler function is slower than the inlined C code. | 352 // For values < 16, the assembler function is slower than the inlined C code. |
| 353 const int kMinComplexMemCopy = 16; | 353 const int kMinComplexMemCopy = 16; |
| 354 V8_INLINE void MemCopy(void* dest, const void* src, size_t size) { | 354 V8_INLINE void MemCopy(void* dest, const void* src, size_t size) { |
| 355 (*memcopy_uint8_function)(reinterpret_cast<uint8_t*>(dest), | 355 (*memcopy_uint8_function)(reinterpret_cast<uint8_t*>(dest), |
| 356 reinterpret_cast<const uint8_t*>(src), size); | 356 reinterpret_cast<const uint8_t*>(src), size); |
| 357 } | 357 } |
| 358 V8_INLINE void MemMove(void* dest, const void* src, size_t size) { | 358 V8_INLINE void MemMove(void* dest, const void* src, size_t size) { |
| 359 memmove(dest, src, size); | 359 memmove(dest, src, size); |
| 360 } | 360 } |
| 361 | 361 |
| 362 typedef void (*MemCopyUint16Uint8Function)(uint16_t* dest, const uint8_t* src, | 362 typedef void (*MemCopyUint16Uint8Function)(uint16_t* dest, const uint8_t* src, |
| 363 size_t size); | 363 size_t size); |
| 364 MemCopyUint16Uint8Function memcopy_uint16_uint8_function; | 364 extern MemCopyUint16Uint8Function memcopy_uint16_uint8_function; |
| 365 void MemCopyUint16Uint8Wrapper(uint16_t* dest, const uint8_t* src, | 365 void MemCopyUint16Uint8Wrapper(uint16_t* dest, const uint8_t* src, |
| 366 size_t chars); | 366 size_t chars); |
| 367 // For values < 12, the assembler function is slower than the inlined C code. | 367 // For values < 12, the assembler function is slower than the inlined C code. |
| 368 const int kMinComplexConvertMemCopy = 12; | 368 const int kMinComplexConvertMemCopy = 12; |
| 369 V8_INLINE void MemCopyUint16Uint8(uint16_t* dest, const uint8_t* src, | 369 V8_INLINE void MemCopyUint16Uint8(uint16_t* dest, const uint8_t* src, |
| 370 size_t size) { | 370 size_t size) { |
| 371 (*memcopy_uint16_uint8_function)(dest, src, size); | 371 (*memcopy_uint16_uint8_function)(dest, src, size); |
| 372 } | 372 } |
| 373 #elif defined(V8_HOST_ARCH_MIPS) | 373 #elif defined(V8_HOST_ARCH_MIPS) |
| 374 typedef void (*MemCopyUint8Function)(uint8_t* dest, const uint8_t* src, | 374 typedef void (*MemCopyUint8Function)(uint8_t* dest, const uint8_t* src, |
| 375 size_t size); | 375 size_t size); |
| 376 MemCopyUint8Function memcopy_uint8_function; | 376 extern MemCopyUint8Function memcopy_uint8_function; |
| 377 V8_INLINE void MemCopyUint8Wrapper(uint8_t* dest, const uint8_t* src, | 377 V8_INLINE void MemCopyUint8Wrapper(uint8_t* dest, const uint8_t* src, |
| 378 size_t chars) { | 378 size_t chars) { |
| 379 memcpy(dest, src, chars); | 379 memcpy(dest, src, chars); |
| 380 } | 380 } |
| 381 // For values < 16, the assembler function is slower than the inlined C code. | 381 // For values < 16, the assembler function is slower than the inlined C code. |
| 382 const int kMinComplexMemCopy = 16; | 382 const int kMinComplexMemCopy = 16; |
| 383 V8_INLINE void MemCopy(void* dest, const void* src, size_t size) { | 383 V8_INLINE void MemCopy(void* dest, const void* src, size_t size) { |
| 384 (*memcopy_uint8_function)(reinterpret_cast<uint8_t*>(dest), | 384 (*memcopy_uint8_function)(reinterpret_cast<uint8_t*>(dest), |
| 385 reinterpret_cast<const uint8_t*>(src), size); | 385 reinterpret_cast<const uint8_t*>(src), size); |
| 386 } | 386 } |
| (...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1546 // Add formatted contents like printf based on a va_list. | 1546 // Add formatted contents like printf based on a va_list. |
| 1547 void AddFormattedList(const char* format, va_list list); | 1547 void AddFormattedList(const char* format, va_list list); |
| 1548 private: | 1548 private: |
| 1549 DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder); | 1549 DISALLOW_IMPLICIT_CONSTRUCTORS(StringBuilder); |
| 1550 }; | 1550 }; |
| 1551 | 1551 |
| 1552 | 1552 |
| 1553 } } // namespace v8::internal | 1553 } } // namespace v8::internal |
| 1554 | 1554 |
| 1555 #endif // V8_UTILS_H_ | 1555 #endif // V8_UTILS_H_ |
| OLD | NEW |