v8  3.11.10(node0.8.26)
V8 is Google's open source JavaScript engine
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
test-platform-win32.cc
Go to the documentation of this file.
1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 //
3 // Tests of the TokenLock class from lock.h
4 
5 #include <stdlib.h>
6 
7 #include "v8.h"
8 
9 #include "platform.h"
10 #include "cctest.h"
11 
12 using namespace ::v8::internal;
13 
14 
15 TEST(VirtualMemory) {
16  OS::SetUp();
17  VirtualMemory* vm = new VirtualMemory(1 * MB);
18  CHECK(vm->IsReserved());
19  void* block_addr = vm->address();
20  size_t block_size = 4 * KB;
21  CHECK(vm->Commit(block_addr, block_size, false));
22  // Check whether we can write to memory.
23  int* addr = static_cast<int*>(block_addr);
24  addr[KB-1] = 2;
25  CHECK(vm->Uncommit(block_addr, block_size));
26  delete vm;
27 }
TEST(VirtualMemory)
const int KB
Definition: globals.h:221
#define CHECK(condition)
Definition: checks.h:56
const int MB
Definition: d8.cc:124