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 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 const char* str, int size, bool verbose = true); | 1035 const char* str, int size, bool verbose = true); |
1036 | 1036 |
1037 | 1037 |
1038 // ---------------------------------------------------------------------------- | 1038 // ---------------------------------------------------------------------------- |
1039 // Memory | 1039 // Memory |
1040 | 1040 |
1041 // Copies words from |src| to |dst|. The data spans must not overlap. | 1041 // Copies words from |src| to |dst|. The data spans must not overlap. |
1042 template <typename T> | 1042 template <typename T> |
1043 inline void CopyWords(T* dst, const T* src, size_t num_words) { | 1043 inline void CopyWords(T* dst, const T* src, size_t num_words) { |
1044 STATIC_ASSERT(sizeof(T) == kPointerSize); | 1044 STATIC_ASSERT(sizeof(T) == kPointerSize); |
1045 // TODO(mvstanton): disabled because mac builds are bogus failing on this | 1045 DCHECK(Min(dst, const_cast<T*>(src)) + num_words <= |
1046 // assert. They are doing a signed comparison. Investigate in | 1046 Max(dst, const_cast<T*>(src))); |
1047 // the morning. | |
1048 // DCHECK(Min(dst, const_cast<T*>(src)) + num_words <= | |
1049 // Max(dst, const_cast<T*>(src))); | |
1050 DCHECK(num_words > 0); | 1047 DCHECK(num_words > 0); |
1051 | 1048 |
1052 // Use block copying MemCopy if the segment we're copying is | 1049 // Use block copying MemCopy if the segment we're copying is |
1053 // enough to justify the extra call/setup overhead. | 1050 // enough to justify the extra call/setup overhead. |
1054 static const size_t kBlockCopyLimit = 16; | 1051 static const size_t kBlockCopyLimit = 16; |
1055 | 1052 |
1056 if (num_words < kBlockCopyLimit) { | 1053 if (num_words < kBlockCopyLimit) { |
1057 do { | 1054 do { |
1058 num_words--; | 1055 num_words--; |
1059 *dst++ = *src++; | 1056 *dst++ = *src++; |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1715 private: | 1712 private: |
1716 T value_; | 1713 T value_; |
1717 ThreadedListZoneEntry<T>* next_; | 1714 ThreadedListZoneEntry<T>* next_; |
1718 DISALLOW_COPY_AND_ASSIGN(ThreadedListZoneEntry); | 1715 DISALLOW_COPY_AND_ASSIGN(ThreadedListZoneEntry); |
1719 }; | 1716 }; |
1720 | 1717 |
1721 } // namespace internal | 1718 } // namespace internal |
1722 } // namespace v8 | 1719 } // namespace v8 |
1723 | 1720 |
1724 #endif // V8_UTILS_H_ | 1721 #endif // V8_UTILS_H_ |
OLD | NEW |