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

Unified Diff: src/ia32/codegen-ia32.cc

Issue 5987005: Refactor MemoryAllocator to allow big normal pages (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: remove rogue printf Created 10 years 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/heap.cc ('k') | src/platform.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/codegen-ia32.cc
diff --git a/src/ia32/codegen-ia32.cc b/src/ia32/codegen-ia32.cc
index b6d1022fbd6ba30d7054c207a410f1e3530cd6d5..3dbef7d9f3426dd14c90043fb22a28fe0e11e908 100644
--- a/src/ia32/codegen-ia32.cc
+++ b/src/ia32/codegen-ia32.cc
@@ -10249,11 +10249,14 @@ MemCopyFunction CreateMemCopyFunction() {
// Copy the generated code into an executable chunk and return a pointer
// to the first instruction in it as a C++ function pointer.
- LargeObjectChunk* chunk = LargeObjectChunk::New(desc.instr_size, EXECUTABLE);
- if (chunk == NULL) return &MemCopyWrapper;
- memcpy(chunk->GetStartAddress(), desc.buffer, desc.instr_size);
- CPU::FlushICache(chunk->GetStartAddress(), desc.instr_size);
- return FUNCTION_CAST<MemCopyFunction>(chunk->GetStartAddress());
+ size_t size = RoundUp(desc.instr_size, OS::AllocateAlignment());
+ void* base = VirtualMemory::ReserveRegion(size);
+ if (base == NULL || !VirtualMemory::CommitRegion(base, size, true)) {
+ return &MemCopyWrapper;
+ }
+ memcpy(base, desc.buffer, desc.instr_size);
+ CPU::FlushICache(base, desc.instr_size);
+ return FUNCTION_CAST<MemCopyFunction>(reinterpret_cast<Address>(base));
}
#undef __
« no previous file with comments | « src/heap.cc ('k') | src/platform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698