Ignore:
Timestamp:
Oct 27, 2009, 3:01:41 PM (16 years ago)
Author:
[email protected]
Message:

JavaScriptCore: https://bugs.webkit.org/show_bug.cgi?id=30800
Cache recently computed date data.

Patch by Geoffrey Garen <[email protected]> on 2009-10-27
Reviewed by Darin Adler and Oliver Hunt.

SunSpider reports a ~0.5% speedup, mostly from date-format-tofte.js.

  • runtime/DateInstance.cpp:

(JSC::DateInstance::DateInstance):
(JSC::DateInstance::getGregorianDateTime): Use the shared cache.

  • runtime/DateInstance.h: Renamed m_cache to m_data, to avoid the confusion

of a "cache cache".

  • runtime/DatePrototype.cpp:

(JSC::formatLocaleDate):
(JSC::dateProtoFuncToString):
(JSC::dateProtoFuncToUTCString):
(JSC::dateProtoFuncToISOString):
(JSC::dateProtoFuncToDateString):
(JSC::dateProtoFuncToTimeString):
(JSC::dateProtoFuncGetFullYear):
(JSC::dateProtoFuncGetUTCFullYear):
(JSC::dateProtoFuncToGMTString):
(JSC::dateProtoFuncGetMonth):
(JSC::dateProtoFuncGetUTCMonth):
(JSC::dateProtoFuncGetDate):
(JSC::dateProtoFuncGetUTCDate):
(JSC::dateProtoFuncGetDay):
(JSC::dateProtoFuncGetUTCDay):
(JSC::dateProtoFuncGetHours):
(JSC::dateProtoFuncGetUTCHours):
(JSC::dateProtoFuncGetMinutes):
(JSC::dateProtoFuncGetUTCMinutes):
(JSC::dateProtoFuncGetSeconds):
(JSC::dateProtoFuncGetUTCSeconds):
(JSC::dateProtoFuncGetTimezoneOffset):
(JSC::setNewValueFromTimeArgs):
(JSC::setNewValueFromDateArgs):
(JSC::dateProtoFuncSetYear):
(JSC::dateProtoFuncGetYear): Pass an ExecState to these functions, so they
can access the DateInstanceCache.

  • runtime/JSGlobalData.h: Keep a DateInstanceCache.

JavaScriptGlue: Updated for JavaScriptCore export changes.

Patch by Geoffrey Garen <[email protected]> on 2009-10-27
Reviewed by Oliver Hunt.

  • ForwardingHeaders/wtf/DateMath.h: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/DateInstance.h

    r49886 r50174  
    3434        DateInstance(ExecState*, double);
    3535        explicit DateInstance(NonNullPassRefPtr<Structure>);
    36         virtual ~DateInstance();
    3736
    3837        double internalNumber() const { return internalValue().uncheckedGetNumber(); }
     
    4544        static JS_EXPORTDATA const ClassInfo info;
    4645
    47         bool getGregorianDateTime(bool outputIsUTC, WTF::GregorianDateTime&) const;
     46        bool getGregorianDateTime(ExecState*, bool outputIsUTC, WTF::GregorianDateTime&) const;
    4847
    4948        static PassRefPtr<Structure> createStructure(JSValue prototype)
     
    5857        virtual const ClassInfo* classInfo() const { return &info; }
    5958
    60 
    61         struct Cache;
    62         mutable Cache* m_cache;
     59        mutable RefPtr<DateInstanceData> m_data;
    6360    };
    6461
Note: See TracChangeset for help on using the changeset viewer.