Changeset 34754 in webkit for trunk/JavaScriptCore/kjs/date_object.cpp
- Timestamp:
- Jun 23, 2008, 10:23:17 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/date_object.cpp
r34659 r34754 22 22 #include "config.h" 23 23 #include "date_object.h" 24 #include "date_object.lut.h" 24 25 #include "DateMath.h" 25 26 #include "JSString.h" 26 27 #if HAVE(ERRNO_H) 28 #include <errno.h> 29 #endif 30 31 #if HAVE(SYS_PARAM_H) 32 #include <sys/param.h> 33 #endif 34 35 #if HAVE(SYS_TIME_H) 36 #include <sys/time.h> 37 #endif 38 39 #if HAVE(SYS_TIMEB_H) 40 #include <sys/timeb.h> 41 #endif 42 27 #include "error_object.h" 28 #include "operations.h" 43 29 #include <float.h> 44 30 #include <limits.h> … … 49 35 #include <string.h> 50 36 #include <time.h> 51 52 #include "error_object.h"53 #include "operations.h"54 #include "DateMath.h"55 56 37 #include <wtf/ASCIICType.h> 57 38 #include <wtf/Assertions.h> … … 60 41 #include <wtf/UnusedParam.h> 61 42 43 #if HAVE(ERRNO_H) 44 #include <errno.h> 45 #endif 46 47 #if HAVE(SYS_PARAM_H) 48 #include <sys/param.h> 49 #endif 50 51 #if HAVE(SYS_TIME_H) 52 #include <sys/time.h> 53 #endif 54 55 #if HAVE(SYS_TIMEB_H) 56 #include <sys/timeb.h> 57 #endif 58 62 59 #if PLATFORM(MAC) 63 60 #include <CoreFoundation/CoreFoundation.h> 64 61 #endif 65 62 66 63 using namespace WTF; 64 65 namespace KJS { 66 67 static JSValue* dateProtoFuncGetDate(ExecState*, JSObject*, JSValue*, const ArgList&); 68 static JSValue* dateProtoFuncGetDay(ExecState*, JSObject*, JSValue*, const ArgList&); 69 static JSValue* dateProtoFuncGetFullYear(ExecState*, JSObject*, JSValue*, const ArgList&); 70 static JSValue* dateProtoFuncGetHours(ExecState*, JSObject*, JSValue*, const ArgList&); 71 static JSValue* dateProtoFuncGetMilliSeconds(ExecState*, JSObject*, JSValue*, const ArgList&); 72 static JSValue* dateProtoFuncGetMinutes(ExecState*, JSObject*, JSValue*, const ArgList&); 73 static JSValue* dateProtoFuncGetMonth(ExecState*, JSObject*, JSValue*, const ArgList&); 74 static JSValue* dateProtoFuncGetSeconds(ExecState*, JSObject*, JSValue*, const ArgList&); 75 static JSValue* dateProtoFuncGetTime(ExecState*, JSObject*, JSValue*, const ArgList&); 76 static JSValue* dateProtoFuncGetTimezoneOffset(ExecState*, JSObject*, JSValue*, const ArgList&); 77 static JSValue* dateProtoFuncGetUTCDate(ExecState*, JSObject*, JSValue*, const ArgList&); 78 static JSValue* dateProtoFuncGetUTCDay(ExecState*, JSObject*, JSValue*, const ArgList&); 79 static JSValue* dateProtoFuncGetUTCFullYear(ExecState*, JSObject*, JSValue*, const ArgList&); 80 static JSValue* dateProtoFuncGetUTCHours(ExecState*, JSObject*, JSValue*, const ArgList&); 81 static JSValue* dateProtoFuncGetUTCMilliseconds(ExecState*, JSObject*, JSValue*, const ArgList&); 82 static JSValue* dateProtoFuncGetUTCMinutes(ExecState*, JSObject*, JSValue*, const ArgList&); 83 static JSValue* dateProtoFuncGetUTCMonth(ExecState*, JSObject*, JSValue*, const ArgList&); 84 static JSValue* dateProtoFuncGetUTCSeconds(ExecState*, JSObject*, JSValue*, const ArgList&); 85 static JSValue* dateProtoFuncGetYear(ExecState*, JSObject*, JSValue*, const ArgList&); 86 static JSValue* dateProtoFuncSetDate(ExecState*, JSObject*, JSValue*, const ArgList&); 87 static JSValue* dateProtoFuncSetFullYear(ExecState*, JSObject*, JSValue*, const ArgList&); 88 static JSValue* dateProtoFuncSetHours(ExecState*, JSObject*, JSValue*, const ArgList&); 89 static JSValue* dateProtoFuncSetMilliSeconds(ExecState*, JSObject*, JSValue*, const ArgList&); 90 static JSValue* dateProtoFuncSetMinutes(ExecState*, JSObject*, JSValue*, const ArgList&); 91 static JSValue* dateProtoFuncSetMonth(ExecState*, JSObject*, JSValue*, const ArgList&); 92 static JSValue* dateProtoFuncSetSeconds(ExecState*, JSObject*, JSValue*, const ArgList&); 93 static JSValue* dateProtoFuncSetTime(ExecState*, JSObject*, JSValue*, const ArgList&); 94 static JSValue* dateProtoFuncSetUTCDate(ExecState*, JSObject*, JSValue*, const ArgList&); 95 static JSValue* dateProtoFuncSetUTCFullYear(ExecState*, JSObject*, JSValue*, const ArgList&); 96 static JSValue* dateProtoFuncSetUTCHours(ExecState*, JSObject*, JSValue*, const ArgList&); 97 static JSValue* dateProtoFuncSetUTCMilliseconds(ExecState*, JSObject*, JSValue*, const ArgList&); 98 static JSValue* dateProtoFuncSetUTCMinutes(ExecState*, JSObject*, JSValue*, const ArgList&); 99 static JSValue* dateProtoFuncSetUTCMonth(ExecState*, JSObject*, JSValue*, const ArgList&); 100 static JSValue* dateProtoFuncSetUTCSeconds(ExecState*, JSObject*, JSValue*, const ArgList&); 101 static JSValue* dateProtoFuncSetYear(ExecState*, JSObject*, JSValue*, const ArgList&); 102 static JSValue* dateProtoFuncToDateString(ExecState*, JSObject*, JSValue*, const ArgList&); 103 static JSValue* dateProtoFuncToGMTString(ExecState*, JSObject*, JSValue*, const ArgList&); 104 static JSValue* dateProtoFuncToLocaleDateString(ExecState*, JSObject*, JSValue*, const ArgList&); 105 static JSValue* dateProtoFuncToLocaleString(ExecState*, JSObject*, JSValue*, const ArgList&); 106 static JSValue* dateProtoFuncToLocaleTimeString(ExecState*, JSObject*, JSValue*, const ArgList&); 107 static JSValue* dateProtoFuncToString(ExecState*, JSObject*, JSValue*, const ArgList&); 108 static JSValue* dateProtoFuncToTimeString(ExecState*, JSObject*, JSValue*, const ArgList&); 109 static JSValue* dateProtoFuncToUTCString(ExecState*, JSObject*, JSValue*, const ArgList&); 110 static JSValue* dateProtoFuncValueOf(ExecState*, JSObject*, JSValue*, const ArgList&); 111 112 } 113 114 #include "date_object.lut.h" 67 115 68 116 namespace KJS { … … 71 119 static double timeClip(double); 72 120 73 inline int gmtoffset(const GregorianDateTime& t)121 static inline int gmtoffset(const GregorianDateTime& t) 74 122 { 75 123 return t.utcOffset; 76 124 } 77 78 79 /**80 * @internal81 *82 * Class to implement all methods that are properties of the83 * Date object84 */85 class DateFunction : public InternalFunction {86 public:87 DateFunction(ExecState *, FunctionPrototype *, int i, int len, const Identifier& );88 89 virtual JSValue *callAsFunction(ExecState *, JSObject *thisObj, const ArgList &args);90 91 enum { Parse, UTC, Now };92 93 private:94 int id;95 };96 125 97 126 struct DateInstance::Cache { … … 117 146 } 118 147 119 static UString formatLocaleDate(ExecState *exec, double time, bool includeDate, bool includeTime, const ArgList &args)148 static UString formatLocaleDate(ExecState *exec, double time, bool includeDate, bool includeTime, const ArgList& args) 120 149 { 121 150 CFDateFormatterStyle dateStyle = (includeDate ? kCFDateFormatterLongStyle : kCFDateFormatterNoStyle); … … 302 331 // 303 332 // Format of member function: f([years,] [months,] [days]) 304 static bool fillStructuresUsingDateArgs(ExecState *exec, const ArgList &args, int maxArgs, double *ms, GregorianDateTime *t)333 static bool fillStructuresUsingDateArgs(ExecState *exec, const ArgList& args, int maxArgs, double *ms, GregorianDateTime *t) 305 334 { 306 335 int idx = 0; … … 369 398 bool DateInstance::getTime(GregorianDateTime &t, int &offset) const 370 399 { 371 double milli = internal Value()->getNumber();400 double milli = internalNumber(); 372 401 if (isnan(milli)) 373 402 return false; … … 380 409 bool DateInstance::getUTCTime(GregorianDateTime &t) const 381 410 { 382 double milli = internal Value()->getNumber();411 double milli = internalNumber(); 383 412 if (isnan(milli)) 384 413 return false; … … 390 419 bool DateInstance::getTime(double &milli, int &offset) const 391 420 { 392 milli = internal Value()->getNumber();421 milli = internalNumber(); 393 422 if (isnan(milli)) 394 423 return false; … … 402 431 bool DateInstance::getUTCTime(double &milli) const 403 432 { 404 milli = internal Value()->getNumber();433 milli = internalNumber(); 405 434 if (isnan(milli)) 406 435 return false; … … 420 449 421 450 /* Source for date_object.lut.h 422 FIXME LWe could use templates to simplify the UTC variants.423 @begin dateTable 61451 FIXME: We could use templates to simplify the UTC variants. 452 @begin dateTable 424 453 toString dateProtoFuncToString DontEnum|Function 0 425 454 toUTCString dateProtoFuncToUTCString DontEnum|Function 0 … … 486 515 // TODO: MakeTime (15.9.11.1) etc. ? 487 516 517 static JSValue* dateParse(ExecState*, JSObject*, JSValue*, const ArgList&); 518 static JSValue* dateNow(ExecState*, JSObject*, JSValue*, const ArgList&); 519 static JSValue* dateUTC(ExecState*, JSObject*, JSValue*, const ArgList&); 520 488 521 DateConstructor::DateConstructor(ExecState* exec, FunctionPrototype* funcProto, DatePrototype* dateProto) 489 522 : InternalFunction(funcProto, Identifier(exec, dateProto->classInfo()->className)) 490 523 { 491 524 putDirect(exec->propertyNames().prototype, dateProto, DontEnum|DontDelete|ReadOnly); 492 putDirectFunction(new (exec) DateFunction(exec, funcProto, DateFunction::Parse, 1, exec->propertyNames().parse), DontEnum); 493 putDirectFunction(new (exec) DateFunction(exec, funcProto, DateFunction::UTC, 7, exec->propertyNames().UTC), DontEnum); 494 putDirectFunction(new (exec) DateFunction(exec, funcProto, DateFunction::Now, 0, exec->propertyNames().now), DontEnum); 495 putDirect(exec, exec->propertyNames().length, 7, ReadOnly|DontDelete|DontEnum); 496 } 497 498 ConstructType DateConstructor::getConstructData(ConstructData&) 499 { 500 return ConstructTypeNative; 525 putDirectFunction(new (exec) PrototypeFunction(exec, funcProto, 1, exec->propertyNames().parse, dateParse), DontEnum); 526 putDirectFunction(new (exec) PrototypeFunction(exec, funcProto, 7, exec->propertyNames().UTC, dateUTC), DontEnum); 527 putDirectFunction(new (exec) PrototypeFunction(exec, funcProto, 0, exec->propertyNames().now, dateNow), DontEnum); 528 putDirect(exec, exec->propertyNames().length, 7, ReadOnly | DontEnum | DontDelete); 501 529 } 502 530 503 531 // ECMA 15.9.3 504 JSObject *DateConstructor::construct(ExecState *exec, const ArgList &args)532 static JSObject* constructDate(ExecState* exec, JSObject*, const ArgList& args) 505 533 { 506 534 int numArgs = args.size(); … … 512 540 } else if (numArgs == 1) { 513 541 if (args[0]->isObject(&DateInstance::info)) 514 value = static_cast<DateInstance*>(args[0])->internal Value()->toNumber(exec);542 value = static_cast<DateInstance*>(args[0])->internalNumber(); 515 543 else { 516 544 JSValue* primitive = args[0]->toPrimitive(exec); … … 549 577 } 550 578 579 ConstructType DateConstructor::getConstructData(ConstructData& constructData) 580 { 581 constructData.native.function = constructDate; 582 return ConstructTypeNative; 583 } 584 551 585 // ECMA 15.9.2 552 JSValue* DateConstructor::callAsFunction(ExecState* exec, JSObject * /*thisObj*/, const ArgList &/*args*/)586 static JSValue* callDate(ExecState* exec, JSObject*, JSValue*, const ArgList&) 553 587 { 554 588 time_t localTime = time(0); … … 559 593 } 560 594 561 // ------------------------------ DateFunction ---------------------------- 562 563 DateFunction::DateFunction(ExecState* exec, FunctionPrototype* funcProto, int i, int len, const Identifier& name) 564 : InternalFunction(funcProto, name), id(i) 565 { 566 putDirect(exec, exec->propertyNames().length, len, DontDelete|ReadOnly|DontEnum); 567 } 568 569 // ECMA 15.9.4.2 - 3 570 JSValue *DateFunction::callAsFunction(ExecState* exec, JSObject*, const ArgList& args) 571 { 572 if (id == Parse) 595 CallType DateConstructor::getCallData(CallData& callData) 596 { 597 callData.native.function = callDate; 598 return CallTypeNative; 599 } 600 601 static JSValue* dateParse(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 602 { 573 603 return jsNumber(exec, parseDate(args[0]->toString(exec))); 574 else if (id == Now) 604 } 605 606 static JSValue* dateNow(ExecState* exec, JSObject*, JSValue*, const ArgList&) 607 { 575 608 return jsNumber(exec, getCurrentUTCTime()); 576 else { // UTC 609 } 610 611 static JSValue* dateUTC(ExecState* exec, JSObject*, JSValue*, const ArgList& args) 612 { 577 613 int n = args.size(); 578 614 if (isnan(args[0]->toNumber(exec)) 579 || isnan(args[1]->toNumber(exec))580 || (n >= 3 && isnan(args[2]->toNumber(exec)))581 || (n >= 4 && isnan(args[3]->toNumber(exec)))582 || (n >= 5 && isnan(args[4]->toNumber(exec)))583 || (n >= 6 && isnan(args[5]->toNumber(exec)))584 || (n >= 7 && isnan(args[6]->toNumber(exec)))) {585 return jsNaN(exec);615 || isnan(args[1]->toNumber(exec)) 616 || (n >= 3 && isnan(args[2]->toNumber(exec))) 617 || (n >= 4 && isnan(args[3]->toNumber(exec))) 618 || (n >= 5 && isnan(args[4]->toNumber(exec))) 619 || (n >= 6 && isnan(args[5]->toNumber(exec))) 620 || (n >= 7 && isnan(args[6]->toNumber(exec)))) { 621 return jsNaN(exec); 586 622 } 587 623 … … 596 632 double ms = (n >= 7) ? args[6]->toNumber(exec) : 0; 597 633 return jsNumber(exec, gregorianDateTimeToMS(t, ms, true)); 598 }599 634 } 600 635 … … 979 1014 // Functions 980 1015 981 JSValue* dateProtoFuncToString(ExecState* exec, JSObject* thisObj, const ArgList&)982 { 983 if (!this Obj->inherits(&DateInstance::info))1016 JSValue* dateProtoFuncToString(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1017 { 1018 if (!thisValue->isObject(&DateInstance::info)) 984 1019 return throwError(exec, TypeError); 985 1020 986 1021 const bool utc = false; 987 1022 988 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 989 JSValue* v = thisDateObj->internalValue(); 990 double milli = v->toNumber(exec); 1023 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1024 double milli = thisDateObj->internalNumber(); 991 1025 if (isnan(milli)) 992 1026 return jsString(exec, "Invalid Date"); … … 997 1031 } 998 1032 999 JSValue* dateProtoFuncToUTCString(ExecState* exec, JSObject* thisObj, const ArgList&)1000 { 1001 if (!this Obj->inherits(&DateInstance::info))1033 JSValue* dateProtoFuncToUTCString(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1034 { 1035 if (!thisValue->isObject(&DateInstance::info)) 1002 1036 return throwError(exec, TypeError); 1003 1037 1004 1038 const bool utc = true; 1005 1039 1006 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1007 JSValue* v = thisDateObj->internalValue(); 1008 double milli = v->toNumber(exec); 1040 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1041 double milli = thisDateObj->internalNumber(); 1009 1042 if (isnan(milli)) 1010 1043 return jsString(exec, "Invalid Date"); … … 1015 1048 } 1016 1049 1017 JSValue* dateProtoFuncToDateString(ExecState* exec, JSObject* thisObj, const ArgList&)1018 { 1019 if (!this Obj->inherits(&DateInstance::info))1050 JSValue* dateProtoFuncToDateString(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1051 { 1052 if (!thisValue->isObject(&DateInstance::info)) 1020 1053 return throwError(exec, TypeError); 1021 1054 1022 1055 const bool utc = false; 1023 1056 1024 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1025 JSValue* v = thisDateObj->internalValue(); 1026 double milli = v->toNumber(exec); 1057 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1058 double milli = thisDateObj->internalNumber(); 1027 1059 if (isnan(milli)) 1028 1060 return jsString(exec, "Invalid Date"); … … 1033 1065 } 1034 1066 1035 JSValue* dateProtoFuncToTimeString(ExecState* exec, JSObject* thisObj, const ArgList&)1036 { 1037 if (!this Obj->inherits(&DateInstance::info))1067 JSValue* dateProtoFuncToTimeString(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1068 { 1069 if (!thisValue->isObject(&DateInstance::info)) 1038 1070 return throwError(exec, TypeError); 1039 1071 1040 1072 const bool utc = false; 1041 1073 1042 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1043 JSValue* v = thisDateObj->internalValue(); 1044 double milli = v->toNumber(exec); 1074 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1075 double milli = thisDateObj->internalNumber(); 1045 1076 if (isnan(milli)) 1046 1077 return jsString(exec, "Invalid Date"); … … 1051 1082 } 1052 1083 1053 JSValue* dateProtoFuncToLocaleString(ExecState* exec, JSObject* thisObj, const ArgList& args) 1054 { 1055 if (!thisObj->inherits(&DateInstance::info)) 1056 return throwError(exec, TypeError); 1057 1058 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1059 JSValue* v = thisDateObj->internalValue(); 1060 double milli = v->toNumber(exec); 1084 JSValue* dateProtoFuncToLocaleString(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) 1085 { 1086 if (!thisValue->isObject(&DateInstance::info)) 1087 return throwError(exec, TypeError); 1088 1089 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1090 double milli = thisDateObj->internalNumber(); 1061 1091 if (isnan(milli)) 1062 1092 return jsString(exec, "Invalid Date"); … … 1076 1106 } 1077 1107 1078 JSValue* dateProtoFuncToLocaleDateString(ExecState* exec, JSObject* thisObj, const ArgList& args) 1079 { 1080 if (!thisObj->inherits(&DateInstance::info)) 1081 return throwError(exec, TypeError); 1082 1083 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1084 JSValue* v = thisDateObj->internalValue(); 1085 double milli = v->toNumber(exec); 1108 JSValue* dateProtoFuncToLocaleDateString(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) 1109 { 1110 if (!thisValue->isObject(&DateInstance::info)) 1111 return throwError(exec, TypeError); 1112 1113 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1114 double milli = thisDateObj->internalNumber(); 1086 1115 if (isnan(milli)) 1087 1116 return jsString(exec, "Invalid Date"); … … 1101 1130 } 1102 1131 1103 JSValue* dateProtoFuncToLocaleTimeString(ExecState* exec, JSObject* thisObj, const ArgList& args) 1104 { 1105 if (!thisObj->inherits(&DateInstance::info)) 1106 return throwError(exec, TypeError); 1107 1108 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1109 JSValue* v = thisDateObj->internalValue(); 1110 double milli = v->toNumber(exec); 1132 JSValue* dateProtoFuncToLocaleTimeString(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) 1133 { 1134 if (!thisValue->isObject(&DateInstance::info)) 1135 return throwError(exec, TypeError); 1136 1137 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1138 double milli = thisDateObj->internalNumber(); 1111 1139 if (isnan(milli)) 1112 1140 return jsString(exec, "Invalid Date"); … … 1126 1154 } 1127 1155 1128 JSValue* dateProtoFuncValueOf(ExecState* exec, JSObject* thisObj, const ArgList&) 1129 { 1130 if (!thisObj->inherits(&DateInstance::info)) 1131 return throwError(exec, TypeError); 1132 1133 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1134 JSValue* v = thisDateObj->internalValue(); 1135 double milli = v->toNumber(exec); 1156 JSValue* dateProtoFuncValueOf(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1157 { 1158 if (!thisValue->isObject(&DateInstance::info)) 1159 return throwError(exec, TypeError); 1160 1161 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1162 double milli = thisDateObj->internalNumber(); 1136 1163 if (isnan(milli)) 1137 1164 return jsNaN(exec); … … 1140 1167 } 1141 1168 1142 JSValue* dateProtoFuncGetTime(ExecState* exec, JSObject* thisObj, const ArgList&) 1143 { 1144 if (!thisObj->inherits(&DateInstance::info)) 1145 return throwError(exec, TypeError); 1146 1147 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1148 JSValue* v = thisDateObj->internalValue(); 1149 double milli = v->toNumber(exec); 1169 JSValue* dateProtoFuncGetTime(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1170 { 1171 if (!thisValue->isObject(&DateInstance::info)) 1172 return throwError(exec, TypeError); 1173 1174 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1175 double milli = thisDateObj->internalNumber(); 1150 1176 if (isnan(milli)) 1151 1177 return jsNaN(exec); … … 1154 1180 } 1155 1181 1156 JSValue* dateProtoFuncGetFullYear(ExecState* exec, JSObject* thisObj, const ArgList&)1157 { 1158 if (!this Obj->inherits(&DateInstance::info))1182 JSValue* dateProtoFuncGetFullYear(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1183 { 1184 if (!thisValue->isObject(&DateInstance::info)) 1159 1185 return throwError(exec, TypeError); 1160 1186 1161 1187 const bool utc = false; 1162 1188 1163 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1164 JSValue* v = thisDateObj->internalValue(); 1165 double milli = v->toNumber(exec); 1189 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1190 double milli = thisDateObj->internalNumber(); 1166 1191 if (isnan(milli)) 1167 1192 return jsNaN(exec); … … 1172 1197 } 1173 1198 1174 JSValue* dateProtoFuncGetUTCFullYear(ExecState* exec, JSObject* thisObj, const ArgList&)1175 { 1176 if (!this Obj->inherits(&DateInstance::info))1199 JSValue* dateProtoFuncGetUTCFullYear(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1200 { 1201 if (!thisValue->isObject(&DateInstance::info)) 1177 1202 return throwError(exec, TypeError); 1178 1203 1179 1204 const bool utc = true; 1180 1205 1181 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1182 JSValue* v = thisDateObj->internalValue(); 1183 double milli = v->toNumber(exec); 1206 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1207 double milli = thisDateObj->internalNumber(); 1184 1208 if (isnan(milli)) 1185 1209 return jsNaN(exec); … … 1190 1214 } 1191 1215 1192 JSValue* dateProtoFuncToGMTString(ExecState* exec, JSObject* thisObj, const ArgList&)1193 { 1194 if (!this Obj->inherits(&DateInstance::info))1216 JSValue* dateProtoFuncToGMTString(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1217 { 1218 if (!thisValue->isObject(&DateInstance::info)) 1195 1219 return throwError(exec, TypeError); 1196 1220 1197 1221 const bool utc = true; 1198 1222 1199 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1200 JSValue* v = thisDateObj->internalValue(); 1201 double milli = v->toNumber(exec); 1223 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1224 double milli = thisDateObj->internalNumber(); 1202 1225 if (isnan(milli)) 1203 1226 return jsString(exec, "Invalid Date"); … … 1208 1231 } 1209 1232 1210 JSValue* dateProtoFuncGetMonth(ExecState* exec, JSObject* thisObj, const ArgList&)1211 { 1212 if (!this Obj->inherits(&DateInstance::info))1233 JSValue* dateProtoFuncGetMonth(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1234 { 1235 if (!thisValue->isObject(&DateInstance::info)) 1213 1236 return throwError(exec, TypeError); 1214 1237 1215 1238 const bool utc = false; 1216 1239 1217 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1218 JSValue* v = thisDateObj->internalValue(); 1219 double milli = v->toNumber(exec); 1240 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1241 double milli = thisDateObj->internalNumber(); 1220 1242 if (isnan(milli)) 1221 1243 return jsNaN(exec); … … 1226 1248 } 1227 1249 1228 JSValue* dateProtoFuncGetUTCMonth(ExecState* exec, JSObject* thisObj, const ArgList&)1229 { 1230 if (!this Obj->inherits(&DateInstance::info))1250 JSValue* dateProtoFuncGetUTCMonth(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1251 { 1252 if (!thisValue->isObject(&DateInstance::info)) 1231 1253 return throwError(exec, TypeError); 1232 1254 1233 1255 const bool utc = true; 1234 1256 1235 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1236 JSValue* v = thisDateObj->internalValue(); 1237 double milli = v->toNumber(exec); 1257 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1258 double milli = thisDateObj->internalNumber(); 1238 1259 if (isnan(milli)) 1239 1260 return jsNaN(exec); … … 1244 1265 } 1245 1266 1246 JSValue* dateProtoFuncGetDate(ExecState* exec, JSObject* thisObj, const ArgList&)1247 { 1248 if (!this Obj->inherits(&DateInstance::info))1267 JSValue* dateProtoFuncGetDate(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1268 { 1269 if (!thisValue->isObject(&DateInstance::info)) 1249 1270 return throwError(exec, TypeError); 1250 1271 1251 1272 const bool utc = false; 1252 1273 1253 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1254 JSValue* v = thisDateObj->internalValue(); 1255 double milli = v->toNumber(exec); 1274 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1275 double milli = thisDateObj->internalNumber(); 1256 1276 if (isnan(milli)) 1257 1277 return jsNaN(exec); … … 1262 1282 } 1263 1283 1264 JSValue* dateProtoFuncGetUTCDate(ExecState* exec, JSObject* thisObj, const ArgList&)1265 { 1266 if (!this Obj->inherits(&DateInstance::info))1284 JSValue* dateProtoFuncGetUTCDate(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1285 { 1286 if (!thisValue->isObject(&DateInstance::info)) 1267 1287 return throwError(exec, TypeError); 1268 1288 1269 1289 const bool utc = true; 1270 1290 1271 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1272 JSValue* v = thisDateObj->internalValue(); 1273 double milli = v->toNumber(exec); 1291 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1292 double milli = thisDateObj->internalNumber(); 1274 1293 if (isnan(milli)) 1275 1294 return jsNaN(exec); … … 1280 1299 } 1281 1300 1282 JSValue* dateProtoFuncGetDay(ExecState* exec, JSObject* thisObj, const ArgList&)1283 { 1284 if (!this Obj->inherits(&DateInstance::info))1301 JSValue* dateProtoFuncGetDay(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1302 { 1303 if (!thisValue->isObject(&DateInstance::info)) 1285 1304 return throwError(exec, TypeError); 1286 1305 1287 1306 const bool utc = false; 1288 1307 1289 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1290 JSValue* v = thisDateObj->internalValue(); 1291 double milli = v->toNumber(exec); 1308 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1309 double milli = thisDateObj->internalNumber(); 1292 1310 if (isnan(milli)) 1293 1311 return jsNaN(exec); … … 1298 1316 } 1299 1317 1300 JSValue* dateProtoFuncGetUTCDay(ExecState* exec, JSObject* thisObj, const ArgList&)1301 { 1302 if (!this Obj->inherits(&DateInstance::info))1318 JSValue* dateProtoFuncGetUTCDay(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1319 { 1320 if (!thisValue->isObject(&DateInstance::info)) 1303 1321 return throwError(exec, TypeError); 1304 1322 1305 1323 const bool utc = true; 1306 1324 1307 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1308 JSValue* v = thisDateObj->internalValue(); 1309 double milli = v->toNumber(exec); 1325 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1326 double milli = thisDateObj->internalNumber(); 1310 1327 if (isnan(milli)) 1311 1328 return jsNaN(exec); … … 1316 1333 } 1317 1334 1318 JSValue* dateProtoFuncGetHours(ExecState* exec, JSObject* thisObj, const ArgList&)1319 { 1320 if (!this Obj->inherits(&DateInstance::info))1335 JSValue* dateProtoFuncGetHours(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1336 { 1337 if (!thisValue->isObject(&DateInstance::info)) 1321 1338 return throwError(exec, TypeError); 1322 1339 1323 1340 const bool utc = false; 1324 1341 1325 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1326 JSValue* v = thisDateObj->internalValue(); 1327 double milli = v->toNumber(exec); 1342 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1343 double milli = thisDateObj->internalNumber(); 1328 1344 if (isnan(milli)) 1329 1345 return jsNaN(exec); … … 1334 1350 } 1335 1351 1336 JSValue* dateProtoFuncGetUTCHours(ExecState* exec, JSObject* thisObj, const ArgList&)1337 { 1338 if (!this Obj->inherits(&DateInstance::info))1352 JSValue* dateProtoFuncGetUTCHours(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1353 { 1354 if (!thisValue->isObject(&DateInstance::info)) 1339 1355 return throwError(exec, TypeError); 1340 1356 1341 1357 const bool utc = true; 1342 1358 1343 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1344 JSValue* v = thisDateObj->internalValue(); 1345 double milli = v->toNumber(exec); 1359 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1360 double milli = thisDateObj->internalNumber(); 1346 1361 if (isnan(milli)) 1347 1362 return jsNaN(exec); … … 1352 1367 } 1353 1368 1354 JSValue* dateProtoFuncGetMinutes(ExecState* exec, JSObject* thisObj, const ArgList&)1355 { 1356 if (!this Obj->inherits(&DateInstance::info))1369 JSValue* dateProtoFuncGetMinutes(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1370 { 1371 if (!thisValue->isObject(&DateInstance::info)) 1357 1372 return throwError(exec, TypeError); 1358 1373 1359 1374 const bool utc = false; 1360 1375 1361 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1362 JSValue* v = thisDateObj->internalValue(); 1363 double milli = v->toNumber(exec); 1376 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1377 double milli = thisDateObj->internalNumber(); 1364 1378 if (isnan(milli)) 1365 1379 return jsNaN(exec); … … 1370 1384 } 1371 1385 1372 JSValue* dateProtoFuncGetUTCMinutes(ExecState* exec, JSObject* thisObj, const ArgList&)1373 { 1374 if (!this Obj->inherits(&DateInstance::info))1386 JSValue* dateProtoFuncGetUTCMinutes(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1387 { 1388 if (!thisValue->isObject(&DateInstance::info)) 1375 1389 return throwError(exec, TypeError); 1376 1390 1377 1391 const bool utc = true; 1378 1392 1379 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1380 JSValue* v = thisDateObj->internalValue(); 1381 double milli = v->toNumber(exec); 1393 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1394 double milli = thisDateObj->internalNumber(); 1382 1395 if (isnan(milli)) 1383 1396 return jsNaN(exec); … … 1388 1401 } 1389 1402 1390 JSValue* dateProtoFuncGetSeconds(ExecState* exec, JSObject* thisObj, const ArgList&)1391 { 1392 if (!this Obj->inherits(&DateInstance::info))1403 JSValue* dateProtoFuncGetSeconds(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1404 { 1405 if (!thisValue->isObject(&DateInstance::info)) 1393 1406 return throwError(exec, TypeError); 1394 1407 1395 1408 const bool utc = false; 1396 1409 1397 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1398 JSValue* v = thisDateObj->internalValue(); 1399 double milli = v->toNumber(exec); 1410 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1411 double milli = thisDateObj->internalNumber(); 1400 1412 if (isnan(milli)) 1401 1413 return jsNaN(exec); … … 1406 1418 } 1407 1419 1408 JSValue* dateProtoFuncGetUTCSeconds(ExecState* exec, JSObject* thisObj, const ArgList&)1409 { 1410 if (!this Obj->inherits(&DateInstance::info))1420 JSValue* dateProtoFuncGetUTCSeconds(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1421 { 1422 if (!thisValue->isObject(&DateInstance::info)) 1411 1423 return throwError(exec, TypeError); 1412 1424 1413 1425 const bool utc = true; 1414 1426 1415 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1416 JSValue* v = thisDateObj->internalValue(); 1417 double milli = v->toNumber(exec); 1427 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1428 double milli = thisDateObj->internalNumber(); 1418 1429 if (isnan(milli)) 1419 1430 return jsNaN(exec); … … 1424 1435 } 1425 1436 1426 JSValue* dateProtoFuncGetMilliSeconds(ExecState* exec, JSObject* thisObj, const ArgList&) 1427 { 1428 if (!thisObj->inherits(&DateInstance::info)) 1429 return throwError(exec, TypeError); 1430 1431 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1432 JSValue* v = thisDateObj->internalValue(); 1433 double milli = v->toNumber(exec); 1437 JSValue* dateProtoFuncGetMilliSeconds(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1438 { 1439 if (!thisValue->isObject(&DateInstance::info)) 1440 return throwError(exec, TypeError); 1441 1442 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1443 double milli = thisDateObj->internalNumber(); 1434 1444 if (isnan(milli)) 1435 1445 return jsNaN(exec); … … 1440 1450 } 1441 1451 1442 JSValue* dateProtoFuncGetUTCMilliseconds(ExecState* exec, JSObject* thisObj, const ArgList&) 1443 { 1444 if (!thisObj->inherits(&DateInstance::info)) 1445 return throwError(exec, TypeError); 1446 1447 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1448 JSValue* v = thisDateObj->internalValue(); 1449 double milli = v->toNumber(exec); 1452 JSValue* dateProtoFuncGetUTCMilliseconds(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1453 { 1454 if (!thisValue->isObject(&DateInstance::info)) 1455 return throwError(exec, TypeError); 1456 1457 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1458 double milli = thisDateObj->internalNumber(); 1450 1459 if (isnan(milli)) 1451 1460 return jsNaN(exec); … … 1456 1465 } 1457 1466 1458 JSValue* dateProtoFuncGetTimezoneOffset(ExecState* exec, JSObject* thisObj, const ArgList&)1459 { 1460 if (!this Obj->inherits(&DateInstance::info))1467 JSValue* dateProtoFuncGetTimezoneOffset(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1468 { 1469 if (!thisValue->isObject(&DateInstance::info)) 1461 1470 return throwError(exec, TypeError); 1462 1471 1463 1472 const bool utc = false; 1464 1473 1465 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1466 JSValue* v = thisDateObj->internalValue(); 1467 double milli = v->toNumber(exec); 1474 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1475 double milli = thisDateObj->internalNumber(); 1468 1476 if (isnan(milli)) 1469 1477 return jsNaN(exec); … … 1474 1482 } 1475 1483 1476 JSValue* dateProtoFuncSetTime(ExecState* exec, JSObject* thisObj, const ArgList& args)1477 { 1478 if (!this Obj->inherits(&DateInstance::info))1479 return throwError(exec, TypeError); 1480 1481 DateInstance* thisDateObj = static_cast<DateInstance*>(this Obj);1484 JSValue* dateProtoFuncSetTime(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) 1485 { 1486 if (!thisValue->isObject(&DateInstance::info)) 1487 return throwError(exec, TypeError); 1488 1489 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1482 1490 1483 1491 double milli = timeClip(args[0]->toNumber(exec)); … … 1487 1495 } 1488 1496 1489 static JSValue* setNewValueFromTimeArgs(ExecState* exec, JSObject* thisObj, const ArgList& args, int numArgsToUse, bool inputIsUTC) 1490 { 1491 if (!thisObj->inherits(&DateInstance::info)) 1492 return throwError(exec, TypeError); 1493 1494 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1495 JSValue* v = thisDateObj->internalValue(); 1496 double milli = v->toNumber(exec); 1497 static JSValue* setNewValueFromTimeArgs(ExecState* exec, JSValue* thisValue, const ArgList& args, int numArgsToUse, bool inputIsUTC) 1498 { 1499 if (!thisValue->isObject(&DateInstance::info)) 1500 return throwError(exec, TypeError); 1501 1502 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1503 double milli = thisDateObj->internalNumber(); 1497 1504 1498 1505 if (args.isEmpty() || isnan(milli)) { … … 1519 1526 } 1520 1527 1521 static JSValue* setNewValueFromDateArgs(ExecState* exec, JS Object* thisObj, const ArgList& args, int numArgsToUse, bool inputIsUTC)1522 { 1523 if (!this Obj->inherits(&DateInstance::info))1524 return throwError(exec, TypeError); 1525 1526 DateInstance* thisDateObj = static_cast<DateInstance*>(this Obj);1528 static JSValue* setNewValueFromDateArgs(ExecState* exec, JSValue* thisValue, const ArgList& args, int numArgsToUse, bool inputIsUTC) 1529 { 1530 if (!thisValue->isObject(&DateInstance::info)) 1531 return throwError(exec, TypeError); 1532 1533 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1527 1534 if (args.isEmpty()) { 1528 1535 JSValue* result = jsNaN(exec); … … 1531 1538 } 1532 1539 1533 JSValue* v = thisDateObj->internalValue(); 1534 double milli = v->toNumber(exec); 1540 double milli = thisDateObj->internalNumber(); 1535 1541 double ms = 0; 1536 1542 … … 1557 1563 } 1558 1564 1559 JSValue* dateProtoFuncSetMilliSeconds(ExecState* exec, JSObject* thisObj, const ArgList& args)1565 JSValue* dateProtoFuncSetMilliSeconds(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) 1560 1566 { 1561 1567 const bool inputIsUTC = false; 1562 return setNewValueFromTimeArgs(exec, this Obj, args, 1, inputIsUTC);1563 } 1564 1565 JSValue* dateProtoFuncSetUTCMilliseconds(ExecState* exec, JSObject* thisObj, const ArgList& args)1568 return setNewValueFromTimeArgs(exec, thisValue, args, 1, inputIsUTC); 1569 } 1570 1571 JSValue* dateProtoFuncSetUTCMilliseconds(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) 1566 1572 { 1567 1573 const bool inputIsUTC = true; 1568 return setNewValueFromTimeArgs(exec, this Obj, args, 1, inputIsUTC);1569 } 1570 1571 JSValue* dateProtoFuncSetSeconds(ExecState* exec, JSObject* thisObj, const ArgList& args)1574 return setNewValueFromTimeArgs(exec, thisValue, args, 1, inputIsUTC); 1575 } 1576 1577 JSValue* dateProtoFuncSetSeconds(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) 1572 1578 { 1573 1579 const bool inputIsUTC = false; 1574 return setNewValueFromTimeArgs(exec, this Obj, args, 2, inputIsUTC);1575 } 1576 1577 JSValue* dateProtoFuncSetUTCSeconds(ExecState* exec, JSObject* thisObj, const ArgList& args)1580 return setNewValueFromTimeArgs(exec, thisValue, args, 2, inputIsUTC); 1581 } 1582 1583 JSValue* dateProtoFuncSetUTCSeconds(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) 1578 1584 { 1579 1585 const bool inputIsUTC = true; 1580 return setNewValueFromTimeArgs(exec, this Obj, args, 2, inputIsUTC);1581 } 1582 1583 JSValue* dateProtoFuncSetMinutes(ExecState* exec, JSObject* thisObj, const ArgList& args)1586 return setNewValueFromTimeArgs(exec, thisValue, args, 2, inputIsUTC); 1587 } 1588 1589 JSValue* dateProtoFuncSetMinutes(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) 1584 1590 { 1585 1591 const bool inputIsUTC = false; 1586 return setNewValueFromTimeArgs(exec, this Obj, args, 3, inputIsUTC);1587 } 1588 1589 JSValue* dateProtoFuncSetUTCMinutes(ExecState* exec, JSObject* thisObj, const ArgList& args)1592 return setNewValueFromTimeArgs(exec, thisValue, args, 3, inputIsUTC); 1593 } 1594 1595 JSValue* dateProtoFuncSetUTCMinutes(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) 1590 1596 { 1591 1597 const bool inputIsUTC = true; 1592 return setNewValueFromTimeArgs(exec, this Obj, args, 3, inputIsUTC);1593 } 1594 1595 JSValue* dateProtoFuncSetHours(ExecState* exec, JSObject* thisObj, const ArgList& args)1598 return setNewValueFromTimeArgs(exec, thisValue, args, 3, inputIsUTC); 1599 } 1600 1601 JSValue* dateProtoFuncSetHours(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) 1596 1602 { 1597 1603 const bool inputIsUTC = false; 1598 return setNewValueFromTimeArgs(exec, this Obj, args, 4, inputIsUTC);1599 } 1600 1601 JSValue* dateProtoFuncSetUTCHours(ExecState* exec, JSObject* thisObj, const ArgList& args)1604 return setNewValueFromTimeArgs(exec, thisValue, args, 4, inputIsUTC); 1605 } 1606 1607 JSValue* dateProtoFuncSetUTCHours(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) 1602 1608 { 1603 1609 const bool inputIsUTC = true; 1604 return setNewValueFromTimeArgs(exec, this Obj, args, 4, inputIsUTC);1605 } 1606 1607 JSValue* dateProtoFuncSetDate(ExecState* exec, JSObject* thisObj, const ArgList& args)1610 return setNewValueFromTimeArgs(exec, thisValue, args, 4, inputIsUTC); 1611 } 1612 1613 JSValue* dateProtoFuncSetDate(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) 1608 1614 { 1609 1615 const bool inputIsUTC = false; 1610 return setNewValueFromDateArgs(exec, this Obj, args, 1, inputIsUTC);1611 } 1612 1613 JSValue* dateProtoFuncSetUTCDate(ExecState* exec, JSObject* thisObj, const ArgList& args)1616 return setNewValueFromDateArgs(exec, thisValue, args, 1, inputIsUTC); 1617 } 1618 1619 JSValue* dateProtoFuncSetUTCDate(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) 1614 1620 { 1615 1621 const bool inputIsUTC = true; 1616 return setNewValueFromDateArgs(exec, this Obj, args, 1, inputIsUTC);1617 } 1618 1619 JSValue* dateProtoFuncSetMonth(ExecState* exec, JSObject* thisObj, const ArgList& args)1622 return setNewValueFromDateArgs(exec, thisValue, args, 1, inputIsUTC); 1623 } 1624 1625 JSValue* dateProtoFuncSetMonth(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) 1620 1626 { 1621 1627 const bool inputIsUTC = false; 1622 return setNewValueFromDateArgs(exec, this Obj, args, 2, inputIsUTC);1623 } 1624 1625 JSValue* dateProtoFuncSetUTCMonth(ExecState* exec, JSObject* thisObj, const ArgList& args)1628 return setNewValueFromDateArgs(exec, thisValue, args, 2, inputIsUTC); 1629 } 1630 1631 JSValue* dateProtoFuncSetUTCMonth(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) 1626 1632 { 1627 1633 const bool inputIsUTC = true; 1628 return setNewValueFromDateArgs(exec, this Obj, args, 2, inputIsUTC);1629 } 1630 1631 JSValue* dateProtoFuncSetFullYear(ExecState* exec, JSObject* thisObj, const ArgList& args)1634 return setNewValueFromDateArgs(exec, thisValue, args, 2, inputIsUTC); 1635 } 1636 1637 JSValue* dateProtoFuncSetFullYear(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) 1632 1638 { 1633 1639 const bool inputIsUTC = false; 1634 return setNewValueFromDateArgs(exec, this Obj, args, 3, inputIsUTC);1635 } 1636 1637 JSValue* dateProtoFuncSetUTCFullYear(ExecState* exec, JSObject* thisObj, const ArgList& args)1640 return setNewValueFromDateArgs(exec, thisValue, args, 3, inputIsUTC); 1641 } 1642 1643 JSValue* dateProtoFuncSetUTCFullYear(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) 1638 1644 { 1639 1645 const bool inputIsUTC = true; 1640 return setNewValueFromDateArgs(exec, this Obj, args, 3, inputIsUTC);1641 } 1642 1643 JSValue* dateProtoFuncSetYear(ExecState* exec, JSObject* thisObj, const ArgList& args)1644 { 1645 if (!this Obj->inherits(&DateInstance::info))1646 return setNewValueFromDateArgs(exec, thisValue, args, 3, inputIsUTC); 1647 } 1648 1649 JSValue* dateProtoFuncSetYear(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args) 1650 { 1651 if (!thisValue->isObject(&DateInstance::info)) 1646 1652 return throwError(exec, TypeError); 1647 1653 1648 1654 const bool utc = false; 1649 1655 1650 DateInstance* thisDateObj = static_cast<DateInstance*>(this Obj);1656 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1651 1657 if (args.isEmpty()) { 1652 1658 JSValue* result = jsNaN(exec); … … 1655 1661 } 1656 1662 1657 JSValue* v = thisDateObj->internalValue(); 1658 double milli = v->toNumber(exec); 1663 double milli = thisDateObj->internalNumber(); 1659 1664 double ms = 0; 1660 1665 … … 1684 1689 } 1685 1690 1686 JSValue* dateProtoFuncGetYear(ExecState* exec, JSObject* thisObj, const ArgList&)1687 { 1688 if (!this Obj->inherits(&DateInstance::info))1691 JSValue* dateProtoFuncGetYear(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList&) 1692 { 1693 if (!thisValue->isObject(&DateInstance::info)) 1689 1694 return throwError(exec, TypeError); 1690 1695 1691 1696 const bool utc = false; 1692 1697 1693 DateInstance* thisDateObj = static_cast<DateInstance*>(thisObj); 1694 JSValue* v = thisDateObj->internalValue(); 1695 double milli = v->toNumber(exec); 1698 DateInstance* thisDateObj = static_cast<DateInstance*>(thisValue); 1699 double milli = thisDateObj->internalNumber(); 1696 1700 if (isnan(milli)) 1697 1701 return jsNaN(exec);
Note:
See TracChangeset
for help on using the changeset viewer.