OLD | NEW |
---|---|
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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
221 void ZapFreeScopedHandles(); | 221 void ZapFreeScopedHandles(); |
222 #endif | 222 #endif |
223 | 223 |
224 HandlesBlock* zone_blocks_; // List of zone handles. | 224 HandlesBlock* zone_blocks_; // List of zone handles. |
225 HandlesBlock first_scoped_block_; // First block of scoped handles. | 225 HandlesBlock first_scoped_block_; // First block of scoped handles. |
226 HandlesBlock* scoped_blocks_; // List of scoped handles. | 226 HandlesBlock* scoped_blocks_; // List of scoped handles. |
227 | 227 |
228 friend class HandleScope; | 228 friend class HandleScope; |
229 friend class Dart; | 229 friend class Dart; |
230 friend class ObjectStore; | 230 friend class ObjectStore; |
231 friend class Isolate; | |
231 DISALLOW_ALLOCATION(); | 232 DISALLOW_ALLOCATION(); |
232 DISALLOW_COPY_AND_ASSIGN(Handles); | 233 DISALLOW_COPY_AND_ASSIGN(Handles); |
233 }; | 234 }; |
234 | 235 |
235 | 236 |
236 static const int kVMHandleSizeInWords = 2; | 237 static const int kVMHandleSizeInWords = 2; |
237 static const int kVMHandlesPerChunk = 64; | 238 static const int kVMHandlesPerChunk = 64; |
238 static const int kOffsetOfRawPtr = kWordSize; | 239 static const int kOffsetOfRawPtr = kWordSize; |
239 class VMHandles : public Handles<kVMHandleSizeInWords, | 240 class VMHandles : public Handles<kVMHandleSizeInWords, |
240 kVMHandlesPerChunk, | 241 kVMHandlesPerChunk, |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
331 explicit NoHandleScope(BaseIsolate* isolate) { } | 332 explicit NoHandleScope(BaseIsolate* isolate) { } |
332 NoHandleScope() { } | 333 NoHandleScope() { } |
333 ~NoHandleScope() { } | 334 ~NoHandleScope() { } |
334 | 335 |
335 private: | 336 private: |
336 DISALLOW_COPY_AND_ASSIGN(NoHandleScope); | 337 DISALLOW_COPY_AND_ASSIGN(NoHandleScope); |
337 }; | 338 }; |
338 #endif // defined(DEBUG) | 339 #endif // defined(DEBUG) |
339 | 340 |
340 // Macro to start a no handles scope in the code. | 341 // Macro to start a no handles scope in the code. |
341 #define NOHANDLESCOPE(isolate) \ | 342 #define NOHANDLESCOPE(isolate) \ |
342 dart::NoHandleScope no_vm_internal_handles_scope_(isolate); | 343 dart::NoHandleScope no_vm_internal_handles_scope_(isolate); |
343 | 344 |
345 | |
346 // The class ReusableHandleScope is used in regions of the | |
347 // virtual machine where isolate specific reusable handles are used. | |
348 // This class asserts that we do not add code that will result in recursive | |
349 // uses of reusable handles. | |
350 // It is used as follows: | |
351 // { | |
352 // REUSABLE_HANDLESCOPE(isolate); | |
353 // .... | |
354 // ..... | |
355 // code that uses isolate specific reusable handles. | |
356 // .... | |
357 // } | |
358 #if defined(DEBUG) | |
359 class ReusableHandleScope : public StackResource { | |
360 public: | |
361 explicit ReusableHandleScope(BaseIsolate* isolate); | |
362 ReusableHandleScope(); | |
363 ~ReusableHandleScope(); | |
364 | |
365 private: | |
366 DISALLOW_COPY_AND_ASSIGN(ReusableHandleScope); | |
367 }; | |
368 #else // defined(DEBUG) | |
369 class ReusableHandleScope : public ValueObject { | |
370 public: | |
371 explicit ReusableHandleScope(BaseIsolate* isolate) { } | |
372 ReusableHandleScope() { } | |
373 ~ReusableHandleScope() { } | |
374 | |
375 private: | |
376 DISALLOW_COPY_AND_ASSIGN(ReusableHandleScope); | |
377 }; | |
378 #endif // defined(DEBUG) | |
379 | |
380 // Macro to start a no handles scope in the code. | |
Ivan Posva
2013/06/16 11:15:26
Comment does not match code.
siva
2013/06/19 20:41:55
Done.
| |
381 #define REUSABLE_HANDLESCOPE(isolate) \ | |
382 dart::ReusableHandleScope reusable_vm_internal_handles_scope_(isolate); | |
383 | |
344 } // namespace dart | 384 } // namespace dart |
345 | 385 |
346 #endif // VM_HANDLES_H_ | 386 #endif // VM_HANDLES_H_ |
OLD | NEW |