OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // ------------------------------------------------------------------- | 5 // ------------------------------------------------------------------- |
6 | 6 |
7 (function(global, utils) { | 7 (function(global, utils) { |
8 | 8 |
9 "use strict"; | 9 "use strict"; |
10 | 10 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 225 |
226 // ECMA 262 - 15.9.5.7 | 226 // ECMA 262 - 15.9.5.7 |
227 function DateToLocaleTimeString() { | 227 function DateToLocaleTimeString() { |
228 CHECK_DATE(this); | 228 CHECK_DATE(this); |
229 var t = UTC_DATE_VALUE(this); | 229 var t = UTC_DATE_VALUE(this); |
230 if (NUMBER_IS_NAN(t)) return kInvalidDate; | 230 if (NUMBER_IS_NAN(t)) return kInvalidDate; |
231 return TimeString(this); | 231 return TimeString(this); |
232 } | 232 } |
233 | 233 |
234 | 234 |
235 // ECMA 262 - 15.9.5.9 | |
236 function DateGetTime() { | |
237 CHECK_DATE(this); | |
238 return UTC_DATE_VALUE(this); | |
239 } | |
240 | |
241 | |
242 // ECMA 262 - 15.9.5.10 | |
243 function DateGetFullYear() { | |
244 CHECK_DATE(this); | |
245 return LOCAL_YEAR(this); | |
246 } | |
247 | |
248 | |
249 // ECMA 262 - 15.9.5.11 | |
250 function DateGetUTCFullYear() { | |
251 CHECK_DATE(this); | |
252 return UTC_YEAR(this); | |
253 } | |
254 | |
255 | |
256 // ECMA 262 - 15.9.5.12 | |
257 function DateGetMonth() { | |
258 CHECK_DATE(this); | |
259 return LOCAL_MONTH(this); | |
260 } | |
261 | |
262 | |
263 // ECMA 262 - 15.9.5.13 | |
264 function DateGetUTCMonth() { | |
265 CHECK_DATE(this); | |
266 return UTC_MONTH(this); | |
267 } | |
268 | |
269 | |
270 // ECMA 262 - 15.9.5.14 | |
271 function DateGetDate() { | |
272 CHECK_DATE(this); | |
273 return LOCAL_DAY(this); | |
274 } | |
275 | |
276 | |
277 // ECMA 262 - 15.9.5.15 | |
278 function DateGetUTCDate() { | |
279 CHECK_DATE(this); | |
280 return UTC_DAY(this); | |
281 } | |
282 | |
283 | |
284 // ECMA 262 - 15.9.5.16 | |
285 function DateGetDay() { | |
286 CHECK_DATE(this); | |
287 return LOCAL_WEEKDAY(this); | |
288 } | |
289 | |
290 | |
291 // ECMA 262 - 15.9.5.17 | |
292 function DateGetUTCDay() { | |
293 CHECK_DATE(this); | |
294 return UTC_WEEKDAY(this); | |
295 } | |
296 | |
297 | |
298 // ECMA 262 - 15.9.5.18 | |
299 function DateGetHours() { | |
300 CHECK_DATE(this); | |
301 return LOCAL_HOUR(this); | |
302 } | |
303 | |
304 | |
305 // ECMA 262 - 15.9.5.19 | |
306 function DateGetUTCHours() { | |
307 CHECK_DATE(this); | |
308 return UTC_HOUR(this); | |
309 } | |
310 | |
311 | |
312 // ECMA 262 - 15.9.5.20 | |
313 function DateGetMinutes() { | |
314 CHECK_DATE(this); | |
315 return LOCAL_MIN(this); | |
316 } | |
317 | |
318 | |
319 // ECMA 262 - 15.9.5.21 | |
320 function DateGetUTCMinutes() { | |
321 CHECK_DATE(this); | |
322 return UTC_MIN(this); | |
323 } | |
324 | |
325 | |
326 // ECMA 262 - 15.9.5.22 | |
327 function DateGetSeconds() { | |
328 CHECK_DATE(this); | |
329 return LOCAL_SEC(this); | |
330 } | |
331 | |
332 | |
333 // ECMA 262 - 15.9.5.23 | |
334 function DateGetUTCSeconds() { | |
335 CHECK_DATE(this); | |
336 return UTC_SEC(this) | |
337 } | |
338 | |
339 | |
340 // ECMA 262 - 15.9.5.24 | |
341 function DateGetMilliseconds() { | |
342 CHECK_DATE(this); | |
343 return LOCAL_MS(this); | |
344 } | |
345 | |
346 | |
347 // ECMA 262 - 15.9.5.25 | |
348 function DateGetUTCMilliseconds() { | |
349 CHECK_DATE(this); | |
350 return UTC_MS(this); | |
351 } | |
352 | |
353 | |
354 // ECMA 262 - 15.9.5.26 | |
355 function DateGetTimezoneOffset() { | |
356 CHECK_DATE(this); | |
357 return TIMEZONE_OFFSET(this); | |
358 } | |
359 | |
360 | |
361 // ECMA 262 - 15.9.5.27 | 235 // ECMA 262 - 15.9.5.27 |
362 function DateSetTime(ms) { | 236 function DateSetTime(ms) { |
363 CHECK_DATE(this); | 237 CHECK_DATE(this); |
364 SET_UTC_DATE_VALUE(this, TO_NUMBER(ms)); | 238 SET_UTC_DATE_VALUE(this, TO_NUMBER(ms)); |
365 return UTC_DATE_VALUE(this); | 239 return UTC_DATE_VALUE(this); |
366 } | 240 } |
367 | 241 |
368 | 242 |
369 // ECMA 262 - 15.9.5.28 | 243 // ECMA 262 - 15.9.5.28 |
370 function DateSetMilliseconds(ms) { | 244 function DateSetMilliseconds(ms) { |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 | 515 |
642 // Set up non-enumerable functions of the Date prototype object and | 516 // Set up non-enumerable functions of the Date prototype object and |
643 // set their names. | 517 // set their names. |
644 utils.InstallFunctions(GlobalDate.prototype, DONT_ENUM, [ | 518 utils.InstallFunctions(GlobalDate.prototype, DONT_ENUM, [ |
645 "toString", DateToString, | 519 "toString", DateToString, |
646 "toDateString", DateToDateString, | 520 "toDateString", DateToDateString, |
647 "toTimeString", DateToTimeString, | 521 "toTimeString", DateToTimeString, |
648 "toLocaleString", DateToLocaleString, | 522 "toLocaleString", DateToLocaleString, |
649 "toLocaleDateString", DateToLocaleDateString, | 523 "toLocaleDateString", DateToLocaleDateString, |
650 "toLocaleTimeString", DateToLocaleTimeString, | 524 "toLocaleTimeString", DateToLocaleTimeString, |
651 "getTime", DateGetTime, | |
652 "getFullYear", DateGetFullYear, | |
653 "getUTCFullYear", DateGetUTCFullYear, | |
654 "getMonth", DateGetMonth, | |
655 "getUTCMonth", DateGetUTCMonth, | |
656 "getDate", DateGetDate, | |
657 "getUTCDate", DateGetUTCDate, | |
658 "getDay", DateGetDay, | |
659 "getUTCDay", DateGetUTCDay, | |
660 "getHours", DateGetHours, | |
661 "getUTCHours", DateGetUTCHours, | |
662 "getMinutes", DateGetMinutes, | |
663 "getUTCMinutes", DateGetUTCMinutes, | |
664 "getSeconds", DateGetSeconds, | |
665 "getUTCSeconds", DateGetUTCSeconds, | |
666 "getMilliseconds", DateGetMilliseconds, | |
667 "getUTCMilliseconds", DateGetUTCMilliseconds, | |
668 "getTimezoneOffset", DateGetTimezoneOffset, | |
669 "setTime", DateSetTime, | 525 "setTime", DateSetTime, |
670 "setMilliseconds", DateSetMilliseconds, | 526 "setMilliseconds", DateSetMilliseconds, |
671 "setUTCMilliseconds", DateSetUTCMilliseconds, | 527 "setUTCMilliseconds", DateSetUTCMilliseconds, |
672 "setSeconds", DateSetSeconds, | 528 "setSeconds", DateSetSeconds, |
673 "setUTCSeconds", DateSetUTCSeconds, | 529 "setUTCSeconds", DateSetUTCSeconds, |
674 "setMinutes", DateSetMinutes, | 530 "setMinutes", DateSetMinutes, |
675 "setUTCMinutes", DateSetUTCMinutes, | 531 "setUTCMinutes", DateSetUTCMinutes, |
676 "setHours", DateSetHours, | 532 "setHours", DateSetHours, |
677 "setUTCHours", DateSetUTCHours, | 533 "setUTCHours", DateSetUTCHours, |
678 "setDate", DateSetDate, | 534 "setDate", DateSetDate, |
679 "setUTCDate", DateSetUTCDate, | 535 "setUTCDate", DateSetUTCDate, |
680 "setMonth", DateSetMonth, | 536 "setMonth", DateSetMonth, |
681 "setUTCMonth", DateSetUTCMonth, | 537 "setUTCMonth", DateSetUTCMonth, |
682 "setFullYear", DateSetFullYear, | 538 "setFullYear", DateSetFullYear, |
683 "setUTCFullYear", DateSetUTCFullYear, | 539 "setUTCFullYear", DateSetUTCFullYear, |
684 "toGMTString", DateToGMTString, | 540 "toGMTString", DateToGMTString, |
685 "toUTCString", DateToUTCString, | 541 "toUTCString", DateToUTCString, |
686 "getYear", DateGetYear, | 542 "getYear", DateGetYear, |
687 "setYear", DateSetYear, | 543 "setYear", DateSetYear, |
688 "toJSON", DateToJSON | 544 "toJSON", DateToJSON |
689 ]); | 545 ]); |
690 | 546 |
691 }) | 547 }) |
OLD | NEW |