Changeset 50705 in webkit for trunk/JavaScriptCore
- Timestamp:
- Nov 9, 2009, 7:14:26 PM (16 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r50704 r50705 1 2009-11-09 Geoffrey Garen <[email protected]> 2 3 Reviewed by Sam "Home Wrecker" Weinig. 4 5 Added a tiny cache for Date parsing. 6 7 SunSpider says 1.2% faster. 8 9 * runtime/DateConversion.cpp: 10 (JSC::parseDate): Try to reuse the last parsed Date, if present. 11 12 * runtime/JSGlobalData.cpp: 13 (JSC::JSGlobalData::resetDateCache): 14 * runtime/JSGlobalData.h: Added storage for last parsed Date. Refactored 15 this code to make resetting the date cache easier. 16 17 * runtime/JSGlobalObject.h: 18 (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): Updated for 19 refactoring. 20 21 * wtf/DateMath.cpp: 22 (JSC::parseDateFromNullTerminatedCharacters): 23 * wtf/DateMath.h: Changed ExecState to be first parameter, as is the JSC custom. 24 1 25 2009-11-09 Oliver Hunt <[email protected]> 2 26 -
trunk/JavaScriptCore/runtime/DateConversion.cpp
r50608 r50705 44 44 #include "DateConversion.h" 45 45 46 #include "CallFrame.h" 46 47 #include "UString.h" 47 48 #include <wtf/DateMath.h> … … 54 55 double parseDate(ExecState* exec, const UString &date) 55 56 { 56 return parseDateFromNullTerminatedCharacters(date.UTF8String().c_str(), exec); 57 if (date == exec->globalData().cachedDateString) 58 return exec->globalData().cachedDateStringValue; 59 double value = parseDateFromNullTerminatedCharacters(exec, date.UTF8String().c_str()); 60 exec->globalData().cachedDateString = date; 61 exec->globalData().cachedDateStringValue = value; 62 return value; 57 63 } 58 64 -
trunk/JavaScriptCore/runtime/JSGlobalData.cpp
r50608 r50705 253 253 } 254 254 255 void JSGlobalData::resetDateCache() 256 { 257 cachedUTCOffset = NaN; 258 cachedDateString = UString(); 259 } 260 255 261 void JSGlobalData::startSampling() 256 262 { -
trunk/JavaScriptCore/runtime/JSGlobalData.h
r50608 r50705 156 156 double cachedUTCOffset; 157 157 158 UString cachedDateString; 159 double cachedDateStringValue; 160 158 161 #ifndef NDEBUG 159 162 bool mainThreadOnly; 160 163 #endif 164 165 void resetDateCache(); 161 166 162 167 void startSampling(); -
trunk/JavaScriptCore/runtime/JSGlobalObject.h
r50608 r50705 446 446 m_dynamicGlobalObjectSlot = dynamicGlobalObject; 447 447 448 // Reset the UTCcache between JS invocations to force the VM448 // Reset the date cache between JS invocations to force the VM 449 449 // to observe time zone changes. 450 callFrame->globalData(). cachedUTCOffset = NaN;450 callFrame->globalData().resetDateCache(); 451 451 } 452 452 } -
trunk/JavaScriptCore/wtf/DateMath.cpp
r50634 r50705 874 874 } 875 875 876 double parseDateFromNullTerminatedCharacters( const char* dateString, ExecState* exec)876 double parseDateFromNullTerminatedCharacters(ExecState* exec, const char* dateString) 877 877 { 878 878 ASSERT(exec); -
trunk/JavaScriptCore/wtf/DateMath.h
r50634 r50705 86 86 double gregorianDateTimeToMS(ExecState*, const GregorianDateTime&, double, bool inputIsUTC); 87 87 double getUTCOffset(ExecState*); 88 double parseDateFromNullTerminatedCharacters( const char* dateString, ExecState*);88 double parseDateFromNullTerminatedCharacters(ExecState*, const char* dateString); 89 89 90 90 // Intentionally overridding the default tm of the system.
Note:
See TracChangeset
for help on using the changeset viewer.