Changeset 123376 in webkit


Ignore:
Timestamp:
Jul 23, 2012 1:53:35 PM (12 years ago)
Author:
Patrick Gansterer
Message:

Move JSC::parseDate() from DateConversion to JSDateMath
https://bugs.webkit.org/show_bug.cgi?id=91982

Reviewed by Geoffrey Garen.

Moveing this function into the other files removes the dependency
on JSC spcific classes in DateConversion.{cpp|h}.

  • runtime/DateConversion.cpp:
  • runtime/DateConversion.h:

(JSC):

  • runtime/JSDateMath.cpp:

(JSC::parseDate):
(JSC):

  • runtime/JSDateMath.h:

(JSC):

Location:
trunk/Source/JavaScriptCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r123350 r123376  
     12012-07-23  Patrick Gansterer  <paroga@webkit.org>
     2
     3        Move JSC::parseDate() from DateConversion to JSDateMath
     4        https://bugs.webkit.org/show_bug.cgi?id=91982
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Moveing this function into the other files removes the dependency
     9        on JSC spcific classes in DateConversion.{cpp|h}.
     10
     11        * runtime/DateConversion.cpp:
     12        * runtime/DateConversion.h:
     13        (JSC):
     14        * runtime/JSDateMath.cpp:
     15        (JSC::parseDate):
     16        (JSC):
     17        * runtime/JSDateMath.h:
     18        (JSC):
     19
    1202012-07-23  Simon Fraser  <simon.fraser@apple.com>
    221
  • trunk/Source/JavaScriptCore/runtime/DateConversion.cpp

    r100205 r123376  
    5656namespace JSC {
    5757
    58 double parseDate(ExecState* exec, const UString &date)
    59 {
    60     if (date == exec->globalData().cachedDateString)
    61         return exec->globalData().cachedDateStringValue;
    62     double value = parseES5DateFromNullTerminatedCharacters(date.utf8().data());
    63     if (isnan(value))
    64         value = parseDateFromNullTerminatedCharacters(exec, date.utf8().data());
    65     exec->globalData().cachedDateString = date;
    66     exec->globalData().cachedDateStringValue = value;
    67     return value;
    68 }
    69 
    7058void formatDate(const GregorianDateTime &t, DateConversionBuffer& buffer)
    7159{
  • trunk/Source/JavaScriptCore/runtime/DateConversion.h

    r52028 r123376  
    4343#define DateConversion_h
    4444
    45 #include "UString.h"
    46 
    4745namespace JSC {
    4846
     
    5351typedef char DateConversionBuffer[DateConversionBufferSize];
    5452
    55 double parseDate(ExecState* exec, const UString&);
    5653void formatDate(const GregorianDateTime&, DateConversionBuffer&);
    5754void formatDateUTCVariant(const GregorianDateTime&, DateConversionBuffer&);
  • trunk/Source/JavaScriptCore/runtime/JSDateMath.cpp

    r113313 r123376  
    260260}
    261261
     262double parseDate(ExecState* exec, const UString& date)
     263{
     264    if (date == exec->globalData().cachedDateString)
     265        return exec->globalData().cachedDateStringValue;
     266    double value = parseES5DateFromNullTerminatedCharacters(date.utf8().data());
     267    if (isnan(value))
     268        value = parseDateFromNullTerminatedCharacters(exec, date.utf8().data());
     269    exec->globalData().cachedDateString = date;
     270    exec->globalData().cachedDateStringValue = value;
     271    return value;
     272}
     273
    262274} // namespace JSC
  • trunk/Source/JavaScriptCore/runtime/JSDateMath.h

    r113451 r123376  
    4949
    5050class ExecState;
     51class UString;
    5152struct GregorianDateTime;
    5253
     
    5556double getUTCOffset(ExecState*);
    5657double parseDateFromNullTerminatedCharacters(ExecState*, const char* dateString);
     58double parseDate(ExecState*, const UString&);
    5759
    5860// Intentionally overridding the default tm of the system.
Note: See TracChangeset for help on using the changeset viewer.