| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 # Type query macros. | 93 # Type query macros. |
| 94 # | 94 # |
| 95 # Note: We have special support for typeof(foo) === 'bar' in the compiler. | 95 # Note: We have special support for typeof(foo) === 'bar' in the compiler. |
| 96 # It will *not* generate a runtime typeof call for the most important | 96 # It will *not* generate a runtime typeof call for the most important |
| 97 # values of 'bar'. | 97 # values of 'bar'. |
| 98 macro IS_NULL(arg) = (arg === null); | 98 macro IS_NULL(arg) = (arg === null); |
| 99 macro IS_NULL_OR_UNDEFINED(arg) = (arg == null); | 99 macro IS_NULL_OR_UNDEFINED(arg) = (arg == null); |
| 100 macro IS_UNDEFINED(arg) = (typeof(arg) === 'undefined'); | 100 macro IS_UNDEFINED(arg) = (typeof(arg) === 'undefined'); |
| 101 macro IS_NUMBER(arg) = (typeof(arg) === 'number'); | 101 macro IS_NUMBER(arg) = (typeof(arg) === 'number'); |
| 102 macro IS_FLOAT32x4(arg) = (typeof(arg) === 'float32x4'); |
| 103 macro IS_INT32x4(arg) = (typeof(arg) === 'int32x4'); |
| 102 macro IS_STRING(arg) = (typeof(arg) === 'string'); | 104 macro IS_STRING(arg) = (typeof(arg) === 'string'); |
| 103 macro IS_BOOLEAN(arg) = (typeof(arg) === 'boolean'); | 105 macro IS_BOOLEAN(arg) = (typeof(arg) === 'boolean'); |
| 104 macro IS_SYMBOL(arg) = (typeof(arg) === 'symbol'); | 106 macro IS_SYMBOL(arg) = (typeof(arg) === 'symbol'); |
| 105 macro IS_OBJECT(arg) = (%_IsObject(arg)); | 107 macro IS_OBJECT(arg) = (%_IsObject(arg)); |
| 106 macro IS_ARRAY(arg) = (%_IsArray(arg)); | 108 macro IS_ARRAY(arg) = (%_IsArray(arg)); |
| 107 macro IS_FUNCTION(arg) = (%_IsFunction(arg)); | 109 macro IS_FUNCTION(arg) = (%_IsFunction(arg)); |
| 108 macro IS_REGEXP(arg) = (%_IsRegExp(arg)); | 110 macro IS_REGEXP(arg) = (%_IsRegExp(arg)); |
| 109 macro IS_SET(arg) = (%_ClassOf(arg) === 'Set'); | 111 macro IS_SET(arg) = (%_ClassOf(arg) === 'Set'); |
| 110 macro IS_MAP(arg) = (%_ClassOf(arg) === 'Map'); | 112 macro IS_MAP(arg) = (%_ClassOf(arg) === 'Map'); |
| 111 macro IS_WEAKMAP(arg) = (%_ClassOf(arg) === 'WeakMap'); | 113 macro IS_WEAKMAP(arg) = (%_ClassOf(arg) === 'WeakMap'); |
| 112 macro IS_WEAKSET(arg) = (%_ClassOf(arg) === 'WeakSet'); | 114 macro IS_WEAKSET(arg) = (%_ClassOf(arg) === 'WeakSet'); |
| 113 macro IS_DATE(arg) = (%_ClassOf(arg) === 'Date'); | 115 macro IS_DATE(arg) = (%_ClassOf(arg) === 'Date'); |
| 114 macro IS_NUMBER_WRAPPER(arg) = (%_ClassOf(arg) === 'Number'); | 116 macro IS_NUMBER_WRAPPER(arg) = (%_ClassOf(arg) === 'Number'); |
| 117 macro IS_FLOAT32x4_WRAPPER(arg) = (%_ClassOf(arg) === 'float32x4'); |
| 118 macro IS_INT32x4_WRAPPER(arg) = (%_ClassOf(arg) === 'int32x4'); |
| 115 macro IS_STRING_WRAPPER(arg) = (%_ClassOf(arg) === 'String'); | 119 macro IS_STRING_WRAPPER(arg) = (%_ClassOf(arg) === 'String'); |
| 116 macro IS_SYMBOL_WRAPPER(arg) = (%_ClassOf(arg) === 'Symbol'); | 120 macro IS_SYMBOL_WRAPPER(arg) = (%_ClassOf(arg) === 'Symbol'); |
| 117 macro IS_BOOLEAN_WRAPPER(arg) = (%_ClassOf(arg) === 'Boolean'); | 121 macro IS_BOOLEAN_WRAPPER(arg) = (%_ClassOf(arg) === 'Boolean'); |
| 118 macro IS_ERROR(arg) = (%_ClassOf(arg) === 'Error'); | 122 macro IS_ERROR(arg) = (%_ClassOf(arg) === 'Error'); |
| 119 macro IS_SCRIPT(arg) = (%_ClassOf(arg) === 'Script'); | 123 macro IS_SCRIPT(arg) = (%_ClassOf(arg) === 'Script'); |
| 120 macro IS_ARGUMENTS(arg) = (%_ClassOf(arg) === 'Arguments'); | 124 macro IS_ARGUMENTS(arg) = (%_ClassOf(arg) === 'Arguments'); |
| 121 macro IS_GLOBAL(arg) = (%_ClassOf(arg) === 'global'); | 125 macro IS_GLOBAL(arg) = (%_ClassOf(arg) === 'global'); |
| 122 macro IS_ARRAYBUFFER(arg) = (%_ClassOf(arg) === 'ArrayBuffer'); | 126 macro IS_ARRAYBUFFER(arg) = (%_ClassOf(arg) === 'ArrayBuffer'); |
| 123 macro IS_DATAVIEW(arg) = (%_ClassOf(arg) === 'DataView'); | 127 macro IS_DATAVIEW(arg) = (%_ClassOf(arg) === 'DataView'); |
| 124 macro IS_GENERATOR(arg) = (%_ClassOf(arg) === 'Generator'); | 128 macro IS_GENERATOR(arg) = (%_ClassOf(arg) === 'Generator'); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 149 macro NUMBER_IS_FINITE(arg) = (%_IsSmi(%IS_VAR(arg)) || ((arg == arg) && (arg !=
1/0) && (arg != -1/0))); | 153 macro NUMBER_IS_FINITE(arg) = (%_IsSmi(%IS_VAR(arg)) || ((arg == arg) && (arg !=
1/0) && (arg != -1/0))); |
| 150 macro TO_INTEGER(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : %NumberToInteger(ToNumber
(arg))); | 154 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)); | 155 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))); | 156 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)); | 157 macro TO_INT32(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : (arg >> 0)); |
| 154 macro TO_UINT32(arg) = (arg >>> 0); | 158 macro TO_UINT32(arg) = (arg >>> 0); |
| 155 macro TO_STRING_INLINE(arg) = (IS_STRING(%IS_VAR(arg)) ? arg : NonStringToString
(arg)); | 159 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)); | 160 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
)); | 161 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"); | 162 macro JSON_NUMBER_TO_STRING(arg) = ((%_IsSmi(%IS_VAR(arg)) || arg - arg == 0) ?
%_NumberToString(arg) : "null"); |
| 163 macro TO_FLOAT32x4(arg) = (IS_FLOAT32x4_WRAPPER(%IS_VAR(arg))) ? %_ValueOf(arg)
: arg; |
| 164 macro TO_INT32x4(arg) = (IS_INT32x4_WRAPPER(%IS_VAR(arg))) ? %_ValueOf(arg) : ar
g; |
| 159 | 165 |
| 160 # Private names. | 166 # Private names. |
| 161 macro NEW_PRIVATE(name) = (%CreatePrivateSymbol(name)); | 167 macro NEW_PRIVATE(name) = (%CreatePrivateSymbol(name)); |
| 162 macro HAS_PRIVATE(obj, sym) = (sym in obj); | 168 macro HAS_PRIVATE(obj, sym) = (sym in obj); |
| 163 macro GET_PRIVATE(obj, sym) = (obj[sym]); | 169 macro GET_PRIVATE(obj, sym) = (obj[sym]); |
| 164 macro SET_PRIVATE(obj, sym, val) = (obj[sym] = val); | 170 macro SET_PRIVATE(obj, sym, val) = (obj[sym] = val); |
| 165 macro DELETE_PRIVATE(obj, sym) = (delete obj[sym]); | 171 macro DELETE_PRIVATE(obj, sym) = (delete obj[sym]); |
| 166 | 172 |
| 167 # Constants. The compiler constant folds them. | 173 # Constants. The compiler constant folds them. |
| 168 const NAN = $NaN; | 174 const NAN = $NaN; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 const TYPE_EXTENSION = 1; | 259 const TYPE_EXTENSION = 1; |
| 254 const TYPE_NORMAL = 2; | 260 const TYPE_NORMAL = 2; |
| 255 | 261 |
| 256 # Matches Script::CompilationType from objects.h | 262 # Matches Script::CompilationType from objects.h |
| 257 const COMPILATION_TYPE_HOST = 0; | 263 const COMPILATION_TYPE_HOST = 0; |
| 258 const COMPILATION_TYPE_EVAL = 1; | 264 const COMPILATION_TYPE_EVAL = 1; |
| 259 const COMPILATION_TYPE_JSON = 2; | 265 const COMPILATION_TYPE_JSON = 2; |
| 260 | 266 |
| 261 # Matches Messages::kNoLineNumberInfo from v8.h | 267 # Matches Messages::kNoLineNumberInfo from v8.h |
| 262 const kNoLineNumberInfo = 0; | 268 const kNoLineNumberInfo = 0; |
| 269 |
| 270 # For simd128.js |
| 271 macro CHECK_FLOAT32x4(arg) = if (typeof(arg) !== 'float32x4') ThrowFloat32x4Type
Error(); |
| 272 macro CHECK_INT32x4(arg) = if (typeof(arg) !== 'int32x4') ThrowInt32x4TypeError(
); |
| OLD | NEW |