| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 macro IS_DATE(arg) = (%_ClassOf(arg) === 'Date'); | 110 macro IS_DATE(arg) = (%_ClassOf(arg) === 'Date'); |
| 111 macro IS_NUMBER_WRAPPER(arg) = (%_ClassOf(arg) === 'Number'); | 111 macro IS_NUMBER_WRAPPER(arg) = (%_ClassOf(arg) === 'Number'); |
| 112 macro IS_STRING_WRAPPER(arg) = (%_ClassOf(arg) === 'String'); | 112 macro IS_STRING_WRAPPER(arg) = (%_ClassOf(arg) === 'String'); |
| 113 macro IS_SYMBOL_WRAPPER(arg) = (%_ClassOf(arg) === 'Symbol'); | 113 macro IS_SYMBOL_WRAPPER(arg) = (%_ClassOf(arg) === 'Symbol'); |
| 114 macro IS_BOOLEAN_WRAPPER(arg) = (%_ClassOf(arg) === 'Boolean'); | 114 macro IS_BOOLEAN_WRAPPER(arg) = (%_ClassOf(arg) === 'Boolean'); |
| 115 macro IS_ERROR(arg) = (%_ClassOf(arg) === 'Error'); | 115 macro IS_ERROR(arg) = (%_ClassOf(arg) === 'Error'); |
| 116 macro IS_SCRIPT(arg) = (%_ClassOf(arg) === 'Script'); | 116 macro IS_SCRIPT(arg) = (%_ClassOf(arg) === 'Script'); |
| 117 macro IS_ARGUMENTS(arg) = (%_ClassOf(arg) === 'Arguments'); | 117 macro IS_ARGUMENTS(arg) = (%_ClassOf(arg) === 'Arguments'); |
| 118 macro IS_GLOBAL(arg) = (%_ClassOf(arg) === 'global'); | 118 macro IS_GLOBAL(arg) = (%_ClassOf(arg) === 'global'); |
| 119 macro IS_ARRAYBUFFER(arg) = (%_ClassOf(arg) === 'ArrayBuffer'); | 119 macro IS_ARRAYBUFFER(arg) = (%_ClassOf(arg) === 'ArrayBuffer'); |
| 120 macro IS_DATAVIEW(arg) = (%_ClassOf(arg) === 'DataView'); |
| 120 macro IS_GENERATOR(arg) = (%_ClassOf(arg) === 'Generator'); | 121 macro IS_GENERATOR(arg) = (%_ClassOf(arg) === 'Generator'); |
| 121 macro IS_UNDETECTABLE(arg) = (%_IsUndetectableObject(arg)); | 122 macro IS_UNDETECTABLE(arg) = (%_IsUndetectableObject(arg)); |
| 122 macro FLOOR(arg) = $floor(arg); | 123 macro FLOOR(arg) = $floor(arg); |
| 123 | 124 |
| 124 # Macro for ECMAScript 5 queries of the type: | 125 # Macro for ECMAScript 5 queries of the type: |
| 125 # "Type(O) is object." | 126 # "Type(O) is object." |
| 126 # This is the same as being either a function or an object in V8 terminology | 127 # This is the same as being either a function or an object in V8 terminology |
| 127 # (including proxies). | 128 # (including proxies). |
| 128 # In addition, an undetectable object is also included by this. | 129 # In addition, an undetectable object is also included by this. |
| 129 macro IS_SPEC_OBJECT(arg) = (%_IsSpecObject(arg)); | 130 macro IS_SPEC_OBJECT(arg) = (%_IsSpecObject(arg)); |
| 130 | 131 |
| 131 # Macro for ECMAScript 5 queries of the type: | 132 # Macro for ECMAScript 5 queries of the type: |
| 132 # "IsCallable(O)" | 133 # "IsCallable(O)" |
| 133 # We assume here that this is the same as being either a function or a function | 134 # We assume here that this is the same as being either a function or a function |
| 134 # proxy. That ignores host objects with [[Call]] methods, but in most situations | 135 # proxy. That ignores host objects with [[Call]] methods, but in most situations |
| 135 # we cannot handle those anyway. | 136 # we cannot handle those anyway. |
| 136 macro IS_SPEC_FUNCTION(arg) = (%_ClassOf(arg) === 'Function'); | 137 macro IS_SPEC_FUNCTION(arg) = (%_ClassOf(arg) === 'Function'); |
| 137 | 138 |
| 138 # Indices in bound function info retrieved by %BoundFunctionGetBindings(...). | 139 # Indices in bound function info retrieved by %BoundFunctionGetBindings(...). |
| 139 const kBoundFunctionIndex = 0; | 140 const kBoundFunctionIndex = 0; |
| 140 const kBoundThisIndex = 1; | 141 const kBoundThisIndex = 1; |
| 141 const kBoundArgumentsStartIndex = 2; | 142 const kBoundArgumentsStartIndex = 2; |
| 142 | 143 |
| 143 # Inline macros. Use %IS_VAR to make sure arg is evaluated only once. | 144 # Inline macros. Use %IS_VAR to make sure arg is evaluated only once. |
| 144 macro NUMBER_IS_NAN(arg) = (!%_IsSmi(%IS_VAR(arg)) && !(arg == arg)); | 145 macro NUMBER_IS_NAN(arg) = (!%_IsSmi(%IS_VAR(arg)) && !(arg == arg)); |
| 145 macro NUMBER_IS_FINITE(arg) = (%_IsSmi(%IS_VAR(arg)) || ((arg == arg) && (arg !=
1/0) && (arg != -1/0))); | 146 macro NUMBER_IS_FINITE(arg) = (%_IsSmi(%IS_VAR(arg)) || ((arg == arg) && (arg !=
1/0) && (arg != -1/0))); |
| 146 macro TO_INTEGER(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : %NumberToInteger(ToNumber
(arg))); | 147 macro TO_INTEGER(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : %NumberToInteger(ToNumber
(arg))); |
| 147 macro TO_POSITIVE_INTEGER(arg) = (%_IsSmi(%IS_VAR(arg)) ? (arg > 0 ? arg : 0) :
%NumberToPositiveInteger(ToNumber(arg))); | |
| 148 macro TO_INTEGER_MAP_MINUS_ZERO(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : %NumberToI
ntegerMapMinusZero(ToNumber(arg))); | 148 macro TO_INTEGER_MAP_MINUS_ZERO(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : %NumberToI
ntegerMapMinusZero(ToNumber(arg))); |
| 149 macro TO_INT32(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : (arg >> 0)); | 149 macro TO_INT32(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : (arg >> 0)); |
| 150 macro TO_UINT32(arg) = (arg >>> 0); | 150 macro TO_UINT32(arg) = (arg >>> 0); |
| 151 macro TO_STRING_INLINE(arg) = (IS_STRING(%IS_VAR(arg)) ? arg : NonStringToString
(arg)); | 151 macro TO_STRING_INLINE(arg) = (IS_STRING(%IS_VAR(arg)) ? arg : NonStringToString
(arg)); |
| 152 macro TO_NUMBER_INLINE(arg) = (IS_NUMBER(%IS_VAR(arg)) ? arg : NonNumberToNumber
(arg)); | 152 macro TO_NUMBER_INLINE(arg) = (IS_NUMBER(%IS_VAR(arg)) ? arg : NonNumberToNumber
(arg)); |
| 153 macro TO_OBJECT_INLINE(arg) = (IS_SPEC_OBJECT(%IS_VAR(arg)) ? arg : ToObject(arg
)); | 153 macro TO_OBJECT_INLINE(arg) = (IS_SPEC_OBJECT(%IS_VAR(arg)) ? arg : ToObject(arg
)); |
| 154 macro JSON_NUMBER_TO_STRING(arg) = ((%_IsSmi(%IS_VAR(arg)) || arg - arg == 0) ?
%_NumberToString(arg) : "null"); | 154 macro JSON_NUMBER_TO_STRING(arg) = ((%_IsSmi(%IS_VAR(arg)) || arg - arg == 0) ?
%_NumberToString(arg) : "null"); |
| 155 | 155 |
| 156 # Macros implemented in Python. | 156 # Macros implemented in Python. |
| 157 python macro CHAR_CODE(str) = ord(str[1]); | 157 python macro CHAR_CODE(str) = ord(str[1]); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 const TYPE_EXTENSION = 1; | 237 const TYPE_EXTENSION = 1; |
| 238 const TYPE_NORMAL = 2; | 238 const TYPE_NORMAL = 2; |
| 239 | 239 |
| 240 # Matches Script::CompilationType from objects.h | 240 # Matches Script::CompilationType from objects.h |
| 241 const COMPILATION_TYPE_HOST = 0; | 241 const COMPILATION_TYPE_HOST = 0; |
| 242 const COMPILATION_TYPE_EVAL = 1; | 242 const COMPILATION_TYPE_EVAL = 1; |
| 243 const COMPILATION_TYPE_JSON = 2; | 243 const COMPILATION_TYPE_JSON = 2; |
| 244 | 244 |
| 245 # Matches Messages::kNoLineNumberInfo from v8.h | 245 # Matches Messages::kNoLineNumberInfo from v8.h |
| 246 const kNoLineNumberInfo = 0; | 246 const kNoLineNumberInfo = 0; |
| OLD | NEW |