| 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 RUNTIME_VM_SCAVENGER_H_ | 5 #ifndef RUNTIME_VM_SCAVENGER_H_ |
| 6 #define RUNTIME_VM_SCAVENGER_H_ | 6 #define RUNTIME_VM_SCAVENGER_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "platform/utils.h" | 9 #include "platform/utils.h" |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 class ObjectSet; | 25 class ObjectSet; |
| 26 class ScavengerVisitor; | 26 class ScavengerVisitor; |
| 27 | 27 |
| 28 // Wrapper around VirtualMemory that adds caching and handles the empty case. | 28 // Wrapper around VirtualMemory that adds caching and handles the empty case. |
| 29 class SemiSpace { | 29 class SemiSpace { |
| 30 public: | 30 public: |
| 31 static void InitOnce(); | 31 static void InitOnce(); |
| 32 | 32 |
| 33 // Get a space of the given size. Returns NULL on out of memory. If size is 0, | 33 // Get a space of the given size. Returns NULL on out of memory. If size is 0, |
| 34 // returns an empty space: pointer(), start() and end() all return NULL. | 34 // returns an empty space: pointer(), start() and end() all return NULL. |
| 35 static SemiSpace* New(intptr_t size_in_words); | 35 // The name parameter may be NULL. If non-NULL it is ued to give the OS a name |
| 36 // for the underlying virtual memory region. |
| 37 static SemiSpace* New(intptr_t size_in_words, const char* name); |
| 36 | 38 |
| 37 // Hand back an unused space. | 39 // Hand back an unused space. |
| 38 void Delete(); | 40 void Delete(); |
| 39 | 41 |
| 40 void* pointer() const { return region_.pointer(); } | 42 void* pointer() const { return region_.pointer(); } |
| 41 uword start() const { return region_.start(); } | 43 uword start() const { return region_.start(); } |
| 42 uword end() const { return region_.end(); } | 44 uword end() const { return region_.end(); } |
| 43 intptr_t size_in_words() const { | 45 intptr_t size_in_words() const { |
| 44 return static_cast<intptr_t>(region_.size()) >> kWordSizeLog2; | 46 return static_cast<intptr_t>(region_.size()) >> kWordSizeLog2; |
| 45 } | 47 } |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 | 299 |
| 298 friend class ScavengerVisitor; | 300 friend class ScavengerVisitor; |
| 299 friend class ScavengerWeakVisitor; | 301 friend class ScavengerWeakVisitor; |
| 300 | 302 |
| 301 DISALLOW_COPY_AND_ASSIGN(Scavenger); | 303 DISALLOW_COPY_AND_ASSIGN(Scavenger); |
| 302 }; | 304 }; |
| 303 | 305 |
| 304 } // namespace dart | 306 } // namespace dart |
| 305 | 307 |
| 306 #endif // RUNTIME_VM_SCAVENGER_H_ | 308 #endif // RUNTIME_VM_SCAVENGER_H_ |
| OLD | NEW |