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/js/macros.py

Issue 1574223002: Revert of [builtins] Refactor the remaining Date builtins. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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 | « src/js/json.js ('k') | src/objects.h » ('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-2009 the V8 project authors. All rights reserved. 1 # Copyright 2006-2009 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without 2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are 3 # modification, are permitted provided that the following conditions are
4 # met: 4 # met:
5 # 5 #
6 # * Redistributions of source code must retain the above copyright 6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above 8 # * Redistributions in binary form must reproduce the above
9 # copyright notice, this list of conditions and the following 9 # copyright notice, this list of conditions and the following
10 # disclaimer in the documentation and/or other materials provided 10 # disclaimer in the documentation and/or other materials provided
(...skipping 21 matching lines...) Expand all
32 define READ_ONLY = 1; 32 define READ_ONLY = 1;
33 define DONT_ENUM = 2; 33 define DONT_ENUM = 2;
34 define DONT_DELETE = 4; 34 define DONT_DELETE = 4;
35 define NEW_ONE_BYTE_STRING = true; 35 define NEW_ONE_BYTE_STRING = true;
36 define NEW_TWO_BYTE_STRING = false; 36 define NEW_TWO_BYTE_STRING = false;
37 37
38 # Constants used for getter and setter operations. 38 # Constants used for getter and setter operations.
39 define GETTER = 0; 39 define GETTER = 0;
40 define SETTER = 1; 40 define SETTER = 1;
41 41
42 # For date.js.
43 define HoursPerDay = 24;
44 define MinutesPerHour = 60;
45 define SecondsPerMinute = 60;
46 define msPerSecond = 1000;
47 define msPerMinute = 60000;
48 define msPerHour = 3600000;
49 define msPerDay = 86400000;
50 define msPerMonth = 2592000000;
51
52 # Note: kDayZeroInJulianDay = ToJulianDay(1970, 0, 1).
53 define kInvalidDate = 'Invalid Date';
54 define kDayZeroInJulianDay = 2440588;
55 define kMonthMask = 0x1e0;
56 define kDayMask = 0x01f;
57 define kYearShift = 9;
58 define kMonthShift = 5;
59
60 # Limits for parts of the date, so that we support all the dates that
61 # ECMA 262 - 15.9.1.1 requires us to, but at the same time be sure that
62 # the date (days since 1970) is in SMI range.
63 define kMinYear = -1000000;
64 define kMaxYear = 1000000;
65 define kMinMonth = -10000000;
66 define kMaxMonth = 10000000;
67
42 # Safe maximum number of arguments to push to stack, when multiplied by 68 # Safe maximum number of arguments to push to stack, when multiplied by
43 # pointer size. Used by Function.prototype.apply(), Reflect.apply() and 69 # pointer size. Used by Function.prototype.apply(), Reflect.apply() and
44 # Reflect.construct(). 70 # Reflect.construct().
45 define kSafeArgumentsLength = 0x800000; 71 define kSafeArgumentsLength = 0x800000;
46 72
47 # 2^53 - 1 73 # 2^53 - 1
48 define kMaxSafeInteger = 9007199254740991; 74 define kMaxSafeInteger = 9007199254740991;
49 75
50 # 2^32 - 1 76 # 2^32 - 1
51 define kMaxUint32 = 4294967295; 77 define kMaxUint32 = 4294967295;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 macro REGEXP_IGNORE_CASE(regexp) = (%_RegExpFlags(regexp) & 2); 176 macro REGEXP_IGNORE_CASE(regexp) = (%_RegExpFlags(regexp) & 2);
151 macro REGEXP_MULTILINE(regexp) = (%_RegExpFlags(regexp) & 4); 177 macro REGEXP_MULTILINE(regexp) = (%_RegExpFlags(regexp) & 4);
152 macro REGEXP_STICKY(regexp) = (%_RegExpFlags(regexp) & 8); 178 macro REGEXP_STICKY(regexp) = (%_RegExpFlags(regexp) & 8);
153 macro REGEXP_UNICODE(regexp) = (%_RegExpFlags(regexp) & 16); 179 macro REGEXP_UNICODE(regexp) = (%_RegExpFlags(regexp) & 16);
154 macro REGEXP_SOURCE(regexp) = (%_RegExpSource(regexp)); 180 macro REGEXP_SOURCE(regexp) = (%_RegExpSource(regexp));
155 181
156 # We can't put macros in macros so we use constants here. 182 # We can't put macros in macros so we use constants here.
157 # REGEXP_NUMBER_OF_CAPTURES 183 # REGEXP_NUMBER_OF_CAPTURES
158 macro NUMBER_OF_CAPTURES(array) = ((array)[0]); 184 macro NUMBER_OF_CAPTURES(array) = ((array)[0]);
159 185
186 # Limit according to ECMA 262 15.9.1.1
187 define MAX_TIME_MS = 8640000000000000;
188 # Limit which is MAX_TIME_MS + msPerMonth.
189 define MAX_TIME_BEFORE_UTC = 8640002592000000;
190
191 # Gets the value of a Date object. If arg is not a Date object
192 # a type error is thrown.
193 macro CHECK_DATE(arg) = if (!%_IsDate(arg)) %_ThrowNotDateError();
194 macro LOCAL_DATE_VALUE(arg) = (%_DateField(arg, 0) + %_DateField(arg, 21));
195 macro UTC_DATE_VALUE(arg) = (%_DateField(arg, 0));
196
197 macro LOCAL_YEAR(arg) = (%_DateField(arg, 1));
198 macro LOCAL_MONTH(arg) = (%_DateField(arg, 2));
199 macro LOCAL_DAY(arg) = (%_DateField(arg, 3));
200 macro LOCAL_WEEKDAY(arg) = (%_DateField(arg, 4));
201 macro LOCAL_HOUR(arg) = (%_DateField(arg, 5));
202 macro LOCAL_MIN(arg) = (%_DateField(arg, 6));
203 macro LOCAL_SEC(arg) = (%_DateField(arg, 7));
204 macro LOCAL_MS(arg) = (%_DateField(arg, 8));
205 macro LOCAL_DAYS(arg) = (%_DateField(arg, 9));
206 macro LOCAL_TIME_IN_DAY(arg) = (%_DateField(arg, 10));
207
208 macro UTC_YEAR(arg) = (%_DateField(arg, 11));
209 macro UTC_MONTH(arg) = (%_DateField(arg, 12));
210 macro UTC_DAY(arg) = (%_DateField(arg, 13));
211 macro UTC_WEEKDAY(arg) = (%_DateField(arg, 14));
212 macro UTC_HOUR(arg) = (%_DateField(arg, 15));
213 macro UTC_MIN(arg) = (%_DateField(arg, 16));
214 macro UTC_SEC(arg) = (%_DateField(arg, 17));
215 macro UTC_MS(arg) = (%_DateField(arg, 18));
216 macro UTC_DAYS(arg) = (%_DateField(arg, 19));
217 macro UTC_TIME_IN_DAY(arg) = (%_DateField(arg, 20));
218
219 macro TIMEZONE_OFFSET(arg) = (%_DateField(arg, 21));
220
221 macro SET_UTC_DATE_VALUE(arg, value) = (%DateSetValue(arg, value, 1));
222 macro SET_LOCAL_DATE_VALUE(arg, value) = (%DateSetValue(arg, value, 0));
223
160 # Last input and last subject of regexp matches. 224 # Last input and last subject of regexp matches.
161 define LAST_SUBJECT_INDEX = 1; 225 define LAST_SUBJECT_INDEX = 1;
162 macro LAST_SUBJECT(array) = ((array)[1]); 226 macro LAST_SUBJECT(array) = ((array)[1]);
163 macro LAST_INPUT(array) = ((array)[2]); 227 macro LAST_INPUT(array) = ((array)[2]);
164 228
165 # REGEXP_FIRST_CAPTURE 229 # REGEXP_FIRST_CAPTURE
166 macro CAPTURE(index) = (3 + (index)); 230 macro CAPTURE(index) = (3 + (index));
167 define CAPTURE0 = 3; 231 define CAPTURE0 = 3;
168 define CAPTURE1 = 4; 232 define CAPTURE1 = 4;
169 233
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 define kStrongMode = 10; 324 define kStrongMode = 10;
261 define kRegExpPrototypeStickyGetter = 11; 325 define kRegExpPrototypeStickyGetter = 11;
262 define kRegExpPrototypeToString = 12; 326 define kRegExpPrototypeToString = 12;
263 define kRegExpPrototypeUnicodeGetter = 13; 327 define kRegExpPrototypeUnicodeGetter = 13;
264 define kIntlV8Parse = 14; 328 define kIntlV8Parse = 14;
265 define kIntlPattern = 15; 329 define kIntlPattern = 15;
266 define kIntlResolved = 16; 330 define kIntlResolved = 16;
267 define kPromiseChain = 17; 331 define kPromiseChain = 17;
268 define kPromiseAccept = 18; 332 define kPromiseAccept = 18;
269 define kPromiseDefer = 19; 333 define kPromiseDefer = 19;
OLDNEW
« no previous file with comments | « src/js/json.js ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698