| OLD | NEW |
| 1 // Copyright (c) 2011, 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 #include "vm/assert.h" | 5 #include "platform/assert.h" |
| 6 #include "vm/freelist.h" | 6 #include "vm/freelist.h" |
| 7 #include "vm/unit_test.h" | 7 #include "vm/unit_test.h" |
| 8 | 8 |
| 9 namespace dart { | 9 namespace dart { |
| 10 | 10 |
| 11 TEST_CASE(FreeList) { | 11 TEST_CASE(FreeList) { |
| 12 FreeList* free_list = new FreeList(); | 12 FreeList* free_list = new FreeList(); |
| 13 intptr_t kBlobSize = 1 * MB; | 13 intptr_t kBlobSize = 1 * MB; |
| 14 intptr_t kSmallObjectSize = 4 * kWordSize; | 14 intptr_t kSmallObjectSize = 4 * kWordSize; |
| 15 intptr_t kMediumObjectSize = 16 * kWordSize; | 15 intptr_t kMediumObjectSize = 16 * kWordSize; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 44 EXPECT_EQ(small_object4 + kSmallObjectSize, large_object); | 44 EXPECT_EQ(small_object4 + kSmallObjectSize, large_object); |
| 45 // Get another large object from the large unallocated remainder. | 45 // Get another large object from the large unallocated remainder. |
| 46 uword large_object2 = free_list->TryAllocate(kLargeObjectSize); | 46 uword large_object2 = free_list->TryAllocate(kLargeObjectSize); |
| 47 EXPECT_EQ(small_object3 + kSmallObjectSize, large_object2); | 47 EXPECT_EQ(small_object3 + kSmallObjectSize, large_object2); |
| 48 // Delete the memory associated with the test. | 48 // Delete the memory associated with the test. |
| 49 free(reinterpret_cast<void*>(blob)); | 49 free(reinterpret_cast<void*>(blob)); |
| 50 delete free_list; | 50 delete free_list; |
| 51 } | 51 } |
| 52 | 52 |
| 53 } // namespace dart | 53 } // namespace dart |
| OLD | NEW |