source: webkit/trunk/JavaScriptCore/runtime/DateInstance.cpp@ 73091

Last change on this file since 73091 was 70496, checked in by [email protected], 15 years ago

2010-10-25 Oliver Hunt <[email protected]>

Reviewed by Gavin Barraclough.

Remove exec and globalData arguments from jsNumber
https://bugs.webkit.org/show_bug.cgi?id=48270

Remove the now unused exec and globalData arguments from jsNumber
and mechanically update all users of jsNumber.

  • API/JSValueRef.cpp: (JSValueMakeNumber):
  • bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitLoad):
  • bytecompiler/NodesCodegen.cpp: (JSC::ArrayNode::emitBytecode):
  • jit/JITArithmetic.cpp: (JSC::JIT::emit_op_mod):
  • jit/JITArithmetic32_64.cpp: (JSC::JIT::emit_op_mod):
  • jit/JITOpcodes.cpp: (JSC::JIT::emit_op_jfalse): (JSC::JIT::emit_op_jtrue):
  • jit/JITStubs.cpp: (JSC::DEFINE_STUB_FUNCTION):
  • jsc.cpp: (functionRun):
  • runtime/Arguments.cpp: (JSC::Arguments::getOwnPropertySlot): (JSC::Arguments::getOwnPropertyDescriptor):
  • runtime/ArrayConstructor.cpp: (JSC::ArrayConstructor::ArrayConstructor):
  • runtime/ArrayPrototype.cpp: (JSC::arrayProtoFuncPop): (JSC::arrayProtoFuncPush): (JSC::arrayProtoFuncShift): (JSC::arrayProtoFuncSplice): (JSC::arrayProtoFuncUnShift): (JSC::arrayProtoFuncFilter): (JSC::arrayProtoFuncMap): (JSC::arrayProtoFuncEvery): (JSC::arrayProtoFuncForEach): (JSC::arrayProtoFuncSome): (JSC::arrayProtoFuncReduce): (JSC::arrayProtoFuncReduceRight): (JSC::arrayProtoFuncIndexOf): (JSC::arrayProtoFuncLastIndexOf):
  • runtime/BooleanConstructor.cpp: (JSC::BooleanConstructor::BooleanConstructor):
  • runtime/CachedTranscendentalFunction.h: (JSC::CachedTranscendentalFunction::operator()):
  • runtime/DateConstructor.cpp: (JSC::DateConstructor::DateConstructor): (JSC::dateParse): (JSC::dateNow): (JSC::dateUTC):
  • runtime/DateInstance.cpp: (JSC::DateInstance::DateInstance):
  • runtime/DatePrototype.cpp: (JSC::dateProtoFuncGetFullYear): (JSC::dateProtoFuncGetUTCFullYear): (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::dateProtoFuncGetMilliSeconds): (JSC::dateProtoFuncGetUTCMilliseconds): (JSC::dateProtoFuncGetTimezoneOffset): (JSC::dateProtoFuncSetTime): (JSC::setNewValueFromTimeArgs): (JSC::setNewValueFromDateArgs): (JSC::dateProtoFuncSetYear): (JSC::dateProtoFuncGetYear):
  • runtime/Error.cpp: (JSC::addErrorSourceInfo): (JSC::addErrorDivotInfo):
  • runtime/ErrorConstructor.cpp: (JSC::ErrorConstructor::ErrorConstructor):
  • runtime/FunctionConstructor.cpp: (JSC::FunctionConstructor::FunctionConstructor):
  • runtime/FunctionPrototype.cpp: (JSC::FunctionPrototype::FunctionPrototype):
  • runtime/JSArray.cpp: (JSC::JSArray::getOwnPropertySlot): (JSC::JSArray::getOwnPropertyDescriptor):
  • runtime/JSByteArray.cpp: (JSC::JSByteArray::JSByteArray):
  • runtime/JSByteArray.h: (JSC::JSByteArray::getIndex):
  • runtime/JSFunction.cpp: (JSC::JSFunction::JSFunction): (JSC::JSFunction::lengthGetter): (JSC::JSFunction::getOwnPropertyDescriptor):
  • runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::reset):
  • runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncParseInt): (JSC::globalFuncParseFloat):
  • runtime/JSNumberCell.h: (JSC::JSValue::JSValue): (JSC::jsNaN): (JSC::JSValue::toJSNumber):
  • runtime/JSONObject.cpp: (JSC::unwrapBoxedPrimitive): (JSC::PropertyNameForFunctionCall::value): (JSC::JSONStringify):
  • runtime/JSString.cpp: (JSC::JSString::getStringPropertyDescriptor):
  • runtime/JSString.h: (JSC::JSString::getStringPropertySlot):
  • runtime/JSValue.h: (JSC::jsDoubleNumber): (JSC::jsNumber): (JSC::jsNaN): (JSC::JSValue::JSValue): (JSC::JSValue::toJSNumber):
  • runtime/LiteralParser.cpp: (JSC::LiteralParser::parse):
  • runtime/MathObject.cpp: (JSC::MathObject::MathObject): (JSC::mathProtoFuncAbs): (JSC::mathProtoFuncACos): (JSC::mathProtoFuncASin): (JSC::mathProtoFuncATan): (JSC::mathProtoFuncATan2): (JSC::mathProtoFuncCeil): (JSC::mathProtoFuncCos): (JSC::mathProtoFuncExp): (JSC::mathProtoFuncFloor): (JSC::mathProtoFuncLog): (JSC::mathProtoFuncMax): (JSC::mathProtoFuncMin): (JSC::mathProtoFuncPow): (JSC::mathProtoFuncRandom): (JSC::mathProtoFuncRound): (JSC::mathProtoFuncSin): (JSC::mathProtoFuncSqrt): (JSC::mathProtoFuncTan):
  • runtime/NativeErrorConstructor.cpp: (JSC::NativeErrorConstructor::NativeErrorConstructor):
  • runtime/NumberConstructor.cpp: (JSC::NumberConstructor::NumberConstructor): (JSC::numberConstructorNaNValue): (JSC::numberConstructorNegInfinity): (JSC::numberConstructorPosInfinity): (JSC::numberConstructorMaxValue): (JSC::numberConstructorMinValue): (JSC::constructWithNumberConstructor): (JSC::callNumberConstructor):
  • runtime/NumberPrototype.cpp: (JSC::NumberPrototype::NumberPrototype):
  • runtime/ObjectConstructor.cpp: (JSC::ObjectConstructor::ObjectConstructor):
  • runtime/Operations.cpp: (JSC::jsAddSlowCase):
  • runtime/Operations.h: (JSC::jsAdd):
  • runtime/PrototypeFunction.cpp: (JSC::PrototypeFunction::PrototypeFunction):
  • runtime/RegExpConstructor.cpp: (JSC::RegExpConstructor::RegExpConstructor): (JSC::RegExpMatchesArray::fillArrayInstance):
  • runtime/RegExpObject.cpp: (JSC::regExpObjectLastIndex):
  • runtime/StringConstructor.cpp: (JSC::StringConstructor::StringConstructor):
  • runtime/StringPrototype.cpp: (JSC::StringPrototype::StringPrototype): (JSC::stringProtoFuncReplace): (JSC::stringProtoFuncCharCodeAt): (JSC::stringProtoFuncIndexOf): (JSC::stringProtoFuncLastIndexOf): (JSC::stringProtoFuncSearch): (JSC::stringProtoFuncLocaleCompare):

