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

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

Issue 717263005: Re-land: 178586 Avoid fragmenting address space on small windows systems. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: ASSERT_NOT_REACHED Created 6 years, 1 month 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 | « no previous file | no next file » | 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 static bool shouldUseAddressHint() 63 static bool shouldUseAddressHint()
64 { 64 {
65 #if CPU(32BIT) 65 #if CPU(32BIT)
66 // When running 32-bit processes under 32-bit Windows, the userspace is 66 // When running 32-bit processes under 32-bit Windows, the userspace is
67 // limited to 2 GB, and we risk fragmenting it badly if we allow further 67 // limited to 2 GB, and we risk fragmenting it badly if we allow further
68 // randomization via our address hint. On the other hand, if the process 68 // randomization via our address hint. On the other hand, if the process
69 // is running under WOW64, then it has at least 3 GB available (and likely 69 // is running under WOW64, then it has at least 3 GB available (and likely
70 // 4 GB depending upon the OS version), and we want use the additional 70 // 4 GB depending upon the OS version), and we want use the additional
71 // randomness. 71 // randomness.
72 // TODO(tsepez): presently disabled due to IsWow64Process() compatibility. 72 static BOOL bIsWow64 = -1;
73 return true; 73 if (bIsWow64 == -1) {
74 BOOL result = IsWow64Process(GetCurrentProcess(), &bIsWow64);
75 if (!result) {
76 ASSERT_NOT_REACHED();
77 bIsWow64 = 0;
78 }
79 }
80 return !!bIsWow64;
74 #else // CPU(32BIT) 81 #else // CPU(32BIT)
75 return true; 82 return true;
76 #endif // CPU(32BIT) 83 #endif // CPU(32BIT)
77 } 84 }
78 85
79 #endif // OS(WIN) 86 #endif // OS(WIN)
80 87
81 // This simple internal function wraps the OS-specific page allocation call so 88 // This simple internal function wraps the OS-specific page allocation call so
82 // that it behaves consistently: the address is a hint and if it cannot be used, 89 // that it behaves consistently: the address is a hint and if it cannot be used,
83 // the allocation will be placed elsewhere. 90 // the allocation will be placed elsewhere.
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 ASSERT(!(len & kSystemPageOffsetMask)); 244 ASSERT(!(len & kSystemPageOffsetMask));
238 #if OS(POSIX) 245 #if OS(POSIX)
239 (void) addr; 246 (void) addr;
240 #else 247 #else
241 setSystemPagesAccessible(addr, len); 248 setSystemPagesAccessible(addr, len);
242 #endif 249 #endif
243 } 250 }
244 251
245 } // namespace WTF 252 } // namespace WTF
246 253
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698