The data contained in this repository can be downloaded to your computer using one of several clients.
Please see the documentation of your version control software client for more information.

Please select the desired protocol below to get the URL.

This URL has Read-Only access.

Statistics
| Branch: | Revision:

main_repo / deps / v8 / test / cctest / test-platform-win32.cc @ 40c0f755

History | View | Annotate | Download (615 Bytes)

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
  VirtualMemory* vm = new VirtualMemory(1 * MB);
17
  CHECK(vm->IsReserved());
18
  void* block_addr = vm->address();
19
  size_t block_size = 4 * KB;
20
  CHECK(vm->Commit(block_addr, block_size, false));
21
  // Check whether we can write to memory.
22
  int* addr = static_cast<int*>(block_addr);
23
  addr[KB-1] = 2;
24
  CHECK(vm->Uncommit(block_addr, block_size));
25
  delete vm;
26
}