| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 | 574 |
| 575 template <typename T> | 575 template <typename T> |
| 576 static inline void MemsetPointer(T** dest, T* value, int counter) { | 576 static inline void MemsetPointer(T** dest, T* value, int counter) { |
| 577 #if defined(V8_HOST_ARCH_IA32) | 577 #if defined(V8_HOST_ARCH_IA32) |
| 578 #define STOS "stosl" | 578 #define STOS "stosl" |
| 579 #elif defined(V8_HOST_ARCH_X64) | 579 #elif defined(V8_HOST_ARCH_X64) |
| 580 #define STOS "stosq" | 580 #define STOS "stosq" |
| 581 #endif | 581 #endif |
| 582 | 582 |
| 583 #if defined(__GNUC__) && defined(STOS) | 583 #if defined(__GNUC__) && defined(STOS) |
| 584 asm("cld;" | 584 asm volatile( |
| 585 "cld;" |
| 585 "rep ; " STOS | 586 "rep ; " STOS |
| 586 : /* no output */ | 587 : "+&c" (counter), "+&D" (dest) |
| 587 : "c" (counter), "a" (value), "D" (dest) | 588 : "a" (value) |
| 588 : /* no clobbered list as all inputs are considered clobbered */); | 589 : "memory", "cc"); |
| 589 #else | 590 #else |
| 590 for (int i = 0; i < counter; i++) { | 591 for (int i = 0; i < counter; i++) { |
| 591 dest[i] = value; | 592 dest[i] = value; |
| 592 } | 593 } |
| 593 #endif | 594 #endif |
| 594 | 595 |
| 595 #undef STOS | 596 #undef STOS |
| 596 } | 597 } |
| 597 | 598 |
| 598 | 599 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 | 633 |
| 633 Dest dest; | 634 Dest dest; |
| 634 memcpy(&dest, &source, sizeof(dest)); | 635 memcpy(&dest, &source, sizeof(dest)); |
| 635 return dest; | 636 return dest; |
| 636 } | 637 } |
| 637 | 638 |
| 638 | 639 |
| 639 } } // namespace v8::internal | 640 } } // namespace v8::internal |
| 640 | 641 |
| 641 #endif // V8_UTILS_H_ | 642 #endif // V8_UTILS_H_ |
| OLD | NEW |