| 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 #include "platform/assert.h" | 5 #include "platform/assert.h" |
| 6 #include "platform/utils.h" | 6 #include "platform/utils.h" |
| 7 #include "vm/globals.h" | 7 #include "vm/globals.h" |
| 8 #include "vm/os.h" | 8 #include "vm/os.h" |
| 9 #include "vm/unit_test.h" | 9 #include "vm/unit_test.h" |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 | 48 |
| 49 UNIT_TEST_CASE(OsFuncs) { | 49 UNIT_TEST_CASE(OsFuncs) { |
| 50 EXPECT(Utils::IsPowerOfTwo(OS::ActivationFrameAlignment())); | 50 EXPECT(Utils::IsPowerOfTwo(OS::ActivationFrameAlignment())); |
| 51 EXPECT(Utils::IsPowerOfTwo(OS::PreferredCodeAlignment())); | 51 EXPECT(Utils::IsPowerOfTwo(OS::PreferredCodeAlignment())); |
| 52 int procs = OS::NumberOfAvailableProcessors(); | 52 int procs = OS::NumberOfAvailableProcessors(); |
| 53 EXPECT_LE(1, procs); | 53 EXPECT_LE(1, procs); |
| 54 EXPECT_LT(0U, OS::GetStackSizeLimit()); | 54 EXPECT_LT(0U, OS::GetStackSizeLimit()); |
| 55 } | 55 } |
| 56 | 56 |
| 57 |
| 58 UNIT_TEST_CASE(OSAlignedAllocate) { |
| 59 void* p16 = OS::AlignedAllocate(1023, 16); |
| 60 void* p32 = OS::AlignedAllocate(1025, 32); |
| 61 void* p64 = OS::AlignedAllocate(1025, 64); |
| 62 EXPECT((reinterpret_cast<intptr_t>(p16) & 15) == 0); |
| 63 EXPECT((reinterpret_cast<intptr_t>(p32) & 31) == 0); |
| 64 EXPECT((reinterpret_cast<intptr_t>(p64) & 63) == 0); |
| 65 OS::AlignedFree(p16); |
| 66 OS::AlignedFree(p32); |
| 67 OS::AlignedFree(p64); |
| 68 } |
| 69 |
| 57 } // namespace dart | 70 } // namespace dart |
| OLD | NEW |