| 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_ZONE_H_ | 5 #ifndef VM_ZONE_H_ |
| 6 #define VM_ZONE_H_ | 6 #define VM_ZONE_H_ |
| 7 | 7 |
| 8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
| 9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
| 10 #include "vm/handles.h" | 10 #include "vm/handles.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 friend class Zone; | 92 friend class Zone; |
| 93 friend class ApiZone; | 93 friend class ApiZone; |
| 94 template<typename T, typename B> friend class BaseGrowableArray; | 94 template<typename T, typename B> friend class BaseGrowableArray; |
| 95 DISALLOW_COPY_AND_ASSIGN(BaseZone); | 95 DISALLOW_COPY_AND_ASSIGN(BaseZone); |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 | 98 |
| 99 class Zone : public StackResource { | 99 class Zone : public StackResource { |
| 100 public: | 100 public: |
| 101 // Create an empty zone and set is at the current zone for the Isolate. | 101 // Create an empty zone and set is at the current zone for the Isolate. |
| 102 explicit Zone(Isolate* isolate); | 102 explicit Zone(BaseIsolate* isolate); |
| 103 | 103 |
| 104 // Delete all memory associated with the zone. | 104 // Delete all memory associated with the zone. |
| 105 ~Zone(); | 105 ~Zone(); |
| 106 | 106 |
| 107 // Allocate 'size' bytes of memory in the zone; expands the zone by | 107 // Allocate 'size' bytes of memory in the zone; expands the zone by |
| 108 // allocating new segments of memory on demand using 'new'. | 108 // allocating new segments of memory on demand using 'new'. |
| 109 uword Allocate(intptr_t size) { return zone_.Allocate(size); } | 109 uword Allocate(intptr_t size) { return zone_.Allocate(size); } |
| 110 | 110 |
| 111 // Allocate 'new_size' bytes of memory and copies 'old_size' bytes from | 111 // Allocate 'new_size' bytes of memory and copies 'old_size' bytes from |
| 112 // 'data' into new allocated memory. Uses current zone. | 112 // 'data' into new allocated memory. Uses current zone. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 } | 165 } |
| 166 | 166 |
| 167 // Check that the result has the proper alignment and return it. | 167 // Check that the result has the proper alignment and return it. |
| 168 ASSERT(Utils::IsAligned(result, kAlignment)); | 168 ASSERT(Utils::IsAligned(result, kAlignment)); |
| 169 return result; | 169 return result; |
| 170 } | 170 } |
| 171 | 171 |
| 172 } // namespace dart | 172 } // namespace dart |
| 173 | 173 |
| 174 #endif // VM_ZONE_H_ | 174 #endif // VM_ZONE_H_ |
| OLD | NEW |