| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/assert.h" | 9 #include "vm/assert.h" |
| 10 #include "vm/raw_object.h" | 10 #include "vm/raw_object.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 intptr_t Size() const { | 26 intptr_t Size() const { |
| 27 if (class_ == minimal_element_class_) { | 27 if (class_ == minimal_element_class_) { |
| 28 return kObjectAlignment; | 28 return kObjectAlignment; |
| 29 } | 29 } |
| 30 ASSERT(class_ == element_class_); | 30 ASSERT(class_ == element_class_); |
| 31 return *SizeAddress(); | 31 return *SizeAddress(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 static FreeListElement* AsElement(uword addr, intptr_t size); | 34 static FreeListElement* AsElement(uword addr, intptr_t size); |
| 35 | 35 |
| 36 static bool IsSpecialClass(RawObject* raw_obj) { |
| 37 return (raw_obj == minimal_element_class_) || (raw_obj == element_class_); |
| 38 } |
| 39 |
| 36 static void InitOnce(); | 40 static void InitOnce(); |
| 37 | 41 |
| 38 private: | 42 private: |
| 39 // This layout mirrors the layout of RawObject. | 43 // This layout mirrors the layout of RawObject. |
| 40 RawClass* class_; | 44 RawClass* class_; |
| 41 FreeListElement* next_; | 45 FreeListElement* next_; |
| 42 | 46 |
| 43 // Returns the address of the embedded size. | 47 // Returns the address of the embedded size. |
| 44 intptr_t* SizeAddress() const { | 48 intptr_t* SizeAddress() const { |
| 45 ASSERT(class_ == element_class_); | 49 ASSERT(class_ == element_class_); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 void SplitElementAfterAndEnqueue(FreeListElement* element, intptr_t size); | 89 void SplitElementAfterAndEnqueue(FreeListElement* element, intptr_t size); |
| 86 | 90 |
| 87 FreeListElement* free_lists_[kNumLists + 1]; | 91 FreeListElement* free_lists_[kNumLists + 1]; |
| 88 | 92 |
| 89 DISALLOW_COPY_AND_ASSIGN(FreeList); | 93 DISALLOW_COPY_AND_ASSIGN(FreeList); |
| 90 }; | 94 }; |
| 91 | 95 |
| 92 } // namespace dart | 96 } // namespace dart |
| 93 | 97 |
| 94 #endif // VM_FREELIST_H_ | 98 #endif // VM_FREELIST_H_ |
| OLD | NEW |