| Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 1 | # Copyright 2006-2009 the V8 project authors. All rights reserved. |
| 2 | # Redistribution and use in source and binary forms, with or without |
| 3 | # modification, are permitted provided that the following conditions are |
| 4 | # met: |
| 5 | # |
| 6 | # * Redistributions of source code must retain the above copyright |
| 7 | # notice, this list of conditions and the following disclaimer. |
| 8 | # * Redistributions in binary form must reproduce the above |
| 9 | # copyright notice, this list of conditions and the following |
| 10 | # disclaimer in the documentation and/or other materials provided |
| 11 | # with the distribution. |
| 12 | # * Neither the name of Google Inc. nor the names of its |
| 13 | # contributors may be used to endorse or promote products derived |
| 14 | # from this software without specific prior written permission. |
| 15 | # |
| 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
| 28 | # Dictionary that is passed as defines for js2c.py. |
| Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 29 | # Used for defines that must be defined for all native JS files. |
| Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 30 | |
| 31 | const NONE = 0; |
| 32 | const READ_ONLY = 1; |
| 33 | const DONT_ENUM = 2; |
| 34 | const DONT_DELETE = 4; |
| Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 35 | const NEW_ONE_BYTE_STRING = true; |
| 36 | const NEW_TWO_BYTE_STRING = false; |
| Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 37 | |
| 38 | # Constants used for getter and setter operations. |
| 39 | const GETTER = 0; |
| 40 | const SETTER = 1; |
| 41 | |
| 42 | # These definitions must match the index of the properties in objects.h. |
| Ben Murdoch | 3fb3ca8 | 2011-12-02 17:19:32 +0000 | [diff] [blame] | 43 | const kApiTagOffset = 0; |
| 44 | const kApiPropertyListOffset = 1; |
| Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 45 | const kApiSerialNumberOffset = 3; |
| 46 | const kApiConstructorOffset = 3; |
| Ben Murdoch | 3fb3ca8 | 2011-12-02 17:19:32 +0000 | [diff] [blame] | 47 | const kApiPrototypeTemplateOffset = 5; |
| 48 | const kApiParentTemplateOffset = 6; |
| Ben Murdoch | 69a99ed | 2011-11-30 16:03:39 +0000 | [diff] [blame] | 49 | const kApiFlagOffset = 14; |
| Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 50 | |
| 51 | const NO_HINT = 0; |
| 52 | const NUMBER_HINT = 1; |
| 53 | const STRING_HINT = 2; |
| 54 | |
| 55 | const kFunctionTag = 0; |
| 56 | const kNewObjectTag = 1; |
| 57 | |
| 58 | # For date.js. |
| 59 | const HoursPerDay = 24; |
| 60 | const MinutesPerHour = 60; |
| 61 | const SecondsPerMinute = 60; |
| 62 | const msPerSecond = 1000; |
| 63 | const msPerMinute = 60000; |
| 64 | const msPerHour = 3600000; |
| 65 | const msPerDay = 86400000; |
| 66 | const msPerMonth = 2592000000; |
| 67 | |
| 68 | # For apinatives.js |
| 69 | const kUninitialized = -1; |
| Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 70 | const kReadOnlyPrototypeBit = 3; |
| 71 | const kRemovePrototypeBit = 4; # For FunctionTemplateInfo, matches objects.h |
| 72 | const kDoNotCacheBit = 5; # For FunctionTemplateInfo, matches objects.h |
| Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 73 | |
| 74 | # Note: kDayZeroInJulianDay = ToJulianDay(1970, 0, 1). |
| 75 | const kInvalidDate = 'Invalid Date'; |
| 76 | const kDayZeroInJulianDay = 2440588; |
| 77 | const kMonthMask = 0x1e0; |
| 78 | const kDayMask = 0x01f; |
| 79 | const kYearShift = 9; |
| 80 | const kMonthShift = 5; |
| 81 | |
| Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 82 | # Limits for parts of the date, so that we support all the dates that |
| 83 | # ECMA 262 - 15.9.1.1 requires us to, but at the same time be sure that |
| 84 | # the date (days since 1970) is in SMI range. |
| 85 | const kMinYear = -1000000; |
| 86 | const kMaxYear = 1000000; |
| 87 | const kMinMonth = -10000000; |
| 88 | const kMaxMonth = 10000000; |
| Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 89 | |
| Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 90 | # Strict mode flags for passing to %SetProperty |
| 91 | const kSloppyMode = 0; |
| 92 | const kStrictMode = 1; |
| 93 | |
| Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 94 | # Native cache ids. |
| 95 | const STRING_TO_REGEXP_CACHE_ID = 0; |
| 96 | |
| Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 97 | # Type query macros. |
| Andrei Popescu | 402d937 | 2010-02-26 13:31:12 +0000 | [diff] [blame] | 98 | # |
| 99 | # Note: We have special support for typeof(foo) === 'bar' in the compiler. |
| 100 | # It will *not* generate a runtime typeof call for the most important |
| 101 | # values of 'bar'. |
| Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 102 | macro IS_NULL(arg) = (arg === null); |
| 103 | macro IS_NULL_OR_UNDEFINED(arg) = (arg == null); |
| Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 104 | macro IS_UNDEFINED(arg) = (arg === (void 0)); |
| Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 105 | macro IS_NUMBER(arg) = (typeof(arg) === 'number'); |
| 106 | macro IS_STRING(arg) = (typeof(arg) === 'string'); |
| Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 107 | macro IS_BOOLEAN(arg) = (typeof(arg) === 'boolean'); |
| Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 108 | macro IS_SYMBOL(arg) = (typeof(arg) === 'symbol'); |
| Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 109 | macro IS_OBJECT(arg) = (%_IsObject(arg)); |
| Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 110 | macro IS_ARRAY(arg) = (%_IsArray(arg)); |
| Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 111 | macro IS_FUNCTION(arg) = (%_IsFunction(arg)); |
| Andrei Popescu | 402d937 | 2010-02-26 13:31:12 +0000 | [diff] [blame] | 112 | macro IS_REGEXP(arg) = (%_IsRegExp(arg)); |
| Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 113 | macro IS_SET(arg) = (%_ClassOf(arg) === 'Set'); |
| 114 | macro IS_MAP(arg) = (%_ClassOf(arg) === 'Map'); |
| 115 | macro IS_WEAKMAP(arg) = (%_ClassOf(arg) === 'WeakMap'); |
| Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 116 | macro IS_WEAKSET(arg) = (%_ClassOf(arg) === 'WeakSet'); |
| Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 117 | macro IS_DATE(arg) = (%_ClassOf(arg) === 'Date'); |
| 118 | macro IS_NUMBER_WRAPPER(arg) = (%_ClassOf(arg) === 'Number'); |
| 119 | macro IS_STRING_WRAPPER(arg) = (%_ClassOf(arg) === 'String'); |
| Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 120 | macro IS_SYMBOL_WRAPPER(arg) = (%_ClassOf(arg) === 'Symbol'); |
| Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 121 | macro IS_BOOLEAN_WRAPPER(arg) = (%_ClassOf(arg) === 'Boolean'); |
| 122 | macro IS_ERROR(arg) = (%_ClassOf(arg) === 'Error'); |
| 123 | macro IS_SCRIPT(arg) = (%_ClassOf(arg) === 'Script'); |
| 124 | macro IS_ARGUMENTS(arg) = (%_ClassOf(arg) === 'Arguments'); |
| 125 | macro IS_GLOBAL(arg) = (%_ClassOf(arg) === 'global'); |
| Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 126 | macro IS_ARRAYBUFFER(arg) = (%_ClassOf(arg) === 'ArrayBuffer'); |
| 127 | macro IS_DATAVIEW(arg) = (%_ClassOf(arg) === 'DataView'); |
| 128 | macro IS_GENERATOR(arg) = (%_ClassOf(arg) === 'Generator'); |
| 129 | macro IS_SET_ITERATOR(arg) = (%_ClassOf(arg) === 'Set Iterator'); |
| 130 | macro IS_MAP_ITERATOR(arg) = (%_ClassOf(arg) === 'Map Iterator'); |
| Leon Clarke | d91b9f7 | 2010-01-27 17:25:45 +0000 | [diff] [blame] | 131 | macro IS_UNDETECTABLE(arg) = (%_IsUndetectableObject(arg)); |
| Leon Clarke | e46be81 | 2010-01-19 14:06:41 +0000 | [diff] [blame] | 132 | macro FLOOR(arg) = $floor(arg); |
| Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 133 | |
| Kristian Monsen | 25f6136 | 2010-05-21 11:50:48 +0100 | [diff] [blame] | 134 | # Macro for ECMAScript 5 queries of the type: |
| 135 | # "Type(O) is object." |
| Ben Murdoch | 589d697 | 2011-11-30 16:04:58 +0000 | [diff] [blame] | 136 | # This is the same as being either a function or an object in V8 terminology |
| 137 | # (including proxies). |
| Ben Murdoch | 3bec4d2 | 2010-07-22 14:51:16 +0100 | [diff] [blame] | 138 | # In addition, an undetectable object is also included by this. |
| Ben Murdoch | 589d697 | 2011-11-30 16:04:58 +0000 | [diff] [blame] | 139 | macro IS_SPEC_OBJECT(arg) = (%_IsSpecObject(arg)); |
| 140 | |
| 141 | # Macro for ECMAScript 5 queries of the type: |
| 142 | # "IsCallable(O)" |
| 143 | # We assume here that this is the same as being either a function or a function |
| 144 | # proxy. That ignores host objects with [[Call]] methods, but in most situations |
| 145 | # we cannot handle those anyway. |
| 146 | macro IS_SPEC_FUNCTION(arg) = (%_ClassOf(arg) === 'Function'); |
| Kristian Monsen | 25f6136 | 2010-05-21 11:50:48 +0100 | [diff] [blame] | 147 | |
| Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 148 | # Macro for ES6 CheckObjectCoercible |
| 149 | # Will throw a TypeError of the form "[functionName] called on null or undefined". |
| 150 | macro CHECK_OBJECT_COERCIBLE(arg, functionName) = if (IS_NULL_OR_UNDEFINED(arg) && !IS_UNDETECTABLE(arg)) throw MakeTypeError('called_on_null_or_undefined', [functionName]); |
| 151 | |
| Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 152 | # Indices in bound function info retrieved by %BoundFunctionGetBindings(...). |
| 153 | const kBoundFunctionIndex = 0; |
| 154 | const kBoundThisIndex = 1; |
| 155 | const kBoundArgumentsStartIndex = 2; |
| 156 | |
| Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 157 | # Inline macros. Use %IS_VAR to make sure arg is evaluated only once. |
| 158 | macro NUMBER_IS_NAN(arg) = (!%_IsSmi(%IS_VAR(arg)) && !(arg == arg)); |
| Ben Murdoch | 589d697 | 2011-11-30 16:04:58 +0000 | [diff] [blame] | 159 | macro NUMBER_IS_FINITE(arg) = (%_IsSmi(%IS_VAR(arg)) || ((arg == arg) && (arg != 1/0) && (arg != -1/0))); |
| Kristian Monsen | 80d68ea | 2010-09-08 11:05:35 +0100 | [diff] [blame] | 160 | macro TO_INTEGER(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : %NumberToInteger(ToNumber(arg))); |
| Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 161 | macro TO_INTEGER_FOR_SIDE_EFFECT(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : ToNumber(arg)); |
| Steve Block | 8defd9f | 2010-07-08 12:39:36 +0100 | [diff] [blame] | 162 | macro TO_INTEGER_MAP_MINUS_ZERO(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : %NumberToIntegerMapMinusZero(ToNumber(arg))); |
| Andrei Popescu | 402d937 | 2010-02-26 13:31:12 +0000 | [diff] [blame] | 163 | macro TO_INT32(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg : (arg >> 0)); |
| 164 | macro TO_UINT32(arg) = (arg >>> 0); |
| 165 | macro TO_STRING_INLINE(arg) = (IS_STRING(%IS_VAR(arg)) ? arg : NonStringToString(arg)); |
| Ben Murdoch | 086aeea | 2011-05-13 15:57:08 +0100 | [diff] [blame] | 166 | macro TO_NUMBER_INLINE(arg) = (IS_NUMBER(%IS_VAR(arg)) ? arg : NonNumberToNumber(arg)); |
| Ben Murdoch | 257744e | 2011-11-30 15:57:28 +0000 | [diff] [blame] | 167 | macro TO_OBJECT_INLINE(arg) = (IS_SPEC_OBJECT(%IS_VAR(arg)) ? arg : ToObject(arg)); |
| Ben Murdoch | 3fb3ca8 | 2011-12-02 17:19:32 +0000 | [diff] [blame] | 168 | macro JSON_NUMBER_TO_STRING(arg) = ((%_IsSmi(%IS_VAR(arg)) || arg - arg == 0) ? %_NumberToString(arg) : "null"); |
| Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 169 | macro HAS_OWN_PROPERTY(obj, index) = (%_CallFunction(obj, index, ObjectHasOwnProperty)); |
| 170 | |
| 171 | # Private names. |
| 172 | # GET_PRIVATE should only be used if the property is known to exists on obj |
| 173 | # itself (it should really use %GetOwnProperty, but that would be way slower). |
| 174 | macro GLOBAL_PRIVATE(name) = (%CreateGlobalPrivateOwnSymbol(name)); |
| 175 | macro NEW_PRIVATE_OWN(name) = (%CreatePrivateOwnSymbol(name)); |
| 176 | macro IS_PRIVATE(sym) = (%SymbolIsPrivate(sym)); |
| 177 | macro HAS_PRIVATE(obj, sym) = (%HasOwnProperty(obj, sym)); |
| 178 | macro HAS_DEFINED_PRIVATE(obj, sym) = (!IS_UNDEFINED(obj[sym])); |
| 179 | macro GET_PRIVATE(obj, sym) = (obj[sym]); |
| 180 | macro SET_PRIVATE(obj, sym, val) = (obj[sym] = val); |
| 181 | macro DELETE_PRIVATE(obj, sym) = (delete obj[sym]); |
| 182 | |
| 183 | # Constants. The compiler constant folds them. |
| 184 | const NAN = $NaN; |
| 185 | const INFINITY = (1/0); |
| 186 | const UNDEFINED = (void 0); |
| Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 187 | |
| 188 | # Macros implemented in Python. |
| 189 | python macro CHAR_CODE(str) = ord(str[1]); |
| 190 | |
| Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 191 | # Constants used on an array to implement the properties of the RegExp object. |
| 192 | const REGEXP_NUMBER_OF_CAPTURES = 0; |
| 193 | const REGEXP_FIRST_CAPTURE = 3; |
| 194 | |
| 195 | # We can't put macros in macros so we use constants here. |
| 196 | # REGEXP_NUMBER_OF_CAPTURES |
| 197 | macro NUMBER_OF_CAPTURES(array) = ((array)[0]); |
| 198 | |
| Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 199 | # Limit according to ECMA 262 15.9.1.1 |
| 200 | const MAX_TIME_MS = 8640000000000000; |
| Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 201 | # Limit which is MAX_TIME_MS + msPerMonth. |
| 202 | const MAX_TIME_BEFORE_UTC = 8640002592000000; |
| Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 203 | |
| Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 204 | # Gets the value of a Date object. If arg is not a Date object |
| 205 | # a type error is thrown. |
| Ben Murdoch | 3ef787d | 2012-04-12 10:51:47 +0100 | [diff] [blame] | 206 | macro CHECK_DATE(arg) = if (%_ClassOf(arg) !== 'Date') ThrowDateTypeError(); |
| 207 | macro LOCAL_DATE_VALUE(arg) = (%_DateField(arg, 0) + %_DateField(arg, 21)); |
| 208 | macro UTC_DATE_VALUE(arg) = (%_DateField(arg, 0)); |
| 209 | |
| 210 | macro LOCAL_YEAR(arg) = (%_DateField(arg, 1)); |
| 211 | macro LOCAL_MONTH(arg) = (%_DateField(arg, 2)); |
| 212 | macro LOCAL_DAY(arg) = (%_DateField(arg, 3)); |
| 213 | macro LOCAL_WEEKDAY(arg) = (%_DateField(arg, 4)); |
| 214 | macro LOCAL_HOUR(arg) = (%_DateField(arg, 5)); |
| 215 | macro LOCAL_MIN(arg) = (%_DateField(arg, 6)); |
| 216 | macro LOCAL_SEC(arg) = (%_DateField(arg, 7)); |
| 217 | macro LOCAL_MS(arg) = (%_DateField(arg, 8)); |
| 218 | macro LOCAL_DAYS(arg) = (%_DateField(arg, 9)); |
| 219 | macro LOCAL_TIME_IN_DAY(arg) = (%_DateField(arg, 10)); |
| 220 | |
| 221 | macro UTC_YEAR(arg) = (%_DateField(arg, 11)); |
| 222 | macro UTC_MONTH(arg) = (%_DateField(arg, 12)); |
| 223 | macro UTC_DAY(arg) = (%_DateField(arg, 13)); |
| 224 | macro UTC_WEEKDAY(arg) = (%_DateField(arg, 14)); |
| 225 | macro UTC_HOUR(arg) = (%_DateField(arg, 15)); |
| 226 | macro UTC_MIN(arg) = (%_DateField(arg, 16)); |
| 227 | macro UTC_SEC(arg) = (%_DateField(arg, 17)); |
| 228 | macro UTC_MS(arg) = (%_DateField(arg, 18)); |
| 229 | macro UTC_DAYS(arg) = (%_DateField(arg, 19)); |
| 230 | macro UTC_TIME_IN_DAY(arg) = (%_DateField(arg, 20)); |
| 231 | |
| 232 | macro TIMEZONE_OFFSET(arg) = (%_DateField(arg, 21)); |
| 233 | |
| 234 | macro SET_UTC_DATE_VALUE(arg, value) = (%DateSetValue(arg, value, 1)); |
| 235 | macro SET_LOCAL_DATE_VALUE(arg, value) = (%DateSetValue(arg, value, 0)); |
| Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 236 | |
| Steve Block | 3ce2e20 | 2009-11-05 08:53:23 +0000 | [diff] [blame] | 237 | # Last input and last subject of regexp matches. |
| Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 238 | const LAST_SUBJECT_INDEX = 1; |
| Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 239 | macro LAST_SUBJECT(array) = ((array)[1]); |
| 240 | macro LAST_INPUT(array) = ((array)[2]); |
| 241 | |
| 242 | # REGEXP_FIRST_CAPTURE |
| 243 | macro CAPTURE(index) = (3 + (index)); |
| 244 | const CAPTURE0 = 3; |
| 245 | const CAPTURE1 = 4; |
| Ben Murdoch | 7f4d5bd | 2010-06-15 11:15:29 +0100 | [diff] [blame] | 246 | |
| Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 247 | # For the regexp capture override array. This has the same |
| 248 | # format as the arguments to a function called from |
| 249 | # String.prototype.replace. |
| 250 | macro OVERRIDE_MATCH(override) = ((override)[0]); |
| 251 | macro OVERRIDE_POS(override) = ((override)[(override).length - 2]); |
| 252 | macro OVERRIDE_SUBJECT(override) = ((override)[(override).length - 1]); |
| 253 | # 1-based so index of 1 returns the first capture |
| 254 | macro OVERRIDE_CAPTURE(override, index) = ((override)[(index)]); |
| 255 | |
| Ben Murdoch | 589d697 | 2011-11-30 16:04:58 +0000 | [diff] [blame] | 256 | # PropertyDescriptor return value indices - must match |
| Ben Murdoch | 7f4d5bd | 2010-06-15 11:15:29 +0100 | [diff] [blame] | 257 | # PropertyDescriptorIndices in runtime.cc. |
| 258 | const IS_ACCESSOR_INDEX = 0; |
| 259 | const VALUE_INDEX = 1; |
| 260 | const GETTER_INDEX = 2; |
| 261 | const SETTER_INDEX = 3; |
| 262 | const WRITABLE_INDEX = 4; |
| 263 | const ENUMERABLE_INDEX = 5; |
| 264 | const CONFIGURABLE_INDEX = 6; |
| Ben Murdoch | 589d697 | 2011-11-30 16:04:58 +0000 | [diff] [blame] | 265 | |
| 266 | # For messages.js |
| 267 | # Matches Script::Type from objects.h |
| 268 | const TYPE_NATIVE = 0; |
| 269 | const TYPE_EXTENSION = 1; |
| 270 | const TYPE_NORMAL = 2; |
| 271 | |
| 272 | # Matches Script::CompilationType from objects.h |
| 273 | const COMPILATION_TYPE_HOST = 0; |
| 274 | const COMPILATION_TYPE_EVAL = 1; |
| 275 | const COMPILATION_TYPE_JSON = 2; |
| 276 | |
| 277 | # Matches Messages::kNoLineNumberInfo from v8.h |
| 278 | const kNoLineNumberInfo = 0; |
| Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame^] | 279 | |
| 280 | # Matches PropertyAttributes from property-details.h |
| 281 | const PROPERTY_ATTRIBUTES_NONE = 0; |
| 282 | const PROPERTY_ATTRIBUTES_STRING = 8; |
| 283 | const PROPERTY_ATTRIBUTES_SYMBOLIC = 16; |
| 284 | const PROPERTY_ATTRIBUTES_PRIVATE_SYMBOL = 32; |
| 285 | |
| 286 | # Use for keys, values and entries iterators. |
| 287 | const ITERATOR_KIND_KEYS = 1; |
| 288 | const ITERATOR_KIND_VALUES = 2; |
| 289 | const ITERATOR_KIND_ENTRIES = 3; |
| 290 | |
| 291 | # Check whether debug is active. |
| 292 | const DEBUG_IS_ACTIVE = (%_DebugIsActive() != 0); |