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

Side by Side Diff: src/platform-posix.cc

Issue 19859008: move 32 bit heap hint on sunos (Closed) Base URL: https://github.com/v8/v8@master
Patch Set: Created 7 years, 5 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 | « 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 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 #if V8_TARGET_ARCH_X64 116 #if V8_TARGET_ARCH_X64
117 uint64_t rnd1 = V8::RandomPrivate(isolate); 117 uint64_t rnd1 = V8::RandomPrivate(isolate);
118 uint64_t rnd2 = V8::RandomPrivate(isolate); 118 uint64_t rnd2 = V8::RandomPrivate(isolate);
119 uint64_t raw_addr = (rnd1 << 32) ^ rnd2; 119 uint64_t raw_addr = (rnd1 << 32) ^ rnd2;
120 // Currently available CPUs have 48 bits of virtual addressing. Truncate 120 // Currently available CPUs have 48 bits of virtual addressing. Truncate
121 // the hint address to 46 bits to give the kernel a fighting chance of 121 // the hint address to 46 bits to give the kernel a fighting chance of
122 // fulfilling our placement request. 122 // fulfilling our placement request.
123 raw_addr &= V8_UINT64_C(0x3ffffffff000); 123 raw_addr &= V8_UINT64_C(0x3ffffffff000);
124 #else 124 #else
125 uint32_t raw_addr = V8::RandomPrivate(isolate); 125 uint32_t raw_addr = V8::RandomPrivate(isolate);
126
127 raw_addr &= 0x3ffff000;
128
129 # ifdef __sun
130 // For our Solaris/illumos mmap hint, we pick a random address in the bottom
131 // half of the top half of the address space (that is, the third quarter).
132 // Because we do not MAP_FIXED, this will be treated only as a hint -- the
133 // system will not fail to mmap() because something else happens to already
134 // be mapped at our random address. We deliberately set the hint high enough
135 // to get well above the system's break (that is, the heap); Solaris and
136 // illumos will try the hint and if that fails allocate as if there were
137 // no hint at all. The high hint prevents the break from getting hemmed in
138 // at low values, ceding half of the address space to the system heap.
139 raw_addr += 0x80000000;
140 # else
126 // The range 0x20000000 - 0x60000000 is relatively unpopulated across a 141 // The range 0x20000000 - 0x60000000 is relatively unpopulated across a
127 // variety of ASLR modes (PAE kernel, NX compat mode, etc) and on macos 142 // variety of ASLR modes (PAE kernel, NX compat mode, etc) and on macos
128 // 10.6 and 10.7. 143 // 10.6 and 10.7.
129 raw_addr &= 0x3ffff000;
130 raw_addr += 0x20000000; 144 raw_addr += 0x20000000;
145 # endif
131 #endif 146 #endif
132 return reinterpret_cast<void*>(raw_addr); 147 return reinterpret_cast<void*>(raw_addr);
133 } 148 }
134 return NULL; 149 return NULL;
135 } 150 }
136 151
137 152
138 // ---------------------------------------------------------------------------- 153 // ----------------------------------------------------------------------------
139 // Math functions 154 // Math functions
140 155
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 return ntohl(value); 664 return ntohl(value);
650 } 665 }
651 666
652 667
653 Socket* OS::CreateSocket() { 668 Socket* OS::CreateSocket() {
654 return new POSIXSocket(); 669 return new POSIXSocket();
655 } 670 }
656 671
657 672
658 } } // namespace v8::internal 673 } } // namespace v8::internal
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