| OLD | NEW |
| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 | 88 |
| 89 // Create guard pages. | 89 // Create guard pages. |
| 90 void OS::Guard(void* address, const size_t size) { | 90 void OS::Guard(void* address, const size_t size) { |
| 91 mprotect(address, size, PROT_NONE); | 91 mprotect(address, size, PROT_NONE); |
| 92 } | 92 } |
| 93 #endif // __CYGWIN__ | 93 #endif // __CYGWIN__ |
| 94 | 94 |
| 95 | 95 |
| 96 void* OS::GetRandomMmapAddr() { | 96 void* OS::GetRandomMmapAddr() { |
| 97 #if defined(__native_client__) |
| 98 // TODO(bradchen): restore randomization once Native Client gets |
| 99 // smarter about using mmap address hints. |
| 100 // See http://code.google.com/p/nativeclient/issues/3341 |
| 101 return NULL; |
| 102 #endif |
| 97 Isolate* isolate = Isolate::UncheckedCurrent(); | 103 Isolate* isolate = Isolate::UncheckedCurrent(); |
| 98 // Note that the current isolate isn't set up in a call path via | 104 // Note that the current isolate isn't set up in a call path via |
| 99 // CpuFeatures::Probe. We don't care about randomization in this case because | 105 // CpuFeatures::Probe. We don't care about randomization in this case because |
| 100 // the code page is immediately freed. | 106 // the code page is immediately freed. |
| 101 if (isolate != NULL) { | 107 if (isolate != NULL) { |
| 102 #ifdef V8_TARGET_ARCH_X64 | 108 #ifdef V8_TARGET_ARCH_X64 |
| 103 uint64_t rnd1 = V8::RandomPrivate(isolate); | 109 uint64_t rnd1 = V8::RandomPrivate(isolate); |
| 104 uint64_t rnd2 = V8::RandomPrivate(isolate); | 110 uint64_t rnd2 = V8::RandomPrivate(isolate); |
| 105 uint64_t raw_addr = (rnd1 << 32) ^ rnd2; | 111 uint64_t raw_addr = (rnd1 << 32) ^ rnd2; |
| 106 // Currently available CPUs have 48 bits of virtual addressing. Truncate | 112 // Currently available CPUs have 48 bits of virtual addressing. Truncate |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 return ntohl(value); | 556 return ntohl(value); |
| 551 } | 557 } |
| 552 | 558 |
| 553 | 559 |
| 554 Socket* OS::CreateSocket() { | 560 Socket* OS::CreateSocket() { |
| 555 return new POSIXSocket(); | 561 return new POSIXSocket(); |
| 556 } | 562 } |
| 557 | 563 |
| 558 | 564 |
| 559 } } // namespace v8::internal | 565 } } // namespace v8::internal |
| OLD | NEW |