| OLD | NEW |
| 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_ALLOCATION_H_ | 5 #ifndef VM_ALLOCATION_H_ |
| 6 #define VM_ALLOCATION_H_ | 6 #define VM_ALLOCATION_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/base_isolate.h" | 9 #include "vm/base_isolate.h" |
| 10 #include "vm/globals.h" | 10 #include "vm/globals.h" |
| 11 | 11 |
| 12 namespace dart { | 12 namespace dart { |
| 13 | 13 |
| 14 // Forward declarations. | 14 // Forward declarations. |
| 15 class Isolate; | 15 class Isolate; |
| 16 | 16 |
| 17 // Stack allocated objects subclass from this base class. Objects of this type | 17 // Stack allocated objects subclass from this base class. Objects of this type |
| 18 // cannot be allocated on either the C or object heaps. Destructors for objects | 18 // cannot be allocated on either the C or object heaps. Destructors for objects |
| 19 // of this type will not be run unless the stack is unwound through normal | 19 // of this type will not be run unless the stack is unwound through normal |
| 20 // program control flow. | 20 // program control flow. |
| 21 class ValueObject { | 21 class ValueObject { |
| 22 public: | 22 public: |
| 23 ValueObject() { } | 23 ValueObject() { } |
| 24 ~ValueObject() { } | 24 ~ValueObject() { } |
| 25 | 25 |
| 26 private: | 26 private: |
| 27 DISALLOW_ALLOCATION(); | 27 DISALLOW_ALLOCATION(); |
| 28 DISALLOW_COPY_AND_ASSIGN(ValueObject); | |
| 29 }; | 28 }; |
| 30 | 29 |
| 31 | 30 |
| 32 // Stack resources subclass from this base class. The VM will ensure that the | 31 // Stack resources subclass from this base class. The VM will ensure that the |
| 33 // destructors of these objects are called before the stack is unwound past the | 32 // destructors of these objects are called before the stack is unwound past the |
| 34 // objects location on the stack. Use stack resource objects if objects | 33 // objects location on the stack. Use stack resource objects if objects |
| 35 // need to be destroyed even in the case of exceptions when a Longjump is done | 34 // need to be destroyed even in the case of exceptions when a Longjump is done |
| 36 // to a stack frame above the frame where these objects were allocated. | 35 // to a stack frame above the frame where these objects were allocated. |
| 37 class StackResource { | 36 class StackResource { |
| 38 public: | 37 public: |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // deallocated by invoking DeleteAll() on the zone they live in. | 107 // deallocated by invoking DeleteAll() on the zone they live in. |
| 109 void operator delete(void* pointer) { UNREACHABLE(); } | 108 void operator delete(void* pointer) { UNREACHABLE(); } |
| 110 | 109 |
| 111 private: | 110 private: |
| 112 DISALLOW_COPY_AND_ASSIGN(ZoneAllocated); | 111 DISALLOW_COPY_AND_ASSIGN(ZoneAllocated); |
| 113 }; | 112 }; |
| 114 | 113 |
| 115 } // namespace dart | 114 } // namespace dart |
| 116 | 115 |
| 117 #endif // VM_ALLOCATION_H_ | 116 #endif // VM_ALLOCATION_H_ |
| OLD | NEW |