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

Side by Side Diff: vm/base_isolate.h

Issue 10008030: Inline the StackResource constructor/destructor. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 8 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 | « vm/allocation.cc ('k') | vm/handles.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 #ifndef VM_BASE_ISOLATE_H_
6 #define VM_BASE_ISOLATE_H_
7
8 namespace dart {
9
10 class HandleScope;
11 class StackResource;
12 class Zone;
13
14 // A BaseIsolate contains just enough functionality to allocate
15 // StackResources. This allows us to inline the StackResource
16 // constructor/destructor for performance.
17 class BaseIsolate {
18 public:
19 StackResource* top_resource() const { return top_resource_; }
20 void set_top_resource(StackResource* value) { top_resource_ = value; }
21
22 Zone* current_zone() const { return current_zone_; }
23 void set_current_zone(Zone* zone) { current_zone_ = zone; }
24
25 HandleScope* top_handle_scope() const {
26 #if defined(DEBUG)
27 return top_handle_scope_;
28 #else
29 return 0;
30 #endif
31 }
32
33 void set_top_handle_scope(HandleScope* handle_scope) {
34 #if defined(DEBUG)
35 top_handle_scope_ = handle_scope;
36 #endif
37 }
38
39 int32_t no_handle_scope_depth() const {
40 #if defined(DEBUG)
41 return no_handle_scope_depth_;
42 #else
43 return 0;
44 #endif
45 }
46
47 void IncrementNoHandleScopeDepth() {
48 #if defined(DEBUG)
49 ASSERT(no_handle_scope_depth_ < INT_MAX);
50 no_handle_scope_depth_ += 1;
51 #endif
52 }
53
54 void DecrementNoHandleScopeDepth() {
55 #if defined(DEBUG)
56 ASSERT(no_handle_scope_depth_ > 0);
57 no_handle_scope_depth_ -= 1;
58 #endif
59 }
60
61 int32_t no_gc_scope_depth() const {
62 #if defined(DEBUG)
63 return no_gc_scope_depth_;
64 #else
65 return 0;
66 #endif
67 }
68
69 void IncrementNoGCScopeDepth() {
70 #if defined(DEBUG)
71 ASSERT(no_gc_scope_depth_ < INT_MAX);
72 no_gc_scope_depth_ += 1;
73 #endif
74 }
75
76 void DecrementNoGCScopeDepth() {
77 #if defined(DEBUG)
78 ASSERT(no_gc_scope_depth_ > 0);
79 no_gc_scope_depth_ -= 1;
80 #endif
81 }
82
83 #if defined(DEBUG)
84 static void AssertCurrent(BaseIsolate* isolate);
85 #endif
86
87 protected:
88 BaseIsolate()
89 : top_resource_(NULL),
90 #if defined(DEBUG)
91 current_zone_(NULL),
92 top_handle_scope_(NULL),
93 no_handle_scope_depth_(0),
94 no_gc_scope_depth_(0)
95 #else
96 current_zone_(NULL)
97 #endif
98 {}
99
100 ~BaseIsolate() {
101 // Do not delete stack resources: top_resource_ and current_zone_.
102 }
103
104 StackResource* top_resource_;
105 Zone* current_zone_;
106 #if defined(DEBUG)
107 HandleScope* top_handle_scope_;
108 int32_t no_handle_scope_depth_;
109 int32_t no_gc_scope_depth_;
110 #endif
111
112 DISALLOW_COPY_AND_ASSIGN(BaseIsolate);
113 };
114
115 } // namespace dart
116
117 #endif // VM_BASE_ISOLATE_H_
OLDNEW
« no previous file with comments | « vm/allocation.cc ('k') | vm/handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698