2010-10-25 Oliver Hunt <[email protected]>

Reviewed by Gavin Barraclough.

Remove exec and globalData arguments from jsNumber
https://bugs.webkit.org/show_bug.cgi?id=48270

Don't pass exec to jsNumber

  • JSUtils.cpp: (JSObjectKJSValue):
  • UserObjectImp.cpp: (UserObjectImp::toPrimitive):

2010-10-25 Oliver Hunt <[email protected]>

Reviewed by Gavin Barraclough.

Remove exec and globalData arguments from jsNumber
https://bugs.webkit.org/show_bug.cgi?id=48270

Mechanical removal of exec parameter to jsNumber.

  • bindings/js/JSAudioConstructor.cpp: (WebCore::JSAudioConstructor::JSAudioConstructor):
  • bindings/js/JSCSSStyleDeclarationCustom.cpp: (WebCore::JSCSSStyleDeclaration::nameGetter):
  • bindings/js/JSCoordinatesCustom.cpp: (WebCore::JSCoordinates::altitude): (WebCore::JSCoordinates::altitudeAccuracy): (WebCore::JSCoordinates::heading): (WebCore::JSCoordinates::speed):
  • bindings/js/JSDOMWindowCustom.cpp: (WebCore::JSDOMWindow::setTimeout): (WebCore::JSDOMWindow::setInterval):
  • bindings/js/JSDeviceMotionEventCustom.cpp: (WebCore::createAccelerationObject): (WebCore::createRotationRateObject): (WebCore::JSDeviceMotionEvent::interval):
  • bindings/js/JSDeviceOrientationEventCustom.cpp: (WebCore::JSDeviceOrientationEvent::alpha): (WebCore::JSDeviceOrientationEvent::beta): (WebCore::JSDeviceOrientationEvent::gamma):
  • bindings/js/JSGeolocationCustom.cpp: (WebCore::JSGeolocation::watchPosition):
  • bindings/js/JSHTMLInputElementCustom.cpp: (WebCore::JSHTMLInputElement::selectionStart): (WebCore::JSHTMLInputElement::selectionEnd):
  • bindings/js/JSHTMLOptionsCollectionCustom.cpp: (WebCore::JSHTMLOptionsCollection::length):
  • bindings/js/JSIDBKeyCustom.cpp: (WebCore::toJS):
  • bindings/js/JSInjectedScriptHostCustom.cpp: (WebCore::InjectedScriptHost::createInjectedScript): (WebCore::JSInjectedScriptHost::pushNodePathToFrontend):
  • bindings/js/JSOptionConstructor.cpp: (WebCore::JSOptionConstructor::JSOptionConstructor):
  • bindings/js/JSSQLResultSetRowListCustom.cpp: (WebCore::JSSQLResultSetRowList::item):
  • bindings/js/JSSVGLengthCustom.cpp: (WebCore::JSSVGLength::value):
  • bindings/js/JSScriptProfileNodeCustom.cpp: (WebCore::JSScriptProfileNode::callUID):
  • bindings/js/JSWebGLRenderingContextCustom.cpp: (WebCore::toJS):
  • bindings/js/JSWorkerContextCustom.cpp: (WebCore::JSWorkerContext::setTimeout): (WebCore::JSWorkerContext::setInterval):
  • bindings/js/JSWorkerContextErrorHandler.cpp: (WebCore::JSWorkerContextErrorHandler::handleEvent):
  • bindings/js/ScriptFunctionCall.cpp: (WebCore::ScriptCallArgumentHandler::appendArgument):
  • bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::readTerminal):
  • bindings/scripts/CodeGeneratorJS.pm:
  • bridge/c/c_instance.cpp: (JSC::Bindings::CInstance::numberValue):
  • bridge/c/c_utility.cpp: (JSC::Bindings::convertNPVariantToValue):
  • bridge/jni/jsc/JNIBridgeJSC.cpp: (JavaField::valueFromInstance): (JavaArray::valueAt):
  • bridge/jni/jsc/JavaInstanceJSC.cpp: (JavaInstance::numberValue): (JavaInstance::invokeMethod):
  • bridge/objc/objc_instance.mm: (ObjcInstance::numberValue):
  • bridge/objc/objc_utility.mm: (JSC::Bindings::convertObjcValueToValue):
  • bridge/runtime_array.cpp: (JSC::RuntimeArray::lengthGetter):
  • bridge/runtime_method.cpp: (JSC::RuntimeMethod::lengthGetter):

