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

Side by Side Diff: src/macros.py

Issue 9572008: Implement date library functions in C++. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 8 years, 9 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/isolate.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_UNCHECKED(arg) = (%_DateField(arg, 0)); 167 macro CHECK_DATE(arg) = if (%_ClassOf(arg) !== 'Date') ThrowDateTypeError();
168 macro DATE_LOCAL_UNCHECKED(arg) = (%_DateField(arg, 1)); 168 macro LOCAL_DATE_VALUE(arg) = (%_DateField(arg, 0) + %_DateField(arg, 21));
169 macro DATE_VALUE(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 0) : Throw DateTypeError()); 169 macro UTC_DATE_VALUE(arg) = (%_DateField(arg, 0));
170 macro DATE_LOCAL(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 1) : Throw DateTypeError()); 170
171 macro DATE_YEAR(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 2) : ThrowD ateTypeError()); 171 macro LOCAL_YEAR(arg) = (%_DateField(arg, 1));
172 macro DATE_MONTH(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 3) : Throw DateTypeError()); 172 macro LOCAL_MONTH(arg) = (%_DateField(arg, 2));
173 macro DATE_DAY(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 4) : ThrowDa teTypeError()); 173 macro LOCAL_DAY(arg) = (%_DateField(arg, 3));
174 macro DATE_HOUR(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 5) : ThrowD ateTypeError()); 174 macro LOCAL_WEEKDAY(arg) = (%_DateField(arg, 4));
175 macro DATE_MIN(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 6) : ThrowDa teTypeError()); 175 macro LOCAL_HOUR(arg) = (%_DateField(arg, 5));
176 macro DATE_SEC(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 7) : ThrowDa teTypeError()); 176 macro LOCAL_MIN(arg) = (%_DateField(arg, 6));
177 macro DATE_WEEKDAY(arg) = (%_ClassOf(arg) === 'Date' ? %_DateField(arg, 8) : Thr owDateTypeError()); 177 macro LOCAL_SEC(arg) = (%_DateField(arg, 7));
178 macro SET_DATE_VALUE(arg, value) = (%_SetDateField(arg, 0, value)); 178 macro LOCAL_MS(arg) = (%_DateField(arg, 8));
179 macro SET_DATE_LOCAL(arg, value) = (%_SetDateField(arg, 1, value)); 179 macro LOCAL_DAYS(arg) = (%_DateField(arg, 9));
180 macro SET_DATE_YEAR(arg, value) = (%_SetDateField(arg, 2, value)); 180 macro LOCAL_TIME_IN_DAY(arg) = (%_DateField(arg, 10));
181 macro SET_DATE_MONTH(arg, value) = (%_SetDateField(arg, 3, value)); 181
182 macro SET_DATE_DAY(arg, value) = (%_SetDateField(arg, 4, value)); 182 macro UTC_YEAR(arg) = (%_DateField(arg, 11));
183 macro SET_DATE_HOUR(arg, value) = (%_SetDateField(arg, 5, value)); 183 macro UTC_MONTH(arg) = (%_DateField(arg, 12));
184 macro SET_DATE_MIN(arg, value) = (%_SetDateField(arg, 6, value)); 184 macro UTC_DAY(arg) = (%_DateField(arg, 13));
185 macro SET_DATE_SEC(arg, value) = (%_SetDateField(arg, 7, value)); 185 macro UTC_WEEKDAY(arg) = (%_DateField(arg, 14));
186 macro SET_DATE_WEEKDAY(arg, value) = (%_SetDateField(arg, 8, value)); 186 macro UTC_HOUR(arg) = (%_DateField(arg, 15));
187 macro DAY(time) = ($floor(time / 86400000)); 187 macro UTC_MIN(arg) = (%_DateField(arg, 16));
188 macro NAN_OR_DATE_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : DateFromTime(t ime)); 188 macro UTC_SEC(arg) = (%_DateField(arg, 17));
189 macro HOUR_FROM_TIME(time) = (Modulo($floor(time / 3600000), 24)); 189 macro UTC_MS(arg) = (%_DateField(arg, 18));
190 macro MIN_FROM_TIME(time) = (Modulo($floor(time / 60000), 60)); 190 macro UTC_DAYS(arg) = (%_DateField(arg, 19));
191 macro NAN_OR_MIN_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : MIN_FROM_TIME(t ime)); 191 macro UTC_TIME_IN_DAY(arg) = (%_DateField(arg, 20));
192 macro SEC_FROM_TIME(time) = (Modulo($floor(time / 1000), 60)); 192
193 macro NAN_OR_SEC_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : SEC_FROM_TIME(t ime)); 193 macro TIMEZONE_OFFSET(arg) = (%_DateField(arg, 21));
194 macro MS_FROM_TIME(time) = (Modulo(time, 1000)); 194
195 macro NAN_OR_MS_FROM_TIME(time) = (NUMBER_IS_NAN(time) ? time : MS_FROM_TIME(tim e)); 195 macro SET_UTC_DATE_VALUE(arg, value) = (%DateSetValue(arg, value, 1));
196 macro SET_LOCAL_DATE_VALUE(arg, value) = (%DateSetValue(arg, value, 0));
196 197
197 # Last input and last subject of regexp matches. 198 # Last input and last subject of regexp matches.
198 macro LAST_SUBJECT(array) = ((array)[1]); 199 macro LAST_SUBJECT(array) = ((array)[1]);
199 macro LAST_INPUT(array) = ((array)[2]); 200 macro LAST_INPUT(array) = ((array)[2]);
200 201
201 # REGEXP_FIRST_CAPTURE 202 # REGEXP_FIRST_CAPTURE
202 macro CAPTURE(index) = (3 + (index)); 203 macro CAPTURE(index) = (3 + (index));
203 const CAPTURE0 = 3; 204 const CAPTURE0 = 3;
204 const CAPTURE1 = 4; 205 const CAPTURE1 = 4;
205 206
(...skipping 13 matching lines...) Expand all
219 const TYPE_EXTENSION = 1; 220 const TYPE_EXTENSION = 1;
220 const TYPE_NORMAL = 2; 221 const TYPE_NORMAL = 2;
221 222
222 # Matches Script::CompilationType from objects.h 223 # Matches Script::CompilationType from objects.h
223 const COMPILATION_TYPE_HOST = 0; 224 const COMPILATION_TYPE_HOST = 0;
224 const COMPILATION_TYPE_EVAL = 1; 225 const COMPILATION_TYPE_EVAL = 1;
225 const COMPILATION_TYPE_JSON = 2; 226 const COMPILATION_TYPE_JSON = 2;
226 227
227 # Matches Messages::kNoLineNumberInfo from v8.h 228 # Matches Messages::kNoLineNumberInfo from v8.h
228 const kNoLineNumberInfo = 0; 229 const kNoLineNumberInfo = 0;
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698