Ignore:
Timestamp:
Nov 12, 2007, 12:00:29 AM (18 years ago)
Author:
oliver
Message:

Add special fastZeroedMalloc function to replace a
number of fastCalloc calls where one argument was 1.

Reviewed by Darin.

This results in a 0.4% progression in SunSpider, more
than making up for the earlier regression caused by
additional overflow checks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/FastMalloc.cpp

    r27698 r27711  
    128128#endif // NDEBUG
    129129
     130#include <string.h>
     131
     132namespace WTF {
     133void *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
    130147#if FORCE_SYSTEM_MALLOC
    131148
     
    190207#include <stddef.h>
    191208#include <stdio.h>
    192 #include <string.h>
    193209#if COMPILER(MSVC)
    194210#define WIN32_LEAN_AND_MEAN
Note: See TracChangeset for help on using the changeset viewer.