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 #include "vm/freelist.h" | 5 #include "vm/freelist.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "vm/bit_set.h" | 10 #include "vm/bit_set.h" |
11 #include "vm/object.h" | 11 #include "vm/object.h" |
12 #include "vm/raw_object.h" | 12 #include "vm/raw_object.h" |
13 | 13 |
14 namespace dart { | 14 namespace dart { |
15 | 15 |
16 | 16 |
17 FreeListElement* FreeListElement::AsElement(uword addr, intptr_t size) { | 17 FreeListElement* FreeListElement::AsElement(uword addr, intptr_t size) { |
18 ASSERT(size >= kObjectAlignment); | 18 ASSERT(size >= kObjectAlignment); |
19 ASSERT(Utils::IsAligned(size, kObjectAlignment)); | 19 ASSERT(Utils::IsAligned(size, kObjectAlignment)); |
20 | 20 |
21 FreeListElement* result = reinterpret_cast<FreeListElement*>(addr); | 21 FreeListElement* result = reinterpret_cast<FreeListElement*>(addr); |
22 | 22 |
23 uword tags = 0; | 23 uword tags = 0; |
24 tags = RawObject::FreeBit::update(true, tags); | 24 // tags = RawObject::FreeBit::update(true, tags); |
25 tags = RawObject::SizeTag::update(size, tags); | 25 tags = RawObject::SizeTag::update(size, tags); |
26 tags = RawObject::ClassIdTag::update(kFreeListElement, tags); | 26 tags = RawObject::ClassIdTag::update(kFreeListElement, tags); |
27 | 27 |
28 result->tags_ = tags; | 28 result->tags_ = tags; |
29 if (size > RawObject::SizeTag::kMaxSizeTag) { | 29 if (size > RawObject::SizeTag::kMaxSizeTag) { |
30 *result->SizeAddress() = size; | 30 *result->SizeAddress() = size; |
31 } | 31 } |
32 result->set_next(NULL); | 32 result->set_next(NULL); |
33 | 33 |
34 return result; | 34 return result; |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 intptr_t remainder_size = element->Size() - size; | 218 intptr_t remainder_size = element->Size() - size; |
219 if (remainder_size == 0) return; | 219 if (remainder_size == 0) return; |
220 | 220 |
221 element = FreeListElement::AsElement(reinterpret_cast<uword>(element) + size, | 221 element = FreeListElement::AsElement(reinterpret_cast<uword>(element) + size, |
222 remainder_size); | 222 remainder_size); |
223 intptr_t remainder_index = IndexForSize(remainder_size); | 223 intptr_t remainder_index = IndexForSize(remainder_size); |
224 EnqueueElement(element, remainder_index); | 224 EnqueueElement(element, remainder_index); |
225 } | 225 } |
226 | 226 |
227 } // namespace dart | 227 } // namespace dart |
OLD | NEW |