| 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 // This file relies on the fact that the following declarations have been made | 5 // This file relies on the fact that the following declarations have been made |
| 6 // in v8natives.js: | 6 // in v8natives.js: |
| 7 // var $isFinite = GlobalIsFinite; | 7 // var $isFinite = GlobalIsFinite; |
| 8 | 8 |
| 9 var $createDate; | 9 var $createDate; |
| 10 | 10 |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 | 684 |
| 685 function PadInt(n, digits) { | 685 function PadInt(n, digits) { |
| 686 if (digits == 1) return n; | 686 if (digits == 1) return n; |
| 687 return n < %_MathPow(10, digits - 1) ? '0' + PadInt(n, digits - 1) : n; | 687 return n < %_MathPow(10, digits - 1) ? '0' + PadInt(n, digits - 1) : n; |
| 688 } | 688 } |
| 689 | 689 |
| 690 | 690 |
| 691 // ECMA 262 - 15.9.5.43 | 691 // ECMA 262 - 15.9.5.43 |
| 692 function DateToISOString() { | 692 function DateToISOString() { |
| 693 var t = UTC_DATE_VALUE(this); | 693 var t = UTC_DATE_VALUE(this); |
| 694 if (NUMBER_IS_NAN(t)) throw MakeRangeError("invalid_time_value", []); | 694 if (NUMBER_IS_NAN(t)) throw MakeRangeError(kInvalidTimeValue); |
| 695 var year = this.getUTCFullYear(); | 695 var year = this.getUTCFullYear(); |
| 696 var year_string; | 696 var year_string; |
| 697 if (year >= 0 && year <= 9999) { | 697 if (year >= 0 && year <= 9999) { |
| 698 year_string = PadInt(year, 4); | 698 year_string = PadInt(year, 4); |
| 699 } else { | 699 } else { |
| 700 if (year < 0) { | 700 if (year < 0) { |
| 701 year_string = "-" + PadInt(-year, 6); | 701 year_string = "-" + PadInt(-year, 6); |
| 702 } else { | 702 } else { |
| 703 year_string = "+" + PadInt(year, 6); | 703 year_string = "+" + PadInt(year, 6); |
| 704 } | 704 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 "getYear", DateGetYear, | 817 "getYear", DateGetYear, |
| 818 "setYear", DateSetYear, | 818 "setYear", DateSetYear, |
| 819 "toISOString", DateToISOString, | 819 "toISOString", DateToISOString, |
| 820 "toJSON", DateToJSON | 820 "toJSON", DateToJSON |
| 821 ]); | 821 ]); |
| 822 | 822 |
| 823 // Expose to the global scope. | 823 // Expose to the global scope. |
| 824 $createDate = CreateDate; | 824 $createDate = CreateDate; |
| 825 | 825 |
| 826 })(); | 826 })(); |
| OLD | NEW |