JavaScriptCore:
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Mar 2007 05:12:59 +0000 (05:12 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Mar 2007 05:12:59 +0000 (05:12 +0000)
        Reviewed by Geoff and Steve.

        - fix some portability issues with TCMalloc.

        * JavaScriptCore.vcproj/WTF/WTF.vcproj:
        * kjs/config.h:
        * wtf/FastMalloc.cpp:
        (WTF::SizeClass):
        (WTF::InitSizeClasses):
        (WTF::TCMalloc_PageHeap::Split):
        (WTF::TCMalloc_PageHeap::RegisterSizeClass):
        (WTF::TCMalloc_Central_FreeList::length):
        (WTF::TCMalloc_ThreadCache::InitTSD):
        (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
        * wtf/TCSpinLock.h:
        * wtf/TCSystemAlloc.cpp:
        (TryVirtualAlloc):
        (TCMalloc_SystemAlloc):

WebCore:

        Reviewed by Geoff and Steve.

        * config.h: Remove unneeded hack.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@20229 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj
JavaScriptCore/kjs/config.h
JavaScriptCore/wtf/FastMalloc.cpp
JavaScriptCore/wtf/TCSpinLock.h
JavaScriptCore/wtf/TCSystemAlloc.cpp
WebCore/ChangeLog
WebCore/config.h

index c5c8e53b63cf05bfad879a321748dce49cd4d3d8..af80b48fa24aeee32b3c5d3e77441f52d9234339 100644 (file)
@@ -1,3 +1,24 @@
+2007-03-15  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Geoff and Steve.
+        
+        - fix some portability issues with TCMalloc.
+
+        * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+        * kjs/config.h:
+        * wtf/FastMalloc.cpp:
+        (WTF::SizeClass):
+        (WTF::InitSizeClasses):
+        (WTF::TCMalloc_PageHeap::Split):
+        (WTF::TCMalloc_PageHeap::RegisterSizeClass):
+        (WTF::TCMalloc_Central_FreeList::length):
+        (WTF::TCMalloc_ThreadCache::InitTSD):
+        (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
+        * wtf/TCSpinLock.h:
+        * wtf/TCSystemAlloc.cpp:
+        (TryVirtualAlloc):
+        (TCMalloc_SystemAlloc):
+
 2007-03-15  Timothy Hatcher  <timothy@apple.com>
 
         Reviewed by John.
index a4767c6ac4c0d84227c519168b984e6a419f20a1..dea32ce527199a7f6f49ad01b25ddf071dd519c8 100644 (file)
-<?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="&quot;$(WebKitOutputDir)\obj\JavaScriptCore\$(ConfigurationName)\DerivedSources\&quot;;../../;&quot;../../os-win32/&quot;;../../pcre/;../../kjs/;../../wtf/;&quot;$(WebKitSDKDir)\include&quot;;&quot;$(WebKitSDKDir)\include\icu&quot;;../../../icu/include;../../bindings;../../bindings/c;../../bindings/jni;&quot;$(WebKitOutputDir)\include\JavaScriptCore&quot;"\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="&quot;$(WebKitOutputDir)\obj\JavaScriptCore\$(ConfigurationName)\DerivedSources\&quot;;../../;&quot;../../os-win32/&quot;;../../pcre/;../../kjs/;../../wtf/;&quot;$(WebKitSDKDir)\include&quot;;&quot;$(WebKitSDKDir)\include\icu&quot;;../../../icu/include;../../bindings;../../bindings/c;../../bindings/jni;&quot;$(WebKitOutputDir)\include\JavaScriptCore&quot;"\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="&quot;$(WebKitOutputDir)\obj\JavaScriptCore\$(ConfigurationName)\DerivedSources\&quot;;../../;&quot;../../os-win32/&quot;;../../pcre/;../../kjs/;../../wtf/;&quot;$(WebKitSDKDir)\include&quot;;&quot;$(WebKitSDKDir)\include\icu&quot;;../../../icu/include;../../bindings;../../bindings/c;../../bindings/jni;&quot;$(WebKitOutputDir)\include\JavaScriptCore&quot;;&quot;$(WebKitSDKDir)\include\pthreads&quot;"
+                               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="&quot;$(WebKitOutputDir)\obj\JavaScriptCore\$(ConfigurationName)\DerivedSources\&quot;;../../;&quot;../../os-win32/&quot;;../../pcre/;../../kjs/;../../wtf/;&quot;$(WebKitSDKDir)\include&quot;;&quot;$(WebKitSDKDir)\include\icu&quot;;../../../icu/include;../../bindings;../../bindings/c;../../bindings/jni;&quot;$(WebKitOutputDir)\include\JavaScriptCore&quot;;&quot;$(WebKitSDKDir)\include\pthreads&quot;"
+                               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>
index 56ce6d45a5595e62f3cbc7180e2f929e376bcdcd..3e007fdc4fcfec5c87bfe04bcff89abbc5c395dc 100644 (file)
@@ -47,9 +47,7 @@
 #define HAVE_FLOAT_H 1
 #define HAVE_FUNC__FINITE 1
 #define HAVE_SYS_TIMEB_H 1
-
-
-#define USE_SYSTEM_MALLOC 1
+#define HAVE_VIRTUALALLOC 1
 
 #else
 
index a6579dd7524dc9730f0c567f6c94cc9f715f3031..eb622a688aecbab063e765ac1d306daff6e2b295 100644 (file)
@@ -189,7 +189,6 @@ void fastMallocSetIsMultiThreaded()
 #include <stddef.h>
 #include <stdio.h>
 #include <string.h>
-#include <unistd.h>
 
 #if WTF_CHANGES
 namespace WTF {
@@ -328,11 +327,11 @@ static inline int LgFloor(size_t n) {
 }
 #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
@@ -349,7 +348,7 @@ static void InitSizeClasses() {
   }
 
   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);
@@ -364,7 +363,7 @@ static void InitSizeClasses() {
       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;
     }
 
@@ -818,7 +817,7 @@ Span* TCMalloc_PageHeap::Split(Span* span, Length n) {
   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);
@@ -908,7 +907,7 @@ void TCMalloc_PageHeap::RegisterSizeClass(Span* span, size_t sc) {
   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);
   }
@@ -1141,7 +1140,7 @@ class TCMalloc_Central_FreeList {
 
   // 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_;
@@ -1564,7 +1563,7 @@ void TCMalloc_ThreadCache::InitTSD() {
   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();
     }
   }
@@ -1588,7 +1587,7 @@ void* TCMalloc_ThreadCache::CreateCacheIfNecessary() {
     // 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;
       }
index 790d4eec35f2e69525c3398c1ff0715369a9faba..14c68cbee6737359b5d16cbee478584d18db8a84 100644 (file)
 #define TCMALLOC_INTERNAL_SPINLOCK_H__
 
 #include "config.h"
+
+#if (PLATFORM(X86) || PLATFORM(PPC)) && COMPILER(GCC)
+
 #include <time.h>       /* For nanosleep() */
+
 #include <sched.h>      /* For sched_yield() */
+
 #if HAVE(STDINT_H)
 #include <stdint.h>
 #elif HAVE(INTTYPES_H)
@@ -45,7 +50,6 @@
 #endif
 #include <stdlib.h>     /* for abort() */
 
-#if (PLATFORM(X86) || PLATFORM(PPC)) && COMPILER(GCC)
 static void TCMalloc_SlowLock(volatile unsigned int* lockword);
 
 // The following is a struct so that it can be initialized at compile time
index e32cb383ac86af7c9c4452c1ea2013e3c9992c37..d78ef71c16fae7dbab989d26b4a67cc854ac0aa2 100644 (file)
@@ -38,7 +38,9 @@
 #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
@@ -73,11 +75,13 @@ static bool use_devmem = false;
 #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,
@@ -172,6 +176,54 @@ static void* TryMmap(size_t size, size_t alignment) {
 
 #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;
@@ -282,10 +334,18 @@ void* TCMalloc_SystemAlloc(size_t size, size_t alignment) {
     }
 #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;
 }
index 9a65e9ac7b3c65d9b6fe43069ce46cf368cb7834..6adec0b9a5904e9fd7437969239d7dccbf5d10d1 100644 (file)
@@ -1,3 +1,9 @@
+2007-03-15  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Geoff and Steve.
+
+        * config.h: Remove unneeded hack.
+
 2007-03-15  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by john
index 55939f99c5c6da3bc3901d12ee5092fa419ec700..6383624954f2ff739e5cbe384edaf6d8530215ca 100644 (file)
@@ -53,10 +53,6 @@ typedef float CGFloat;
 #define max max
 #define min min
 
-// Hack to match configuration of JavaScriptCore.
-// Maybe there's a better way to do this.
-#define USE_SYSTEM_MALLOC 1
-
 // FIXME: Should probably just dump this eventually, but it's needed for now.
 // We get this from some system place on OS X; probably better not to use it
 // in WebCore code.