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

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: Add constant for index of first barrier-free slot. 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
« no previous file with comments | « src/ia32/lithium-ia32.cc ('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 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, 0) : Throw DateTypeError());
168 macro DATE_YEAR(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 1) : ThrowD ateTypeError());
169 macro DATE_MONTH(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 2) : Throw DateTypeError());
170 macro DATE_DAY(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 3) : ThrowDa teTypeError());
171 macro DATE_HOUR(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 4) : ThrowD ateTypeError());
172 macro DATE_MIN(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 5) : ThrowDa teTypeError());
173 macro DATE_SEC(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 6) : ThrowDa teTypeError());
174 macro DATE_MS(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 7) : ThrowDat eTypeError());
175 macro SET_DATE_VALUE(arg, value) = (%_SetDateField(arg, 0, value));
176 macro SET_DATE_YEAR(arg, value) = (%_SetDateField(arg, 1, value));
177 macro SET_DATE_MONTH(arg, value) = (%_SetDateField(arg, 2, value));
178 macro SET_DATE_DAY(arg, value) = (%_SetDateField(arg, 3, value));
179 macro SET_DATE_HOUR(arg, value) = (%_SetDateField(arg, 4, value));
180 macro SET_DATE_MIN(arg, value) = (%_SetDateField(arg, 5, value));
181 macro SET_DATE_SEC(arg, value) = (%_SetDateField(arg, 6, value));
182 macro SET_DATE_MS(arg, value) = (%_SetDateField(arg, 7, value));
168 macro DAY(time) = ($floor(time / 86400000)); 183 macro DAY(time) = ($floor(time / 86400000));
169 macro NAN_OR_DATE_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : DateFromTime(t ime)); 184 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)); 185 macro HOUR_FROM_TIME(time) = (Modulo($floor(time / 3600000), 24));
171 macro MIN_FROM_TIME(time) = (Modulo($floor(time / 60000), 60)); 186 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)); 187 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)); 188 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)); 189 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)); 190 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)); 191 macro NAN_OR_MS_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : MS_FROM_TIME(tim e));
177 192
(...skipping 22 matching lines...) Expand all
200 const TYPE_EXTENSION = 1; 215 const TYPE_EXTENSION = 1;
201 const TYPE_NORMAL = 2; 216 const TYPE_NORMAL = 2;
202 217
203 # Matches Script::CompilationType from objects.h 218 # Matches Script::CompilationType from objects.h
204 const COMPILATION_TYPE_HOST = 0; 219 const COMPILATION_TYPE_HOST = 0;
205 const COMPILATION_TYPE_EVAL = 1; 220 const COMPILATION_TYPE_EVAL = 1;
206 const COMPILATION_TYPE_JSON = 2; 221 const COMPILATION_TYPE_JSON = 2;
207 222
208 # Matches Messages::kNoLineNumberInfo from v8.h 223 # Matches Messages::kNoLineNumberInfo from v8.h
209 const kNoLineNumberInfo = 0; 224 const kNoLineNumberInfo = 0;
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698