| 1 |
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
| 2 |
* vim: set ts=8 sts=2 et sw=2 tw=80: |
| 3 |
* This Source Code Form is subject to the terms of the Mozilla Public |
| 4 |
* License, v. 2.0. If a copy of the MPL was not distributed with this |
| 5 |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 6 |
|
| 7 |
#ifndef jit_InlinableNatives_h |
| 8 |
#define jit_InlinableNatives_h |
| 9 |
|
| 10 |
#include <stdint.h> // For uint16_t |
| 11 |
|
| 12 |
#ifdef ENABLE_EXPLICIT_RESOURCE_MANAGEMENT |
| 13 |
# define INLINABLE_EXPLICIT_RESOURCE_MANAGEMENENT_LIST(_) \ |
| 14 |
_(IntrinsicGuardToAsyncDisposableStack) \ |
| 15 |
_(IntrinsicGuardToDisposableStack) |
| 16 |
#else |
| 17 |
# define INLINABLE_EXPLICIT_RESOURCE_MANAGEMENENT_LIST(_) |
| 18 |
#endif |
| 19 |
|
| 20 |
#ifdef FUZZING_JS_FUZZILLI |
| 21 |
# define INLINABLE_NATIVE_FUZZILLI_LIST(_) _(FuzzilliHash) |
| 22 |
#else |
| 23 |
# define INLINABLE_NATIVE_FUZZILLI_LIST(_) |
| 24 |
#endif |
| 25 |
|
| 26 |
#ifdef NIGHTLY_BUILD |
| 27 |
# define INLINABLE_NATIVE_ITERATOR_RANGE_LIST(_) \ |
| 28 |
_(IntrinsicGuardToIteratorRange) |
| 29 |
#else |
| 30 |
# define INLINABLE_NATIVE_ITERATOR_RANGE_LIST(_) |
| 31 |
#endif |
| 32 |
|
| 33 |
#define INLINABLE_NATIVE_LIST(_) \ |
| 34 |
_(Array) \ |
| 35 |
_(ArrayIsArray) \ |
| 36 |
_(ArrayJoin) \ |
| 37 |
_(ArrayPop) \ |
| 38 |
_(ArrayShift) \ |
| 39 |
_(ArrayPush) \ |
| 40 |
_(ArraySlice) \ |
| 41 |
\ |
| 42 |
_(AtomicsCompareExchange) \ |
| 43 |
_(AtomicsExchange) \ |
| 44 |
_(AtomicsLoad) \ |
| 45 |
_(AtomicsStore) \ |
| 46 |
_(AtomicsAdd) \ |
| 47 |
_(AtomicsSub) \ |
| 48 |
_(AtomicsAnd) \ |
| 49 |
_(AtomicsOr) \ |
| 50 |
_(AtomicsXor) \ |
| 51 |
_(AtomicsIsLockFree) \ |
| 52 |
_(AtomicsPause) \ |
| 53 |
\ |
| 54 |
_(BigInt) \ |
| 55 |
_(BigIntAsIntN) \ |
| 56 |
_(BigIntAsUintN) \ |
| 57 |
\ |
| 58 |
_(Boolean) \ |
| 59 |
\ |
| 60 |
_(DataViewGetInt8) \ |
| 61 |
_(DataViewGetUint8) \ |
| 62 |
_(DataViewGetInt16) \ |
| 63 |
_(DataViewGetUint16) \ |
| 64 |
_(DataViewGetInt32) \ |
| 65 |
_(DataViewGetUint32) \ |
| 66 |
_(DataViewGetFloat16) \ |
| 67 |
_(DataViewGetFloat32) \ |
| 68 |
_(DataViewGetFloat64) \ |
| 69 |
_(DataViewGetBigInt64) \ |
| 70 |
_(DataViewGetBigUint64) \ |
| 71 |
_(DataViewSetInt8) \ |
| 72 |
_(DataViewSetUint8) \ |
| 73 |
_(DataViewSetInt16) \ |
| 74 |
_(DataViewSetUint16) \ |
| 75 |
_(DataViewSetInt32) \ |
| 76 |
_(DataViewSetUint32) \ |
| 77 |
_(DataViewSetFloat16) \ |
| 78 |
_(DataViewSetFloat32) \ |
| 79 |
_(DataViewSetFloat64) \ |
| 80 |
_(DataViewSetBigInt64) \ |
| 81 |
_(DataViewSetBigUint64) \ |
| 82 |
\ |
| 83 |
_(DateGetTime) \ |
| 84 |
_(DateGetFullYear) \ |
| 85 |
_(DateGetMonth) \ |
| 86 |
_(DateGetDate) \ |
| 87 |
_(DateGetDay) \ |
| 88 |
_(DateGetHours) \ |
| 89 |
_(DateGetMinutes) \ |
| 90 |
_(DateGetSeconds) \ |
| 91 |
\ |
| 92 |
_(FunctionBind) \ |
| 93 |
\ |
| 94 |
_(IntlGuardToCollator) \ |
| 95 |
_(IntlGuardToDateTimeFormat) \ |
| 96 |
_(IntlGuardToDisplayNames) \ |
| 97 |
_(IntlGuardToDurationFormat) \ |
| 98 |
_(IntlGuardToListFormat) \ |
| 99 |
_(IntlGuardToNumberFormat) \ |
| 100 |
_(IntlGuardToPluralRules) \ |
| 101 |
_(IntlGuardToRelativeTimeFormat) \ |
| 102 |
_(IntlGuardToSegmenter) \ |
| 103 |
_(IntlGuardToSegments) \ |
| 104 |
_(IntlGuardToSegmentIterator) \ |
| 105 |
\ |
| 106 |
_(MapConstructor) \ |
| 107 |
_(MapDelete) \ |
| 108 |
_(MapGet) \ |
| 109 |
_(MapHas) \ |
| 110 |
_(MapSet) \ |
| 111 |
\ |
| 112 |
_(MathAbs) \ |
| 113 |
_(MathFloor) \ |
| 114 |
_(MathCeil) \ |
| 115 |
_(MathRound) \ |
| 116 |
_(MathClz32) \ |
| 117 |
_(MathSqrt) \ |
| 118 |
_(MathATan2) \ |
| 119 |
_(MathHypot) \ |
| 120 |
_(MathMax) \ |
| 121 |
_(MathMin) \ |
| 122 |
_(MathPow) \ |
| 123 |
_(MathRandom) \ |
| 124 |
_(MathImul) \ |
| 125 |
_(MathFRound) \ |
| 126 |
_(MathF16Round) \ |
| 127 |
_(MathSin) \ |
| 128 |
_(MathTan) \ |
| 129 |
_(MathCos) \ |
| 130 |
_(MathExp) \ |
| 131 |
_(MathLog) \ |
| 132 |
_(MathASin) \ |
| 133 |
_(MathATan) \ |
| 134 |
_(MathACos) \ |
| 135 |
_(MathLog10) \ |
| 136 |
_(MathLog2) \ |
| 137 |
_(MathLog1P) \ |
| 138 |
_(MathExpM1) \ |
| 139 |
_(MathSinH) \ |
| 140 |
_(MathTanH) \ |
| 141 |
_(MathCosH) \ |
| 142 |
_(MathASinH) \ |
| 143 |
_(MathATanH) \ |
| 144 |
_(MathACosH) \ |
| 145 |
_(MathSign) \ |
| 146 |
_(MathTrunc) \ |
| 147 |
_(MathCbrt) \ |
| 148 |
\ |
| 149 |
_(Number) \ |
| 150 |
_(NumberParseInt) \ |
| 151 |
_(NumberToString) \ |
| 152 |
\ |
| 153 |
_(ReflectGetPrototypeOf) \ |
| 154 |
\ |
| 155 |
_(RegExpMatcher) \ |
| 156 |
_(RegExpSearcher) \ |
| 157 |
_(RegExpSearcherLastLimit) \ |
| 158 |
_(RegExpHasCaptureGroups) \ |
| 159 |
_(IsRegExpObject) \ |
| 160 |
_(IsOptimizableRegExpObject) \ |
| 161 |
_(IsPossiblyWrappedRegExpObject) \ |
| 162 |
_(IsRegExpPrototypeOptimizable) \ |
| 163 |
_(GetFirstDollarIndex) \ |
| 164 |
\ |
| 165 |
_(SetConstructor) \ |
| 166 |
_(SetDelete) \ |
| 167 |
_(SetHas) \ |
| 168 |
_(SetAdd) \ |
| 169 |
_(SetSize) \ |
| 170 |
\ |
| 171 |
_(String) \ |
| 172 |
_(StringToString) \ |
| 173 |
_(StringValueOf) \ |
| 174 |
_(StringCharCodeAt) \ |
| 175 |
_(StringCodePointAt) \ |
| 176 |
_(StringFromCharCode) \ |
| 177 |
_(StringFromCodePoint) \ |
| 178 |
_(StringCharAt) \ |
| 179 |
_(StringAt) \ |
| 180 |
_(StringIncludes) \ |
| 181 |
_(StringIndexOf) \ |
| 182 |
_(StringLastIndexOf) \ |
| 183 |
_(StringStartsWith) \ |
| 184 |
_(StringEndsWith) \ |
| 185 |
_(StringToLowerCase) \ |
| 186 |
_(StringToUpperCase) \ |
| 187 |
_(StringTrim) \ |
| 188 |
_(StringTrimStart) \ |
| 189 |
_(StringTrimEnd) \ |
| 190 |
\ |
| 191 |
_(IntrinsicStringReplaceString) \ |
| 192 |
_(IntrinsicStringSplitString) \ |
| 193 |
\ |
| 194 |
_(Object) \ |
| 195 |
_(ObjectCreate) \ |
| 196 |
_(ObjectIs) \ |
| 197 |
_(ObjectIsPrototypeOf) \ |
| 198 |
_(ObjectKeys) \ |
| 199 |
_(ObjectToString) \ |
| 200 |
\ |
| 201 |
_(TestBailout) \ |
| 202 |
_(TestAssertFloat32) \ |
| 203 |
_(TestAssertRecoveredOnBailout) \ |
| 204 |
\ |
| 205 |
_(IntrinsicUnsafeSetReservedSlot) \ |
| 206 |
_(IntrinsicUnsafeGetReservedSlot) \ |
| 207 |
_(IntrinsicUnsafeGetObjectFromReservedSlot) \ |
| 208 |
_(IntrinsicUnsafeGetInt32FromReservedSlot) \ |
| 209 |
_(IntrinsicUnsafeGetStringFromReservedSlot) \ |
| 210 |
\ |
| 211 |
_(IntrinsicIsCallable) \ |
| 212 |
_(IntrinsicIsConstructor) \ |
| 213 |
_(IntrinsicToObject) \ |
| 214 |
_(IntrinsicIsObject) \ |
| 215 |
_(IntrinsicIsCrossRealmArrayConstructor) \ |
| 216 |
_(IntrinsicCanOptimizeArraySpecies) \ |
| 217 |
_(IntrinsicCanOptimizeStringProtoSymbolLookup) \ |
| 218 |
_(IntrinsicToInteger) \ |
| 219 |
_(IntrinsicToLength) \ |
| 220 |
_(IntrinsicIsConstructing) \ |
| 221 |
_(IntrinsicSubstringKernel) \ |
| 222 |
_(IntrinsicIsPackedArray) \ |
| 223 |
\ |
| 224 |
_(IntrinsicIsSuspendedGenerator) \ |
| 225 |
\ |
| 226 |
_(IntrinsicGuardToArrayIterator) \ |
| 227 |
_(IntrinsicGuardToMapIterator) \ |
| 228 |
_(IntrinsicGuardToSetIterator) \ |
| 229 |
_(IntrinsicGuardToStringIterator) \ |
| 230 |
_(IntrinsicGuardToRegExpStringIterator) \ |
| 231 |
_(IntrinsicGuardToWrapForValidIterator) \ |
| 232 |
_(IntrinsicGuardToIteratorHelper) \ |
| 233 |
_(IntrinsicGuardToAsyncIteratorHelper) \ |
| 234 |
_(IntrinsicGuardToMapObject) \ |
| 235 |
_(IntrinsicGetNextMapEntryForIterator) \ |
| 236 |
\ |
| 237 |
_(IntrinsicGuardToSetObject) \ |
| 238 |
_(IntrinsicGetNextSetEntryForIterator) \ |
| 239 |
\ |
| 240 |
_(IntrinsicNewArrayIterator) \ |
| 241 |
_(IntrinsicNewStringIterator) \ |
| 242 |
_(IntrinsicNewRegExpStringIterator) \ |
| 243 |
_(IntrinsicArrayIteratorPrototypeOptimizable) \ |
| 244 |
\ |
| 245 |
_(IntrinsicGuardToArrayBuffer) \ |
| 246 |
\ |
| 247 |
_(IntrinsicGuardToSharedArrayBuffer) \ |
| 248 |
\ |
| 249 |
_(TypedArrayConstructor) \ |
| 250 |
_(IntrinsicIsTypedArrayConstructor) \ |
| 251 |
_(IntrinsicIsTypedArray) \ |
| 252 |
_(IntrinsicIsPossiblyWrappedTypedArray) \ |
| 253 |
_(IntrinsicTypedArrayLength) \ |
| 254 |
_(IntrinsicTypedArrayLengthZeroOnOutOfBounds) \ |
| 255 |
_(IntrinsicPossiblyWrappedTypedArrayLength) \ |
| 256 |
_(IntrinsicRegExpBuiltinExec) \ |
| 257 |
_(IntrinsicRegExpBuiltinExecForTest) \ |
| 258 |
_(IntrinsicRegExpExec) \ |
| 259 |
_(IntrinsicRegExpExecForTest) \ |
| 260 |
_(IntrinsicTypedArrayByteOffset) \ |
| 261 |
_(IntrinsicTypedArrayElementSize) \ |
| 262 |
\ |
| 263 |
_(IntrinsicThisTimeValue) \ |
| 264 |
\ |
| 265 |
INLINABLE_EXPLICIT_RESOURCE_MANAGEMENENT_LIST(_) \ |
| 266 |
INLINABLE_NATIVE_FUZZILLI_LIST(_) \ |
| 267 |
INLINABLE_NATIVE_ITERATOR_RANGE_LIST(_) |
| 268 |
|
| 269 |
struct JSClass; |
| 270 |
class JSJitInfo; |
| 271 |
|
| 272 |
namespace js { |
| 273 |
namespace jit { |
| 274 |
|
| 275 |
enum class InlinableNative : uint16_t { |
| 276 |
#define ADD_NATIVE(native) native, |
| 277 |
INLINABLE_NATIVE_LIST(ADD_NATIVE) |
| 278 |
#undef ADD_NATIVE |
| 279 |
Limit |
| 280 |
}; |
| 281 |
|
| 282 |
#define ADD_NATIVE(native) extern const JSJitInfo JitInfo_##native; |
| 283 |
INLINABLE_NATIVE_LIST(ADD_NATIVE) |
| 284 |
#undef ADD_NATIVE |
| 285 |
|
| 286 |
const JSClass* InlinableNativeGuardToClass(InlinableNative native); |
| 287 |
|
| 288 |
bool CanInlineNativeCrossRealm(InlinableNative native); |
| 289 |
|
| 290 |
} // namespace jit |
| 291 |
} // namespace js |
| 292 |
|
| 293 |
#endif /* jit_InlinableNatives_h */ |