| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #include "vm/handles.h" | 5 #include "vm/handles.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
| 9 #include "vm/dart_api_state.h" | 9 #include "vm/dart_api_state.h" |
| 10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
| 11 #include "vm/os.h" | 11 #include "vm/os.h" |
| 12 #include "vm/raw_object.h" | 12 #include "vm/raw_object.h" |
| 13 #include "vm/visitor.h" | 13 #include "vm/visitor.h" |
| 14 #include "vm/zone.h" | 14 #include "vm/zone.h" |
| 15 | 15 |
| 16 #include "vm/handles_impl.h" | 16 #include "vm/handles_impl.h" |
| 17 | 17 |
| 18 namespace dart { | 18 namespace dart { |
| 19 | 19 |
| 20 DEFINE_FLAG(bool, verify_handles, false, "Verify handles."); | 20 DEFINE_FLAG(bool, verify_handles, false, "Verify handles."); |
| 21 DEFINE_DEBUG_FLAG(bool, trace_handles, | |
| 22 false, "Traces allocation of handles."); | |
| 23 | 21 |
| 24 | 22 |
| 25 VMHandles::~VMHandles() { | 23 VMHandles::~VMHandles() { |
| 26 #ifdef DEBUG | |
| 27 if (FLAG_trace_handles) { | 24 if (FLAG_trace_handles) { |
| 28 OS::PrintErr("*** Handle Counts for 0x(%" Px | 25 OS::PrintErr("*** Handle Counts for 0x(%" Px |
| 29 "):Zone = %d,Scoped = %d\n", | 26 "):Zone = %d,Scoped = %d\n", |
| 30 reinterpret_cast<intptr_t>(this), | 27 reinterpret_cast<intptr_t>(this), |
| 31 CountZoneHandles(), CountScopedHandles()); | 28 CountZoneHandles(), CountScopedHandles()); |
| 32 OS::PrintErr("*** Deleting VM handle block 0x%" Px "\n", | 29 OS::PrintErr("*** Deleting VM handle block 0x%" Px "\n", |
| 33 reinterpret_cast<intptr_t>(this)); | 30 reinterpret_cast<intptr_t>(this)); |
| 34 } | 31 } |
| 35 #endif | |
| 36 } | 32 } |
| 37 | 33 |
| 38 | 34 |
| 39 void VMHandles::VisitObjectPointers(ObjectPointerVisitor* visitor) { | 35 void VMHandles::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
| 40 return Handles<kVMHandleSizeInWords, | 36 return Handles<kVMHandleSizeInWords, |
| 41 kVMHandlesPerChunk, | 37 kVMHandlesPerChunk, |
| 42 kOffsetOfRawPtr>::VisitObjectPointers(visitor); | 38 kOffsetOfRawPtr>::VisitObjectPointers(visitor); |
| 43 } | 39 } |
| 44 | 40 |
| 45 | 41 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 thread->IncrementNoHandleScopeDepth(); | 124 thread->IncrementNoHandleScopeDepth(); |
| 129 } | 125 } |
| 130 | 126 |
| 131 | 127 |
| 132 NoHandleScope::~NoHandleScope() { | 128 NoHandleScope::~NoHandleScope() { |
| 133 thread()->DecrementNoHandleScopeDepth(); | 129 thread()->DecrementNoHandleScopeDepth(); |
| 134 } | 130 } |
| 135 #endif // defined(DEBUG) | 131 #endif // defined(DEBUG) |
| 136 | 132 |
| 137 } // namespace dart | 133 } // namespace dart |
| OLD | NEW |