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

Side by Side Diff: src/macros.py

Issue 27491002: Cosmetic: Add macros for NaN, undefined and Infinity to native js code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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/liveedit-debugger.js ('k') | src/math.js » ('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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 macro TO_INTEGER(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : %NumberToInteger(ToNumber (arg))); 150 macro TO_INTEGER(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : %NumberToInteger(ToNumber (arg)));
151 macro TO_INTEGER_FOR_SIDE_EFFECT(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : ToNumber( arg)); 151 macro TO_INTEGER_FOR_SIDE_EFFECT(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : ToNumber( arg));
152 macro TO_INTEGER_MAP_MINUS_ZERO(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : %NumberToI ntegerMapMinusZero(ToNumber(arg))); 152 macro TO_INTEGER_MAP_MINUS_ZERO(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : %NumberToI ntegerMapMinusZero(ToNumber(arg)));
153 macro TO_INT32(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : (arg >> 0)); 153 macro TO_INT32(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : (arg >> 0));
154 macro TO_UINT32(arg) = (arg >>> 0); 154 macro TO_UINT32(arg) = (arg >>> 0);
155 macro TO_STRING_INLINE(arg) = (IS_STRING(%IS_VAR(arg)) ? arg : NonStringToString (arg)); 155 macro TO_STRING_INLINE(arg) = (IS_STRING(%IS_VAR(arg)) ? arg : NonStringToString (arg));
156 macro TO_NUMBER_INLINE(arg) = (IS_NUMBER(%IS_VAR(arg)) ? arg : NonNumberToNumber (arg)); 156 macro TO_NUMBER_INLINE(arg) = (IS_NUMBER(%IS_VAR(arg)) ? arg : NonNumberToNumber (arg));
157 macro TO_OBJECT_INLINE(arg) = (IS_SPEC_OBJECT(%IS_VAR(arg)) ? arg : ToObject(arg )); 157 macro TO_OBJECT_INLINE(arg) = (IS_SPEC_OBJECT(%IS_VAR(arg)) ? arg : ToObject(arg ));
158 macro JSON_NUMBER_TO_STRING(arg) = ((%_IsSmi(%IS_VAR(arg)) || arg - arg == 0) ? %_NumberToString(arg) : "null"); 158 macro JSON_NUMBER_TO_STRING(arg) = ((%_IsSmi(%IS_VAR(arg)) || arg - arg == 0) ? %_NumberToString(arg) : "null");
159 159
160 # Constants. The compiler constant folds them.
161 const NAN = $NaN;
162 const INFINITY = (1/0);
163 const UNDEFINED = (void 0);
164
160 # Macros implemented in Python. 165 # Macros implemented in Python.
161 python macro CHAR_CODE(str) = ord(str[1]); 166 python macro CHAR_CODE(str) = ord(str[1]);
162 167
163 # Constants used on an array to implement the properties of the RegExp object. 168 # Constants used on an array to implement the properties of the RegExp object.
164 const REGEXP_NUMBER_OF_CAPTURES = 0; 169 const REGEXP_NUMBER_OF_CAPTURES = 0;
165 const REGEXP_FIRST_CAPTURE = 3; 170 const REGEXP_FIRST_CAPTURE = 3;
166 171
167 # We can't put macros in macros so we use constants here. 172 # We can't put macros in macros so we use constants here.
168 # REGEXP_NUMBER_OF_CAPTURES 173 # REGEXP_NUMBER_OF_CAPTURES
169 macro NUMBER_OF_CAPTURES(array) = ((array)[0]); 174 macro NUMBER_OF_CAPTURES(array) = ((array)[0]);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 const TYPE_EXTENSION = 1; 246 const TYPE_EXTENSION = 1;
242 const TYPE_NORMAL = 2; 247 const TYPE_NORMAL = 2;
243 248
244 # Matches Script::CompilationType from objects.h 249 # Matches Script::CompilationType from objects.h
245 const COMPILATION_TYPE_HOST = 0; 250 const COMPILATION_TYPE_HOST = 0;
246 const COMPILATION_TYPE_EVAL = 1; 251 const COMPILATION_TYPE_EVAL = 1;
247 const COMPILATION_TYPE_JSON = 2; 252 const COMPILATION_TYPE_JSON = 2;
248 253
249 # Matches Messages::kNoLineNumberInfo from v8.h 254 # Matches Messages::kNoLineNumberInfo from v8.h
250 const kNoLineNumberInfo = 0; 255 const kNoLineNumberInfo = 0;
OLDNEW
« no previous file with comments | « src/liveedit-debugger.js ('k') | src/math.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698