source: webkit/trunk/JavaScriptCore/runtime/MathObject.cpp@ 60631

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

Bug 40094 - The return type of NativeFunction should be EncodedJSValue
On Windows & Linux, using JSVALUE32_64, EncodedJSValue is returned in registers, but JSValue is not.

Reviewed by Oliver Hunt.

JavaScriptCore:

  • API/JSCallbackFunction.cpp:

(JSC::JSCallbackFunction::call):

  • API/JSCallbackFunction.h:
  • API/JSCallbackObject.h:
  • API/JSCallbackObjectFunctions.h:

(JSC::::call):

(JSC::Interpreter::executeCall):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • jit/JITStubs.h:
  • jsc.cpp:

(functionPrint):
(functionDebug):
(functionGC):
(functionVersion):
(functionRun):
(functionLoad):
(functionCheckSyntax):
(functionSetSamplingFlags):
(functionClearSamplingFlags):
(functionReadline):
(functionQuit):

  • runtime/ArrayConstructor.cpp:

(JSC::callArrayConstructor):
(JSC::arrayConstructorIsArray):

  • runtime/ArrayPrototype.cpp:

(JSC::arrayProtoFuncToString):
(JSC::arrayProtoFuncToLocaleString):
(JSC::arrayProtoFuncJoin):
(JSC::arrayProtoFuncConcat):
(JSC::arrayProtoFuncPop):
(JSC::arrayProtoFuncPush):
(JSC::arrayProtoFuncReverse):
(JSC::arrayProtoFuncShift):
(JSC::arrayProtoFuncSlice):
(JSC::arrayProtoFuncSort):
(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::callBooleanConstructor):

  • runtime/BooleanPrototype.cpp:

(JSC::booleanProtoFuncToString):
(JSC::booleanProtoFuncValueOf):

  • runtime/CallData.h:
  • runtime/DateConstructor.cpp:

(JSC::callDate):
(JSC::dateParse):
(JSC::dateNow):
(JSC::dateUTC):

  • runtime/DatePrototype.cpp:

(JSC::dateProtoFuncToString):
(JSC::dateProtoFuncToUTCString):
(JSC::dateProtoFuncToISOString):
(JSC::dateProtoFuncToDateString):
(JSC::dateProtoFuncToTimeString):
(JSC::dateProtoFuncToLocaleString):
(JSC::dateProtoFuncToLocaleDateString):
(JSC::dateProtoFuncToLocaleTimeString):
(JSC::dateProtoFuncGetTime):
(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::dateProtoFuncGetMilliSeconds):
(JSC::dateProtoFuncGetUTCMilliseconds):
(JSC::dateProtoFuncGetTimezoneOffset):
(JSC::dateProtoFuncSetTime):
(JSC::dateProtoFuncSetMilliSeconds):
(JSC::dateProtoFuncSetUTCMilliseconds):
(JSC::dateProtoFuncSetSeconds):
(JSC::dateProtoFuncSetUTCSeconds):
(JSC::dateProtoFuncSetMinutes):
(JSC::dateProtoFuncSetUTCMinutes):
(JSC::dateProtoFuncSetHours):
(JSC::dateProtoFuncSetUTCHours):
(JSC::dateProtoFuncSetDate):
(JSC::dateProtoFuncSetUTCDate):
(JSC::dateProtoFuncSetMonth):
(JSC::dateProtoFuncSetUTCMonth):
(JSC::dateProtoFuncSetFullYear):
(JSC::dateProtoFuncSetUTCFullYear):
(JSC::dateProtoFuncSetYear):
(JSC::dateProtoFuncGetYear):
(JSC::dateProtoFuncToJSON):

  • runtime/ErrorConstructor.cpp:

(JSC::callErrorConstructor):

  • runtime/ErrorPrototype.cpp:

(JSC::errorProtoFuncToString):

  • runtime/FunctionConstructor.cpp:

(JSC::callFunctionConstructor):

  • runtime/FunctionPrototype.cpp:

(JSC::callFunctionPrototype):
(JSC::functionProtoFuncToString):
(JSC::functionProtoFuncApply):
(JSC::functionProtoFuncCall):

  • runtime/JSCell.h:

(JSC::getCallData):
(JSC::getConstructData):

  • runtime/JSFunction.cpp:

(JSC::callHostFunctionAsConstructor):

  • runtime/JSFunction.h:
  • runtime/JSGlobalObjectFunctions.cpp:

