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" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } | 55 } |
56 #if defined(DEBUG) | 56 #if defined(DEBUG) |
57 if (isolate() != NULL) { | 57 if (isolate() != NULL) { |
58 BaseIsolate::AssertCurrent(isolate()); | 58 BaseIsolate::AssertCurrent(isolate()); |
59 } | 59 } |
60 #endif | 60 #endif |
61 } | 61 } |
62 | 62 |
63 BaseIsolate* isolate() const { return isolate_; } | 63 BaseIsolate* isolate() const { return isolate_; } |
64 | 64 |
65 // The delete operator should be private instead of public, but unfortunately | |
66 // the compiler complains when compiling the destructors for subclasses. | |
67 void operator delete(void* pointer) { UNREACHABLE(); } | |
68 | |
69 private: | 65 private: |
70 BaseIsolate* isolate_; // Current isolate for this stack resource. | 66 BaseIsolate* const isolate_; // Current isolate for this stack resource. |
71 StackResource* previous_; | 67 StackResource* previous_; |
72 | 68 |
73 void* operator new(uword size); | 69 DISALLOW_ALLOCATION(); |
74 | |
75 DISALLOW_IMPLICIT_CONSTRUCTORS(StackResource); | 70 DISALLOW_IMPLICIT_CONSTRUCTORS(StackResource); |
76 }; | 71 }; |
77 | 72 |
78 | 73 |
79 // Static allocated classes only contain static members and can never | 74 // Static allocated classes only contain static members and can never |
80 // be instantiated in the heap or on the stack. | 75 // be instantiated in the heap or on the stack. |
81 class AllStatic { | 76 class AllStatic { |
82 private: | 77 private: |
83 DISALLOW_ALLOCATION(); | 78 DISALLOW_ALLOCATION(); |
84 DISALLOW_IMPLICIT_CONSTRUCTORS(AllStatic); | 79 DISALLOW_IMPLICIT_CONSTRUCTORS(AllStatic); |
(...skipping 23 matching lines...) Expand all Loading... |
108 // deallocated by invoking DeleteAll() on the zone they live in. | 103 // deallocated by invoking DeleteAll() on the zone they live in. |
109 void operator delete(void* pointer) { UNREACHABLE(); } | 104 void operator delete(void* pointer) { UNREACHABLE(); } |
110 | 105 |
111 private: | 106 private: |
112 DISALLOW_COPY_AND_ASSIGN(ZoneAllocated); | 107 DISALLOW_COPY_AND_ASSIGN(ZoneAllocated); |
113 }; | 108 }; |
114 | 109 |
115 } // namespace dart | 110 } // namespace dart |
116 | 111 |
117 #endif // VM_ALLOCATION_H_ | 112 #endif // VM_ALLOCATION_H_ |
OLD | NEW |