| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 RUNTIME_VM_REUSABLE_HANDLES_H_ | 5 #ifndef RUNTIME_VM_REUSABLE_HANDLES_H_ |
| 6 #define RUNTIME_VM_REUSABLE_HANDLES_H_ | 6 #define RUNTIME_VM_REUSABLE_HANDLES_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/handles.h" | 9 #include "vm/handles.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // { | 23 // { |
| 24 // REUSABLE_ARRAY_HANDLESCOPE(thread); | 24 // REUSABLE_ARRAY_HANDLESCOPE(thread); |
| 25 // .... | 25 // .... |
| 26 // .... | 26 // .... |
| 27 // Array& funcs = reused_array_handle.Handle(); | 27 // Array& funcs = reused_array_handle.Handle(); |
| 28 // code that uses funcs | 28 // code that uses funcs |
| 29 // .... | 29 // .... |
| 30 // } | 30 // } |
| 31 // | 31 // |
| 32 | 32 |
| 33 | |
| 34 #if defined(DEBUG) | 33 #if defined(DEBUG) |
| 35 #define REUSABLE_SCOPE(name) \ | 34 #define REUSABLE_SCOPE(name) \ |
| 36 class Reusable##name##HandleScope : public ValueObject { \ | 35 class Reusable##name##HandleScope : public ValueObject { \ |
| 37 public: \ | 36 public: \ |
| 38 explicit Reusable##name##HandleScope(Thread* thread) : thread_(thread) { \ | 37 explicit Reusable##name##HandleScope(Thread* thread) : thread_(thread) { \ |
| 39 ASSERT(!thread->reusable_##name##_handle_scope_active()); \ | 38 ASSERT(!thread->reusable_##name##_handle_scope_active()); \ |
| 40 thread->set_reusable_##name##_handle_scope_active(true); \ | 39 thread->set_reusable_##name##_handle_scope_active(true); \ |
| 41 } \ | 40 } \ |
| 42 Reusable##name##HandleScope() : thread_(Thread::Current()) { \ | 41 Reusable##name##HandleScope() : thread_(Thread::Current()) { \ |
| 43 ASSERT(!thread_->reusable_##name##_handle_scope_active()); \ | 42 ASSERT(!thread_->reusable_##name##_handle_scope_active()); \ |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 #define REUSABLE_STRING_HANDLESCOPE(thread) \ | 110 #define REUSABLE_STRING_HANDLESCOPE(thread) \ |
| 112 ReusableStringHandleScope reused_string_handle(thread); | 111 ReusableStringHandleScope reused_string_handle(thread); |
| 113 #define REUSABLE_TYPE_ARGUMENTS_HANDLESCOPE(thread) \ | 112 #define REUSABLE_TYPE_ARGUMENTS_HANDLESCOPE(thread) \ |
| 114 ReusableTypeArgumentsHandleScope reused_type_arguments_handle(thread); | 113 ReusableTypeArgumentsHandleScope reused_type_arguments_handle(thread); |
| 115 #define REUSABLE_TYPE_PARAMETER_HANDLESCOPE(thread) \ | 114 #define REUSABLE_TYPE_PARAMETER_HANDLESCOPE(thread) \ |
| 116 ReusableTypeParameterHandleScope reused_type_parameter(thread); | 115 ReusableTypeParameterHandleScope reused_type_parameter(thread); |
| 117 | 116 |
| 118 } // namespace dart | 117 } // namespace dart |
| 119 | 118 |
| 120 #endif // RUNTIME_VM_REUSABLE_HANDLES_H_ | 119 #endif // RUNTIME_VM_REUSABLE_HANDLES_H_ |
| OLD | NEW |