Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Unified Diff: src/heap/spaces.cc

Issue 621743002: Reserve a page at the beginning of the code range on Win64 for SEH (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/globals.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/spaces.cc
diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc
index ae4048f452e820f58f848c7e622b9bb75a779005..6794a4e92e6ea7c730b678feaa514654115cd573 100644
--- a/src/heap/spaces.cc
+++ b/src/heap/spaces.cc
@@ -110,6 +110,10 @@ bool CodeRange::SetUp(size_t requested) {
}
}
+ if (requested < kMinimumCodeRangeSize) {
+ requested = kMinimumCodeRangeSize;
+ }
+
DCHECK(!kRequiresCodeRange || requested <= kMaximalCodeRangeSize);
code_range_ = new base::VirtualMemory(requested);
CHECK(code_range_ != NULL);
@@ -121,14 +125,25 @@ bool CodeRange::SetUp(size_t requested) {
// We are sure that we have mapped a block of requested addresses.
DCHECK(code_range_->size() == requested);
- LOG(isolate_, NewEvent("CodeRange", code_range_->address(), requested));
Address base = reinterpret_cast<Address>(code_range_->address());
- Address aligned_base =
- RoundUp(reinterpret_cast<Address>(code_range_->address()),
- MemoryChunk::kAlignment);
+
+ // On some platforms, specifically Win64, we need to reserve some pages at
+ // the beginning of an executable space.
+ if (kReservedCodeRangePages) {
+ if (!code_range_->Commit(
+ base, kReservedCodeRangePages * base::OS::CommitPageSize(), true)) {
+ delete code_range_;
+ code_range_ = NULL;
+ return false;
+ }
+ base += kReservedCodeRangePages * base::OS::CommitPageSize();
+ }
+ Address aligned_base = RoundUp(base, MemoryChunk::kAlignment);
size_t size = code_range_->size() - (aligned_base - base);
allocation_list_.Add(FreeBlock(aligned_base, size));
current_allocation_block_index_ = 0;
+
+ LOG(isolate_, NewEvent("CodeRange", code_range_->address(), requested));
return true;
}
« no previous file with comments | « src/globals.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698