Ignore:
Timestamp:
Oct 27, 2009, 4:29:40 PM (16 years ago)
Author:
[email protected]
Message:

JavaScriptCore: A little bit of refactoring in the date code.

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

  • runtime/DateConstructor.cpp:

(JSC::constructDate):

  • runtime/DateInstance.cpp:

(JSC::DateInstance::DateInstance):

  • runtime/DateInstance.h: Removed some unused functions. Changed the default

constructor to ensure that a DateInstance is always initialized.

  • runtime/DatePrototype.cpp:

(JSC::DatePrototype::DatePrototype): Pass an initializer to our constructor,
since it now requires one.

  • wtf/DateMath.cpp:

(WTF::msToGregorianDateTime): Only compute our offset from UTC if our
output will require it. Otherwise, our offset is 0.

WebKit/mac: Updated for refactoring in the date code.

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

  • WebView/WebView.mm:

(aeDescFromJSValue): Since we just want a number of milliseconds, do that
instead of something more complicated.

File:
1 edited

Legend:

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

    r50174 r50183  
    3535const ClassInfo DateInstance::info = {"Date", 0, 0, 0};
    3636
    37 DateInstance::DateInstance(NonNullPassRefPtr<Structure> structure)
     37DateInstance::DateInstance(ExecState* exec, NonNullPassRefPtr<Structure> structure)
    3838    : JSWrapperObject(structure)
    3939{
     40    setInternalValue(jsNaN(exec));
    4041}
    4142
     
    7273}
    7374
    74 bool DateInstance::getTime(GregorianDateTime& t, int& offset) const
    75 {
    76     double milli = internalNumber();
    77     if (isnan(milli))
    78         return false;
    79    
    80     msToGregorianDateTime(milli, false, t);
    81     offset = gmtoffset(t);
    82     return true;
    83 }
    84 
    85 bool DateInstance::getUTCTime(GregorianDateTime& t) const
    86 {
    87     double milli = internalNumber();
    88     if (isnan(milli))
    89         return false;
    90    
    91     msToGregorianDateTime(milli, true, t);
    92     return true;
    93 }
    94 
    95 bool DateInstance::getTime(double& milli, int& offset) const
    96 {
    97     milli = internalNumber();
    98     if (isnan(milli))
    99         return false;
    100    
    101     GregorianDateTime t;
    102     msToGregorianDateTime(milli, false, t);
    103     offset = gmtoffset(t);
    104     return true;
    105 }
    106 
    107 bool DateInstance::getUTCTime(double& milli) const
    108 {
    109     milli = internalNumber();
    110     if (isnan(milli))
    111         return false;
    112    
    113     return true;
    114 }
    115 
    11675} // namespace JSC
Note: See TracChangeset for help on using the changeset viewer.