Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: runtime/vm/os_test.cc

Issue 11416291: Fix win32 build breakage (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add TODO to test Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/os_macos.cc ('k') | runtime/vm/os_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 57
58 UNIT_TEST_CASE(OSAlignedAllocate) { 58 UNIT_TEST_CASE(OSAlignedAllocate) {
59 void* p16 = OS::AlignedAllocate(1023, 16); 59 // TODO(johnmccutchan): Test other alignments, once we support
60 void* p32 = OS::AlignedAllocate(1025, 32); 60 // alignments != 16 on Mac.
61 void* p64 = OS::AlignedAllocate(1025, 64); 61 void* p1 = OS::AlignedAllocate(1023, 16);
62 EXPECT((reinterpret_cast<intptr_t>(p16) & 15) == 0); 62 void* p2 = OS::AlignedAllocate(1025, 16);
63 EXPECT((reinterpret_cast<intptr_t>(p32) & 31) == 0); 63 void* p3 = OS::AlignedAllocate(1025, 16);
64 EXPECT((reinterpret_cast<intptr_t>(p64) & 63) == 0); 64 void* p4 = OS::AlignedAllocate(1, 16);
65 OS::AlignedFree(p16); 65 void* p5 = OS::AlignedAllocate(2, 16);
66 OS::AlignedFree(p32); 66 void* p6 = OS::AlignedAllocate(4, 16);
67 OS::AlignedFree(p64); 67 EXPECT((reinterpret_cast<intptr_t>(p1) & 15) == 0);
68 EXPECT((reinterpret_cast<intptr_t>(p2) & 15) == 0);
69 EXPECT((reinterpret_cast<intptr_t>(p3) & 15) == 0);
70 EXPECT((reinterpret_cast<intptr_t>(p4) & 15) == 0);
71 EXPECT((reinterpret_cast<intptr_t>(p5) & 15) == 0);
72 EXPECT((reinterpret_cast<intptr_t>(p6) & 15) == 0);
73 OS::AlignedFree(p1);
74 OS::AlignedFree(p2);
75 OS::AlignedFree(p3);
76 OS::AlignedFree(p4);
77 OS::AlignedFree(p5);
78 OS::AlignedFree(p6);
68 } 79 }
69 80
70 } // namespace dart 81 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/os_macos.cc ('k') | runtime/vm/os_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698