Revision: 8808 Author: [email protected] Date: Wed Aug 3 04:03:19 2011 Log: Merge r8780, r8803 from the bleeding edge 3.4 branch.
Mark optimized modulo and memcpy code pages -w after writing them. Check phi uses of the arguments object after redundant phies elimination. This allows to handle code like: var a = arguments; while (smth) a[i]; without bailout. Review URL: http://codereview.chromium.org/7563006 http://code.google.com/p/v8/source/detail?r=8808 Modified: /branches/3.4/src/hydrogen.cc /branches/3.4/src/ia32/codegen-ia32.cc /branches/3.4/src/platform-posix.cc /branches/3.4/src/platform-win32.cc /branches/3.4/src/platform.h /branches/3.4/src/version.cc /branches/3.4/src/x64/codegen-x64.cc ======================================= --- /branches/3.4/src/hydrogen.cc Tue Aug 2 03:47:41 2011 +++ /branches/3.4/src/hydrogen.cc Wed Aug 3 04:03:19 2011 @@ -2304,11 +2304,11 @@ graph()->OrderBlocks(); graph()->AssignDominators(); + graph()->EliminateRedundantPhis(); if (!graph()->CheckPhis()) { Bailout("Unsupported phi use of arguments object"); return NULL; } - graph()->EliminateRedundantPhis(); if (FLAG_eliminate_dead_phis) graph()->EliminateUnreachablePhis(); if (!graph()->CollectPhis()) { Bailout("Unsupported phi use of uninitialized constant"); ======================================= --- /branches/3.4/src/ia32/codegen-ia32.cc Mon Apr 11 05:33:05 2011 +++ /branches/3.4/src/ia32/codegen-ia32.cc Wed Aug 3 04:03:19 2011 @@ -255,6 +255,7 @@ ASSERT(desc.reloc_size == 0); CPU::FlushICache(buffer, actual_size); + OS::ProtectCode(buffer, actual_size); return FUNCTION_CAST<OS::MemCopyFunction>(buffer); } ======================================= --- /branches/3.4/src/platform-posix.cc Wed Jul 20 06:44:42 2011 +++ /branches/3.4/src/platform-posix.cc Wed Aug 3 04:03:19 2011 @@ -68,6 +68,12 @@ if (result != 0) return 0; return limit.rlim_cur; } + + +// Get rid of writable permission on code allocations. +void OS::ProtectCode(void* address, const size_t size) { + mprotect(address, size, PROT_READ | PROT_EXEC); +} // Create guard pages. ======================================= --- /branches/3.4/src/platform-win32.cc Wed Jul 20 06:44:42 2011 +++ /branches/3.4/src/platform-win32.cc Wed Aug 3 04:03:19 2011 @@ -955,6 +955,12 @@ VirtualFree(address, 0, MEM_RELEASE); USE(size); } + + +void OS::ProtectCode(void* address, const size_t size) { + DWORD old_protect; + VirtualProtect(address, size, PAGE_EXECUTE_READ, &old_protect); +} void OS::Guard(void* address, const size_t size) { ======================================= --- /branches/3.4/src/platform.h Wed Jul 20 06:44:42 2011 +++ /branches/3.4/src/platform.h Wed Aug 3 04:03:19 2011 @@ -207,6 +207,9 @@ bool is_executable); static void Free(void* address, const size_t size); + // Mark code segments non-writable. + static void ProtectCode(void* address, const size_t size); + // Assign memory as a guard page so that access will cause an exception. static void Guard(void* address, const size_t size); ======================================= --- /branches/3.4/src/version.cc Wed Aug 3 02:23:27 2011 +++ /branches/3.4/src/version.cc Wed Aug 3 04:03:19 2011 @@ -35,7 +35,7 @@ #define MAJOR_VERSION 3 #define MINOR_VERSION 4 #define BUILD_NUMBER 14 -#define PATCH_LEVEL 5 +#define PATCH_LEVEL 6 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) #define IS_CANDIDATE_VERSION 0 ======================================= --- /branches/3.4/src/x64/codegen-x64.cc Mon Apr 11 05:33:05 2011 +++ /branches/3.4/src/x64/codegen-x64.cc Wed Aug 3 04:03:19 2011 @@ -132,6 +132,7 @@ CodeDesc desc; masm.GetCode(&desc); + OS::ProtectCode(buffer, actual_size); // Call the function from C++ through this pointer. return FUNCTION_CAST<ModuloFunction>(buffer); } -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
