Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: src/date.js

Issue 1317403002: Make Date.prototype an ordinary object (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix mozilla test Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/date.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 })
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/date.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698