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 var $createDate; | 5 var $createDate; |
6 | 6 |
7 // ------------------------------------------------------------------- | 7 // ------------------------------------------------------------------- |
8 | 8 |
9 (function(global, utils) { | 9 (function(global, utils) { |
10 | 10 |
11 "use strict"; | 11 "use strict"; |
12 | 12 |
13 %CheckIsBootstrapping(); | 13 %CheckIsBootstrapping(); |
14 | 14 |
15 // ------------------------------------------------------------------- | 15 // ------------------------------------------------------------------- |
16 // Imports | 16 // Imports |
17 | 17 |
18 var GlobalDate = global.Date; | 18 var GlobalDate = global.Date; |
19 var InternalArray = utils.InternalArray; | 19 var InternalArray = utils.InternalArray; |
20 var IsFinite; | 20 var IsFinite; |
21 var MathAbs; | 21 var MathAbs; |
22 var MathFloor; | 22 var MathFloor; |
23 var ToNumber; | 23 var ToNumber; |
| 24 var toPrimitiveSymbol = utils.ImportNow("to_primitive_symbol"); |
24 var ToString; | 25 var ToString; |
25 | 26 |
26 utils.Import(function(from) { | 27 utils.Import(function(from) { |
27 IsFinite = from.IsFinite; | 28 IsFinite = from.IsFinite; |
28 MathAbs = from.MathAbs; | 29 MathAbs = from.MathAbs; |
29 MathFloor = from.MathFloor; | 30 MathFloor = from.MathFloor; |
30 ToNumber = from.ToNumber; | 31 ToNumber = from.ToNumber; |
31 ToString = from.ToString; | 32 ToString = from.ToString; |
32 }); | 33 }); |
33 | 34 |
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 | 841 |
841 // Set up non-enumerable properties of the Date object itself. | 842 // Set up non-enumerable properties of the Date object itself. |
842 utils.InstallFunctions(GlobalDate, DONT_ENUM, [ | 843 utils.InstallFunctions(GlobalDate, DONT_ENUM, [ |
843 "UTC", DateUTC, | 844 "UTC", DateUTC, |
844 "parse", DateParse, | 845 "parse", DateParse, |
845 "now", DateNow | 846 "now", DateNow |
846 ]); | 847 ]); |
847 | 848 |
848 // Set up non-enumerable constructor property of the Date prototype object. | 849 // Set up non-enumerable constructor property of the Date prototype object. |
849 %AddNamedProperty(GlobalDate.prototype, "constructor", GlobalDate, DONT_ENUM); | 850 %AddNamedProperty(GlobalDate.prototype, "constructor", GlobalDate, DONT_ENUM); |
850 utils.SetFunctionName(DateToPrimitive, symbolToPrimitive); | 851 utils.SetFunctionName(DateToPrimitive, toPrimitiveSymbol); |
851 %AddNamedProperty(GlobalDate.prototype, symbolToPrimitive, DateToPrimitive, | 852 %AddNamedProperty(GlobalDate.prototype, toPrimitiveSymbol, DateToPrimitive, |
852 DONT_ENUM | READ_ONLY); | 853 DONT_ENUM | READ_ONLY); |
853 | 854 |
854 // Set up non-enumerable functions of the Date prototype object and | 855 // Set up non-enumerable functions of the Date prototype object and |
855 // set their names. | 856 // set their names. |
856 utils.InstallFunctions(GlobalDate.prototype, DONT_ENUM, [ | 857 utils.InstallFunctions(GlobalDate.prototype, DONT_ENUM, [ |
857 "toString", DateToString, | 858 "toString", DateToString, |
858 "toDateString", DateToDateString, | 859 "toDateString", DateToDateString, |
859 "toTimeString", DateToTimeString, | 860 "toTimeString", DateToTimeString, |
860 "toLocaleString", DateToLocaleString, | 861 "toLocaleString", DateToLocaleString, |
861 "toLocaleDateString", DateToLocaleDateString, | 862 "toLocaleDateString", DateToLocaleDateString, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 "toUTCString", DateToUTCString, | 899 "toUTCString", DateToUTCString, |
899 "getYear", DateGetYear, | 900 "getYear", DateGetYear, |
900 "setYear", DateSetYear, | 901 "setYear", DateSetYear, |
901 "toISOString", DateToISOString, | 902 "toISOString", DateToISOString, |
902 "toJSON", DateToJSON | 903 "toJSON", DateToJSON |
903 ]); | 904 ]); |
904 | 905 |
905 %InstallToContext(["create_date_fun", CreateDate]); | 906 %InstallToContext(["create_date_fun", CreateDate]); |
906 | 907 |
907 }) | 908 }) |
OLD | NEW |