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

Side by Side Diff: src/macros.py

Issue 9117034: New class for Date objects: caches individual date components. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 | 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 # REGEXP_NUMBER_OF_CAPTURES 157 # REGEXP_NUMBER_OF_CAPTURES
158 macro NUMBER_OF_CAPTURES(array) = ((array)[0]); 158 macro NUMBER_OF_CAPTURES(array) = ((array)[0]);
159 159
160 # Limit according to ECMA 262 15.9.1.1 160 # Limit according to ECMA 262 15.9.1.1
161 const MAX_TIME_MS = 8640000000000000; 161 const MAX_TIME_MS = 8640000000000000;
162 # Limit which is MAX_TIME_MS + msPerMonth. 162 # Limit which is MAX_TIME_MS + msPerMonth.
163 const MAX_TIME_BEFORE_UTC = 8640002592000000; 163 const MAX_TIME_BEFORE_UTC = 8640002592000000;
164 164
165 # Gets the value of a Date object. If arg is not a Date object 165 # Gets the value of a Date object. If arg is not a Date object
166 # a type error is thrown. 166 # a type error is thrown.
167 macro DATE_VALUE(arg) = (%_ClassOf(arg) === 'Date' ? %_ValueOf(arg) : ThrowDateT ypeError()); 167 macro DATE_VALUE(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, -1) : Thro wDateTypeError());
168 macro SET_DATE_VALUE(arg, value) = (%_SetDateField(arg, -1, value));
168 macro DAY(time) = ($floor(time / 86400000)); 169 macro DAY(time) = ($floor(time / 86400000));
169 macro NAN_OR_DATE_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : DateFromTime(t ime)); 170 macro NAN_OR_DATE_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : DateFromTime(t ime));
170 macro HOUR_FROM_TIME(time) = (Modulo($floor(time / 3600000), 24)); 171 macro HOUR_FROM_TIME(time) = (Modulo($floor(time / 3600000), 24));
171 macro MIN_FROM_TIME(time) = (Modulo($floor(time / 60000), 60)); 172 macro MIN_FROM_TIME(time) = (Modulo($floor(time / 60000), 60));
172 macro NAN_OR_MIN_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : MIN_FROM_TIME(t ime)); 173 macro NAN_OR_MIN_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : MIN_FROM_TIME(t ime));
173 macro SEC_FROM_TIME(time) = (Modulo($floor(time / 1000), 60)); 174 macro SEC_FROM_TIME(time) = (Modulo($floor(time / 1000), 60));
174 macro NAN_OR_SEC_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : SEC_FROM_TIME(t ime)); 175 macro NAN_OR_SEC_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : SEC_FROM_TIME(t ime));
175 macro MS_FROM_TIME(time) = (Modulo(time, 1000)); 176 macro MS_FROM_TIME(time) = (Modulo(time, 1000));
176 macro NAN_OR_MS_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : MS_FROM_TIME(tim e)); 177 macro NAN_OR_MS_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : MS_FROM_TIME(tim e));
177 178
(...skipping 22 matching lines...) Expand all
200 const TYPE_EXTENSION = 1; 201 const TYPE_EXTENSION = 1;
201 const TYPE_NORMAL = 2; 202 const TYPE_NORMAL = 2;
202 203
203 # Matches Script::CompilationType from objects.h 204 # Matches Script::CompilationType from objects.h
204 const COMPILATION_TYPE_HOST = 0; 205 const COMPILATION_TYPE_HOST = 0;
205 const COMPILATION_TYPE_EVAL = 1; 206 const COMPILATION_TYPE_EVAL = 1;
206 const COMPILATION_TYPE_JSON = 2; 207 const COMPILATION_TYPE_JSON = 2;
207 208
208 # Matches Messages::kNoLineNumberInfo from v8.h 209 # Matches Messages::kNoLineNumberInfo from v8.h
209 const kNoLineNumberInfo = 0; 210 const kNoLineNumberInfo = 0;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698