From fdca2c3183c9cb65fa9e17b9c148aa569ad27aa8 Mon Sep 17 00:00:00 2001 From: "sgjesse@chromium.org" Date: Thu, 2 Dec 2010 15:37:45 +0000 Subject: [PATCH] nGW build - add missing functions SignalCodeMovingGC() and MemoryBarrier() - avoid pointer conversion/comparison warnings - don't attempt to hide symbols with -fvisibility, MinGW doesn't support it BUG=http://code.google.com/p/v8/issues/detail?id=949 Patch by Bert Belder Review URL: http://codereview.chromium.org/5471001 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5913 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- AUTHORS | 1 + SConstruct | 13 +++++++++++-- src/platform-win32.cc | 14 +++++++++++--- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/AUTHORS b/AUTHORS index 3749ceb..ea5b93e 100644 --- a/AUTHORS +++ b/AUTHORS @@ -11,6 +11,7 @@ Hewlett-Packard Development Company, LP Alexander Botero-Lowry Alexandre Vassalotti Andreas Anyuru +Bert Belder Burcu Dogan Craig Schlenter Daniel Andersson diff --git a/SConstruct b/SConstruct index 820c1a1..ca63c29 100644 --- a/SConstruct +++ b/SConstruct @@ -654,9 +654,18 @@ def GuessToolchain(os): return None +def GuessVisibility(os, toolchain): + if os == 'win32' and toolchain == 'gcc': + # MinGW can't do it. + return 'default' + else: + return 'hidden' + + OS_GUESS = utils.GuessOS() TOOLCHAIN_GUESS = GuessToolchain(OS_GUESS) ARCH_GUESS = utils.GuessArchitecture() +VISIBILITY_GUESS = GuessVisibility(OS_GUESS, TOOLCHAIN_GUESS) SIMPLE_OPTIONS = { @@ -762,8 +771,8 @@ SIMPLE_OPTIONS = { }, 'visibility': { 'values': ['default', 'hidden'], - 'default': 'hidden', - 'help': 'shared library symbol visibility' + 'default': VISIBILITY_GUESS, + 'help': 'shared library symbol visibility (%s)' % VISIBILITY_GUESS }, 'pgo': { 'values': ['off', 'instrument', 'optimize'], diff --git a/src/platform-win32.cc b/src/platform-win32.cc index c50424e..7791d62 100644 --- a/src/platform-win32.cc +++ b/src/platform-win32.cc @@ -207,6 +207,12 @@ int strncpy_s(char* strDest, size_t numberOfElements, return 0; } + +inline void MemoryBarrier() { + int barrier = 0; + __asm__ __volatile__("xchgl %%eax,%0 ":"=r" (barrier)); +} + #endif // __MINGW32__ // Generate a pseudo-random number in the range 0-2^31-1. Usually @@ -858,13 +864,14 @@ void* OS::Allocate(const size_t requested, // VirtualAlloc rounds allocated size to page size automatically. size_t msize = RoundUp(requested, static_cast(GetPageSize())); - intptr_t address = NULL; + intptr_t address = 0; // Windows XP SP2 allows Data Excution Prevention (DEP). int prot = is_executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE; // For exectutable pages try and randomize the allocation address - if (prot == PAGE_EXECUTE_READWRITE && msize >= Page::kPageSize) { + if (prot == PAGE_EXECUTE_READWRITE && + msize >= static_cast(Page::kPageSize)) { address = (V8::RandomPrivate() << kPageSizeBits) | kAllocationRandomAddressMin; address &= kAllocationRandomAddressMax; @@ -874,7 +881,7 @@ void* OS::Allocate(const size_t requested, msize, MEM_COMMIT | MEM_RESERVE, prot); - if (mbase == NULL && address != NULL) + if (mbase == NULL && address != 0) mbase = VirtualAlloc(NULL, msize, MEM_COMMIT | MEM_RESERVE, prot); if (mbase == NULL) { @@ -1347,6 +1354,7 @@ int OS::StackWalk(Vector frames) { #else // __MINGW32__ void OS::LogSharedLibraryAddresses() { } +void OS::SignalCodeMovingGC() { } int OS::StackWalk(Vector frames) { return 0; } #endif // __MINGW32__ -- 2.7.4