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

Side by Side Diff: src/macros.py

Issue 7830036: Optimize isFinite and isNaN. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Made the change general by moving putting it in the NUMBER_IS_FINITE macro. Created 9 years, 3 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/json.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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 macro FLOOR(arg) = $floor(arg); 115 macro FLOOR(arg) = $floor(arg);
116 116
117 # Macro for ECMAScript 5 queries of the type: 117 # Macro for ECMAScript 5 queries of the type:
118 # "Type(O) is object." 118 # "Type(O) is object."
119 # This is the same as being either a function or an object in V8 terminology. 119 # This is the same as being either a function or an object in V8 terminology.
120 # In addition, an undetectable object is also included by this. 120 # In addition, an undetectable object is also included by this.
121 macro IS_SPEC_OBJECT(arg) = (%_IsSpecObject(arg)); 121 macro IS_SPEC_OBJECT(arg) = (%_IsSpecObject(arg));
122 122
123 # Inline macros. Use %IS_VAR to make sure arg is evaluated only once. 123 # Inline macros. Use %IS_VAR to make sure arg is evaluated only once.
124 macro NUMBER_IS_NAN(arg) = (!%_IsSmi(%IS_VAR(arg)) && !(arg == arg)); 124 macro NUMBER_IS_NAN(arg) = (!%_IsSmi(%IS_VAR(arg)) && !(arg == arg));
125 macro NUMBER_IS_FINITE(arg) = (%_IsSmi(%IS_VAR(arg)) || arg - arg == 0); 125 macro NUMBER_IS_FINITE(arg) = (%_IsSmi(%IS_VAR(arg)) || ((arg == arg) && (arg != 1/0) && (arg != -1/0)));
126 macro TO_INTEGER(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : %NumberToInteger(ToNumber (arg))); 126 macro TO_INTEGER(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : %NumberToInteger(ToNumber (arg)));
127 macro TO_INTEGER_MAP_MINUS_ZERO(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : %NumberToI ntegerMapMinusZero(ToNumber(arg))); 127 macro TO_INTEGER_MAP_MINUS_ZERO(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : %NumberToI ntegerMapMinusZero(ToNumber(arg)));
128 macro TO_INT32(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : (arg >> 0)); 128 macro TO_INT32(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : (arg >> 0));
129 macro TO_UINT32(arg) = (arg >>> 0); 129 macro TO_UINT32(arg) = (arg >>> 0);
130 macro TO_STRING_INLINE(arg) = (IS_STRING(%IS_VAR(arg)) ? arg : NonStringToString (arg)); 130 macro TO_STRING_INLINE(arg) = (IS_STRING(%IS_VAR(arg)) ? arg : NonStringToString (arg));
131 macro TO_NUMBER_INLINE(arg) = (IS_NUMBER(%IS_VAR(arg)) ? arg : NonNumberToNumber (arg)); 131 macro TO_NUMBER_INLINE(arg) = (IS_NUMBER(%IS_VAR(arg)) ? arg : NonNumberToNumber (arg));
132 macro TO_OBJECT_INLINE(arg) = (IS_SPEC_OBJECT(%IS_VAR(arg)) ? arg : ToObject(arg )); 132 macro TO_OBJECT_INLINE(arg) = (IS_SPEC_OBJECT(%IS_VAR(arg)) ? arg : ToObject(arg ));
133 macro JSON_NUMBER_TO_STRING(arg) = ((%_IsSmi(%IS_VAR(arg)) || arg - arg == 0) ? %_NumberToString(arg) : "null"); 133 macro JSON_NUMBER_TO_STRING(arg) = ((%_IsSmi(%IS_VAR(arg)) || arg - arg == 0) ? %_NumberToString(arg) : "null");
134 134
135 # Macros implemented in Python. 135 # Macros implemented in Python.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 const TYPE_EXTENSION = 1; 186 const TYPE_EXTENSION = 1;
187 const TYPE_NORMAL = 2; 187 const TYPE_NORMAL = 2;
188 188
189 # Matches Script::CompilationType from objects.h 189 # Matches Script::CompilationType from objects.h
190 const COMPILATION_TYPE_HOST = 0; 190 const COMPILATION_TYPE_HOST = 0;
191 const COMPILATION_TYPE_EVAL = 1; 191 const COMPILATION_TYPE_EVAL = 1;
192 const COMPILATION_TYPE_JSON = 2; 192 const COMPILATION_TYPE_JSON = 2;
193 193
194 # Matches Messages::kNoLineNumberInfo from v8.h 194 # Matches Messages::kNoLineNumberInfo from v8.h
195 const kNoLineNumberInfo = 0; 195 const kNoLineNumberInfo = 0;
OLDNEW
« no previous file with comments | « src/json.js ('k') | src/math.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698