| 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 29 matching lines...) Expand all Loading... |
| 40 define kMaxUint32 = 4294967295; | 40 define kMaxUint32 = 4294967295; |
| 41 | 41 |
| 42 # Type query macros. | 42 # Type query macros. |
| 43 # | 43 # |
| 44 # Note: We have special support for typeof(foo) === 'bar' in the compiler. | 44 # Note: We have special support for typeof(foo) === 'bar' in the compiler. |
| 45 # It will *not* generate a runtime typeof call for the most important | 45 # It will *not* generate a runtime typeof call for the most important |
| 46 # values of 'bar'. | 46 # values of 'bar'. |
| 47 macro IS_ARRAY(arg) = (%_IsArray(arg)); | 47 macro IS_ARRAY(arg) = (%_IsArray(arg)); |
| 48 macro IS_ARRAYBUFFER(arg) = (%_ClassOf(arg) === 'ArrayBuffer'); | 48 macro IS_ARRAYBUFFER(arg) = (%_ClassOf(arg) === 'ArrayBuffer'); |
| 49 macro IS_BOOLEAN(arg) = (typeof(arg) === 'boolean'); | 49 macro IS_BOOLEAN(arg) = (typeof(arg) === 'boolean'); |
| 50 macro IS_DATAVIEW(arg) = (%_ClassOf(arg) === 'DataView'); |
| 50 macro IS_DATE(arg) = (%IsDate(arg)); | 51 macro IS_DATE(arg) = (%IsDate(arg)); |
| 51 macro IS_ERROR(arg) = (%_ClassOf(arg) === 'Error'); | 52 macro IS_ERROR(arg) = (%_ClassOf(arg) === 'Error'); |
| 52 macro IS_FUNCTION(arg) = (%IsFunction(arg)); | 53 macro IS_FUNCTION(arg) = (%IsFunction(arg)); |
| 53 macro IS_GENERATOR(arg) = (%_ClassOf(arg) === 'Generator'); | 54 macro IS_GENERATOR(arg) = (%_ClassOf(arg) === 'Generator'); |
| 54 macro IS_GLOBAL(arg) = (%_IsJSGlobalProxy(arg)); | 55 macro IS_GLOBAL(arg) = (%_ClassOf(arg) === 'global'); |
| 55 macro IS_MAP(arg) = (%_IsJSMap(arg)); | 56 macro IS_MAP(arg) = (%_ClassOf(arg) === 'Map'); |
| 56 macro IS_MAP_ITERATOR(arg) = (%_IsJSMapIterator(arg)); | 57 macro IS_MAP_ITERATOR(arg) = (%_ClassOf(arg) === 'Map Iterator'); |
| 57 macro IS_NULL(arg) = (arg === null); | 58 macro IS_NULL(arg) = (arg === null); |
| 58 macro IS_NULL_OR_UNDEFINED(arg) = (arg == null); | 59 macro IS_NULL_OR_UNDEFINED(arg) = (arg == null); |
| 59 macro IS_NUMBER(arg) = (typeof(arg) === 'number'); | 60 macro IS_NUMBER(arg) = (typeof(arg) === 'number'); |
| 60 macro IS_OBJECT(arg) = (typeof(arg) === 'object'); | 61 macro IS_OBJECT(arg) = (typeof(arg) === 'object'); |
| 61 macro IS_PROXY(arg) = (%_IsJSProxy(arg)); | 62 macro IS_PROXY(arg) = (%_IsJSProxy(arg)); |
| 62 macro IS_SCRIPT(arg) = (%_ClassOf(arg) === 'Script'); | 63 macro IS_SCRIPT(arg) = (%_ClassOf(arg) === 'Script'); |
| 63 macro IS_SET(arg) = (%_IsJSSet(arg)); | 64 macro IS_SET(arg) = (%_ClassOf(arg) === 'Set'); |
| 64 macro IS_SET_ITERATOR(arg) = (%_IsJSSetIterator(arg)); | 65 macro IS_SET_ITERATOR(arg) = (%_ClassOf(arg) === 'Set Iterator'); |
| 65 macro IS_SHAREDARRAYBUFFER(arg) = (%_ClassOf(arg) === 'SharedArrayBuffer'); | 66 macro IS_SHAREDARRAYBUFFER(arg) = (%_ClassOf(arg) === 'SharedArrayBuffer'); |
| 66 macro IS_STRING(arg) = (typeof(arg) === 'string'); | 67 macro IS_STRING(arg) = (typeof(arg) === 'string'); |
| 67 macro IS_SYMBOL(arg) = (typeof(arg) === 'symbol'); | 68 macro IS_SYMBOL(arg) = (typeof(arg) === 'symbol'); |
| 68 macro IS_TYPEDARRAY(arg) = (%_IsTypedArray(arg)); | 69 macro IS_TYPEDARRAY(arg) = (%_IsTypedArray(arg)); |
| 69 macro IS_UNDEFINED(arg) = (arg === (void 0)); | 70 macro IS_UNDEFINED(arg) = (arg === (void 0)); |
| 70 macro IS_WEAKMAP(arg) = (%_IsJSWeakMap(arg)); | 71 macro IS_WEAKMAP(arg) = (%_ClassOf(arg) === 'WeakMap'); |
| 71 macro IS_WEAKSET(arg) = (%_IsJSWeakSet(arg)); | 72 macro IS_WEAKSET(arg) = (%_ClassOf(arg) === 'WeakSet'); |
| 72 | 73 |
| 73 # Macro for ES queries of the type: "Type(O) is Object." | 74 # Macro for ES queries of the type: "Type(O) is Object." |
| 74 macro IS_RECEIVER(arg) = (%_IsJSReceiver(arg)); | 75 macro IS_RECEIVER(arg) = (%_IsJSReceiver(arg)); |
| 75 | 76 |
| 76 # Macro for ES queries of the type: "IsCallable(O)" | 77 # Macro for ES queries of the type: "IsCallable(O)" |
| 77 macro IS_CALLABLE(arg) = (typeof(arg) === 'function'); | 78 macro IS_CALLABLE(arg) = (typeof(arg) === 'function'); |
| 78 | 79 |
| 79 # Macro for ES6 CheckObjectCoercible | 80 # Macro for ES6 CheckObjectCoercible |
| 80 # Will throw a TypeError of the form "[functionName] called on null or undefined
". | 81 # Will throw a TypeError of the form "[functionName] called on null or undefined
". |
| 81 macro CHECK_OBJECT_COERCIBLE(arg, functionName) = if (IS_NULL(%IS_VAR(arg)) || I
S_UNDEFINED(arg)) throw %make_type_error(kCalledOnNullOrUndefined, functionName)
; | 82 macro CHECK_OBJECT_COERCIBLE(arg, functionName) = if (IS_NULL(%IS_VAR(arg)) || I
S_UNDEFINED(arg)) throw %make_type_error(kCalledOnNullOrUndefined, functionName)
; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 define kSloppyModeBlockScopedFunctionRedefinition = 22; | 188 define kSloppyModeBlockScopedFunctionRedefinition = 22; |
| 188 define kForInInitializer = 23; | 189 define kForInInitializer = 23; |
| 189 define kArrayProtectorDirtied = 24; | 190 define kArrayProtectorDirtied = 24; |
| 190 define kArraySpeciesModified = 25; | 191 define kArraySpeciesModified = 25; |
| 191 define kArrayPrototypeConstructorModified = 26; | 192 define kArrayPrototypeConstructorModified = 26; |
| 192 define kArrayInstanceProtoModified = 27; | 193 define kArrayInstanceProtoModified = 27; |
| 193 define kArrayInstanceConstructorModified = 28; | 194 define kArrayInstanceConstructorModified = 28; |
| 194 define kLegacyFunctionDeclaration = 29; | 195 define kLegacyFunctionDeclaration = 29; |
| 195 define kRegExpPrototypeSourceGetter = 30; | 196 define kRegExpPrototypeSourceGetter = 30; |
| 196 define kRegExpPrototypeOldFlagGetter = 31; | 197 define kRegExpPrototypeOldFlagGetter = 31; |
| OLD | NEW |