| 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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 // by the kernel and allows us to synchronize V8 code log and the | 587 // by the kernel and allows us to synchronize V8 code log and the |
| 588 // kernel log. | 588 // kernel log. |
| 589 int size = sysconf(_SC_PAGESIZE); | 589 int size = sysconf(_SC_PAGESIZE); |
| 590 FILE* f = fopen(FLAG_gc_fake_mmap, "w+"); | 590 FILE* f = fopen(FLAG_gc_fake_mmap, "w+"); |
| 591 if (f == NULL) { | 591 if (f == NULL) { |
| 592 OS::PrintError("Failed to open %s\n", FLAG_gc_fake_mmap); | 592 OS::PrintError("Failed to open %s\n", FLAG_gc_fake_mmap); |
| 593 OS::Abort(); | 593 OS::Abort(); |
| 594 } | 594 } |
| 595 void* addr = mmap(OS::GetRandomMmapAddr(), | 595 void* addr = mmap(OS::GetRandomMmapAddr(), |
| 596 size, | 596 size, |
| 597 #if defined(__native_client__) |
| 598 // The Native Client port of V8 uses an interpreter, |
| 599 // so code pages don't need PROT_EXEC. |
| 600 PROT_READ, |
| 601 #else |
| 597 PROT_READ | PROT_EXEC, | 602 PROT_READ | PROT_EXEC, |
| 603 #endif |
| 598 MAP_PRIVATE, | 604 MAP_PRIVATE, |
| 599 fileno(f), | 605 fileno(f), |
| 600 0); | 606 0); |
| 601 ASSERT(addr != MAP_FAILED); | 607 ASSERT(addr != MAP_FAILED); |
| 602 OS::Free(addr, size); | 608 OS::Free(addr, size); |
| 603 fclose(f); | 609 fclose(f); |
| 604 } | 610 } |
| 605 | 611 |
| 606 | 612 |
| 607 int OS::StackWalk(Vector<OS::StackFrame> frames) { | 613 int OS::StackWalk(Vector<OS::StackFrame> frames) { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 kMmapFd, | 716 kMmapFd, |
| 711 kMmapFdOffset); | 717 kMmapFdOffset); |
| 712 | 718 |
| 713 if (result == MAP_FAILED) return NULL; | 719 if (result == MAP_FAILED) return NULL; |
| 714 | 720 |
| 715 return result; | 721 return result; |
| 716 } | 722 } |
| 717 | 723 |
| 718 | 724 |
| 719 bool VirtualMemory::CommitRegion(void* base, size_t size, bool is_executable) { | 725 bool VirtualMemory::CommitRegion(void* base, size_t size, bool is_executable) { |
| 726 #if defined(__native_client__) |
| 727 // The Native Client port of V8 uses an interpreter, |
| 728 // so code pages don't need PROT_EXEC. |
| 729 int prot = PROT_READ | PROT_WRITE; |
| 730 #else |
| 720 int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0); | 731 int prot = PROT_READ | PROT_WRITE | (is_executable ? PROT_EXEC : 0); |
| 732 #endif |
| 721 if (MAP_FAILED == mmap(base, | 733 if (MAP_FAILED == mmap(base, |
| 722 size, | 734 size, |
| 723 prot, | 735 prot, |
| 724 MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, | 736 MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, |
| 725 kMmapFd, | 737 kMmapFd, |
| 726 kMmapFdOffset)) { | 738 kMmapFdOffset)) { |
| 727 return false; | 739 return false; |
| 728 } | 740 } |
| 729 | 741 |
| 730 UpdateAllocatedSpaceLimits(base, size); | 742 UpdateAllocatedSpaceLimits(base, size); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 924 limit_mutex = CreateMutex(); | 936 limit_mutex = CreateMutex(); |
| 925 } | 937 } |
| 926 | 938 |
| 927 | 939 |
| 928 void OS::TearDown() { | 940 void OS::TearDown() { |
| 929 delete limit_mutex; | 941 delete limit_mutex; |
| 930 } | 942 } |
| 931 | 943 |
| 932 | 944 |
| 933 } } // namespace v8::internal | 945 } } // namespace v8::internal |
| OLD | NEW |