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

Side by Side Diff: src/macros.py

Issue 5905003: Perform more aggressive time to NaN conversions. Our internal date... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years 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 | Annotate | Revision Log
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 # Constants used on an array to implement the properties of the RegExp object. 133 # Constants used on an array to implement the properties of the RegExp object.
134 const REGEXP_NUMBER_OF_CAPTURES = 0; 134 const REGEXP_NUMBER_OF_CAPTURES = 0;
135 const REGEXP_FIRST_CAPTURE = 3; 135 const REGEXP_FIRST_CAPTURE = 3;
136 136
137 # We can't put macros in macros so we use constants here. 137 # We can't put macros in macros so we use constants here.
138 # REGEXP_NUMBER_OF_CAPTURES 138 # REGEXP_NUMBER_OF_CAPTURES
139 macro NUMBER_OF_CAPTURES(array) = ((array)[0]); 139 macro NUMBER_OF_CAPTURES(array) = ((array)[0]);
140 140
141 # Limit according to ECMA 262 15.9.1.1 141 # Limit according to ECMA 262 15.9.1.1
142 const MAX_TIME_MS = 8640000000000000; 142 const MAX_TIME_MS = 8640000000000000;
143 # Limit which is MAX_TIME_MS + msPerMonth.
144 const MAX_TIME_BEFORE_UTC = 8640002592000000;
143 145
144 # Gets the value of a Date object. If arg is not a Date object 146 # Gets the value of a Date object. If arg is not a Date object
145 # a type error is thrown. 147 # a type error is thrown.
146 macro DATE_VALUE(arg) = (%_ClassOf(arg) === 'Date' ? %_ValueOf(arg) : ThrowDateT ypeError()); 148 macro DATE_VALUE(arg) = (%_ClassOf(arg) === 'Date' ? %_ValueOf(arg) : ThrowDateT ypeError());
147 macro DAY(time) = ($floor(time / 86400000)); 149 macro DAY(time) = ($floor(time / 86400000));
148 macro MONTH_FROM_TIME(time) = (MonthFromTime(time)); 150 macro NAN_OR_DATE_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : DateFromTime(t ime));
149 macro DATE_FROM_TIME(time) = (DateFromTime(time));
150 macro NAN_OR_DATE_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : DATE_FROM_TIME (time));
151 macro YEAR_FROM_TIME(time) = (YearFromTime(time));
152 macro HOUR_FROM_TIME(time) = (Modulo($floor(time / 3600000), 24)); 151 macro HOUR_FROM_TIME(time) = (Modulo($floor(time / 3600000), 24));
153 macro MIN_FROM_TIME(time) = (Modulo($floor(time / 60000), 60)); 152 macro MIN_FROM_TIME(time) = (Modulo($floor(time / 60000), 60));
154 macro NAN_OR_MIN_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : MIN_FROM_TIME(t ime)); 153 macro NAN_OR_MIN_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : MIN_FROM_TIME(t ime));
155 macro SEC_FROM_TIME(time) = (Modulo($floor(time / 1000), 60)); 154 macro SEC_FROM_TIME(time) = (Modulo($floor(time / 1000), 60));
156 macro NAN_OR_SEC_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : SEC_FROM_TIME(t ime)); 155 macro NAN_OR_SEC_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : SEC_FROM_TIME(t ime));
157 macro MS_FROM_TIME(time) = (Modulo(time, 1000)); 156 macro MS_FROM_TIME(time) = (Modulo(time, 1000));
158 macro NAN_OR_MS_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : MS_FROM_TIME(tim e)); 157 macro NAN_OR_MS_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : MS_FROM_TIME(tim e));
159 158
160 # Last input and last subject of regexp matches. 159 # Last input and last subject of regexp matches.
161 macro LAST_SUBJECT(array) = ((array)[1]); 160 macro LAST_SUBJECT(array) = ((array)[1]);
162 macro LAST_INPUT(array) = ((array)[2]); 161 macro LAST_INPUT(array) = ((array)[2]);
163 162
164 # REGEXP_FIRST_CAPTURE 163 # REGEXP_FIRST_CAPTURE
165 macro CAPTURE(index) = (3 + (index)); 164 macro CAPTURE(index) = (3 + (index));
166 const CAPTURE0 = 3; 165 const CAPTURE0 = 3;
167 const CAPTURE1 = 4; 166 const CAPTURE1 = 4;
168 167
169 # PropertyDescriptor return value indices - must match 168 # PropertyDescriptor return value indices - must match
170 # PropertyDescriptorIndices in runtime.cc. 169 # PropertyDescriptorIndices in runtime.cc.
171 const IS_ACCESSOR_INDEX = 0; 170 const IS_ACCESSOR_INDEX = 0;
172 const VALUE_INDEX = 1; 171 const VALUE_INDEX = 1;
173 const GETTER_INDEX = 2; 172 const GETTER_INDEX = 2;
174 const SETTER_INDEX = 3; 173 const SETTER_INDEX = 3;
175 const WRITABLE_INDEX = 4; 174 const WRITABLE_INDEX = 4;
176 const ENUMERABLE_INDEX = 5; 175 const ENUMERABLE_INDEX = 5;
177 const CONFIGURABLE_INDEX = 6; 176 const CONFIGURABLE_INDEX = 6;
OLDNEW
« src/date.js ('K') | « src/date.js ('k') | test/mjsunit/date.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698