| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 | 692 |
| 693 | 693 |
| 694 int MemoryAllocator::CodePageGuardStartOffset() { | 694 int MemoryAllocator::CodePageGuardStartOffset() { |
| 695 // We are guarding code pages: the first OS page after the header | 695 // We are guarding code pages: the first OS page after the header |
| 696 // will be protected as non-writable. | 696 // will be protected as non-writable. |
| 697 return RoundUp(Page::kObjectStartOffset, OS::CommitPageSize()); | 697 return RoundUp(Page::kObjectStartOffset, OS::CommitPageSize()); |
| 698 } | 698 } |
| 699 | 699 |
| 700 | 700 |
| 701 int MemoryAllocator::CodePageGuardSize() { | 701 int MemoryAllocator::CodePageGuardSize() { |
| 702 return OS::CommitPageSize(); | 702 return static_cast<int>(OS::CommitPageSize()); |
| 703 } | 703 } |
| 704 | 704 |
| 705 | 705 |
| 706 int MemoryAllocator::CodePageAreaStartOffset() { | 706 int MemoryAllocator::CodePageAreaStartOffset() { |
| 707 // We are guarding code pages: the first OS page after the header | 707 // We are guarding code pages: the first OS page after the header |
| 708 // will be protected as non-writable. | 708 // will be protected as non-writable. |
| 709 return CodePageGuardStartOffset() + CodePageGuardSize(); | 709 return CodePageGuardStartOffset() + CodePageGuardSize(); |
| 710 } | 710 } |
| 711 | 711 |
| 712 | 712 |
| 713 int MemoryAllocator::CodePageAreaEndOffset() { | 713 int MemoryAllocator::CodePageAreaEndOffset() { |
| 714 // We are guarding code pages: the last OS page will be protected as | 714 // We are guarding code pages: the last OS page will be protected as |
| 715 // non-writable. | 715 // non-writable. |
| 716 return Page::kPageSize - OS::CommitPageSize(); | 716 return Page::kPageSize - static_cast<int>(OS::CommitPageSize()); |
| 717 } | 717 } |
| 718 | 718 |
| 719 | 719 |
| 720 bool MemoryAllocator::CommitCodePage(VirtualMemory* vm, | 720 bool MemoryAllocator::CommitCodePage(VirtualMemory* vm, |
| 721 Address start, | 721 Address start, |
| 722 size_t size) { | 722 size_t size) { |
| 723 // Commit page header (not executable). | 723 // Commit page header (not executable). |
| 724 if (!vm->Commit(start, | 724 if (!vm->Commit(start, |
| 725 CodePageGuardStartOffset(), | 725 CodePageGuardStartOffset(), |
| 726 false)) { | 726 false)) { |
| (...skipping 2055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2782 object->ShortPrint(); | 2782 object->ShortPrint(); |
| 2783 PrintF("\n"); | 2783 PrintF("\n"); |
| 2784 } | 2784 } |
| 2785 printf(" --------------------------------------\n"); | 2785 printf(" --------------------------------------\n"); |
| 2786 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 2786 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 2787 } | 2787 } |
| 2788 | 2788 |
| 2789 #endif // DEBUG | 2789 #endif // DEBUG |
| 2790 | 2790 |
| 2791 } } // namespace v8::internal | 2791 } } // namespace v8::internal |
| OLD | NEW |