From cd50f9f865e86047f38351d2b1c851032dc672c5 Mon Sep 17 00:00:00 2001 From: "erik.corry@gmail.com" Date: Wed, 17 Sep 2008 10:59:19 +0000 Subject: [PATCH] Move the initial code space to be before the young space instead of after it. The old arrangement meant that the alignment requirements of young space were likely to nullify ASLR. Review URL: http://codereview.chromium.org/2925 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@326 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/heap.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/heap.cc b/src/heap.cc index dd166ee..b2aaf32 100644 --- a/src/heap.cc +++ b/src/heap.cc @@ -2461,11 +2461,11 @@ bool Heap::Setup(bool create_heap_objects) { // code space. Align the pair of semispaces to their size, which must be // a power of 2. ASSERT(IsPowerOf2(young_generation_size_)); - Address old_space_start = reinterpret_cast
(chunk); - Address new_space_start = RoundUp(old_space_start, young_generation_size_); - Address code_space_start = new_space_start + young_generation_size_; - int old_space_size = new_space_start - old_space_start; - int code_space_size = young_generation_size_ - old_space_size; + Address code_space_start = reinterpret_cast
(chunk); + Address new_space_start = RoundUp(code_space_start, young_generation_size_); + Address old_space_start = new_space_start + young_generation_size_; + int code_space_size = new_space_start - code_space_start; + int old_space_size = young_generation_size_ - code_space_size; // Initialize new space. new_space_ = new NewSpace(initial_semispace_size_, -- 2.7.4