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

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

Issue 868913002: Add Zone-based handle allocation interface and reduce use of Isolate-based interfaces. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 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
OLDNEW
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_H_ 5 #ifndef VM_HANDLES_H_
6 #define VM_HANDLES_H_ 6 #define VM_HANDLES_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/os.h" 10 #include "vm/os.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 // Visit all of the various handles. 106 // Visit all of the various handles.
107 void Visit(HandleVisitor* visitor); 107 void Visit(HandleVisitor* visitor);
108 108
109 // Reset the handles so that we can reuse. 109 // Reset the handles so that we can reuse.
110 void Reset(); 110 void Reset();
111 111
112 // Allocates a handle in the current handle scope. This handle is valid only 112 // Allocates a handle in the current handle scope. This handle is valid only
113 // in the current handle scope and is destroyed when the current handle 113 // in the current handle scope and is destroyed when the current handle
114 // scope ends. 114 // scope ends.
115 static uword AllocateHandle(Isolate* isolate); 115 static uword AllocateHandle(Zone* zone);
116 116
117 // Allocates a handle in the current zone. This handle will be destroyed 117 // Allocates a handle in the current zone. This handle will be destroyed
118 // when the current zone is destroyed. 118 // when the current zone is destroyed.
119 static uword AllocateZoneHandle(Isolate* isolate); 119 static uword AllocateZoneHandle(Zone* zone);
120 120
121 // Returns true if specified handle is a zone handle. 121 // Returns true if specified handle is a zone handle.
122 static bool IsZoneHandle(uword handle); 122 static bool IsZoneHandle(uword handle);
123 123
124 protected: 124 protected:
125 // Allocates space for a scoped handle. 125 // Allocates space for a scoped handle.
126 uword AllocateScopedHandle() { 126 uword AllocateScopedHandle() {
127 if (scoped_blocks_->IsFull()) { 127 if (scoped_blocks_->IsFull()) {
128 SetupNextScopeBlock(); 128 SetupNextScopeBlock();
129 } 129 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 OS::PrintErr("*** Starting a new VM handle block 0x%" Px "\n", 261 OS::PrintErr("*** Starting a new VM handle block 0x%" Px "\n",
262 reinterpret_cast<intptr_t>(this)); 262 reinterpret_cast<intptr_t>(this));
263 } 263 }
264 #endif 264 #endif
265 } 265 }
266 ~VMHandles(); 266 ~VMHandles();
267 267
268 // Visit all object pointers stored in the various handles. 268 // Visit all object pointers stored in the various handles.
269 void VisitObjectPointers(ObjectPointerVisitor* visitor); 269 void VisitObjectPointers(ObjectPointerVisitor* visitor);
270 270
271 // Allocates a handle in the current handle scope. This handle is valid only 271 // Allocates a handle in the current handle scope of 'zone', which must be
272 // in the current handle scope and is destroyed when the current handle 272 // the current zone. This handle is valid only in the current handle scope
273 // scope ends. 273 // and is destroyed when the current handle scope ends.
274 static uword AllocateHandle(Isolate* isolate); 274 static uword AllocateHandle(Zone* zone);
275 275
276 // Allocates a handle in the current zone. This handle will be destroyed 276 // Allocates a handle in 'zone', which must be the current zone. This handle
277 // when the current zone is destroyed. 277 // will be destroyed when the current zone is destroyed.
278 static uword AllocateZoneHandle(Isolate* isolate); 278 static uword AllocateZoneHandle(Zone* zone);
279 279
280 // Returns true if specified handle is a zone handle. 280 // Returns true if specified handle is a zone handle.
281 static bool IsZoneHandle(uword handle); 281 static bool IsZoneHandle(uword handle);
282 282
283 // Returns number of handles, these functions are used for testing purposes. 283 // Returns number of handles, these functions are used for testing purposes.
284 static int ScopedHandleCount(); 284 static int ScopedHandleCount();
285 static int ZoneHandleCount(); 285 static int ZoneHandleCount();
286 }; 286 };
287 287
288 288
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 }; 348 };
349 #endif // defined(DEBUG) 349 #endif // defined(DEBUG)
350 350
351 // Macro to start a no handles scope in the code. 351 // Macro to start a no handles scope in the code.
352 #define NOHANDLESCOPE(isolate) \ 352 #define NOHANDLESCOPE(isolate) \
353 dart::NoHandleScope no_vm_internal_handles_scope_(isolate); 353 dart::NoHandleScope no_vm_internal_handles_scope_(isolate);
354 354
355 } // namespace dart 355 } // namespace dart
356 356
357 #endif // VM_HANDLES_H_ 357 #endif // VM_HANDLES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698