-<?xml version="1.0" encoding="Windows-1252"?>\r
-<VisualStudioProject\r
- ProjectType="Visual C++"\r
- Version="8.00"\r
- Name="WTF"\r
- ProjectGUID="{AA8A5A85-592B-4357-BC60-E0E91E026AF6}"\r
- RootNamespace="WTF"\r
- Keyword="Win32Proj"\r
- >\r
- <Platforms>\r
- <Platform\r
- Name="Win32"\r
- />\r
- </Platforms>\r
- <ToolFiles>\r
- </ToolFiles>\r
- <Configurations>\r
- <Configuration\r
- Name="Debug|Win32"\r
- OutputDirectory="$(WebKitOutputDir)\lib"\r
- IntermediateDirectory="$(WebKitOutputDir)\obj\$(ProjectName)\$(ConfigurationName)"\r
- ConfigurationType="4"\r
- InheritedPropertySheets="..\debug.vsprops"\r
- CharacterSet="1"\r
- DeleteExtensionsOnClean="*.obj;*.ilk;*.tlb;*.tli;*.tlh;*.tmp;*.rsp;*.pgc;*.pgd;$(TargetPath)"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- Description=""\r
- CommandLine=""\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- Optimization="0"\r
- AdditionalIncludeDirectories=""$(WebKitOutputDir)\obj\JavaScriptCore\$(ConfigurationName)\DerivedSources\";../../;"../../os-win32/";../../pcre/;../../kjs/;../../wtf/;"$(WebKitSDKDir)\include";"$(WebKitSDKDir)\include\icu";../../../icu/include;../../bindings;../../bindings/c;../../bindings/jni;"$(WebKitOutputDir)\include\JavaScriptCore""\r
- PreprocessorDefinitions="HAVE_CONFIG_H;WIN32;__STD_C;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"\r
- MinimalRebuild="true"\r
- ExceptionHandling="0"\r
- BasicRuntimeChecks="3"\r
- RuntimeLibrary="3"\r
- RuntimeTypeInfo="false"\r
- UsePrecompiledHeader="0"\r
- WarningLevel="4"\r
- WarnAsError="true"\r
- Detect64BitPortabilityProblems="true"\r
- DebugInformationFormat="4"\r
- DisableSpecificWarnings="4127;4355;4510;4512;4610;4706;4996"\r
- ForcedIncludeFiles=""\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLibrarianTool"\r
- OutputFile="$(OutDir)\$(ProjectName)$(ConfigSuffix).lib"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCFxCopTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- </Configuration>\r
- <Configuration\r
- Name="Release|Win32"\r
- OutputDirectory="$(WebKitOutputDir)\lib"\r
- IntermediateDirectory="$(WebKitOutputDir)\obj\$(ProjectName)\$(ConfigurationName)"\r
- ConfigurationType="4"\r
- InheritedPropertySheets="..\release.vsprops"\r
- CharacterSet="1"\r
- DeleteExtensionsOnClean="*.obj;*.ilk;*.tlb;*.tli;*.tlh;*.tmp;*.rsp;*.pgc;*.pgd;$(TargetPath)"\r
- WholeProgramOptimization="1"\r
- >\r
- <Tool\r
- Name="VCPreBuildEventTool"\r
- />\r
- <Tool\r
- Name="VCCustomBuildTool"\r
- Description=""\r
- CommandLine=""\r
- />\r
- <Tool\r
- Name="VCXMLDataGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCWebServiceProxyGeneratorTool"\r
- />\r
- <Tool\r
- Name="VCMIDLTool"\r
- />\r
- <Tool\r
- Name="VCCLCompilerTool"\r
- AdditionalIncludeDirectories=""$(WebKitOutputDir)\obj\JavaScriptCore\$(ConfigurationName)\DerivedSources\";../../;"../../os-win32/";../../pcre/;../../kjs/;../../wtf/;"$(WebKitSDKDir)\include";"$(WebKitSDKDir)\include\icu";../../../icu/include;../../bindings;../../bindings/c;../../bindings/jni;"$(WebKitOutputDir)\include\JavaScriptCore""\r
- PreprocessorDefinitions="HAVE_CONFIG_H;WIN32;__STD_C;NDEBUG;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"\r
- ExceptionHandling="0"\r
- RuntimeLibrary="2"\r
- RuntimeTypeInfo="false"\r
- UsePrecompiledHeader="0"\r
- WarningLevel="4"\r
- WarnAsError="true"\r
- Detect64BitPortabilityProblems="true"\r
- DebugInformationFormat="3"\r
- DisableSpecificWarnings="4127;4355;4510;4512;4610;4706;4996"\r
- ForcedIncludeFiles=""\r
- />\r
- <Tool\r
- Name="VCManagedResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCResourceCompilerTool"\r
- />\r
- <Tool\r
- Name="VCPreLinkEventTool"\r
- />\r
- <Tool\r
- Name="VCLibrarianTool"\r
- OutputFile="$(OutDir)\$(ProjectName)$(ConfigSuffix).lib"\r
- />\r
- <Tool\r
- Name="VCALinkTool"\r
- />\r
- <Tool\r
- Name="VCXDCMakeTool"\r
- />\r
- <Tool\r
- Name="VCBscMakeTool"\r
- />\r
- <Tool\r
- Name="VCFxCopTool"\r
- />\r
- <Tool\r
- Name="VCPostBuildEventTool"\r
- />\r
- </Configuration>\r
- </Configurations>\r
- <References>\r
- </References>\r
- <Files>\r
- <File\r
- RelativePath="..\..\wtf\AlwaysInline.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\Assertions.cpp"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\Assertions.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\FastMalloc.cpp"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\FastMalloc.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\FastMallocInternal.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\Forward.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\GetPtr.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\HashCountedSet.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\HashFunctions.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\HashMap.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\HashSet.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\HashTable.cpp"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\HashTable.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\HashTraits.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\ListHashSet.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\ListRefPtr.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\MathExtras.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\Noncopyable.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\OwnArrayPtr.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\OwnPtr.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\PassRefPtr.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\Platform.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\RefPtr.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\StringExtras.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\TCPageMap.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\TCSpinLock.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\TCSystemAlloc.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\unicode\Unicode.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\unicode\icu\UnicodeIcu.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\UnusedParam.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\Vector.h"\r
- >\r
- </File>\r
- <File\r
- RelativePath="..\..\wtf\VectorTraits.h"\r
- >\r
- </File>\r
- </Files>\r
- <Globals>\r
- </Globals>\r
-</VisualStudioProject>\r
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="WTF"
+ ProjectGUID="{AA8A5A85-592B-4357-BC60-E0E91E026AF6}"
+ RootNamespace="WTF"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(WebKitOutputDir)\lib"
+ IntermediateDirectory="$(WebKitOutputDir)\obj\$(ProjectName)\$(ConfigurationName)"
+ ConfigurationType="4"
+ InheritedPropertySheets="..\debug.vsprops"
+ CharacterSet="1"
+ DeleteExtensionsOnClean="*.obj;*.ilk;*.tlb;*.tli;*.tlh;*.tmp;*.rsp;*.pgc;*.pgd;$(TargetPath)"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ Description=""
+ CommandLine=""
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""$(WebKitOutputDir)\obj\JavaScriptCore\$(ConfigurationName)\DerivedSources\";../../;"../../os-win32/";../../pcre/;../../kjs/;../../wtf/;"$(WebKitSDKDir)\include";"$(WebKitSDKDir)\include\icu";../../../icu/include;../../bindings;../../bindings/c;../../bindings/jni;"$(WebKitOutputDir)\include\JavaScriptCore";"$(WebKitSDKDir)\include\pthreads""
+ PreprocessorDefinitions="HAVE_CONFIG_H;WIN32;__STD_C;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
+ MinimalRebuild="true"
+ ExceptionHandling="0"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ RuntimeTypeInfo="false"
+ UsePrecompiledHeader="0"
+ WarningLevel="4"
+ WarnAsError="true"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ DisableSpecificWarnings="4127;4355;4510;4512;4610;4706;4996"
+ ForcedIncludeFiles=""
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="$(OutDir)\$(ProjectName)$(ConfigSuffix).lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(WebKitOutputDir)\lib"
+ IntermediateDirectory="$(WebKitOutputDir)\obj\$(ProjectName)\$(ConfigurationName)"
+ ConfigurationType="4"
+ InheritedPropertySheets="..\release.vsprops"
+ CharacterSet="1"
+ DeleteExtensionsOnClean="*.obj;*.ilk;*.tlb;*.tli;*.tlh;*.tmp;*.rsp;*.pgc;*.pgd;$(TargetPath)"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ Description=""
+ CommandLine=""
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""$(WebKitOutputDir)\obj\JavaScriptCore\$(ConfigurationName)\DerivedSources\";../../;"../../os-win32/";../../pcre/;../../kjs/;../../wtf/;"$(WebKitSDKDir)\include";"$(WebKitSDKDir)\include\icu";../../../icu/include;../../bindings;../../bindings/c;../../bindings/jni;"$(WebKitOutputDir)\include\JavaScriptCore";"$(WebKitSDKDir)\include\pthreads""
+ PreprocessorDefinitions="HAVE_CONFIG_H;WIN32;__STD_C;NDEBUG;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
+ ExceptionHandling="0"
+ RuntimeLibrary="2"
+ RuntimeTypeInfo="false"
+ UsePrecompiledHeader="0"
+ WarningLevel="4"
+ WarnAsError="true"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ DisableSpecificWarnings="4127;4355;4510;4512;4610;4706;4996"
+ ForcedIncludeFiles=""
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ OutputFile="$(OutDir)\$(ProjectName)$(ConfigSuffix).lib"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath="..\..\wtf\AlwaysInline.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\Assertions.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\Assertions.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\FastMalloc.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\FastMalloc.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\FastMallocInternal.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\Forward.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\GetPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\HashCountedSet.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\HashFunctions.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\HashMap.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\HashSet.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\HashTable.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\HashTable.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\HashTraits.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\ListHashSet.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\ListRefPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\MathExtras.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\Noncopyable.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\OwnArrayPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\OwnPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\PassRefPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\Platform.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\RefPtr.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\StringExtras.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\TCPageMap.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\TCSpinLock.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\TCSystemAlloc.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\TCSystemAlloc.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\unicode\Unicode.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\unicode\icu\UnicodeIcu.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\UnusedParam.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\Vector.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\wtf\VectorTraits.h"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
-#include <unistd.h>
#if WTF_CHANGES
namespace WTF {
}
#endif
-static inline int SizeClass(size_t size) {
+static inline size_t SizeClass(size_t size) {
if (size == 0) size = 1;
const int lg = LgFloor(size);
const int align = size_shift[lg];
- return static_cast<int>(size_base[lg]) + ((size-1) >> align);
+ return size_base[lg] + ((size-1) >> align);
}
// Get the byte-size for a specified class
}
size_t next_class = 1;
- int alignshift = kAlignShift;
+ unsigned char alignshift = kAlignShift;
int last_lg = -1;
for (size_t size = kAlignment; size <= kMaxSize; size += (1 << alignshift)) {
int lg = LgFloor(size);
if ((lg >= 8) && (alignshift < 9)) {
alignshift++;
}
- size_base[lg] = next_class - ((size-1) >> alignshift);
+ size_base[lg] = static_cast<unsigned char>(next_class - ((size-1) >> alignshift));
size_shift[lg] = alignshift;
}
ASSERT(span->sizeclass == 0);
Event(span, 'T', n);
- const int extra = span->length - n;
+ const Length extra = span->length - n;
Span* leftover = NewSpan(span->start + n, extra);
Event(leftover, 'U', extra);
RecordSpan(leftover);
ASSERT(GetDescriptor(span->start) == span);
ASSERT(GetDescriptor(span->start+span->length-1) == span);
Event(span, 'C', sc);
- span->sizeclass = sc;
+ span->sizeclass = static_cast<unsigned int>(sc);
for (Length i = 1; i < span->length-1; i++) {
pagemap_.set(span->start+i, span);
}
// REQUIRES: lock_ is held
// Number of free objects in cache
- int length() const { return counter_; }
+ size_t length() const { return counter_; }
// Lock -- exposed because caller grabs it before touching this object
SpinLock lock_;
ASSERT(pageheap_lock.IsLocked());
#endif
for (TCMalloc_ThreadCache* h = thread_heaps; h != NULL; h = h->next_) {
- if (h->tid_ == zero) {
+ if (pthread_equal(h->tid_, zero)) {
h->tid_ = pthread_self();
}
}
// In that case, the heap for this thread has already been created
// and added to the linked list. So we search for that first.
for (TCMalloc_ThreadCache* h = thread_heaps; h != NULL; h = h->next_) {
- if (h->tid_ == me) {
+ if (pthread_equal(h->tid_, me)) {
heap = h;
break;
}
#else
#include <sys/types.h>
#endif
-#if !PLATFORM(WIN_OS)
+#if PLATFORM(WIN_OS)
+#include "windows.h"
+#else
#include <unistd.h>
#include <sys/mman.h>
#endif
#endif
static bool use_sbrk = false;
static bool use_mmap = true;
+static bool use_VirtualAlloc = true;
// Flags to keep us from retrying allocators that failed.
static bool devmem_failure = false;
static bool sbrk_failure = false;
static bool mmap_failure = false;
+static bool VirtualAlloc_failure = false;
#ifndef WTF_CHANGES
DEFINE_int32(malloc_devmem_start, 0,
#endif /* HAVE(MMAP) */
+#if HAVE(VIRTUALALLOC)
+
+static void* TryVirtualAlloc(size_t size, size_t alignment) {
+ // Enforce page alignment
+ if (pagesize == 0) {
+ SYSTEM_INFO system_info;
+ GetSystemInfo(&system_info);
+ pagesize = system_info.dwPageSize;
+ }
+ if (alignment < pagesize) alignment = pagesize;
+ size = ((size + alignment - 1) / alignment) * alignment;
+
+ // Ask for extra memory if alignment > pagesize
+ size_t extra = 0;
+ if (alignment > pagesize) {
+ extra = alignment - pagesize;
+ }
+ void* result = VirtualAlloc(NULL, size + extra,
+ MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN,
+ PAGE_READWRITE);
+
+ if (result == NULL) {
+ VirtualAlloc_failure = true;
+ return NULL;
+ }
+
+ // Adjust the return memory so it is aligned
+ uintptr_t ptr = reinterpret_cast<uintptr_t>(result);
+ size_t adjust = 0;
+ if ((ptr & (alignment - 1)) != 0) {
+ adjust = alignment - (ptr & (alignment - 1));
+ }
+
+ // Return the unused memory to the system - we'd like to release but the best we can do
+ // is decommit, since Windows only lets you free the whole allocation.
+ if (adjust > 0) {
+ VirtualFree(reinterpret_cast<void*>(ptr), adjust, MEM_DECOMMIT);
+ }
+ if (adjust < extra) {
+ VirtualFree(reinterpret_cast<void*>(ptr + adjust + size), extra-adjust, MEM_DECOMMIT);
+ }
+
+ ptr += adjust;
+ return reinterpret_cast<void*>(ptr);
+}
+
+#endif /* HAVE(MMAP) */
+
#ifndef WTF_CHANGES
static void* TryDevMem(size_t size, size_t alignment) {
static bool initialized = false;
}
#endif
+#if HAVE(VIRTUALALLOC)
+ if (use_VirtualAlloc && !VirtualAlloc_failure) {
+ void* result = TryVirtualAlloc(size, alignment);
+ if (result != NULL) return result;
+ }
+#endif
+
// nothing worked - reset failure flags and try again
devmem_failure = false;
sbrk_failure = false;
mmap_failure = false;
+ VirtualAlloc_failure = false;
}
return NULL;
}