OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 template <typename T> | 113 template <typename T> |
114 inline Vector< Handle<Object> > HandleVector(v8::internal::Handle<T>* elms, | 114 inline Vector< Handle<Object> > HandleVector(v8::internal::Handle<T>* elms, |
115 int length) { | 115 int length) { |
116 return Vector< Handle<Object> >( | 116 return Vector< Handle<Object> >( |
117 reinterpret_cast<v8::internal::Handle<Object>*>(elms), length); | 117 reinterpret_cast<v8::internal::Handle<Object>*>(elms), length); |
118 } | 118 } |
119 | 119 |
120 // Memory | 120 // Memory |
121 | 121 |
122 // Copies data from |src| to |dst|. The data spans MUST not overlap. | 122 // Copies data from |src| to |dst|. The data spans MUST not overlap. |
123 inline void CopyWords(Object** dst, Object** src, int num_words) { | 123 template <typename T> |
| 124 inline void CopyWords(T* dst, T* src, int num_words) { |
| 125 STATIC_ASSERT(sizeof(T) == kPointerSize); |
124 ASSERT(Min(dst, src) + num_words <= Max(dst, src)); | 126 ASSERT(Min(dst, src) + num_words <= Max(dst, src)); |
125 ASSERT(num_words > 0); | 127 ASSERT(num_words > 0); |
126 | 128 |
127 // Use block copying memcpy if the segment we're copying is | 129 // Use block copying memcpy if the segment we're copying is |
128 // enough to justify the extra call/setup overhead. | 130 // enough to justify the extra call/setup overhead. |
129 static const int kBlockCopyLimit = 16; | 131 static const int kBlockCopyLimit = 16; |
130 | 132 |
131 if (num_words >= kBlockCopyLimit) { | 133 if (num_words >= kBlockCopyLimit) { |
132 memcpy(dst, src, num_words * kPointerSize); | 134 memcpy(dst, src, num_words * kPointerSize); |
133 } else { | 135 } else { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 | 310 |
309 const char* data_; | 311 const char* data_; |
310 size_t length_; | 312 size_t length_; |
311 bool remove_file_on_cleanup_; | 313 bool remove_file_on_cleanup_; |
312 }; | 314 }; |
313 | 315 |
314 | 316 |
315 } } // namespace v8::internal | 317 } } // namespace v8::internal |
316 | 318 |
317 #endif // V8_V8UTILS_H_ | 319 #endif // V8_V8UTILS_H_ |
OLD | NEW |