| 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 GlobalObject = global.Object; |
| 19 var InternalArray = utils.InternalArray; | 20 var InternalArray = utils.InternalArray; |
| 20 var IsFinite; | 21 var IsFinite; |
| 21 var MathAbs; | 22 var MathAbs; |
| 22 var MathFloor; | 23 var MathFloor; |
| 23 var ToNumber; | 24 var ToNumber; |
| 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; |
| (...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 | 814 |
| 814 function CreateDate(time) { | 815 function CreateDate(time) { |
| 815 var date = new GlobalDate(); | 816 var date = new GlobalDate(); |
| 816 date.setTime(time); | 817 date.setTime(time); |
| 817 return date; | 818 return date; |
| 818 } | 819 } |
| 819 | 820 |
| 820 // ------------------------------------------------------------------- | 821 // ------------------------------------------------------------------- |
| 821 | 822 |
| 822 %SetCode(GlobalDate, DateConstructor); | 823 %SetCode(GlobalDate, DateConstructor); |
| 823 %FunctionSetPrototype(GlobalDate, new GlobalDate(NAN)); | 824 %FunctionSetPrototype(GlobalDate, new GlobalObject()); |
| 824 | 825 |
| 825 // Set up non-enumerable properties of the Date object itself. | 826 // Set up non-enumerable properties of the Date object itself. |
| 826 utils.InstallFunctions(GlobalDate, DONT_ENUM, [ | 827 utils.InstallFunctions(GlobalDate, DONT_ENUM, [ |
| 827 "UTC", DateUTC, | 828 "UTC", DateUTC, |
| 828 "parse", DateParse, | 829 "parse", DateParse, |
| 829 "now", DateNow | 830 "now", DateNow |
| 830 ]); | 831 ]); |
| 831 | 832 |
| 832 // Set up non-enumerable constructor property of the Date prototype object. | 833 // Set up non-enumerable constructor property of the Date prototype object. |
| 833 %AddNamedProperty(GlobalDate.prototype, "constructor", GlobalDate, DONT_ENUM); | 834 %AddNamedProperty(GlobalDate.prototype, "constructor", GlobalDate, DONT_ENUM); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 "toUTCString", DateToUTCString, | 880 "toUTCString", DateToUTCString, |
| 880 "getYear", DateGetYear, | 881 "getYear", DateGetYear, |
| 881 "setYear", DateSetYear, | 882 "setYear", DateSetYear, |
| 882 "toISOString", DateToISOString, | 883 "toISOString", DateToISOString, |
| 883 "toJSON", DateToJSON | 884 "toJSON", DateToJSON |
| 884 ]); | 885 ]); |
| 885 | 886 |
| 886 %InstallToContext(["create_date_fun", CreateDate]); | 887 %InstallToContext(["create_date_fun", CreateDate]); |
| 887 | 888 |
| 888 }) | 889 }) |
| OLD | NEW |