| 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_FREELIST_H_ | 5 #ifndef VM_FREELIST_H_ |
| 6 #define VM_FREELIST_H_ | 6 #define VM_FREELIST_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
| 10 #include "vm/bit_set.h" | 10 #include "vm/bit_set.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 static FreeListElement* AsElement(uword addr, intptr_t size); | 36 static FreeListElement* AsElement(uword addr, intptr_t size); |
| 37 | 37 |
| 38 static void InitOnce(); | 38 static void InitOnce(); |
| 39 | 39 |
| 40 // Used to allocate class for free list elements in Object::InitOnce. | 40 // Used to allocate class for free list elements in Object::InitOnce. |
| 41 class FakeInstance { | 41 class FakeInstance { |
| 42 public: | 42 public: |
| 43 FakeInstance() { } | 43 FakeInstance() { } |
| 44 static cpp_vtable vtable() { return 0; } | 44 static cpp_vtable vtable() { return 0; } |
| 45 static intptr_t InstanceSize() { return 0; } | 45 static intptr_t InstanceSize() { return 0; } |
| 46 static intptr_t NextFieldOffset() { return -kWordSize; } |
| 46 static const ClassId kClassId = kFreeListElement; | 47 static const ClassId kClassId = kFreeListElement; |
| 47 static bool IsInstance() { return true; } | 48 static bool IsInstance() { return true; } |
| 48 | 49 |
| 49 private: | 50 private: |
| 50 DISALLOW_ALLOCATION(); | 51 DISALLOW_ALLOCATION(); |
| 51 DISALLOW_COPY_AND_ASSIGN(FakeInstance); | 52 DISALLOW_COPY_AND_ASSIGN(FakeInstance); |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 private: | 55 private: |
| 55 // This layout mirrors the layout of RawObject. | 56 // This layout mirrors the layout of RawObject. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 BitSet<kNumLists> free_map_; | 100 BitSet<kNumLists> free_map_; |
| 100 | 101 |
| 101 FreeListElement* free_lists_[kNumLists + 1]; | 102 FreeListElement* free_lists_[kNumLists + 1]; |
| 102 | 103 |
| 103 DISALLOW_COPY_AND_ASSIGN(FreeList); | 104 DISALLOW_COPY_AND_ASSIGN(FreeList); |
| 104 }; | 105 }; |
| 105 | 106 |
| 106 } // namespace dart | 107 } // namespace dart |
| 107 | 108 |
| 108 #endif // VM_FREELIST_H_ | 109 #endif // VM_FREELIST_H_ |
| OLD | NEW |