tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

InlinableNatives.h (15163B)


      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  _(ArrayBufferByteLength)                         \
     43                                                   \
     44  _(AtomicsCompareExchange)                        \
     45  _(AtomicsExchange)                               \
     46  _(AtomicsLoad)                                   \
     47  _(AtomicsStore)                                  \
     48  _(AtomicsAdd)                                    \
     49  _(AtomicsSub)                                    \
     50  _(AtomicsAnd)                                    \
     51  _(AtomicsOr)                                     \
     52  _(AtomicsXor)                                    \
     53  _(AtomicsIsLockFree)                             \
     54  _(AtomicsPause)                                  \
     55                                                   \
     56  _(BigInt)                                        \
     57  _(BigIntAsIntN)                                  \
     58  _(BigIntAsUintN)                                 \
     59                                                   \
     60  _(Boolean)                                       \
     61                                                   \
     62  _(DataViewGetInt8)                               \
     63  _(DataViewGetUint8)                              \
     64  _(DataViewGetInt16)                              \
     65  _(DataViewGetUint16)                             \
     66  _(DataViewGetInt32)                              \
     67  _(DataViewGetUint32)                             \
     68  _(DataViewGetFloat16)                            \
     69  _(DataViewGetFloat32)                            \
     70  _(DataViewGetFloat64)                            \
     71  _(DataViewGetBigInt64)                           \
     72  _(DataViewGetBigUint64)                          \
     73  _(DataViewSetInt8)                               \
     74  _(DataViewSetUint8)                              \
     75  _(DataViewSetInt16)                              \
     76  _(DataViewSetUint16)                             \
     77  _(DataViewSetInt32)                              \
     78  _(DataViewSetUint32)                             \
     79  _(DataViewSetFloat16)                            \
     80  _(DataViewSetFloat32)                            \
     81  _(DataViewSetFloat64)                            \
     82  _(DataViewSetBigInt64)                           \
     83  _(DataViewSetBigUint64)                          \
     84  _(DataViewByteLength)                            \
     85  _(DataViewByteOffset)                            \
     86                                                   \
     87  _(DateGetTime)                                   \
     88  _(DateGetFullYear)                               \
     89  _(DateGetMonth)                                  \
     90  _(DateGetDate)                                   \
     91  _(DateGetDay)                                    \
     92  _(DateGetHours)                                  \
     93  _(DateGetMinutes)                                \
     94  _(DateGetSeconds)                                \
     95                                                   \
     96  _(FunctionBind)                                  \
     97                                                   \
     98  _(IntlGuardToCollator)                           \
     99  _(IntlGuardToDateTimeFormat)                     \
    100  _(IntlGuardToDisplayNames)                       \
    101  _(IntlGuardToDurationFormat)                     \
    102  _(IntlGuardToListFormat)                         \
    103  _(IntlGuardToNumberFormat)                       \
    104  _(IntlGuardToPluralRules)                        \
    105  _(IntlGuardToRelativeTimeFormat)                 \
    106  _(IntlGuardToSegmenter)                          \
    107  _(IntlGuardToSegments)                           \
    108  _(IntlGuardToSegmentIterator)                    \
    109                                                   \
    110  _(MapConstructor)                                \
    111  _(MapDelete)                                     \
    112  _(MapGet)                                        \
    113  _(MapHas)                                        \
    114  _(MapSet)                                        \
    115  _(MapSize)                                       \
    116                                                   \
    117  _(MathAbs)                                       \
    118  _(MathFloor)                                     \
    119  _(MathCeil)                                      \
    120  _(MathRound)                                     \
    121  _(MathClz32)                                     \
    122  _(MathSqrt)                                      \
    123  _(MathATan2)                                     \
    124  _(MathHypot)                                     \
    125  _(MathMax)                                       \
    126  _(MathMin)                                       \
    127  _(MathPow)                                       \
    128  _(MathRandom)                                    \
    129  _(MathImul)                                      \
    130  _(MathFRound)                                    \
    131  _(MathF16Round)                                  \
    132  _(MathSin)                                       \
    133  _(MathTan)                                       \
    134  _(MathCos)                                       \
    135  _(MathExp)                                       \
    136  _(MathLog)                                       \
    137  _(MathASin)                                      \
    138  _(MathATan)                                      \
    139  _(MathACos)                                      \
    140  _(MathLog10)                                     \
    141  _(MathLog2)                                      \
    142  _(MathLog1P)                                     \
    143  _(MathExpM1)                                     \
    144  _(MathSinH)                                      \
    145  _(MathTanH)                                      \
    146  _(MathCosH)                                      \
    147  _(MathASinH)                                     \
    148  _(MathATanH)                                     \
    149  _(MathACosH)                                     \
    150  _(MathSign)                                      \
    151  _(MathTrunc)                                     \
    152  _(MathCbrt)                                      \
    153                                                   \
    154  _(Number)                                        \
    155  _(NumberParseInt)                                \
    156  _(NumberToString)                                \
    157                                                   \
    158  _(ReflectGetPrototypeOf)                         \
    159                                                   \
    160  _(RegExpDotAll)                                  \
    161  _(RegExpGlobal)                                  \
    162  _(RegExpHasIndices)                              \
    163  _(RegExpIgnoreCase)                              \
    164  _(RegExpMultiline)                               \
    165  _(RegExpSticky)                                  \
    166  _(RegExpUnicode)                                 \
    167  _(RegExpUnicodeSets)                             \
    168  _(RegExpMatcher)                                 \
    169  _(RegExpSearcher)                                \
    170  _(RegExpSearcherLastLimit)                       \
    171  _(RegExpHasCaptureGroups)                        \
    172  _(IsRegExpObject)                                \
    173  _(IsOptimizableRegExpObject)                     \
    174  _(IsPossiblyWrappedRegExpObject)                 \
    175  _(IsRegExpPrototypeOptimizable)                  \
    176  _(GetFirstDollarIndex)                           \
    177                                                   \
    178  _(SetConstructor)                                \
    179  _(SetDelete)                                     \
    180  _(SetHas)                                        \
    181  _(SetAdd)                                        \
    182  _(SetSize)                                       \
    183                                                   \
    184  _(SharedArrayBufferByteLength)                   \
    185                                                   \
    186  _(String)                                        \
    187  _(StringToString)                                \
    188  _(StringValueOf)                                 \
    189  _(StringCharCodeAt)                              \
    190  _(StringCodePointAt)                             \
    191  _(StringFromCharCode)                            \
    192  _(StringFromCodePoint)                           \
    193  _(StringCharAt)                                  \
    194  _(StringAt)                                      \
    195  _(StringIncludes)                                \
    196  _(StringIndexOf)                                 \
    197  _(StringLastIndexOf)                             \
    198  _(StringStartsWith)                              \
    199  _(StringEndsWith)                                \
    200  _(StringToLowerCase)                             \
    201  _(StringToUpperCase)                             \
    202  _(StringToLocaleLowerCase)                       \
    203  _(StringToLocaleUpperCase)                       \
    204  _(StringTrim)                                    \
    205  _(StringTrimStart)                               \
    206  _(StringTrimEnd)                                 \
    207                                                   \
    208  _(IntrinsicStringReplaceString)                  \
    209  _(IntrinsicStringSplitString)                    \
    210                                                   \
    211  _(Object)                                        \
    212  _(ObjectCreate)                                  \
    213  _(ObjectIs)                                      \
    214  _(ObjectIsPrototypeOf)                           \
    215  _(ObjectKeys)                                    \
    216  _(ObjectToString)                                \
    217                                                   \
    218  _(TypedArrayFill)                                \
    219  _(TypedArraySet)                                 \
    220  _(TypedArraySubarray)                            \
    221  _(TypedArrayLength)                              \
    222  _(TypedArrayByteLength)                          \
    223  _(TypedArrayByteOffset)                          \
    224                                                   \
    225  _(TestBailout)                                   \
    226  _(TestAssertFloat32)                             \
    227  _(TestAssertRecoveredOnBailout)                  \
    228                                                   \
    229  _(WeakMapGet)                                    \
    230  _(WeakMapHas)                                    \
    231  _(WeakSetHas)                                    \
    232                                                   \
    233  _(IntrinsicUnsafeSetReservedSlot)                \
    234  _(IntrinsicUnsafeGetReservedSlot)                \
    235  _(IntrinsicUnsafeGetObjectFromReservedSlot)      \
    236  _(IntrinsicUnsafeGetInt32FromReservedSlot)       \
    237  _(IntrinsicUnsafeGetStringFromReservedSlot)      \
    238                                                   \
    239  _(IntrinsicIsCallable)                           \
    240  _(IntrinsicIsConstructor)                        \
    241  _(IntrinsicToObject)                             \
    242  _(IntrinsicIsObject)                             \
    243  _(IntrinsicIsCrossRealmArrayConstructor)         \
    244  _(IntrinsicCanOptimizeArraySpecies)              \
    245  _(IntrinsicToInteger)                            \
    246  _(IntrinsicToLength)                             \
    247  _(IntrinsicIsConstructing)                       \
    248  _(IntrinsicSubstringKernel)                      \
    249  _(IntrinsicIsPackedArray)                        \
    250                                                   \
    251  _(IntrinsicIsSuspendedGenerator)                 \
    252                                                   \
    253  _(IntrinsicGuardToArrayIterator)                 \
    254  _(IntrinsicGuardToMapIterator)                   \
    255  _(IntrinsicGuardToSetIterator)                   \
    256  _(IntrinsicGuardToStringIterator)                \
    257  _(IntrinsicGuardToRegExpStringIterator)          \
    258  _(IntrinsicGuardToWrapForValidIterator)          \
    259  _(IntrinsicGuardToIteratorHelper)                \
    260  _(IntrinsicGuardToAsyncIteratorHelper)           \
    261  _(IntrinsicGuardToMapObject)                     \
    262  _(IntrinsicGetNextMapEntryForIterator)           \
    263                                                   \
    264  _(IntrinsicGuardToSetObject)                     \
    265  _(IntrinsicGetNextSetEntryForIterator)           \
    266                                                   \
    267  _(IntrinsicNewArrayIterator)                     \
    268  _(IntrinsicNewStringIterator)                    \
    269  _(IntrinsicNewRegExpStringIterator)              \
    270  _(IntrinsicArrayIteratorPrototypeOptimizable)    \
    271                                                   \
    272  _(IntrinsicGuardToArrayBuffer)                   \
    273                                                   \
    274  _(IntrinsicGuardToSharedArrayBuffer)             \
    275                                                   \
    276  _(TypedArrayConstructor)                         \
    277  _(IntrinsicIsTypedArrayConstructor)              \
    278  _(IntrinsicIsTypedArray)                         \
    279  _(IntrinsicIsPossiblyWrappedTypedArray)          \
    280  _(IntrinsicTypedArrayLength)                     \
    281  _(IntrinsicPossiblyWrappedTypedArrayLength)      \
    282  _(IntrinsicRegExpBuiltinExec)                    \
    283  _(IntrinsicRegExpBuiltinExecForTest)             \
    284  _(IntrinsicRegExpExec)                           \
    285  _(IntrinsicRegExpExecForTest)                    \
    286                                                   \
    287  INLINABLE_EXPLICIT_RESOURCE_MANAGEMENENT_LIST(_) \
    288  INLINABLE_NATIVE_FUZZILLI_LIST(_)                \
    289  INLINABLE_NATIVE_ITERATOR_RANGE_LIST(_)
    290 
    291 struct JSClass;
    292 class JSJitInfo;
    293 
    294 namespace js {
    295 namespace jit {
    296 
    297 enum class InlinableNative : uint16_t {
    298 #define ADD_NATIVE(native) native,
    299  INLINABLE_NATIVE_LIST(ADD_NATIVE)
    300 #undef ADD_NATIVE
    301      Limit
    302 };
    303 
    304 #define ADD_NATIVE(native) extern const JSJitInfo JitInfo_##native;
    305 INLINABLE_NATIVE_LIST(ADD_NATIVE)
    306 #undef ADD_NATIVE
    307 
    308 const JSClass* InlinableNativeGuardToClass(InlinableNative native);
    309 
    310 bool CanInlineNativeCrossRealm(InlinableNative native);
    311 
    312 }  // namespace jit
    313 }  // namespace js
    314 
    315 #endif /* jit_InlinableNatives_h */