Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Side by Side Diff: runtime/vm/reusable_handles.h

Issue 264933006: Fix edge case where profiler would miss the caller of the top frame (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/profiler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 VM_REUSABLE_HANDLES_H_ 5 #ifndef VM_REUSABLE_HANDLES_H_
6 #define VM_REUSABLE_HANDLES_H_ 6 #define 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"
11 11
12 namespace dart { 12 namespace dart {
13 13
14 // The class ReusableHandleScope is used in regions of the 14 // Classes registered in REUSABLE_HANDLE_LIST have an isolate specific reusable
15 // virtual machine where isolate specific reusable handles are used. 15 // handle. A guard class (Reusable*ClassName*HandleScope) should be used in
16 // This class asserts that we do not add code that will result in recursive 16 // regions of the virtual machine where the isolate specific reusable handle
17 // uses of reusable handles. 17 // of that type is used. The class asserts that we do not add code that will
18 // It is used as follows: 18 // result in recursive uses of the class's reusable handle.
19 //
20 // Below is an example of a reusable array handle via the
21 // REUSABLE_*CLASSNAME*_HANDLESCOPE macro:
22 //
19 // { 23 // {
20 // ReusableHandleScope reused_handles(isolate); 24 // REUSABLE_ARRAY_HANDLESCOPE(isolate);
21 // .... 25 // ....
22 // ..... 26 // ....
23 // code that uses isolate specific reusable handles. 27 // Array& funcs = reused_array_handle.Handle();
24 // Array& funcs = reused_handles.ArrayHandle(); 28 // code that uses funcs
25 // .... 29 // ....
26 // } 30 // }
31 //
27 32
28 #if defined(DEBUG) 33 #if defined(DEBUG)
29 #define REUSABLE_SCOPE(name) \ 34 #define REUSABLE_SCOPE(name) \
30 class Reusable##name##HandleScope : public ValueObject { \ 35 class Reusable##name##HandleScope : public ValueObject { \
31 public: \ 36 public: \
32 explicit Reusable##name##HandleScope(Isolate* isolate) \ 37 explicit Reusable##name##HandleScope(Isolate* isolate) \
33 : isolate_(isolate) { \ 38 : isolate_(isolate) { \
34 ASSERT(!isolate->reusable_##name##_handle_scope_active()); \ 39 ASSERT(!isolate->reusable_##name##_handle_scope_active()); \
35 isolate->set_reusable_##name##_handle_scope_active(true); \ 40 isolate->set_reusable_##name##_handle_scope_active(true); \
36 } \ 41 } \
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 return *handle_; \ 74 return *handle_; \
70 } \ 75 } \
71 private: \ 76 private: \
72 name* handle_; \ 77 name* handle_; \
73 DISALLOW_COPY_AND_ASSIGN(Reusable##name##HandleScope); \ 78 DISALLOW_COPY_AND_ASSIGN(Reusable##name##HandleScope); \
74 }; 79 };
75 #endif // defined(DEBUG) 80 #endif // defined(DEBUG)
76 REUSABLE_HANDLE_LIST(REUSABLE_SCOPE) 81 REUSABLE_HANDLE_LIST(REUSABLE_SCOPE)
77 #undef REUSABLE_SCOPE 82 #undef REUSABLE_SCOPE
78 83
84 #define REUSABLE_ABSTRACT_TYPE_HANDLESCOPE(isolate) \
85 ReusableAbstractTypeHandleScope reused_abstract_type(isolate);
86 #define REUSABLE_ARRAY_HANDLESCOPE(isolate) \
87 ReusableArrayHandleScope reused_array_handle(isolate);
88 #define REUSABLE_CLASS_HANDLESCOPE(isolate) \
89 ReusableClassHandleScope reused_class_handle(isolate);
90 #define REUSABLE_CODE_HANDLESCOPE(isolate) \
91 ReusableCodeHandleScope reused_code_handle(isolate);
92 #define REUSABLE_ERROR_HANDLESCOPE(isolate) \
93 ReusableErrorHandleScope reused_error_handle(isolate);
94 #define REUSABLE_FIELD_HANDLESCOPE(isolate) \
95 ReusableFieldHandleScope reused_field_handle(isolate);
96 #define REUSABLE_FUNCTION_HANDLESCOPE(isolate) \
97 ReusableFunctionHandleScope reused_function_handle(isolate);
98 #define REUSABLE_INSTANCE_HANDLESCOPE(isolate) \
99 ReusableInstanceHandleScope reused_instance_handle(isolate);
79 #define REUSABLE_OBJECT_HANDLESCOPE(isolate) \ 100 #define REUSABLE_OBJECT_HANDLESCOPE(isolate) \
80 ReusableObjectHandleScope reused_object_handle(isolate); 101 ReusableObjectHandleScope reused_object_handle(isolate);
81 #define REUSABLE_ERROR_HANDLESCOPE(isolate) \
82 ReusableErrorHandleScope reused_error_handle(isolate);
83 #define REUSABLE_ARRAY_HANDLESCOPE(isolate) \
84 ReusableArrayHandleScope reused_array_handle(isolate);
85 #define REUSABLE_STRING_HANDLESCOPE(isolate) \ 102 #define REUSABLE_STRING_HANDLESCOPE(isolate) \
86 ReusableStringHandleScope reused_string_handle(isolate); 103 ReusableStringHandleScope reused_string_handle(isolate);
87 #define REUSABLE_INSTANCE_HANDLESCOPE(isolate) \ 104 #define REUSABLE_TYPE_ARGUMENTS_HANDLESCOPE(isolate) \
88 ReusableInstanceHandleScope reused_instance_handle(isolate); 105 ReusableTypeArgumentsHandleScope reused_type_arguments_handle(isolate);
89 #define REUSABLE_FUNCTION_HANDLESCOPE(isolate) \
90 ReusableFunctionHandleScope reused_function_handle(isolate);
91 #define REUSABLE_FIELD_HANDLESCOPE(isolate) \
92 ReusableFieldHandleScope reused_field_handle(isolate);
93 #define REUSABLE_CLASS_HANDLESCOPE(isolate) \
94 ReusableClassHandleScope reused_class_handle(isolate);
95 #define REUSABLE_ABSTRACT_TYPE_HANDLESCOPE(isolate) \
96 ReusableAbstractTypeHandleScope reused_abstract_type(isolate);
97 #define REUSABLE_TYPE_PARAMETER_HANDLESCOPE(isolate) \ 106 #define REUSABLE_TYPE_PARAMETER_HANDLESCOPE(isolate) \
98 ReusableTypeParameterHandleScope reused_type_parameter(isolate); 107 ReusableTypeParameterHandleScope reused_type_parameter(isolate);
99 #define REUSABLE_TYPE_ARGUMENTS_HANDLESCOPE(isolate) \ 108
100 ReusableTypeArgumentsHandleScope reused_type_arguments_handle(isolate);
101 109
102 } // namespace dart 110 } // namespace dart
103 111
104 #endif // VM_REUSABLE_HANDLES_H_ 112 #endif // VM_REUSABLE_HANDLES_H_
OLDNEW
« no previous file with comments | « runtime/vm/profiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698