| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 static Mutex* limit_mutex = NULL; | 73 static Mutex* limit_mutex = NULL; |
| 74 | 74 |
| 75 | 75 |
| 76 static void* GetRandomMmapAddr() { | 76 static void* GetRandomMmapAddr() { |
| 77 Isolate* isolate = Isolate::UncheckedCurrent(); | 77 Isolate* isolate = Isolate::UncheckedCurrent(); |
| 78 // Note that the current isolate isn't set up in a call path via | 78 // Note that the current isolate isn't set up in a call path via |
| 79 // CpuFeatures::Probe. We don't care about randomization in this case because | 79 // CpuFeatures::Probe. We don't care about randomization in this case because |
| 80 // the code page is immediately freed. | 80 // the code page is immediately freed. |
| 81 if (isolate != NULL) { | 81 if (isolate != NULL) { |
| 82 #ifdef V8_TARGET_ARCH_X64 | 82 #if V8_TARGET_ARCH_X64 |
| 83 uint64_t rnd1 = V8::RandomPrivate(isolate); | 83 uint64_t rnd1 = V8::RandomPrivate(isolate); |
| 84 uint64_t rnd2 = V8::RandomPrivate(isolate); | 84 uint64_t rnd2 = V8::RandomPrivate(isolate); |
| 85 uint64_t raw_addr = (rnd1 << 32) ^ rnd2; | 85 uint64_t raw_addr = (rnd1 << 32) ^ rnd2; |
| 86 // Currently available CPUs have 48 bits of virtual addressing. Truncate | 86 // Currently available CPUs have 48 bits of virtual addressing. Truncate |
| 87 // the hint address to 46 bits to give the kernel a fighting chance of | 87 // the hint address to 46 bits to give the kernel a fighting chance of |
| 88 // fulfilling our placement request. | 88 // fulfilling our placement request. |
| 89 raw_addr &= V8_UINT64_C(0x3ffffffff000); | 89 raw_addr &= V8_UINT64_C(0x3ffffffff000); |
| 90 #else | 90 #else |
| 91 uint32_t raw_addr = V8::RandomPrivate(isolate); | 91 uint32_t raw_addr = V8::RandomPrivate(isolate); |
| 92 // The range 0x20000000 - 0x60000000 is relatively unpopulated across a | 92 // The range 0x20000000 - 0x60000000 is relatively unpopulated across a |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 limit_mutex = CreateMutex(); | 732 limit_mutex = CreateMutex(); |
| 733 } | 733 } |
| 734 | 734 |
| 735 | 735 |
| 736 void OS::TearDown() { | 736 void OS::TearDown() { |
| 737 delete limit_mutex; | 737 delete limit_mutex; |
| 738 } | 738 } |
| 739 | 739 |
| 740 | 740 |
| 741 } } // namespace v8::internal | 741 } } // namespace v8::internal |
| OLD | NEW |