2010-10-25 Oliver Hunt <[email protected]>

Reviewed by Gavin Barraclough.

Remove exec and globalData arguments from jsNumber
https://bugs.webkit.org/show_bug.cgi?id=48270

Mechanical removal of exec parameter to jsNumber

  • Plugins/Hosted/NetscapePluginInstanceProxy.mm: (WebKit::NetscapePluginInstanceProxy::demarshalValueFromArray):
  • Plugins/Hosted/ProxyInstance.mm: (WebKit::ProxyInstance::numberValue):

2010-10-25 Oliver Hunt <[email protected]>

Reviewed by Gavin Barraclough.

Remove exec and globalData arguments from jsNumber
https://bugs.webkit.org/show_bug.cgi?id=48270

Mechanical removal of exec parameter to jsNumber

  • WebProcess/Plugins/NPRuntimeObjectMap.cpp: (WebKit::NPRuntimeObjectMap::convertNPVariantToJSValue):
  • Property svn:eol-style set to native
File size: 2.6 KB
Line 
1/*
2 * Copyright (C) 1999-2000 Harri Porten ([email protected])
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
18 * USA
19 *
20 */
21
22#include "config.h"
23#include "DateInstance.h"
24
25#include "JSGlobalObject.h"
26
27#include <math.h>
28#include <wtf/DateMath.h>
29#include <wtf/MathExtras.h>
30
31using namespace WTF;
32
33namespace JSC {
34
35const ClassInfo DateInstance::info = {"Date", 0, 0, 0};
36
37DateInstance::DateInstance(ExecState*, NonNullPassRefPtr<Structure> structure)
38 : JSWrapperObject(structure)
39{
40 setInternalValue(jsNaN());
41}
42
43DateInstance::DateInstance(ExecState*, NonNullPassRefPtr<Structure> structure, double time)
44 : JSWrapperObject(structure)
45{
46 setInternalValue(jsNumber(timeClip(time)));
47}
48
49DateInstance::DateInstance(ExecState* exec, double time)
50 : JSWrapperObject(exec->lexicalGlobalObject()->dateStructure())
51{
52 setInternalValue(jsNumber(timeClip(time)));
53}
54
55const GregorianDateTime* DateInstance::calculateGregorianDateTime(ExecState* exec) const
56{
57 double milli = internalNumber();
58 if (isnan(milli))
59 return 0;
60
61 if (!m_data)
62 m_data = exec->globalData().dateInstanceCache.add(milli);
63
64 if (m_data->m_gregorianDateTimeCachedForMS != milli) {
65 msToGregorianDateTime(exec, milli, false, m_data->m_cachedGregorianDateTime);
66 m_data->m_gregorianDateTimeCachedForMS = milli;
67 }
68 return &m_data->m_cachedGregorianDateTime;
69}
70
71const GregorianDateTime* DateInstance::calculateGregorianDateTimeUTC(ExecState* exec) const
72{
73 double milli = internalNumber();
74 if (isnan(milli))
75 return 0;
76
77 if (!m_data)
78 m_data = exec->globalData().dateInstanceCache.add(milli);
79
80 if (m_data->m_gregorianDateTimeUTCCachedForMS != milli) {
81 msToGregorianDateTime(exec, milli, true, m_data->m_cachedGregorianDateTimeUTC);
82 m_data->m_gregorianDateTimeUTCCachedForMS = milli;
83 }
84 return &m_data->m_cachedGregorianDateTimeUTC;
85}
86
87} // namespace JSC
Note: See TracBrowser for help on using the repository browser.