OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 OS::MemMoveFunction CreateMemMoveFunction(); | 333 OS::MemMoveFunction CreateMemMoveFunction(); |
334 | 334 |
335 // Copy memory area. No restrictions. | 335 // Copy memory area. No restrictions. |
336 void OS::MemMove(void* dest, const void* src, size_t size) { | 336 void OS::MemMove(void* dest, const void* src, size_t size) { |
337 if (size == 0) return; | 337 if (size == 0) return; |
338 // Note: here we rely on dependent reads being ordered. This is true | 338 // Note: here we rely on dependent reads being ordered. This is true |
339 // on all architectures we currently support. | 339 // on all architectures we currently support. |
340 (*memmove_function)(dest, src, size); | 340 (*memmove_function)(dest, src, size); |
341 } | 341 } |
342 | 342 |
343 #endif // V8_TARGET_ARCH_IA32 | 343 #elif defined(V8_HOST_ARCH_ARM) && defined(V8_HOST_CAN_READ_UNALIGNED) |
| 344 void OS::MemCopyUint16Uint8Wrapper(uint16_t* dest, |
| 345 const uint8_t* src, |
| 346 size_t chars) { |
| 347 uint16_t* limit = dest + chars; |
| 348 while (dest < limit) { |
| 349 *dest++ = static_cast<uint16_t>(*src++); |
| 350 } |
| 351 } |
| 352 |
| 353 |
| 354 OS::MemCopyUint8Function OS::memcopy_uint8_function = &OS::MemCopyUint8Wrapper; |
| 355 OS::MemCopyUint16Uint8Function OS::memcopy_uint16_uint8_function = |
| 356 &OS::MemCopyUint16Uint8Wrapper; |
| 357 // Defined in codegen-arm.cc. |
| 358 OS::MemCopyUint8Function CreateMemCopyUint8Function( |
| 359 OS::MemCopyUint8Function stub); |
| 360 OS::MemCopyUint16Uint8Function CreateMemCopyUint16Uint8Function( |
| 361 OS::MemCopyUint16Uint8Function stub); |
| 362 #endif |
344 | 363 |
345 | 364 |
346 void POSIXPostSetUp() { | 365 void POSIXPostSetUp() { |
347 #if defined(V8_TARGET_ARCH_IA32) | 366 #if defined(V8_TARGET_ARCH_IA32) |
348 OS::MemMoveFunction generated_memmove = CreateMemMoveFunction(); | 367 OS::MemMoveFunction generated_memmove = CreateMemMoveFunction(); |
349 if (generated_memmove != NULL) { | 368 if (generated_memmove != NULL) { |
350 memmove_function = generated_memmove; | 369 memmove_function = generated_memmove; |
351 } | 370 } |
| 371 #elif defined(V8_HOST_ARCH_ARM) && defined(V8_HOST_CAN_READ_UNALIGNED) |
| 372 OS::memcopy_uint8_function = |
| 373 CreateMemCopyUint8Function(&OS::MemCopyUint8Wrapper); |
| 374 OS::memcopy_uint16_uint8_function = |
| 375 CreateMemCopyUint16Uint8Function(&OS::MemCopyUint16Uint8Wrapper); |
352 #endif | 376 #endif |
353 init_fast_sin_function(); | 377 init_fast_sin_function(); |
354 init_fast_cos_function(); | 378 init_fast_cos_function(); |
355 init_fast_tan_function(); | 379 init_fast_tan_function(); |
356 init_fast_log_function(); | 380 init_fast_log_function(); |
357 // fast_exp is initialized lazily. | 381 // fast_exp is initialized lazily. |
358 init_fast_sqrt_function(); | 382 init_fast_sqrt_function(); |
359 } | 383 } |
360 | 384 |
361 // ---------------------------------------------------------------------------- | 385 // ---------------------------------------------------------------------------- |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 return ntohl(value); | 588 return ntohl(value); |
565 } | 589 } |
566 | 590 |
567 | 591 |
568 Socket* OS::CreateSocket() { | 592 Socket* OS::CreateSocket() { |
569 return new POSIXSocket(); | 593 return new POSIXSocket(); |
570 } | 594 } |
571 | 595 |
572 | 596 |
573 } } // namespace v8::internal | 597 } } // namespace v8::internal |
OLD | NEW |