Index: src/spaces.cc |
=================================================================== |
--- src/spaces.cc (revision 8657) |
+++ src/spaces.cc (working copy) |
@@ -380,7 +380,10 @@ |
if (isolate_->code_range()->exists()) { |
mem = isolate_->code_range()->AllocateRawMemory(requested, allocated); |
} else { |
- mem = OS::Allocate(requested, allocated, true); |
+ mem = OS::Allocate(requested + Page::kPageSize, allocated, true); |
+ OS::Guard(mem, Page::kPageSize); |
Vyacheslav Egorov (Chromium)
2011/07/15 11:59:14
You have decreased kPagesPerChunk for all spaces b
Cris Neckar
2011/07/15 18:51:29
Done.
|
+ *allocated -= Page::kPageSize; |
+ mem = static_cast<char*>(mem) + Page::kPageSize; |
Vyacheslav Egorov (Chromium)
2011/07/15 11:59:14
we use Address type instead of char* in such cases
Cris Neckar
2011/07/15 18:51:29
Done.
|
} |
// Update executable memory size. |
size_executable_ += static_cast<int>(*allocated); |
@@ -407,7 +410,8 @@ |
if (isolate_->code_range()->contains(static_cast<Address>(mem))) { |
isolate_->code_range()->FreeRawMemory(mem, length); |
} else { |
- OS::Free(mem, length); |
+ size_t guardsize = (executable == EXECUTABLE) ? Page::kPageSize : 0; |
+ OS::Free(static_cast<char*>(mem) - guardsize, length + guardsize); |
Vyacheslav Egorov (Chromium)
2011/07/15 11:59:14
we use Address type instead of char* in such cases
Cris Neckar
2011/07/15 18:51:29
Done.
|
} |
isolate_->counters()->memory_allocated()->Decrement(static_cast<int>(length)); |
size_ -= static_cast<int>(length); |