Changeset 27711 in webkit for trunk/JavaScriptCore
- Timestamp:
- Nov 12, 2007, 12:00:29 AM (18 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r27710 r27711 1 2007-11-11 Oliver Hunt <[email protected]> 2 3 Reviewed by Darin. 4 5 Add special fastZeroedMalloc function to replace a 6 number of fastCalloc calls where one argument was 1. 7 8 This results in a 0.4% progression in SunSpider, more 9 than making up for the earlier regression caused by 10 additional overflow checks. 11 12 * JavaScriptCore.exp: 13 * kjs/array_instance.cpp: 14 * kjs/property_map.cpp: 15 * wtf/FastMalloc.cpp: 16 * wtf/FastMalloc.h: 17 * wtf/HashTable.h: 18 1 19 2007-11-11 Adam Roben <[email protected]> 2 20 -
trunk/JavaScriptCore/JavaScriptCore.exp
r27695 r27711 231 231 __ZN3WTF10fastMallocEm 232 232 __ZN3WTF11fastReallocEPvm 233 __ZN3WTF16fastZeroedMallocEm 233 234 __ZN3WTF8fastFreeEPv 234 235 __ZNK3KJS11Interpreter12builtinArrayEv -
trunk/JavaScriptCore/kjs/array_instance.cpp
r27448 r27711 76 76 m_length = initialLength; 77 77 m_vectorLength = initialCapacity; 78 m_storage = static_cast<ArrayStorage*>(fast Calloc(storageSize(initialCapacity), 1));78 m_storage = static_cast<ArrayStorage*>(fastZeroedMalloc(storageSize(initialCapacity))); 79 79 80 80 Collector::reportExtraMemoryCost(initialCapacity * sizeof(JSValue*)); -
trunk/JavaScriptCore/kjs/property_map.cpp
r27678 r27711 510 510 #endif 511 511 512 m_u.table = static_cast<Table*>(fast Calloc(1,Table::allocationSize(newTableSize)));512 m_u.table = static_cast<Table*>(fastZeroedMalloc(Table::allocationSize(newTableSize))); 513 513 m_u.table->size = newTableSize; 514 514 m_u.table->sizeMask = newTableSize - 1; … … 535 535 Table* oldTable = m_u.table; 536 536 537 m_u.table = static_cast<Table*>(fast Calloc(1,Table::allocationSize(newTableSize)));537 m_u.table = static_cast<Table*>(fastZeroedMalloc(Table::allocationSize(newTableSize))); 538 538 m_u.table->size = newTableSize; 539 539 m_u.table->sizeMask = newTableSize - 1; -
trunk/JavaScriptCore/wtf/FastMalloc.cpp
r27698 r27711 128 128 #endif // NDEBUG 129 129 130 #include <string.h> 131 132 namespace WTF { 133 void *fastZeroedMalloc(size_t n) 134 { 135 void *result = fastMalloc(n); 136 if (!result) 137 return 0; 138 memset(result, 0, n); 139 #ifndef WTF_CHANGES 140 MallocHook::InvokeNewHook(result, n); 141 #endif 142 return result; 143 } 144 145 } 146 130 147 #if FORCE_SYSTEM_MALLOC 131 148 … … 190 207 #include <stddef.h> 191 208 #include <stdio.h> 192 #include <string.h>193 209 #if COMPILER(MSVC) 194 210 #define WIN32_LEAN_AND_MEAN -
trunk/JavaScriptCore/wtf/FastMalloc.h
r27297 r27711 31 31 32 32 void *fastMalloc(size_t n); 33 void *fastZeroedMalloc(size_t n); 33 34 void *fastCalloc(size_t n_elements, size_t element_size); 34 35 void fastFree(void* p); -
trunk/JavaScriptCore/wtf/HashTable.h
r27710 r27711 827 827 // gcc doesn't appear to support that 828 828 if (Traits::emptyValueIsZero) 829 return static_cast<ValueType *>(fast Calloc(size,sizeof(ValueType)));829 return static_cast<ValueType *>(fastZeroedMalloc(size * sizeof(ValueType))); 830 830 ValueType* result = static_cast<ValueType*>(fastMalloc(size * sizeof(ValueType))); 831 831 for (int i = 0; i < size; i++)
Note:
See TracChangeset
for help on using the changeset viewer.