OLD | NEW |
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 macro IS_NUMBER_WRAPPER(arg) = (%_ClassOf(arg) === 'Number'); | 105 macro IS_NUMBER_WRAPPER(arg) = (%_ClassOf(arg) === 'Number'); |
106 macro IS_STRING_WRAPPER(arg) = (%_ClassOf(arg) === 'String'); | 106 macro IS_STRING_WRAPPER(arg) = (%_ClassOf(arg) === 'String'); |
107 macro IS_BOOLEAN_WRAPPER(arg) = (%_ClassOf(arg) === 'Boolean'); | 107 macro IS_BOOLEAN_WRAPPER(arg) = (%_ClassOf(arg) === 'Boolean'); |
108 macro IS_ERROR(arg) = (%_ClassOf(arg) === 'Error'); | 108 macro IS_ERROR(arg) = (%_ClassOf(arg) === 'Error'); |
109 macro IS_SCRIPT(arg) = (%_ClassOf(arg) === 'Script'); | 109 macro IS_SCRIPT(arg) = (%_ClassOf(arg) === 'Script'); |
110 macro IS_ARGUMENTS(arg) = (%_ClassOf(arg) === 'Arguments'); | 110 macro IS_ARGUMENTS(arg) = (%_ClassOf(arg) === 'Arguments'); |
111 macro IS_GLOBAL(arg) = (%_ClassOf(arg) === 'global'); | 111 macro IS_GLOBAL(arg) = (%_ClassOf(arg) === 'global'); |
112 macro IS_UNDETECTABLE(arg) = (%_IsUndetectableObject(arg)); | 112 macro IS_UNDETECTABLE(arg) = (%_IsUndetectableObject(arg)); |
113 macro FLOOR(arg) = $floor(arg); | 113 macro FLOOR(arg) = $floor(arg); |
114 | 114 |
| 115 # Macro for ECMAScript 5 queries of the type: |
| 116 # "Type(O) is object." |
| 117 # This is the same as being either a function or an object in V8 terminology. |
| 118 macro IS_SPEC_OBJECT_OR_NULL(arg) = (%_IsObject(arg) || %_IsFunction(arg)); |
| 119 |
115 # Inline macros. Use %IS_VAR to make sure arg is evaluated only once. | 120 # Inline macros. Use %IS_VAR to make sure arg is evaluated only once. |
116 macro NUMBER_IS_NAN(arg) = (!%_IsSmi(%IS_VAR(arg)) && !(arg == arg)); | 121 macro NUMBER_IS_NAN(arg) = (!%_IsSmi(%IS_VAR(arg)) && !(arg == arg)); |
117 macro TO_INTEGER(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : ToInteger(arg)); | 122 macro TO_INTEGER(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : ToInteger(arg)); |
118 macro TO_INT32(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : (arg >> 0)); | 123 macro TO_INT32(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : (arg >> 0)); |
119 macro TO_UINT32(arg) = (arg >>> 0); | 124 macro TO_UINT32(arg) = (arg >>> 0); |
120 macro TO_STRING_INLINE(arg) = (IS_STRING(%IS_VAR(arg)) ? arg : NonStringToString
(arg)); | 125 macro TO_STRING_INLINE(arg) = (IS_STRING(%IS_VAR(arg)) ? arg : NonStringToString
(arg)); |
121 | 126 |
122 | 127 |
123 # Macros implemented in Python. | 128 # Macros implemented in Python. |
124 python macro CHAR_CODE(str) = ord(str[1]); | 129 python macro CHAR_CODE(str) = ord(str[1]); |
(...skipping 22 matching lines...) Expand all Loading... |
147 macro MS_FROM_TIME(time) = (Modulo(time, 1000)); | 152 macro MS_FROM_TIME(time) = (Modulo(time, 1000)); |
148 | 153 |
149 # Last input and last subject of regexp matches. | 154 # Last input and last subject of regexp matches. |
150 macro LAST_SUBJECT(array) = ((array)[1]); | 155 macro LAST_SUBJECT(array) = ((array)[1]); |
151 macro LAST_INPUT(array) = ((array)[2]); | 156 macro LAST_INPUT(array) = ((array)[2]); |
152 | 157 |
153 # REGEXP_FIRST_CAPTURE | 158 # REGEXP_FIRST_CAPTURE |
154 macro CAPTURE(index) = (3 + (index)); | 159 macro CAPTURE(index) = (3 + (index)); |
155 const CAPTURE0 = 3; | 160 const CAPTURE0 = 3; |
156 const CAPTURE1 = 4; | 161 const CAPTURE1 = 4; |
OLD | NEW |