Changeset 37845 in webkit for trunk/JavaScriptCore/kjs/MathObject.cpp
- Timestamp:
- Oct 24, 2008, 9:22:51 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/MathObject.cpp
r37747 r37845 32 32 ASSERT_CLASS_FITS_IN_CELL(MathObject); 33 33 34 static JSValue Ptr mathProtoFuncAbs(ExecState*, JSObject*, JSValuePtr, const ArgList&);35 static JSValue Ptr mathProtoFuncACos(ExecState*, JSObject*, JSValuePtr, const ArgList&);36 static JSValue Ptr mathProtoFuncASin(ExecState*, JSObject*, JSValuePtr, const ArgList&);37 static JSValue Ptr mathProtoFuncATan(ExecState*, JSObject*, JSValuePtr, const ArgList&);38 static JSValue Ptr mathProtoFuncATan2(ExecState*, JSObject*, JSValuePtr, const ArgList&);39 static JSValue Ptr mathProtoFuncCeil(ExecState*, JSObject*, JSValuePtr, const ArgList&);40 static JSValue Ptr mathProtoFuncCos(ExecState*, JSObject*, JSValuePtr, const ArgList&);41 static JSValue Ptr mathProtoFuncExp(ExecState*, JSObject*, JSValuePtr, const ArgList&);42 static JSValue Ptr mathProtoFuncFloor(ExecState*, JSObject*, JSValuePtr, const ArgList&);43 static JSValue Ptr mathProtoFuncLog(ExecState*, JSObject*, JSValuePtr, const ArgList&);44 static JSValue Ptr mathProtoFuncMax(ExecState*, JSObject*, JSValuePtr, const ArgList&);45 static JSValue Ptr mathProtoFuncMin(ExecState*, JSObject*, JSValuePtr, const ArgList&);46 static JSValue Ptr mathProtoFuncPow(ExecState*, JSObject*, JSValuePtr, const ArgList&);47 static JSValue Ptr mathProtoFuncRandom(ExecState*, JSObject*, JSValuePtr, const ArgList&);48 static JSValue Ptr mathProtoFuncRound(ExecState*, JSObject*, JSValuePtr, const ArgList&);49 static JSValue Ptr mathProtoFuncSin(ExecState*, JSObject*, JSValuePtr, const ArgList&);50 static JSValue Ptr mathProtoFuncSqrt(ExecState*, JSObject*, JSValuePtr, const ArgList&);51 static JSValue Ptr mathProtoFuncTan(ExecState*, JSObject*, JSValuePtr, const ArgList&);34 static JSValue* mathProtoFuncAbs(ExecState*, JSObject*, JSValue*, const ArgList&); 35 static JSValue* mathProtoFuncACos(ExecState*, JSObject*, JSValue*, const ArgList&); 36 static JSValue* mathProtoFuncASin(ExecState*, JSObject*, JSValue*, const ArgList&); 37 static JSValue* mathProtoFuncATan(ExecState*, JSObject*, JSValue*, const ArgList&); 38 static JSValue* mathProtoFuncATan2(ExecState*, JSObject*, JSValue*, const ArgList&); 39 static JSValue* mathProtoFuncCeil(ExecState*, JSObject*, JSValue*, const ArgList&); 40 static JSValue* mathProtoFuncCos(ExecState*, JSObject*, JSValue*, const ArgList&); 41 static JSValue* mathProtoFuncExp(ExecState*, JSObject*, JSValue*, const ArgList&); 42 static JSValue* mathProtoFuncFloor(ExecState*, JSObject*, JSValue*, const ArgList&); 43 static JSValue* mathProtoFuncLog(ExecState*, JSObject*, JSValue*, const ArgList&); 44 static JSValue* mathProtoFuncMax(ExecState*, JSObject*, JSValue*, const ArgList&); 45 static JSValue* mathProtoFuncMin(ExecState*, JSObject*, JSValue*, const ArgList&); 46 static JSValue* mathProtoFuncPow(ExecState*, JSObject*, JSValue*, const ArgList&); 47 static JSValue* mathProtoFuncRandom(ExecState*, JSObject*, JSValue*, const ArgList&); 48 static JSValue* mathProtoFuncRound(ExecState*, JSObject*, JSValue*, const ArgList&); 49 static JSValue* mathProtoFuncSin(ExecState*, JSObject*, JSValue*, const ArgList&); 50 static JSValue* mathProtoFuncSqrt(ExecState*, JSObject*, JSValue*, const ArgList&); 51 static JSValue* mathProtoFuncTan(ExecState*, JSObject*, JSValue*, const ArgList&); 52 52 53 53 } … … 113 113 // ------------------------------ Functions -------------------------------- 114 114 115 JSValue Ptr mathProtoFuncAbs(ExecState* exec, JSObject*, JSValuePtr, const ArgList& args)115 JSValue* mathProtoFuncAbs(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 116 116 { 117 117 return jsNumber(exec, fabs(args.at(exec, 0)->toNumber(exec))); 118 118 } 119 119 120 JSValue Ptr mathProtoFuncACos(ExecState* exec, JSObject*, JSValuePtr, const ArgList& args)120 JSValue* mathProtoFuncACos(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 121 121 { 122 122 return jsNumber(exec, acos(args.at(exec, 0)->toNumber(exec))); 123 123 } 124 124 125 JSValue Ptr mathProtoFuncASin(ExecState* exec, JSObject*, JSValuePtr, const ArgList& args)125 JSValue* mathProtoFuncASin(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 126 126 { 127 127 return jsNumber(exec, asin(args.at(exec, 0)->toNumber(exec))); 128 128 } 129 129 130 JSValue Ptr mathProtoFuncATan(ExecState* exec, JSObject*, JSValuePtr, const ArgList& args)130 JSValue* mathProtoFuncATan(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 131 131 { 132 132 return jsNumber(exec, atan(args.at(exec, 0)->toNumber(exec))); 133 133 } 134 134 135 JSValue Ptr mathProtoFuncATan2(ExecState* exec, JSObject*, JSValuePtr, const ArgList& args)135 JSValue* mathProtoFuncATan2(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 136 136 { 137 137 return jsNumber(exec, atan2(args.at(exec, 0)->toNumber(exec), args.at(exec, 1)->toNumber(exec))); 138 138 } 139 139 140 JSValue Ptr mathProtoFuncCeil(ExecState* exec, JSObject*, JSValuePtr, const ArgList& args)140 JSValue* mathProtoFuncCeil(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 141 141 { 142 142 return jsNumber(exec, ceil(args.at(exec, 0)->toNumber(exec))); 143 143 } 144 144 145 JSValue Ptr mathProtoFuncCos(ExecState* exec, JSObject*, JSValuePtr, const ArgList& args)145 JSValue* mathProtoFuncCos(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 146 146 { 147 147 return jsNumber(exec, cos(args.at(exec, 0)->toNumber(exec))); 148 148 } 149 149 150 JSValue Ptr mathProtoFuncExp(ExecState* exec, JSObject*, JSValuePtr, const ArgList& args)150 JSValue* mathProtoFuncExp(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 151 151 { 152 152 return jsNumber(exec, exp(args.at(exec, 0)->toNumber(exec))); 153 153 } 154 154 155 JSValue Ptr mathProtoFuncFloor(ExecState* exec, JSObject*, JSValuePtr, const ArgList& args)155 JSValue* mathProtoFuncFloor(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 156 156 { 157 157 return jsNumber(exec, floor(args.at(exec, 0)->toNumber(exec))); 158 158 } 159 159 160 JSValue Ptr mathProtoFuncLog(ExecState* exec, JSObject*, JSValuePtr, const ArgList& args)160 JSValue* mathProtoFuncLog(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 161 161 { 162 162 return jsNumber(exec, log(args.at(exec, 0)->toNumber(exec))); 163 163 } 164 164 165 JSValue Ptr mathProtoFuncMax(ExecState* exec, JSObject*, JSValuePtr, const ArgList& args)165 JSValue* mathProtoFuncMax(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 166 166 { 167 167 unsigned argsCount = args.size(); … … 179 179 } 180 180 181 JSValue Ptr mathProtoFuncMin(ExecState* exec, JSObject*, JSValuePtr, const ArgList& args)181 JSValue* mathProtoFuncMin(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 182 182 { 183 183 unsigned argsCount = args.size(); … … 195 195 } 196 196 197 JSValue Ptr mathProtoFuncPow(ExecState* exec, JSObject*, JSValuePtr, const ArgList& args)197 JSValue* mathProtoFuncPow(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 198 198 { 199 199 // ECMA 15.8.2.1.13 … … 209 209 } 210 210 211 JSValue Ptr mathProtoFuncRandom(ExecState* exec, JSObject*, JSValuePtr, const ArgList&)211 JSValue* mathProtoFuncRandom(ExecState* exec, JSObject*, JSValue*, const ArgList&) 212 212 { 213 213 #if !ENABLE(JSC_MULTIPLE_THREADS) … … 222 222 } 223 223 224 JSValue Ptr mathProtoFuncRound(ExecState* exec, JSObject*, JSValuePtr, const ArgList& args)224 JSValue* mathProtoFuncRound(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 225 225 { 226 226 double arg = args.at(exec, 0)->toNumber(exec); … … 230 230 } 231 231 232 JSValue Ptr mathProtoFuncSin(ExecState* exec, JSObject*, JSValuePtr, const ArgList& args)232 JSValue* mathProtoFuncSin(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 233 233 { 234 234 return jsNumber(exec, sin(args.at(exec, 0)->toNumber(exec))); 235 235 } 236 236 237 JSValue Ptr mathProtoFuncSqrt(ExecState* exec, JSObject*, JSValuePtr, const ArgList& args)237 JSValue* mathProtoFuncSqrt(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 238 238 { 239 239 return jsNumber(exec, sqrt(args.at(exec, 0)->toNumber(exec))); 240 240 } 241 241 242 JSValue Ptr mathProtoFuncTan(ExecState* exec, JSObject*, JSValuePtr, const ArgList& args)242 JSValue* mathProtoFuncTan(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 243 243 { 244 244 return jsNumber(exec, tan(args.at(exec, 0)->toNumber(exec)));
Note:
See TracChangeset
for help on using the changeset viewer.