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

Side by Side Diff: Source/wtf/PageAllocator.cpp

Issue 23887002: Header cleanup: don't include system header stdio.h in non-debug builds (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Reworked. Created 7 years, 3 months 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
« no previous file with comments | « Source/wtf/FastMalloc.cpp ('k') | Source/wtf/dtoa.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #endif 48 #endif
49 49
50 #elif OS(WINDOWS) 50 #elif OS(WINDOWS)
51 51
52 #include <windows.h> 52 #include <windows.h>
53 53
54 #else 54 #else
55 #error Unknown OS 55 #error Unknown OS
56 #endif // OS(UNIX) 56 #endif // OS(UNIX)
57 57
58 #include <stdio.h>
59
60 namespace WTF { 58 namespace WTF {
61 59
62 void* allocSuperPages(void* addr, size_t len) 60 void* allocSuperPages(void* addr, size_t len)
63 { 61 {
64 ASSERT(!(len & kSuperPageOffsetMask)); 62 ASSERT(!(len & kSuperPageOffsetMask));
65 ASSERT(!(reinterpret_cast<uintptr_t>(addr) & kSuperPageOffsetMask)); 63 ASSERT(!(reinterpret_cast<uintptr_t>(addr) & kSuperPageOffsetMask));
66 #if OS(UNIX) 64 #if OS(UNIX)
67 char* ptr = reinterpret_cast<char*>(mmap(addr, len, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0)); 65 char* ptr = reinterpret_cast<char*>(mmap(addr, len, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0));
68 RELEASE_ASSERT(ptr != MAP_FAILED); 66 RELEASE_ASSERT(ptr != MAP_FAILED);
69 // If our requested address collided with another mapping, there's a 67 // If our requested address collided with another mapping, there's a
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // This is a good range on Windows, Linux and Mac. 158 // This is a good range on Windows, Linux and Mac.
161 // Allocates in the 0.5-1.5GB region. 159 // Allocates in the 0.5-1.5GB region.
162 random &= (0x3fffffff & kSuperPageBaseMask); 160 random &= (0x3fffffff & kSuperPageBaseMask);
163 random += 0x20000000; 161 random += 0x20000000;
164 #endif // CPU(X86_64) 162 #endif // CPU(X86_64)
165 return reinterpret_cast<char*>(random); 163 return reinterpret_cast<char*>(random);
166 } 164 }
167 165
168 } // namespace WTF 166 } // namespace WTF
169 167
OLDNEW
« no previous file with comments | « Source/wtf/FastMalloc.cpp ('k') | Source/wtf/dtoa.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698