(JSC::globalFuncEval):
(JSC::globalFuncParseInt):
(JSC::globalFuncParseFloat):
(JSC::globalFuncIsNaN):
(JSC::globalFuncIsFinite):
(JSC::globalFuncDecodeURI):
(JSC::globalFuncDecodeURIComponent):
(JSC::globalFuncEncodeURI):
(JSC::globalFuncEncodeURIComponent):
(JSC::globalFuncEscape):
(JSC::globalFuncUnescape):
(JSC::globalFuncJSCPrint):

  • runtime/JSGlobalObjectFunctions.h:
  • runtime/JSONObject.cpp:

(JSC::JSONProtoFuncParse):
(JSC::JSONProtoFuncStringify):

  • runtime/JSObject.cpp:

(JSC::callDefaultValueFunction):

  • runtime/JSValue.h:
  • runtime/MathObject.cpp:

(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::callNativeErrorConstructor):

  • runtime/NumberConstructor.cpp:

(JSC::callNumberConstructor):

  • runtime/NumberPrototype.cpp:

(JSC::numberProtoFuncToString):
(JSC::numberProtoFuncToLocaleString):
(JSC::numberProtoFuncValueOf):
(JSC::numberProtoFuncToFixed):
(JSC::numberProtoFuncToExponential):
(JSC::numberProtoFuncToPrecision):

  • runtime/ObjectConstructor.cpp:

(JSC::callObjectConstructor):
(JSC::objectConstructorGetPrototypeOf):
(JSC::objectConstructorGetOwnPropertyDescriptor):
(JSC::objectConstructorGetOwnPropertyNames):
(JSC::objectConstructorKeys):
(JSC::toPropertyDescriptor):
(JSC::objectConstructorDefineProperty):
(JSC::objectConstructorDefineProperties):
(JSC::objectConstructorCreate):

  • runtime/ObjectPrototype.cpp:

(JSC::objectProtoFuncValueOf):
(JSC::objectProtoFuncHasOwnProperty):
(JSC::objectProtoFuncIsPrototypeOf):
(JSC::objectProtoFuncDefineGetter):
(JSC::objectProtoFuncDefineSetter):
(JSC::objectProtoFuncLookupGetter):
(JSC::objectProtoFuncLookupSetter):
(JSC::objectProtoFuncPropertyIsEnumerable):
(JSC::objectProtoFuncToLocaleString):
(JSC::objectProtoFuncToString):

  • runtime/ObjectPrototype.h:
  • runtime/RegExpConstructor.cpp:

(JSC::callRegExpConstructor):

  • runtime/RegExpObject.cpp:

(JSC::callRegExpObject):

  • runtime/RegExpPrototype.cpp:

(JSC::regExpProtoFuncTest):
(JSC::regExpProtoFuncExec):
(JSC::regExpProtoFuncCompile):
(JSC::regExpProtoFuncToString):

  • runtime/StringConstructor.cpp:

(JSC::stringFromCharCode):
(JSC::callStringConstructor):

  • runtime/StringPrototype.cpp:

(JSC::stringProtoFuncReplace):
(JSC::stringProtoFuncToString):
(JSC::stringProtoFuncCharAt):
(JSC::stringProtoFuncCharCodeAt):
(JSC::stringProtoFuncConcat):
(JSC::stringProtoFuncIndexOf):
(JSC::stringProtoFuncLastIndexOf):
(JSC::stringProtoFuncMatch):
(JSC::stringProtoFuncSearch):
(JSC::stringProtoFuncSlice):
(JSC::stringProtoFuncSplit):
(JSC::stringProtoFuncSubstr):
(JSC::stringProtoFuncSubstring):
(JSC::stringProtoFuncToLowerCase):
(JSC::stringProtoFuncToUpperCase):
(JSC::stringProtoFuncLocaleCompare):
(JSC::stringProtoFuncBig):
(JSC::stringProtoFuncSmall):
(JSC::stringProtoFuncBlink):
(JSC::stringProtoFuncBold):
(JSC::stringProtoFuncFixed):
(JSC::stringProtoFuncItalics):
(JSC::stringProtoFuncStrike):
(JSC::stringProtoFuncSub):
(JSC::stringProtoFuncSup):
(JSC::stringProtoFuncFontcolor):
(JSC::stringProtoFuncFontsize):
(JSC::stringProtoFuncAnchor):
(JSC::stringProtoFuncLink):
(JSC::stringProtoFuncTrim):
(JSC::stringProtoFuncTrimLeft):
(JSC::stringProtoFuncTrimRight):

JavaScriptGlue:

  • JSObject.cpp:

(nativeCallFunction):

WebCore:

  • bindings/js/JSCallbackData.cpp:

