| 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 // It is used as follows: | 290 // It is used as follows: |
| 291 // { | 291 // { |
| 292 // HANDLESCOPE(isolate); | 292 // HANDLESCOPE(isolate); |
| 293 // .... | 293 // .... |
| 294 // ..... | 294 // ..... |
| 295 // code that creates some scoped handles. | 295 // code that creates some scoped handles. |
| 296 // .... | 296 // .... |
| 297 // } | 297 // } |
| 298 class HandleScope : public StackResource { | 298 class HandleScope : public StackResource { |
| 299 public: | 299 public: |
| 300 explicit HandleScope(BaseIsolate* isolate); | 300 explicit HandleScope(Isolate* isolate); |
| 301 ~HandleScope(); | 301 ~HandleScope(); |
| 302 | 302 |
| 303 private: | 303 private: |
| 304 VMHandles::HandlesBlock* saved_handle_block_; // Handle block at prev scope. | 304 VMHandles::HandlesBlock* saved_handle_block_; // Handle block at prev scope. |
| 305 uword saved_handle_slot_; // Next available handle slot at previous scope. | 305 uword saved_handle_slot_; // Next available handle slot at previous scope. |
| 306 #if defined(DEBUG) | 306 #if defined(DEBUG) |
| 307 HandleScope* link_; // Link to previous scope. | 307 HandleScope* link_; // Link to previous scope. |
| 308 #endif | 308 #endif |
| 309 DISALLOW_IMPLICIT_CONSTRUCTORS(HandleScope); | 309 DISALLOW_IMPLICIT_CONSTRUCTORS(HandleScope); |
| 310 }; | 310 }; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 322 // { | 322 // { |
| 323 // NOHANDLESCOPE(isolate); | 323 // NOHANDLESCOPE(isolate); |
| 324 // .... | 324 // .... |
| 325 // ..... | 325 // ..... |
| 326 // critical code that manipulates dart objects directly. | 326 // critical code that manipulates dart objects directly. |
| 327 // .... | 327 // .... |
| 328 // } | 328 // } |
| 329 #if defined(DEBUG) | 329 #if defined(DEBUG) |
| 330 class NoHandleScope : public StackResource { | 330 class NoHandleScope : public StackResource { |
| 331 public: | 331 public: |
| 332 explicit NoHandleScope(BaseIsolate* isolate); | 332 explicit NoHandleScope(Isolate* isolate); |
| 333 NoHandleScope(); | 333 NoHandleScope(); |
| 334 ~NoHandleScope(); | 334 ~NoHandleScope(); |
| 335 | 335 |
| 336 private: | 336 private: |
| 337 DISALLOW_COPY_AND_ASSIGN(NoHandleScope); | 337 DISALLOW_COPY_AND_ASSIGN(NoHandleScope); |
| 338 }; | 338 }; |
| 339 #else // defined(DEBUG) | 339 #else // defined(DEBUG) |
| 340 class NoHandleScope : public ValueObject { | 340 class NoHandleScope : public ValueObject { |
| 341 public: | 341 public: |
| 342 explicit NoHandleScope(BaseIsolate* isolate) { } | 342 explicit NoHandleScope(Isolate* isolate) { } |
| 343 NoHandleScope() { } | 343 NoHandleScope() { } |
| 344 ~NoHandleScope() { } | 344 ~NoHandleScope() { } |
| 345 | 345 |
| 346 private: | 346 private: |
| 347 DISALLOW_COPY_AND_ASSIGN(NoHandleScope); | 347 DISALLOW_COPY_AND_ASSIGN(NoHandleScope); |
| 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_ |
| OLD | NEW |