OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_HANDLES_IMPL_H_ | 5 #ifndef VM_HANDLES_IMPL_H_ |
6 #define VM_HANDLES_IMPL_H_ | 6 #define VM_HANDLES_IMPL_H_ |
7 | 7 |
8 namespace dart { | 8 namespace dart { |
9 | 9 |
10 DECLARE_DEBUG_FLAG(bool, trace_handles_count); | 10 DECLARE_DEBUG_FLAG(bool, trace_handles_count); |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 } | 296 } |
297 } | 297 } |
298 | 298 |
299 | 299 |
300 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr> | 300 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr> |
301 void Handles<kHandleSizeInWords, | 301 void Handles<kHandleSizeInWords, |
302 kHandlesPerChunk, | 302 kHandlesPerChunk, |
303 kOffsetOfRawPtr>::HandlesBlock::Visit(HandleVisitor* visitor) { | 303 kOffsetOfRawPtr>::HandlesBlock::Visit(HandleVisitor* visitor) { |
304 ASSERT(visitor != NULL); | 304 ASSERT(visitor != NULL); |
305 for (intptr_t i = 0; i < next_handle_slot_; i += kHandleSizeInWords) { | 305 for (intptr_t i = 0; i < next_handle_slot_; i += kHandleSizeInWords) { |
306 visitor->Visit(&data_[i + kOffsetOfRawPtr/kWordSize]); | 306 visitor->VisitHandle(reinterpret_cast<uword>(&data_[i])); |
307 } | 307 } |
308 } | 308 } |
309 | 309 |
310 | 310 |
311 #if defined(DEBUG) | 311 #if defined(DEBUG) |
312 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr> | 312 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr> |
313 void Handles<kHandleSizeInWords, | 313 void Handles<kHandleSizeInWords, |
314 kHandlesPerChunk, | 314 kHandlesPerChunk, |
315 kOffsetOfRawPtr>::HandlesBlock::ZapFreeHandles() { | 315 kOffsetOfRawPtr>::HandlesBlock::ZapFreeHandles() { |
316 // Reinitialize the handle area to some uninitialized value. | 316 // Reinitialize the handle area to some uninitialized value. |
317 for (intptr_t i = next_handle_slot_; | 317 for (intptr_t i = next_handle_slot_; |
318 i < (kHandleSizeInWords * kHandlesPerChunk); | 318 i < (kHandleSizeInWords * kHandlesPerChunk); |
319 i++) { | 319 i++) { |
320 data_[i] = kZapUninitializedWord; | 320 data_[i] = kZapUninitializedWord; |
321 } | 321 } |
322 } | 322 } |
323 #endif | 323 #endif |
324 | 324 |
325 | 325 |
326 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr> | 326 template <int kHandleSizeInWords, int kHandlesPerChunk, int kOffsetOfRawPtr> |
327 int Handles<kHandleSizeInWords, | 327 int Handles<kHandleSizeInWords, |
328 kHandlesPerChunk, | 328 kHandlesPerChunk, |
329 kOffsetOfRawPtr>::HandlesBlock::HandleCount() const { | 329 kOffsetOfRawPtr>::HandlesBlock::HandleCount() const { |
330 return (next_handle_slot_ / kHandleSizeInWords); | 330 return (next_handle_slot_ / kHandleSizeInWords); |
331 } | 331 } |
332 | 332 |
333 } // namespace dart | 333 } // namespace dart |
334 | 334 |
335 #endif // VM_HANDLES_IMPL_H_ | 335 #endif // VM_HANDLES_IMPL_H_ |
OLD | NEW |