| 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/raw_object.h" | 10 #include "vm/raw_object.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 intptr_t Size() const { | 35 intptr_t Size() const { |
| 36 if (class_ == minimal_element_class_) { | 36 if (class_ == minimal_element_class_) { |
| 37 return kObjectAlignment; | 37 return kObjectAlignment; |
| 38 } | 38 } |
| 39 ASSERT(class_ == element_class_); | 39 ASSERT(class_ == element_class_); |
| 40 return *SizeAddress(); | 40 return *SizeAddress(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 static FreeListElement* AsElement(uword addr, intptr_t size); | 43 static FreeListElement* AsElement(uword addr, intptr_t size); |
| 44 | 44 |
| 45 static bool IsSpecialClass(RawObject* raw_obj) { | 45 static bool IsSpecialClass(const RawObject* raw_obj) { |
| 46 return (raw_obj == minimal_element_class_) || (raw_obj == element_class_); | 46 return (raw_obj == minimal_element_class_) || (raw_obj == element_class_); |
| 47 } | 47 } |
| 48 | 48 |
| 49 static void InitOnce(); | 49 static void InitOnce(); |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 // This layout mirrors the layout of RawObject. | 52 // This layout mirrors the layout of RawObject. |
| 53 RawClass* class_; | 53 RawClass* class_; |
| 54 uword next_; | 54 uword next_; |
| 55 | 55 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 void SplitElementAfterAndEnqueue(FreeListElement* element, intptr_t size); | 98 void SplitElementAfterAndEnqueue(FreeListElement* element, intptr_t size); |
| 99 | 99 |
| 100 FreeListElement* free_lists_[kNumLists + 1]; | 100 FreeListElement* free_lists_[kNumLists + 1]; |
| 101 | 101 |
| 102 DISALLOW_COPY_AND_ASSIGN(FreeList); | 102 DISALLOW_COPY_AND_ASSIGN(FreeList); |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 } // namespace dart | 105 } // namespace dart |
| 106 | 106 |
| 107 #endif // VM_FREELIST_H_ | 107 #endif // VM_FREELIST_H_ |
| OLD | NEW |