OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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_COPY_AND_ASSIGN(ValueObject); |
Kevin Millikin (Google)
2013/02/04 11:15:03
It seems strange and not useful that ValueObject i
regis
2013/02/04 16:41:45
Objects deriving from ValueObject *can* be passed
| |
28 // TODO(5411081): Add DISALLOW_COPY_AND_ASSIGN(ValueObject) once the mac | |
29 // build issue is resolved. | |
30 }; | 28 }; |
31 | 29 |
32 | 30 |
33 // 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 |
34 // 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 |
35 // objects location on the stack. Use stack resource objects if objects | 33 // objects location on the stack. Use stack resource objects if objects |
36 // 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 |
37 // 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. |
38 class StackResource { | 36 class StackResource { |
39 public: | 37 public: |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 // deallocated by invoking DeleteAll() on the zone they live in. | 107 // deallocated by invoking DeleteAll() on the zone they live in. |
110 void operator delete(void* pointer) { UNREACHABLE(); } | 108 void operator delete(void* pointer) { UNREACHABLE(); } |
111 | 109 |
112 private: | 110 private: |
113 DISALLOW_COPY_AND_ASSIGN(ZoneAllocated); | 111 DISALLOW_COPY_AND_ASSIGN(ZoneAllocated); |
114 }; | 112 }; |
115 | 113 |
116 } // namespace dart | 114 } // namespace dart |
117 | 115 |
118 #endif // VM_ALLOCATION_H_ | 116 #endif // VM_ALLOCATION_H_ |
OLD | NEW |