(WebCore::JSCallbackData::invokeCallback):

  • bindings/js/JSCustomXPathNSResolver.cpp:

(WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):

  • bindings/js/JSEventListener.cpp:

(WebCore::JSEventListener::handleEvent):

  • bindings/js/JSHTMLAllCollectionCustom.cpp:

(WebCore::callHTMLAllCollection):

  • bindings/js/JSHTMLCollectionCustom.cpp:

(WebCore::callHTMLCollection):

  • bindings/js/JSHTMLDocumentCustom.cpp:

(WebCore::JSHTMLDocument::open):

  • bindings/js/JSInjectedScriptHostCustom.cpp:

(WebCore::InjectedScriptHost::createInjectedScript):

  • bindings/js/JSNodeFilterCondition.cpp:

(WebCore::JSNodeFilterCondition::acceptNode):

  • bindings/js/JSNodeListCustom.cpp:

(WebCore::callNodeList):

  • bindings/js/JSPluginElementFunctions.cpp:

(WebCore::callPlugin):

  • bindings/js/ScheduledAction.cpp:

(WebCore::ScheduledAction::create):
(WebCore::ScheduledAction::executeFunctionInContext):

  • bindings/js/ScriptFunctionCall.cpp:

(WebCore::ScriptFunctionCall::call):

  • bindings/js/SerializedScriptValue.cpp:

(WebCore::SerializingTreeWalker::convertIfTerminal):

  • bindings/objc/WebScriptObject.mm:

(-[WebScriptObject callWebScriptMethod:withArguments:]):

  • bindings/scripts/CodeGeneratorJS.pm:
  • bridge/NP_jsobject.cpp:

(_NPN_InvokeDefault):
(_NPN_Invoke):
(_NPN_Construct):

  • bridge/jni/jni_jsobject.mm:

(JavaJSObject::call):

  • bridge/objc/objc_runtime.mm:

(JSC::Bindings::callObjCFallbackObject):

  • bridge/runtime_method.cpp:

(JSC::callRuntimeMethod):

  • bridge/runtime_object.cpp:

(JSC::Bindings::callRuntimeObject):

WebKit/mac:

  • Plugins/Hosted/NetscapePluginInstanceProxy.h:
  • Plugins/Hosted/NetscapePluginInstanceProxy.mm:

(WebKit::NetscapePluginInstanceProxy::invoke):

  • Property svn:eol-style set to native
