Changeset 34754 in webkit for trunk/JavaScriptCore/kjs/MathObject.cpp
- Timestamp:
- Jun 23, 2008, 10:23:17 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/MathObject.cpp
r34659 r34754 21 21 #include "config.h" 22 22 #include "MathObject.h" 23 #include "MathObject.lut.h"24 23 25 24 #include "operations.h" … … 30 29 namespace KJS { 31 30 31 static JSValue* mathProtoFuncAbs(ExecState*, JSObject*, JSValue*, const ArgList&); 32 static JSValue* mathProtoFuncACos(ExecState*, JSObject*, JSValue*, const ArgList&); 33 static JSValue* mathProtoFuncASin(ExecState*, JSObject*, JSValue*, const ArgList&); 34 static JSValue* mathProtoFuncATan(ExecState*, JSObject*, JSValue*, const ArgList&); 35 static JSValue* mathProtoFuncATan2(ExecState*, JSObject*, JSValue*, const ArgList&); 36 static JSValue* mathProtoFuncCeil(ExecState*, JSObject*, JSValue*, const ArgList&); 37 static JSValue* mathProtoFuncCos(ExecState*, JSObject*, JSValue*, const ArgList&); 38 static JSValue* mathProtoFuncExp(ExecState*, JSObject*, JSValue*, const ArgList&); 39 static JSValue* mathProtoFuncFloor(ExecState*, JSObject*, JSValue*, const ArgList&); 40 static JSValue* mathProtoFuncLog(ExecState*, JSObject*, JSValue*, const ArgList&); 41 static JSValue* mathProtoFuncMax(ExecState*, JSObject*, JSValue*, const ArgList&); 42 static JSValue* mathProtoFuncMin(ExecState*, JSObject*, JSValue*, const ArgList&); 43 static JSValue* mathProtoFuncPow(ExecState*, JSObject*, JSValue*, const ArgList&); 44 static JSValue* mathProtoFuncRandom(ExecState*, JSObject*, JSValue*, const ArgList&); 45 static JSValue* mathProtoFuncRound(ExecState*, JSObject*, JSValue*, const ArgList&); 46 static JSValue* mathProtoFuncSin(ExecState*, JSObject*, JSValue*, const ArgList&); 47 static JSValue* mathProtoFuncSqrt(ExecState*, JSObject*, JSValue*, const ArgList&); 48 static JSValue* mathProtoFuncTan(ExecState*, JSObject*, JSValue*, const ArgList&); 49 50 } 51 52 #include "MathObject.lut.h" 53 54 namespace KJS { 55 32 56 // ------------------------------ MathObject -------------------------------- 33 57 … … 35 59 36 60 /* Source for MathObject.lut.h 37 @begin mathTable 2161 @begin mathTable 38 62 E MathObject::Euler DontEnum|DontDelete|ReadOnly 39 63 LN2 MathObject::Ln2 DontEnum|DontDelete|ReadOnly … … 104 128 // ------------------------------ Functions -------------------------------- 105 129 106 JSValue* mathProtoFuncAbs(ExecState* exec, JSObject*, const ArgList& args)130 JSValue* mathProtoFuncAbs(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 107 131 { 108 132 double arg = args[0]->toNumber(exec); … … 110 134 } 111 135 112 JSValue* mathProtoFuncACos(ExecState* exec, JSObject*, const ArgList& args)136 JSValue* mathProtoFuncACos(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 113 137 { 114 138 return jsNumber(exec, acos(args[0]->toNumber(exec))); 115 139 } 116 140 117 JSValue* mathProtoFuncASin(ExecState* exec, JSObject*, const ArgList& args)141 JSValue* mathProtoFuncASin(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 118 142 { 119 143 return jsNumber(exec, asin(args[0]->toNumber(exec))); 120 144 } 121 145 122 JSValue* mathProtoFuncATan(ExecState* exec, JSObject*, const ArgList& args)146 JSValue* mathProtoFuncATan(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 123 147 { 124 148 return jsNumber(exec, atan(args[0]->toNumber(exec))); 125 149 } 126 150 127 JSValue* mathProtoFuncATan2(ExecState* exec, JSObject*, const ArgList& args)151 JSValue* mathProtoFuncATan2(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 128 152 { 129 153 return jsNumber(exec, atan2(args[0]->toNumber(exec), args[1]->toNumber(exec))); 130 154 } 131 155 132 JSValue* mathProtoFuncCeil(ExecState* exec, JSObject*, const ArgList& args)156 JSValue* mathProtoFuncCeil(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 133 157 { 134 158 double arg = args[0]->toNumber(exec); … … 138 162 } 139 163 140 JSValue* mathProtoFuncCos(ExecState* exec, JSObject*, const ArgList& args)164 JSValue* mathProtoFuncCos(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 141 165 { 142 166 return jsNumber(exec, cos(args[0]->toNumber(exec))); 143 167 } 144 168 145 JSValue* mathProtoFuncExp(ExecState* exec, JSObject*, const ArgList& args)169 JSValue* mathProtoFuncExp(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 146 170 { 147 171 return jsNumber(exec, exp(args[0]->toNumber(exec))); 148 172 } 149 173 150 JSValue* mathProtoFuncFloor(ExecState* exec, JSObject*, const ArgList& args)174 JSValue* mathProtoFuncFloor(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 151 175 { 152 176 double arg = args[0]->toNumber(exec); … … 156 180 } 157 181 158 JSValue* mathProtoFuncLog(ExecState* exec, JSObject*, const ArgList& args)182 JSValue* mathProtoFuncLog(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 159 183 { 160 184 return jsNumber(exec, log(args[0]->toNumber(exec))); 161 185 } 162 186 163 JSValue* mathProtoFuncMax(ExecState* exec, JSObject*, const ArgList& args)187 JSValue* mathProtoFuncMax(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 164 188 { 165 189 unsigned argsCount = args.size(); … … 177 201 } 178 202 179 JSValue* mathProtoFuncMin(ExecState* exec, JSObject*, const ArgList& args)203 JSValue* mathProtoFuncMin(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 180 204 { 181 205 unsigned argsCount = args.size(); … … 193 217 } 194 218 195 JSValue* mathProtoFuncPow(ExecState* exec, JSObject*, const ArgList& args)219 JSValue* mathProtoFuncPow(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 196 220 { 197 221 // ECMA 15.8.2.1.13 … … 207 231 } 208 232 209 JSValue* mathProtoFuncRandom(ExecState* exec, JSObject*, const ArgList&)233 JSValue* mathProtoFuncRandom(ExecState* exec, JSObject*, JSValue*, const ArgList&) 210 234 { 211 235 #if !USE(MULTIPLE_THREADS) … … 220 244 } 221 245 222 JSValue* mathProtoFuncRound(ExecState* exec, JSObject*, const ArgList& args)246 JSValue* mathProtoFuncRound(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 223 247 { 224 248 double arg = args[0]->toNumber(exec); … … 228 252 } 229 253 230 JSValue* mathProtoFuncSin(ExecState* exec, JSObject*, const ArgList& args)254 JSValue* mathProtoFuncSin(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 231 255 { 232 256 return jsNumber(exec, sin(args[0]->toNumber(exec))); 233 257 } 234 258 235 JSValue* mathProtoFuncSqrt(ExecState* exec, JSObject*, const ArgList& args)259 JSValue* mathProtoFuncSqrt(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 236 260 { 237 261 return jsNumber(exec, sqrt(args[0]->toNumber(exec))); 238 262 } 239 263 240 JSValue* mathProtoFuncTan(ExecState* exec, JSObject*, const ArgList& args)264 JSValue* mathProtoFuncTan(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 241 265 { 242 266 return jsNumber(exec, tan(args[0]->toNumber(exec)));
Note:
See TracChangeset
for help on using the changeset viewer.