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