File size: 9.2 KB
Line 
1/*
2 * Copyright (C) 1999-2000 Harri Porten ([email protected])
3 * Copyright (C) 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 USA
18 *
19 */
20
21#include "config.h"
22#include "MathObject.h"
23
24#include "Lookup.h"
25#include "ObjectPrototype.h"
26#include "Operations.h"
27#include <time.h>
28#include <wtf/Assertions.h>
29#include <wtf/MathExtras.h>
30#include <wtf/RandomNumber.h>
31#include <wtf/RandomNumberSeed.h>
32
33namespace JSC {
34
35ASSERT_CLASS_FITS_IN_CELL(MathObject);
36
37static EncodedJSValue JSC_HOST_CALL mathProtoFuncAbs(ExecState*);
38static EncodedJSValue JSC_HOST_CALL mathProtoFuncACos(ExecState*);
39static EncodedJSValue JSC_HOST_CALL mathProtoFuncASin(ExecState*);
40static EncodedJSValue JSC_HOST_CALL mathProtoFuncATan(ExecState*);
41static EncodedJSValue JSC_HOST_CALL mathProtoFuncATan2(ExecState*);
42static EncodedJSValue JSC_HOST_CALL mathProtoFuncCeil(ExecState*);
43static EncodedJSValue JSC_HOST_CALL mathProtoFuncCos(ExecState*);
44static EncodedJSValue JSC_HOST_CALL mathProtoFuncExp(ExecState*);
45static EncodedJSValue JSC_HOST_CALL mathProtoFuncFloor(ExecState*);
46static EncodedJSValue JSC_HOST_CALL mathProtoFuncLog(ExecState*);
47static EncodedJSValue JSC_HOST_CALL mathProtoFuncMax(ExecState*);
48static EncodedJSValue JSC_HOST_CALL mathProtoFuncMin(ExecState*);
49static EncodedJSValue JSC_HOST_CALL mathProtoFuncPow(ExecState*);
50static EncodedJSValue JSC_HOST_CALL mathProtoFuncRandom(ExecState*);
51static EncodedJSValue JSC_HOST_CALL mathProtoFuncRound(ExecState*);
52static EncodedJSValue JSC_HOST_CALL mathProtoFuncSin(ExecState*);
53static EncodedJSValue JSC_HOST_CALL mathProtoFuncSqrt(ExecState*);
54static EncodedJSValue JSC_HOST_CALL mathProtoFuncTan(ExecState*);
55
56}
57
58#include "MathObject.lut.h"
59
60namespace JSC {
61
62// ------------------------------ MathObject --------------------------------
63
64const ClassInfo MathObject::info = { "Math", 0, 0, ExecState::mathTable };
65
66/* Source for MathObject.lut.h
67@begin mathTable
68 abs mathProtoFuncAbs DontEnum|Function 1
69 acos mathProtoFuncACos DontEnum|Function 1
70 asin mathProtoFuncASin DontEnum|Function 1
71 atan mathProtoFuncATan DontEnum|Function 1
72 atan2 mathProtoFuncATan2 DontEnum|Function 2
73 ceil mathProtoFuncCeil DontEnum|Function 1
74 cos mathProtoFuncCos DontEnum|Function 1
75 exp mathProtoFuncExp DontEnum|Function 1
76 floor mathProtoFuncFloor DontEnum|Function 1
77 log mathProtoFuncLog DontEnum|Function 1
78 max mathProtoFuncMax DontEnum|Function 2
79 min mathProtoFuncMin DontEnum|Function 2
80 pow mathProtoFuncPow DontEnum|Function 2
81 random mathProtoFuncRandom DontEnum|Function 0
82 round mathProtoFuncRound DontEnum|Function 1
83 sin mathProtoFuncSin DontEnum|Function 1
84 sqrt mathProtoFuncSqrt DontEnum|Function 1
85 tan mathProtoFuncTan DontEnum|Function 1
86@end
87*/
88
89MathObject::MathObject(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure)
90 : JSObjectWithGlobalObject(globalObject, structure)
91{
92 putDirectWithoutTransition(Identifier(exec, "E"), jsNumber(exec, exp(1.0)), DontDelete | DontEnum | ReadOnly);
93 putDirectWithoutTransition(Identifier(exec, "LN2"), jsNumber(exec, log(2.0)), DontDelete | DontEnum | ReadOnly);
94 putDirectWithoutTransition(Identifier(exec, "LN10"), jsNumber(exec, log(10.0)), DontDelete | DontEnum | ReadOnly);
95 putDirectWithoutTransition(Identifier(exec, "LOG2E"), jsNumber(exec, 1.0 / log(2.0)), DontDelete | DontEnum | ReadOnly);
96 putDirectWithoutTransition(Identifier(exec, "LOG10E"), jsNumber(exec, 1.0 / log(10.0)), DontDelete | DontEnum | ReadOnly);
97 putDirectWithoutTransition(Identifier(exec, "PI"), jsNumber(exec, piDouble), DontDelete | DontEnum | ReadOnly);
98 putDirectWithoutTransition(Identifier(exec, "SQRT1_2"), jsNumber(exec, sqrt(0.5)), DontDelete | DontEnum | ReadOnly);
99 putDirectWithoutTransition(Identifier(exec, "SQRT2"), jsNumber(exec, sqrt(2.0)), DontDelete | DontEnum | ReadOnly);
100}
101
102// ECMA 15.8
103
104bool MathObject::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot &slot)
105{
106 return getStaticFunctionSlot<JSObject>(exec, ExecState::mathTable(exec), this, propertyName, slot);
107}
108
109bool MathObject::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
110{
111 return getStaticFunctionDescriptor<JSObject>(exec, ExecState::mathTable(exec), this, propertyName, descriptor);
112}
113
114// ------------------------------ Functions --------------------------------
115
116EncodedJSValue JSC_HOST_CALL mathProtoFuncAbs(ExecState* exec)
117{
118 return JSValue::encode(jsNumber(exec, fabs(exec->argument(0).toNumber(exec))));
119}
120
121EncodedJSValue JSC_HOST_CALL mathProtoFuncACos(ExecState* exec)
122{
123 return JSValue::encode(jsDoubleNumber(exec, acos(exec->argument(0).toNumber(exec))));
124}
125
126EncodedJSValue JSC_HOST_CALL mathProtoFuncASin(ExecState* exec)
127{
128 return JSValue::encode(jsDoubleNumber(exec, asin(exec->argument(0).toNumber(exec))));
129}
130
131EncodedJSValue JSC_HOST_CALL mathProtoFuncATan(ExecState* exec)
132{
133 return JSValue::encode(jsDoubleNumber(exec, atan(exec->argument(0).toNumber(exec))));
134}
135
136EncodedJSValue JSC_HOST_CALL mathProtoFuncATan2(ExecState* exec)
137{
138 return JSValue::encode(jsDoubleNumber(exec, atan2(exec->argument(0).toNumber(exec), exec->argument(1).toNumber(exec))));
139}
140
141EncodedJSValue JSC_HOST_CALL mathProtoFuncCeil(ExecState* exec)
142{
143 return JSValue::encode(jsNumber(exec, ceil(exec->argument(0).toNumber(exec))));
144}
145
146EncodedJSValue JSC_HOST_CALL mathProtoFuncCos(ExecState* exec)
147{
148 return JSValue::encode(jsDoubleNumber(exec, cos(exec->argument(0).toNumber(exec))));
149}
150
151EncodedJSValue JSC_HOST_CALL mathProtoFuncExp(ExecState* exec)
152{
153 return JSValue::encode(jsDoubleNumber(exec, exp(exec->argument(0).toNumber(exec))));
154}
155
156EncodedJSValue JSC_HOST_CALL mathProtoFuncFloor(ExecState* exec)
157{
158 return JSValue::encode(jsNumber(exec, floor(exec->argument(0).toNumber(exec))));
159}
160
161EncodedJSValue JSC_HOST_CALL mathProtoFuncLog(ExecState* exec)
162{
163 return JSValue::encode(jsDoubleNumber(exec, log(exec->argument(0).toNumber(exec))));
164}
165
166EncodedJSValue JSC_HOST_CALL mathProtoFuncMax(ExecState* exec)
167{
168 unsigned argsCount = exec->argumentCount();
169 double result = -Inf;
170 for (unsigned k = 0; k < argsCount; ++k) {
171 double val = exec->argument(k).toNumber(exec);
172 if (isnan(val)) {
173 result = NaN;
174 break;
175 }
176 if (val > result || (val == 0 && result == 0 && !signbit(val)))
177 result = val;
178 }
179 return JSValue::encode(jsNumber(exec, result));
180}
181
182EncodedJSValue JSC_HOST_CALL mathProtoFuncMin(ExecState* exec)
183{
184 unsigned argsCount = exec->argumentCount();
185 double result = +Inf;
186 for (unsigned k = 0; k < argsCount; ++k) {
187 double val = exec->argument(k).toNumber(exec);
188 if (isnan(val)) {
189 result = NaN;
190 break;
191 }
192 if (val < result || (val == 0 && result == 0 && signbit(val)))
193 result = val;
194 }
195 return JSValue::encode(jsNumber(exec, result));
196}
197
198EncodedJSValue JSC_HOST_CALL mathProtoFuncPow(ExecState* exec)
199{
200 // ECMA 15.8.2.1.13
201
202 double arg = exec->argument(0).toNumber(exec);
203 double arg2 = exec->argument(1).toNumber(exec);
204
205 if (isnan(arg2))
206 return JSValue::encode(jsNaN(exec));
207 if (isinf(arg2) && fabs(arg) == 1)
208 return JSValue::encode(jsNaN(exec));
209 return JSValue::encode(jsNumber(exec, pow(arg, arg2)));
210}
211
212EncodedJSValue JSC_HOST_CALL mathProtoFuncRandom(ExecState* exec)
213{
214 return JSValue::encode(jsDoubleNumber(exec, exec->globalData().weakRandom.get()));
215}
216
217EncodedJSValue JSC_HOST_CALL mathProtoFuncRound(ExecState* exec)
218{
219 double arg = exec->argument(0).toNumber(exec);
220 double integer = ceil(arg);
221 return JSValue::encode(jsNumber(exec, integer - (integer - arg > 0.5)));
222}
223
224EncodedJSValue JSC_HOST_CALL mathProtoFuncSin(ExecState* exec)
225{
226 return JSValue::encode(exec->globalData().cachedSin(exec, exec->argument(0).toNumber(exec)));
227}
228
229EncodedJSValue JSC_HOST_CALL mathProtoFuncSqrt(ExecState* exec)
230{
231 return JSValue::encode(jsDoubleNumber(exec, sqrt(exec->argument(0).toNumber(exec))));
232}
233
234EncodedJSValue JSC_HOST_CALL mathProtoFuncTan(ExecState* exec)
235{
236 return JSValue::encode(jsDoubleNumber(exec, tan(exec->argument(0).toNumber(exec))));
237}
238
239} // namespace JSC
Note: See TracBrowser for help on using the repository browser.