OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // | 2 // |
3 // Tests of the TokenLock class from lock.h | 3 // Tests of the TokenLock class from lock.h |
4 | 4 |
5 #include <pthread.h> | 5 #include <pthread.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include <unistd.h> // for usleep() | 7 #include <unistd.h> // for usleep() |
8 | 8 |
9 #include "v8.h" | 9 #include "v8.h" |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 &RunTestBusyLock, | 60 &RunTestBusyLock, |
61 mutex); | 61 mutex); |
62 CHECK_EQ(0, thread_created); | 62 CHECK_EQ(0, thread_created); |
63 LoopIncrement(mutex, 1); | 63 LoopIncrement(mutex, 1); |
64 pthread_join(other, NULL); | 64 pthread_join(other, NULL); |
65 delete mutex; | 65 delete mutex; |
66 } | 66 } |
67 | 67 |
68 | 68 |
69 TEST(VirtualMemory) { | 69 TEST(VirtualMemory) { |
| 70 OS::Setup(); |
70 VirtualMemory* vm = new VirtualMemory(1 * MB); | 71 VirtualMemory* vm = new VirtualMemory(1 * MB); |
71 CHECK(vm->IsReserved()); | 72 CHECK(vm->IsReserved()); |
72 void* block_addr = vm->address(); | 73 void* block_addr = vm->address(); |
73 size_t block_size = 4 * KB; | 74 size_t block_size = 4 * KB; |
74 CHECK(vm->Commit(block_addr, block_size, false)); | 75 CHECK(vm->Commit(block_addr, block_size, false)); |
75 // Check whether we can write to memory. | 76 // Check whether we can write to memory. |
76 int* addr = static_cast<int*>(block_addr); | 77 int* addr = static_cast<int*>(block_addr); |
77 addr[KB-1] = 2; | 78 addr[KB-1] = 2; |
78 CHECK(vm->Uncommit(block_addr, block_size)); | 79 CHECK(vm->Uncommit(block_addr, block_size)); |
79 delete vm; | 80 delete vm; |
80 } | 81 } |
OLD | NEW |