Home | History | Annotate | Download | only in runtime
      1 // Copyright 2012 the V8 project authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef V8_RUNTIME_RUNTIME_H_
      6 #define V8_RUNTIME_RUNTIME_H_
      7 
      8 #include "src/allocation.h"
      9 #include "src/objects.h"
     10 #include "src/unicode.h"
     11 #include "src/zone.h"
     12 
     13 namespace v8 {
     14 namespace internal {
     15 
     16 // * Each intrinsic is consistently exposed in JavaScript via 2 names:
     17 //    * %#name, which is always a runtime call.
     18 //    * %_#name, which can be inlined or just a runtime call, the compiler in
     19 //      question decides.
     20 //
     21 // * IntrinsicTypes are Runtime::RUNTIME and Runtime::INLINE, respectively.
     22 //
     23 // * IDs are Runtime::k##name and Runtime::kInline##name, respectively.
     24 //
     25 // * All intrinsics have a C++ implementation Runtime_##name.
     26 //
     27 // * Each compiler has an explicit list of intrisics it supports, falling back
     28 //   to a simple runtime call if necessary.
     29 
     30 
     31 // Entries have the form F(name, number of arguments, number of values):
     32 
     33 #define FOR_EACH_INTRINSIC_ARRAY(F)  \
     34   F(FinishArrayPrototypeSetup, 1, 1) \
     35   F(SpecialArrayFunctions, 0, 1)     \
     36   F(TransitionElementsKind, 2, 1)    \
     37   F(PushIfAbsent, 2, 1)              \
     38   F(RemoveArrayHoles, 2, 1)          \
     39   F(MoveArrayContents, 2, 1)         \
     40   F(EstimateNumberOfElements, 1, 1)  \
     41   F(GetArrayKeys, 2, 1)              \
     42   F(ArrayConstructor, -1, 1)         \
     43   F(NewArray, -1 /* >= 3 */, 1)      \
     44   F(InternalArrayConstructor, -1, 1) \
     45   F(NormalizeElements, 1, 1)         \
     46   F(GrowArrayElements, 2, 1)         \
     47   F(HasComplexElements, 1, 1)        \
     48   F(IsArray, 1, 1)                   \
     49   F(HasCachedArrayIndex, 1, 1)       \
     50   F(GetCachedArrayIndex, 1, 1)       \
     51   F(FixedArrayGet, 2, 1)             \
     52   F(FixedArraySet, 3, 1)             \
     53   F(FastOneByteArrayJoin, 2, 1)      \
     54   F(ArraySpeciesConstructor, 1, 1)
     55 
     56 
     57 #define FOR_EACH_INTRINSIC_ATOMICS(F) \
     58   F(AtomicsCompareExchange, 4, 1)     \
     59   F(AtomicsLoad, 2, 1)                \
     60   F(AtomicsStore, 3, 1)               \
     61   F(AtomicsAdd, 3, 1)                 \
     62   F(AtomicsSub, 3, 1)                 \
     63   F(AtomicsAnd, 3, 1)                 \
     64   F(AtomicsOr, 3, 1)                  \
     65   F(AtomicsXor, 3, 1)                 \
     66   F(AtomicsExchange, 3, 1)            \
     67   F(AtomicsIsLockFree, 1, 1)
     68 
     69 
     70 #define FOR_EACH_INTRINSIC_FUTEX(F)  \
     71   F(AtomicsFutexWait, 4, 1)          \
     72   F(AtomicsFutexWake, 3, 1)          \
     73   F(AtomicsFutexWakeOrRequeue, 5, 1) \
     74   F(AtomicsFutexNumWaitersForTesting, 2, 1)
     75 
     76 
     77 #define FOR_EACH_INTRINSIC_CLASSES(F)       \
     78   F(ThrowNonMethodError, 0, 1)              \
     79   F(ThrowUnsupportedSuperError, 0, 1)       \
     80   F(ThrowConstructorNonCallableError, 1, 1) \
     81   F(ThrowArrayNotSubclassableError, 0, 1)   \
     82   F(ThrowStaticPrototypeError, 0, 1)        \
     83   F(ThrowIfStaticPrototype, 1, 1)           \
     84   F(HomeObjectSymbol, 0, 1)                 \
     85   F(DefineClass, 5, 1)                      \
     86   F(FinalizeClassDefinition, 2, 1)          \
     87   F(DefineClassMethod, 3, 1)                \
     88   F(LoadFromSuper, 4, 1)                    \
     89   F(LoadKeyedFromSuper, 4, 1)               \
     90   F(StoreToSuper_Strict, 4, 1)              \
     91   F(StoreToSuper_Sloppy, 4, 1)              \
     92   F(StoreKeyedToSuper_Strict, 4, 1)         \
     93   F(StoreKeyedToSuper_Sloppy, 4, 1)         \
     94   F(GetSuperConstructor, 1, 1)
     95 
     96 
     97 #define FOR_EACH_INTRINSIC_COLLECTIONS(F) \
     98   F(StringGetRawHashField, 1, 1)          \
     99   F(TheHole, 0, 1)                        \
    100   F(JSCollectionGetTable, 1, 1)           \
    101   F(GenericHash, 1, 1)                    \
    102   F(SetInitialize, 1, 1)                  \
    103   F(SetGrow, 1, 1)                        \
    104   F(SetShrink, 1, 1)                      \
    105   F(SetClear, 1, 1)                       \
    106   F(SetIteratorInitialize, 3, 1)          \
    107   F(SetIteratorClone, 1, 1)               \
    108   F(SetIteratorNext, 2, 1)                \
    109   F(SetIteratorDetails, 1, 1)             \
    110   F(MapInitialize, 1, 1)                  \
    111   F(MapShrink, 1, 1)                      \
    112   F(MapClear, 1, 1)                       \
    113   F(MapGrow, 1, 1)                        \
    114   F(MapIteratorInitialize, 3, 1)          \
    115   F(MapIteratorClone, 1, 1)               \
    116   F(MapIteratorDetails, 1, 1)             \
    117   F(GetWeakMapEntries, 2, 1)              \
    118   F(MapIteratorNext, 2, 1)                \
    119   F(WeakCollectionInitialize, 1, 1)       \
    120   F(WeakCollectionGet, 3, 1)              \
    121   F(WeakCollectionHas, 3, 1)              \
    122   F(WeakCollectionDelete, 3, 1)           \
    123   F(WeakCollectionSet, 4, 1)              \
    124   F(GetWeakSetValues, 2, 1)               \
    125   F(ObservationWeakMapCreate, 0, 1)
    126 
    127 
    128 #define FOR_EACH_INTRINSIC_COMPILER(F)    \
    129   F(CompileLazy, 1, 1)                    \
    130   F(CompileOptimized_Concurrent, 1, 1)    \
    131   F(CompileOptimized_NotConcurrent, 1, 1) \
    132   F(NotifyStubFailure, 0, 1)              \
    133   F(NotifyDeoptimized, 1, 1)              \
    134   F(CompileForOnStackReplacement, 1, 1)   \
    135   F(TryInstallOptimizedCode, 1, 1)        \
    136   F(ResolvePossiblyDirectEval, 5, 1)
    137 
    138 
    139 #define FOR_EACH_INTRINSIC_DATE(F) \
    140   F(IsDate, 1, 1)                  \
    141   F(DateCurrentTime, 0, 1)         \
    142   F(ThrowNotDateError, 0, 1)
    143 
    144 
    145 #define FOR_EACH_INTRINSIC_DEBUG(F)            \
    146   F(HandleDebuggerStatement, 0, 1)             \
    147   F(DebugBreak, 0, 1)                          \
    148   F(SetDebugEventListener, 2, 1)               \
    149   F(ScheduleBreak, 0, 1)                       \
    150   F(DebugGetInternalProperties, 1, 1)          \
    151   F(DebugGetPropertyDetails, 2, 1)             \
    152   F(DebugGetProperty, 2, 1)                    \
    153   F(DebugPropertyTypeFromDetails, 1, 1)        \
    154   F(DebugPropertyAttributesFromDetails, 1, 1)  \
    155   F(DebugPropertyIndexFromDetails, 1, 1)       \
    156   F(DebugNamedInterceptorPropertyValue, 2, 1)  \
    157   F(DebugIndexedInterceptorElementValue, 2, 1) \
    158   F(CheckExecutionState, 1, 1)                 \
    159   F(GetFrameCount, 1, 1)                       \
    160   F(GetFrameDetails, 2, 1)                     \
    161   F(GetScopeCount, 2, 1)                       \
    162   F(GetStepInPositions, 2, 1)                  \
    163   F(GetScopeDetails, 4, 1)                     \
    164   F(GetAllScopesDetails, 4, 1)                 \
    165   F(GetFunctionScopeCount, 1, 1)               \
    166   F(GetFunctionScopeDetails, 2, 1)             \
    167   F(SetScopeVariableValue, 6, 1)               \
    168   F(DebugPrintScopes, 0, 1)                    \
    169   F(GetThreadCount, 1, 1)                      \
    170   F(GetThreadDetails, 2, 1)                    \
    171   F(SetBreakPointsActive, 1, 1)                \
    172   F(GetBreakLocations, 2, 1)                   \
    173   F(SetFunctionBreakPoint, 3, 1)               \
    174   F(SetScriptBreakPoint, 4, 1)                 \
    175   F(ClearBreakPoint, 1, 1)                     \
    176   F(ChangeBreakOnException, 2, 1)              \
    177   F(IsBreakOnException, 1, 1)                  \
    178   F(PrepareStep, 2, 1)                         \
    179   F(ClearStepping, 0, 1)                       \
    180   F(DebugEvaluate, 6, 1)                       \
    181   F(DebugEvaluateGlobal, 4, 1)                 \
    182   F(DebugGetLoadedScripts, 0, 1)               \
    183   F(DebugReferencedBy, 3, 1)                   \
    184   F(DebugConstructedBy, 2, 1)                  \
    185   F(DebugGetPrototype, 1, 1)                   \
    186   F(DebugSetScriptSource, 2, 1)                \
    187   F(FunctionGetInferredName, 1, 1)             \
    188   F(FunctionGetDebugName, 1, 1)                \
    189   F(GetFunctionCodePositionFromSource, 2, 1)   \
    190   F(ExecuteInDebugContext, 1, 1)               \
    191   F(GetDebugContext, 0, 1)                     \
    192   F(CollectGarbage, 1, 1)                      \
    193   F(GetHeapUsage, 0, 1)                        \
    194   F(GetScript, 1, 1)                           \
    195   F(DebugPrepareStepInIfStepping, 1, 1)        \
    196   F(DebugPushPromise, 2, 1)                    \
    197   F(DebugPopPromise, 0, 1)                     \
    198   F(DebugPromiseEvent, 1, 1)                   \
    199   F(DebugAsyncTaskEvent, 1, 1)                 \
    200   F(DebugIsActive, 0, 1)                       \
    201   F(DebugBreakInOptimizedCode, 0, 1)
    202 
    203 
    204 #define FOR_EACH_INTRINSIC_FORIN(F) \
    205   F(ForInDone, 2, 1)                \
    206   F(ForInFilter, 2, 1)              \
    207   F(ForInNext, 4, 1)                \
    208   F(ForInStep, 1, 1)
    209 
    210 
    211 #define FOR_EACH_INTRINSIC_INTERPRETER(F) \
    212   F(InterpreterEquals, 2, 1)              \
    213   F(InterpreterNotEquals, 2, 1)           \
    214   F(InterpreterStrictEquals, 2, 1)        \
    215   F(InterpreterStrictNotEquals, 2, 1)     \
    216   F(InterpreterLessThan, 2, 1)            \
    217   F(InterpreterGreaterThan, 2, 1)         \
    218   F(InterpreterLessThanOrEqual, 2, 1)     \
    219   F(InterpreterGreaterThanOrEqual, 2, 1)  \
    220   F(InterpreterToBoolean, 1, 1)           \
    221   F(InterpreterLogicalNot, 1, 1)          \
    222   F(InterpreterTypeOf, 1, 1)              \
    223   F(InterpreterNewClosure, 2, 1)          \
    224   F(InterpreterForInPrepare, 1, 1)
    225 
    226 
    227 #define FOR_EACH_INTRINSIC_FUNCTION(F)     \
    228   F(FunctionGetName, 1, 1)                 \
    229   F(FunctionSetName, 2, 1)                 \
    230   F(FunctionRemovePrototype, 1, 1)         \
    231   F(FunctionGetScript, 1, 1)               \
    232   F(FunctionGetSourceCode, 1, 1)           \
    233   F(FunctionGetScriptSourcePosition, 1, 1) \
    234   F(FunctionGetPositionForOffset, 2, 1)    \
    235   F(FunctionSetInstanceClassName, 2, 1)    \
    236   F(FunctionSetLength, 2, 1)               \
    237   F(FunctionSetPrototype, 2, 1)            \
    238   F(FunctionIsAPIFunction, 1, 1)           \
    239   F(SetCode, 2, 1)                         \
    240   F(SetNativeFlag, 1, 1)                   \
    241   F(ThrowStrongModeTooFewArguments, 0, 1)  \
    242   F(IsConstructor, 1, 1)                   \
    243   F(SetForceInlineFlag, 1, 1)              \
    244   F(Call, -1 /* >= 2 */, 1)                \
    245   F(TailCall, -1 /* >= 2 */, 1)            \
    246   F(Apply, 5, 1)                           \
    247   F(ConvertReceiver, 1, 1)                 \
    248   F(IsFunction, 1, 1)                      \
    249   F(FunctionToString, 1, 1)
    250 
    251 
    252 #define FOR_EACH_INTRINSIC_GENERATOR(F) \
    253   F(CreateJSGeneratorObject, 0, 1)      \
    254   F(SuspendJSGeneratorObject, -1, 1)    \
    255   F(ResumeJSGeneratorObject, 3, 1)      \
    256   F(GeneratorClose, 1, 1)               \
    257   F(GeneratorGetFunction, 1, 1)         \
    258   F(GeneratorGetContext, 1, 1)          \
    259   F(GeneratorGetReceiver, 1, 1)         \
    260   F(GeneratorGetContinuation, 1, 1)     \
    261   F(GeneratorGetSourcePosition, 1, 1)   \
    262   F(GeneratorNext, 2, 1)                \
    263   F(GeneratorThrow, 2, 1)
    264 
    265 
    266 #ifdef V8_I18N_SUPPORT
    267 #define FOR_EACH_INTRINSIC_I18N(F)           \
    268   F(CanonicalizeLanguageTag, 1, 1)           \
    269   F(AvailableLocalesOf, 1, 1)                \
    270   F(GetDefaultICULocale, 0, 1)               \
    271   F(GetLanguageTagVariants, 1, 1)            \
    272   F(IsInitializedIntlObject, 1, 1)           \
    273   F(IsInitializedIntlObjectOfType, 2, 1)     \
    274   F(MarkAsInitializedIntlObjectOfType, 3, 1) \
    275   F(GetImplFromInitializedIntlObject, 1, 1)  \
    276   F(CreateDateTimeFormat, 3, 1)              \
    277   F(InternalDateFormat, 2, 1)                \
    278   F(InternalDateParse, 2, 1)                 \
    279   F(CreateNumberFormat, 3, 1)                \
    280   F(InternalNumberFormat, 2, 1)              \
    281   F(InternalNumberParse, 2, 1)               \
    282   F(CreateCollator, 3, 1)                    \
    283   F(InternalCompare, 3, 1)                   \
    284   F(StringNormalize, 2, 1)                   \
    285   F(CreateBreakIterator, 3, 1)               \
    286   F(BreakIteratorAdoptText, 2, 1)            \
    287   F(BreakIteratorFirst, 1, 1)                \
    288   F(BreakIteratorNext, 1, 1)                 \
    289   F(BreakIteratorCurrent, 1, 1)              \
    290   F(BreakIteratorBreakType, 1, 1)
    291 #else
    292 #define FOR_EACH_INTRINSIC_I18N(F)
    293 #endif
    294 
    295 
    296 #define FOR_EACH_INTRINSIC_INTERNAL(F)        \
    297   F(CheckIsBootstrapping, 0, 1)               \
    298   F(ExportFromRuntime, 1, 1)                  \
    299   F(ExportExperimentalFromRuntime, 1, 1)      \
    300   F(InstallToContext, 1, 1)                   \
    301   F(Throw, 1, 1)                              \
    302   F(ReThrow, 1, 1)                            \
    303   F(UnwindAndFindExceptionHandler, 0, 1)      \
    304   F(PromoteScheduledException, 0, 1)          \
    305   F(ThrowReferenceError, 1, 1)                \
    306   F(ThrowApplyNonFunction, 1, 1)              \
    307   F(NewTypeError, 2, 1)                       \
    308   F(NewSyntaxError, 2, 1)                     \
    309   F(NewReferenceError, 2, 1)                  \
    310   F(ThrowIllegalInvocation, 0, 1)             \
    311   F(ThrowIteratorResultNotAnObject, 1, 1)     \
    312   F(ThrowStackOverflow, 0, 1)                 \
    313   F(ThrowStrongModeImplicitConversion, 0, 1)  \
    314   F(PromiseRejectEvent, 3, 1)                 \
    315   F(PromiseRevokeReject, 1, 1)                \
    316   F(StackGuard, 0, 1)                         \
    317   F(Interrupt, 0, 1)                          \
    318   F(AllocateInNewSpace, 1, 1)                 \
    319   F(AllocateInTargetSpace, 2, 1)              \
    320   F(CollectStackTrace, 2, 1)                  \
    321   F(MessageGetStartPosition, 1, 1)            \
    322   F(MessageGetScript, 1, 1)                   \
    323   F(FormatMessageString, 4, 1)                \
    324   F(CallSiteGetFileNameRT, 1, 1)              \
    325   F(CallSiteGetFunctionNameRT, 1, 1)          \
    326   F(CallSiteGetScriptNameOrSourceUrlRT, 1, 1) \
    327   F(CallSiteGetMethodNameRT, 1, 1)            \
    328   F(CallSiteGetLineNumberRT, 1, 1)            \
    329   F(CallSiteGetColumnNumberRT, 1, 1)          \
    330   F(CallSiteIsNativeRT, 1, 1)                 \
    331   F(CallSiteIsToplevelRT, 1, 1)               \
    332   F(CallSiteIsEvalRT, 1, 1)                   \
    333   F(CallSiteIsConstructorRT, 1, 1)            \
    334   F(IS_VAR, 1, 1)                             \
    335   F(IncrementStatsCounter, 1, 1)              \
    336   F(ThrowConstructedNonConstructable, 1, 1)   \
    337   F(ThrowCalledNonCallable, 1, 1)             \
    338   F(CreateListFromArrayLike, 1, 1)            \
    339   F(IncrementUseCounter, 1, 1)
    340 
    341 
    342 #define FOR_EACH_INTRINSIC_JSON(F) \
    343   F(QuoteJSONString, 1, 1)         \
    344   F(BasicJSONStringify, 1, 1)      \
    345   F(ParseJson, 1, 1)
    346 
    347 
    348 #define FOR_EACH_INTRINSIC_LITERALS(F)   \
    349   F(CreateRegExpLiteral, 4, 1)           \
    350   F(CreateObjectLiteral, 4, 1)           \
    351   F(CreateArrayLiteral, 4, 1)            \
    352   F(CreateArrayLiteralStubBailout, 3, 1) \
    353   F(StoreArrayLiteralElement, 5, 1)
    354 
    355 
    356 #define FOR_EACH_INTRINSIC_LIVEEDIT(F)              \
    357   F(LiveEditFindSharedFunctionInfosForScript, 1, 1) \
    358   F(LiveEditGatherCompileInfo, 2, 1)                \
    359   F(LiveEditReplaceScript, 3, 1)                    \
    360   F(LiveEditFunctionSourceUpdated, 1, 1)            \
    361   F(LiveEditReplaceFunctionCode, 2, 1)              \
    362   F(LiveEditFunctionSetScript, 2, 1)                \
    363   F(LiveEditReplaceRefToNestedFunction, 3, 1)       \
    364   F(LiveEditPatchFunctionPositions, 2, 1)           \
    365   F(LiveEditCheckAndDropActivations, 3, 1)          \
    366   F(LiveEditCompareStrings, 2, 1)                   \
    367   F(LiveEditRestartFrame, 2, 1)
    368 
    369 
    370 #define FOR_EACH_INTRINSIC_MATHS(F) \
    371   F(MathAcos, 1, 1)                 \
    372   F(MathAsin, 1, 1)                 \
    373   F(MathAtan, 1, 1)                 \
    374   F(MathLogRT, 1, 1)                \
    375   F(DoubleHi, 1, 1)                 \
    376   F(DoubleLo, 1, 1)                 \
    377   F(ConstructDouble, 2, 1)          \
    378   F(RemPiO2, 2, 1)                  \
    379   F(MathAtan2, 2, 1)                \
    380   F(MathExpRT, 1, 1)                \
    381   F(MathClz32, 1, 1)                \
    382   F(MathFloor, 1, 1)                \
    383   F(MathPow, 2, 1)                  \
    384   F(MathPowRT, 2, 1)                \
    385   F(RoundNumber, 1, 1)              \
    386   F(MathSqrt, 1, 1)                 \
    387   F(MathFround, 1, 1)               \
    388   F(IsMinusZero, 1, 1)              \
    389   F(GenerateRandomNumbers, 1, 1)
    390 
    391 
    392 #define FOR_EACH_INTRINSIC_NUMBERS(F)  \
    393   F(NumberToRadixString, 2, 1)         \
    394   F(NumberToFixed, 2, 1)               \
    395   F(NumberToExponential, 2, 1)         \
    396   F(NumberToPrecision, 2, 1)           \
    397   F(IsValidSmi, 1, 1)                  \
    398   F(StringToNumber, 1, 1)              \
    399   F(StringParseInt, 2, 1)              \
    400   F(StringParseFloat, 1, 1)            \
    401   F(NumberToString, 1, 1)              \
    402   F(NumberToStringSkipCache, 1, 1)     \
    403   F(NumberToIntegerMapMinusZero, 1, 1) \
    404   F(NumberToSmi, 1, 1)                 \
    405   F(NumberImul, 2, 1)                  \
    406   F(SmiLexicographicCompare, 2, 1)     \
    407   F(MaxSmi, 0, 1)                      \
    408   F(IsSmi, 1, 1)                       \
    409   F(GetRootNaN, 0, 1)                  \
    410   F(GetHoleNaNUpper, 0, 1)             \
    411   F(GetHoleNaNLower, 0, 1)
    412 
    413 
    414 #define FOR_EACH_INTRINSIC_OBJECT(F)                 \
    415   F(GetPrototype, 1, 1)                              \
    416   F(InternalSetPrototype, 2, 1)                      \
    417   F(SetPrototype, 2, 1)                              \
    418   F(GetOwnProperty, 2, 1)                            \
    419   F(GetOwnProperty_Legacy, 2, 1)                     \
    420   F(OptimizeObjectForAddingMultipleProperties, 2, 1) \
    421   F(GetProperty, 2, 1)                               \
    422   F(GetPropertyStrong, 2, 1)                         \
    423   F(KeyedGetProperty, 2, 1)                          \
    424   F(KeyedGetPropertyStrong, 2, 1)                    \
    425   F(LoadGlobalViaContext, 1, 1)                      \
    426   F(StoreGlobalViaContext_Sloppy, 2, 1)              \
    427   F(StoreGlobalViaContext_Strict, 2, 1)              \
    428   F(AddNamedProperty, 4, 1)                          \
    429   F(SetProperty, 4, 1)                               \
    430   F(AddElement, 3, 1)                                \
    431   F(AppendElement, 2, 1)                             \
    432   F(DeleteProperty_Sloppy, 2, 1)                     \
    433   F(DeleteProperty_Strict, 2, 1)                     \
    434   F(HasOwnProperty, 2, 1)                            \
    435   F(HasProperty, 2, 1)                               \
    436   F(PropertyIsEnumerable, 2, 1)                      \
    437   F(GetPropertyNamesFast, 1, 1)                      \
    438   F(GetOwnPropertyKeys, 2, 1)                        \
    439   F(GetInterceptorInfo, 1, 1)                        \
    440   F(ToFastProperties, 1, 1)                          \
    441   F(AllocateHeapNumber, 0, 1)                        \
    442   F(NewObject, 2, 1)                                 \
    443   F(FinalizeInstanceSize, 1, 1)                      \
    444   F(GlobalProxy, 1, 1)                               \
    445   F(LookupAccessor, 3, 1)                            \
    446   F(LoadMutableDouble, 2, 1)                         \
    447   F(TryMigrateInstance, 1, 1)                        \
    448   F(IsJSGlobalProxy, 1, 1)                           \
    449   F(DefineAccessorPropertyUnchecked, 5, 1)           \
    450   F(DefineDataPropertyUnchecked, 4, 1)               \
    451   F(GetDataProperty, 2, 1)                           \
    452   F(HasFastPackedElements, 1, 1)                     \
    453   F(ValueOf, 1, 1)                                   \
    454   F(SetValueOf, 2, 1)                                \
    455   F(JSValueGetValue, 1, 1)                           \
    456   F(ObjectEquals, 2, 1)                              \
    457   F(IsJSReceiver, 1, 1)                              \
    458   F(IsStrong, 1, 1)                                  \
    459   F(ClassOf, 1, 1)                                   \
    460   F(DefineGetterPropertyUnchecked, 4, 1)             \
    461   F(DefineSetterPropertyUnchecked, 4, 1)             \
    462   F(ToObject, 1, 1)                                  \
    463   F(ToPrimitive, 1, 1)                               \
    464   F(ToPrimitive_Number, 1, 1)                        \
    465   F(ToPrimitive_String, 1, 1)                        \
    466   F(ToNumber, 1, 1)                                  \
    467   F(ToInteger, 1, 1)                                 \
    468   F(ToLength, 1, 1)                                  \
    469   F(ToString, 1, 1)                                  \
    470   F(ToName, 1, 1)                                    \
    471   F(Equals, 2, 1)                                    \
    472   F(StrictEquals, 2, 1)                              \
    473   F(Compare, 3, 1)                                   \
    474   F(Compare_Strong, 3, 1)                            \
    475   F(InstanceOf, 2, 1)                                \
    476   F(HasInPrototypeChain, 2, 1)                       \
    477   F(CreateIterResultObject, 2, 1)                    \
    478   F(IsAccessCheckNeeded, 1, 1)                       \
    479   F(ObjectDefineProperties, 2, 1)                    \
    480   F(ObjectDefineProperty, 3, 1)
    481 
    482 
    483 #define FOR_EACH_INTRINSIC_OBSERVE(F)            \
    484   F(IsObserved, 1, 1)                            \
    485   F(SetIsObserved, 1, 1)                         \
    486   F(EnqueueMicrotask, 1, 1)                      \
    487   F(RunMicrotasks, 0, 1)                         \
    488   F(DeliverObservationChangeRecords, 2, 1)       \
    489   F(GetObservationState, 0, 1)                   \
    490   F(ObserverObjectAndRecordHaveSameOrigin, 3, 1) \
    491   F(ObjectWasCreatedInCurrentOrigin, 1, 1)       \
    492   F(GetObjectContextObjectObserve, 1, 1)         \
    493   F(GetObjectContextObjectGetNotifier, 1, 1)     \
    494   F(GetObjectContextNotifierPerformChange, 1, 1)
    495 
    496 
    497 #define FOR_EACH_INTRINSIC_OPERATORS(F) \
    498   F(Multiply, 2, 1)                     \
    499   F(Multiply_Strong, 2, 1)              \
    500   F(Divide, 2, 1)                       \
    501   F(Divide_Strong, 2, 1)                \
    502   F(Modulus, 2, 1)                      \
    503   F(Modulus_Strong, 2, 1)               \
    504   F(Add, 2, 1)                          \
    505   F(Add_Strong, 2, 1)                   \
    506   F(Subtract, 2, 1)                     \
    507   F(Subtract_Strong, 2, 1)              \
    508   F(ShiftLeft, 2, 1)                    \
    509   F(ShiftLeft_Strong, 2, 1)             \
    510   F(ShiftRight, 2, 1)                   \
    511   F(ShiftRight_Strong, 2, 1)            \
    512   F(ShiftRightLogical, 2, 1)            \
    513   F(ShiftRightLogical_Strong, 2, 1)     \
    514   F(BitwiseAnd, 2, 1)                   \
    515   F(BitwiseAnd_Strong, 2, 1)            \
    516   F(BitwiseOr, 2, 1)                    \
    517   F(BitwiseOr_Strong, 2, 1)             \
    518   F(BitwiseXor, 2, 1)                   \
    519   F(BitwiseXor_Strong, 2, 1)
    520 
    521 #define FOR_EACH_INTRINSIC_PROXY(F)     \
    522   F(IsJSProxy, 1, 1)                    \
    523   F(JSProxyCall, -1 /* >= 2 */, 1)      \
    524   F(JSProxyConstruct, -1 /* >= 3 */, 1) \
    525   F(JSProxyGetTarget, 1, 1)             \
    526   F(JSProxyGetHandler, 1, 1)            \
    527   F(JSProxyRevoke, 1, 1)
    528 
    529 #define FOR_EACH_INTRINSIC_REGEXP(F)           \
    530   F(StringReplaceGlobalRegExpWithString, 4, 1) \
    531   F(StringSplit, 3, 1)                         \
    532   F(RegExpExec, 4, 1)                          \
    533   F(RegExpFlags, 1, 1)                         \
    534   F(RegExpSource, 1, 1)                        \
    535   F(RegExpConstructResult, 3, 1)               \
    536   F(RegExpInitializeAndCompile, 3, 1)          \
    537   F(RegExpExecMultiple, 4, 1)                  \
    538   F(RegExpExecReThrow, 4, 1)                   \
    539   F(IsRegExp, 1, 1)
    540 
    541 
    542 #define FOR_EACH_INTRINSIC_SCOPES(F)       \
    543   F(ThrowConstAssignError, 0, 1)           \
    544   F(DeclareGlobals, 2, 1)                  \
    545   F(InitializeVarGlobal, 3, 1)             \
    546   F(InitializeConstGlobal, 2, 1)           \
    547   F(DeclareLookupSlot, 3, 1)               \
    548   F(InitializeLegacyConstLookupSlot, 3, 1) \
    549   F(NewSloppyArguments_Generic, 1, 1)      \
    550   F(NewStrictArguments_Generic, 1, 1)      \
    551   F(NewRestArguments_Generic, 2, 1)        \
    552   F(NewSloppyArguments, 3, 1)              \
    553   F(NewStrictArguments, 3, 1)              \
    554   F(NewRestParam, 3, 1)                    \
    555   F(NewClosure, 1, 1)                      \
    556   F(NewClosure_Tenured, 1, 1)              \
    557   F(NewScriptContext, 2, 1)                \
    558   F(NewFunctionContext, 1, 1)              \
    559   F(PushWithContext, 2, 1)                 \
    560   F(PushCatchContext, 3, 1)                \
    561   F(PushBlockContext, 2, 1)                \
    562   F(IsJSModule, 1, 1)                      \
    563   F(PushModuleContext, 2, 1)               \
    564   F(DeclareModules, 1, 1)                  \
    565   F(DeleteLookupSlot, 2, 1)                \
    566   F(StoreLookupSlot, 4, 1)                 \
    567   F(ArgumentsLength, 0, 1)                 \
    568   F(Arguments, 1, 1)
    569 
    570 
    571 #define FOR_EACH_INTRINSIC_SIMD(F)           \
    572   F(IsSimdValue, 1, 1)                       \
    573   F(SimdSameValue, 2, 1)                     \
    574   F(SimdSameValueZero, 2, 1)                 \
    575   F(CreateFloat32x4, 4, 1)                   \
    576   F(CreateInt32x4, 4, 1)                     \
    577   F(CreateUint32x4, 4, 1)                    \
    578   F(CreateBool32x4, 4, 1)                    \
    579   F(CreateInt16x8, 8, 1)                     \
    580   F(CreateUint16x8, 8, 1)                    \
    581   F(CreateBool16x8, 8, 1)                    \
    582   F(CreateInt8x16, 16, 1)                    \
    583   F(CreateUint8x16, 16, 1)                   \
    584   F(CreateBool8x16, 16, 1)                   \
    585   F(Float32x4Check, 1, 1)                    \
    586   F(Float32x4ExtractLane, 2, 1)              \
    587   F(Float32x4ReplaceLane, 3, 1)              \
    588   F(Float32x4Abs, 1, 1)                      \
    589   F(Float32x4Neg, 1, 1)                      \
    590   F(Float32x4Sqrt, 1, 1)                     \
    591   F(Float32x4RecipApprox, 1, 1)              \
    592   F(Float32x4RecipSqrtApprox, 1, 1)          \
    593   F(Float32x4Add, 2, 1)                      \
    594   F(Float32x4Sub, 2, 1)                      \
    595   F(Float32x4Mul, 2, 1)                      \
    596   F(Float32x4Div, 2, 1)                      \
    597   F(Float32x4Min, 2, 1)                      \
    598   F(Float32x4Max, 2, 1)                      \
    599   F(Float32x4MinNum, 2, 1)                   \
    600   F(Float32x4MaxNum, 2, 1)                   \
    601   F(Float32x4Equal, 2, 1)                    \
    602   F(Float32x4NotEqual, 2, 1)                 \
    603   F(Float32x4LessThan, 2, 1)                 \
    604   F(Float32x4LessThanOrEqual, 2, 1)          \
    605   F(Float32x4GreaterThan, 2, 1)              \
    606   F(Float32x4GreaterThanOrEqual, 2, 1)       \
    607   F(Float32x4Select, 3, 1)                   \
    608   F(Float32x4Swizzle, 5, 1)                  \
    609   F(Float32x4Shuffle, 6, 1)                  \
    610   F(Float32x4FromInt32x4, 1, 1)              \
    611   F(Float32x4FromUint32x4, 1, 1)             \
    612   F(Float32x4FromInt32x4Bits, 1, 1)          \
    613   F(Float32x4FromUint32x4Bits, 1, 1)         \
    614   F(Float32x4FromInt16x8Bits, 1, 1)          \
    615   F(Float32x4FromUint16x8Bits, 1, 1)         \
    616   F(Float32x4FromInt8x16Bits, 1, 1)          \
    617   F(Float32x4FromUint8x16Bits, 1, 1)         \
    618   F(Float32x4Load, 2, 1)                     \
    619   F(Float32x4Load1, 2, 1)                    \
    620   F(Float32x4Load2, 2, 1)                    \
    621   F(Float32x4Load3, 2, 1)                    \
    622   F(Float32x4Store, 3, 1)                    \
    623   F(Float32x4Store1, 3, 1)                   \
    624   F(Float32x4Store2, 3, 1)                   \
    625   F(Float32x4Store3, 3, 1)                   \
    626   F(Int32x4Check, 1, 1)                      \
    627   F(Int32x4ExtractLane, 2, 1)                \
    628   F(Int32x4ReplaceLane, 3, 1)                \
    629   F(Int32x4Neg, 1, 1)                        \
    630   F(Int32x4Add, 2, 1)                        \
    631   F(Int32x4Sub, 2, 1)                        \
    632   F(Int32x4Mul, 2, 1)                        \
    633   F(Int32x4Min, 2, 1)                        \
    634   F(Int32x4Max, 2, 1)                        \
    635   F(Int32x4And, 2, 1)                        \
    636   F(Int32x4Or, 2, 1)                         \
    637   F(Int32x4Xor, 2, 1)                        \
    638   F(Int32x4Not, 1, 1)                        \
    639   F(Int32x4ShiftLeftByScalar, 2, 1)          \
    640   F(Int32x4ShiftRightByScalar, 2, 1)         \
    641   F(Int32x4Equal, 2, 1)                      \
    642   F(Int32x4NotEqual, 2, 1)                   \
    643   F(Int32x4LessThan, 2, 1)                   \
    644   F(Int32x4LessThanOrEqual, 2, 1)            \
    645   F(Int32x4GreaterThan, 2, 1)                \
    646   F(Int32x4GreaterThanOrEqual, 2, 1)         \
    647   F(Int32x4Select, 3, 1)                     \
    648   F(Int32x4Swizzle, 5, 1)                    \
    649   F(Int32x4Shuffle, 6, 1)                    \
    650   F(Int32x4FromFloat32x4, 1, 1)              \
    651   F(Int32x4FromUint32x4, 1, 1)               \
    652   F(Int32x4FromFloat32x4Bits, 1, 1)          \
    653   F(Int32x4FromUint32x4Bits, 1, 1)           \
    654   F(Int32x4FromInt16x8Bits, 1, 1)            \
    655   F(Int32x4FromUint16x8Bits, 1, 1)           \
    656   F(Int32x4FromInt8x16Bits, 1, 1)            \
    657   F(Int32x4FromUint8x16Bits, 1, 1)           \
    658   F(Int32x4Load, 2, 1)                       \
    659   F(Int32x4Load1, 2, 1)                      \
    660   F(Int32x4Load2, 2, 1)                      \
    661   F(Int32x4Load3, 2, 1)                      \
    662   F(Int32x4Store, 3, 1)                      \
    663   F(Int32x4Store1, 3, 1)                     \
    664   F(Int32x4Store2, 3, 1)                     \
    665   F(Int32x4Store3, 3, 1)                     \
    666   F(Uint32x4Check, 1, 1)                     \
    667   F(Uint32x4ExtractLane, 2, 1)               \
    668   F(Uint32x4ReplaceLane, 3, 1)               \
    669   F(Uint32x4Add, 2, 1)                       \
    670   F(Uint32x4Sub, 2, 1)                       \
    671   F(Uint32x4Mul, 2, 1)                       \
    672   F(Uint32x4Min, 2, 1)                       \
    673   F(Uint32x4Max, 2, 1)                       \
    674   F(Uint32x4And, 2, 1)                       \
    675   F(Uint32x4Or, 2, 1)                        \
    676   F(Uint32x4Xor, 2, 1)                       \
    677   F(Uint32x4Not, 1, 1)                       \
    678   F(Uint32x4ShiftLeftByScalar, 2, 1)         \
    679   F(Uint32x4ShiftRightByScalar, 2, 1)        \
    680   F(Uint32x4Equal, 2, 1)                     \
    681   F(Uint32x4NotEqual, 2, 1)                  \
    682   F(Uint32x4LessThan, 2, 1)                  \
    683   F(Uint32x4LessThanOrEqual, 2, 1)           \
    684   F(Uint32x4GreaterThan, 2, 1)               \
    685   F(Uint32x4GreaterThanOrEqual, 2, 1)        \
    686   F(Uint32x4Select, 3, 1)                    \
    687   F(Uint32x4Swizzle, 5, 1)                   \
    688   F(Uint32x4Shuffle, 6, 1)                   \
    689   F(Uint32x4FromFloat32x4, 1, 1)             \
    690   F(Uint32x4FromInt32x4, 1, 1)               \
    691   F(Uint32x4FromFloat32x4Bits, 1, 1)         \
    692   F(Uint32x4FromInt32x4Bits, 1, 1)           \
    693   F(Uint32x4FromInt16x8Bits, 1, 1)           \
    694   F(Uint32x4FromUint16x8Bits, 1, 1)          \
    695   F(Uint32x4FromInt8x16Bits, 1, 1)           \
    696   F(Uint32x4FromUint8x16Bits, 1, 1)          \
    697   F(Uint32x4Load, 2, 1)                      \
    698   F(Uint32x4Load1, 2, 1)                     \
    699   F(Uint32x4Load2, 2, 1)                     \
    700   F(Uint32x4Load3, 2, 1)                     \
    701   F(Uint32x4Store, 3, 1)                     \
    702   F(Uint32x4Store1, 3, 1)                    \
    703   F(Uint32x4Store2, 3, 1)                    \
    704   F(Uint32x4Store3, 3, 1)                    \
    705   F(Bool32x4Check, 1, 1)                     \
    706   F(Bool32x4ExtractLane, 2, 1)               \
    707   F(Bool32x4ReplaceLane, 3, 1)               \
    708   F(Bool32x4And, 2, 1)                       \
    709   F(Bool32x4Or, 2, 1)                        \
    710   F(Bool32x4Xor, 2, 1)                       \
    711   F(Bool32x4Not, 1, 1)                       \
    712   F(Bool32x4AnyTrue, 1, 1)                   \
    713   F(Bool32x4AllTrue, 1, 1)                   \
    714   F(Bool32x4Swizzle, 5, 1)                   \
    715   F(Bool32x4Shuffle, 6, 1)                   \
    716   F(Int16x8Check, 1, 1)                      \
    717   F(Int16x8ExtractLane, 2, 1)                \
    718   F(Int16x8ReplaceLane, 3, 1)                \
    719   F(Int16x8Neg, 1, 1)                        \
    720   F(Int16x8Add, 2, 1)                        \
    721   F(Int16x8AddSaturate, 2, 1)                \
    722   F(Int16x8Sub, 2, 1)                        \
    723   F(Int16x8SubSaturate, 2, 1)                \
    724   F(Int16x8Mul, 2, 1)                        \
    725   F(Int16x8Min, 2, 1)                        \
    726   F(Int16x8Max, 2, 1)                        \
    727   F(Int16x8And, 2, 1)                        \
    728   F(Int16x8Or, 2, 1)                         \
    729   F(Int16x8Xor, 2, 1)                        \
    730   F(Int16x8Not, 1, 1)                        \
    731   F(Int16x8ShiftLeftByScalar, 2, 1)          \
    732   F(Int16x8ShiftRightByScalar, 2, 1)         \
    733   F(Int16x8Equal, 2, 1)                      \
    734   F(Int16x8NotEqual, 2, 1)                   \
    735   F(Int16x8LessThan, 2, 1)                   \
    736   F(Int16x8LessThanOrEqual, 2, 1)            \
    737   F(Int16x8GreaterThan, 2, 1)                \
    738   F(Int16x8GreaterThanOrEqual, 2, 1)         \
    739   F(Int16x8Select, 3, 1)                     \
    740   F(Int16x8Swizzle, 9, 1)                    \
    741   F(Int16x8Shuffle, 10, 1)                   \
    742   F(Int16x8FromUint16x8, 1, 1)               \
    743   F(Int16x8FromFloat32x4Bits, 1, 1)          \
    744   F(Int16x8FromInt32x4Bits, 1, 1)            \
    745   F(Int16x8FromUint32x4Bits, 1, 1)           \
    746   F(Int16x8FromUint16x8Bits, 1, 1)           \
    747   F(Int16x8FromInt8x16Bits, 1, 1)            \
    748   F(Int16x8FromUint8x16Bits, 1, 1)           \
    749   F(Int16x8Load, 2, 1)                       \
    750   F(Int16x8Store, 3, 1)                      \
    751   F(Uint16x8Check, 1, 1)                     \
    752   F(Uint16x8ExtractLane, 2, 1)               \
    753   F(Uint16x8ReplaceLane, 3, 1)               \
    754   F(Uint16x8Add, 2, 1)                       \
    755   F(Uint16x8AddSaturate, 2, 1)               \
    756   F(Uint16x8Sub, 2, 1)                       \
    757   F(Uint16x8SubSaturate, 2, 1)               \
    758   F(Uint16x8Mul, 2, 1)                       \
    759   F(Uint16x8Min, 2, 1)                       \
    760   F(Uint16x8Max, 2, 1)                       \
    761   F(Uint16x8And, 2, 1)                       \
    762   F(Uint16x8Or, 2, 1)                        \
    763   F(Uint16x8Xor, 2, 1)                       \
    764   F(Uint16x8Not, 1, 1)                       \
    765   F(Uint16x8ShiftLeftByScalar, 2, 1)         \
    766   F(Uint16x8ShiftRightByScalar, 2, 1)        \
    767   F(Uint16x8Equal, 2, 1)                     \
    768   F(Uint16x8NotEqual, 2, 1)                  \
    769   F(Uint16x8LessThan, 2, 1)                  \
    770   F(Uint16x8LessThanOrEqual, 2, 1)           \
    771   F(Uint16x8GreaterThan, 2, 1)               \
    772   F(Uint16x8GreaterThanOrEqual, 2, 1)        \
    773   F(Uint16x8Select, 3, 1)                    \
    774   F(Uint16x8Swizzle, 9, 1)                   \
    775   F(Uint16x8Shuffle, 10, 1)                  \
    776   F(Uint16x8FromInt16x8, 1, 1)               \
    777   F(Uint16x8FromFloat32x4Bits, 1, 1)         \
    778   F(Uint16x8FromInt32x4Bits, 1, 1)           \
    779   F(Uint16x8FromUint32x4Bits, 1, 1)          \
    780   F(Uint16x8FromInt16x8Bits, 1, 1)           \
    781   F(Uint16x8FromInt8x16Bits, 1, 1)           \
    782   F(Uint16x8FromUint8x16Bits, 1, 1)          \
    783   F(Uint16x8Load, 2, 1)                      \
    784   F(Uint16x8Store, 3, 1)                     \
    785   F(Bool16x8Check, 1, 1)                     \
    786   F(Bool16x8ExtractLane, 2, 1)               \
    787   F(Bool16x8ReplaceLane, 3, 1)               \
    788   F(Bool16x8And, 2, 1)                       \
    789   F(Bool16x8Or, 2, 1)                        \
    790   F(Bool16x8Xor, 2, 1)                       \
    791   F(Bool16x8Not, 1, 1)                       \
    792   F(Bool16x8AnyTrue, 1, 1)                   \
    793   F(Bool16x8AllTrue, 1, 1)                   \
    794   F(Bool16x8Swizzle, 9, 1)                   \
    795   F(Bool16x8Shuffle, 10, 1)                  \
    796   F(Int8x16Check, 1, 1)                      \
    797   F(Int8x16ExtractLane, 2, 1)                \
    798   F(Int8x16ReplaceLane, 3, 1)                \
    799   F(Int8x16Neg, 1, 1)                        \
    800   F(Int8x16Add, 2, 1)                        \
    801   F(Int8x16AddSaturate, 2, 1)                \
    802   F(Int8x16Sub, 2, 1)                        \
    803   F(Int8x16SubSaturate, 2, 1)                \
    804   F(Int8x16Mul, 2, 1)                        \
    805   F(Int8x16Min, 2, 1)                        \
    806   F(Int8x16Max, 2, 1)                        \
    807   F(Int8x16And, 2, 1)                        \
    808   F(Int8x16Or, 2, 1)                         \
    809   F(Int8x16Xor, 2, 1)                        \
    810   F(Int8x16Not, 1, 1)                        \
    811   F(Int8x16ShiftLeftByScalar, 2, 1)          \
    812   F(Int8x16ShiftRightByScalar, 2, 1)         \
    813   F(Int8x16Equal, 2, 1)                      \
    814   F(Int8x16NotEqual, 2, 1)                   \
    815   F(Int8x16LessThan, 2, 1)                   \
    816   F(Int8x16LessThanOrEqual, 2, 1)            \
    817   F(Int8x16GreaterThan, 2, 1)                \
    818   F(Int8x16GreaterThanOrEqual, 2, 1)         \
    819   F(Int8x16Select, 3, 1)                     \
    820   F(Int8x16Swizzle, 17, 1)                   \
    821   F(Int8x16Shuffle, 18, 1)                   \
    822   F(Int8x16FromUint8x16, 1, 1)               \
    823   F(Int8x16FromFloat32x4Bits, 1, 1)          \
    824   F(Int8x16FromInt32x4Bits, 1, 1)            \
    825   F(Int8x16FromUint32x4Bits, 1, 1)           \
    826   F(Int8x16FromInt16x8Bits, 1, 1)            \
    827   F(Int8x16FromUint16x8Bits, 1, 1)           \
    828   F(Int8x16FromUint8x16Bits, 1, 1)           \
    829   F(Int8x16Load, 2, 1)                       \
    830   F(Int8x16Store, 3, 1)                      \
    831   F(Uint8x16Check, 1, 1)                     \
    832   F(Uint8x16ExtractLane, 2, 1)               \
    833   F(Uint8x16ReplaceLane, 3, 1)               \
    834   F(Uint8x16Add, 2, 1)                       \
    835   F(Uint8x16AddSaturate, 2, 1)               \
    836   F(Uint8x16Sub, 2, 1)                       \
    837   F(Uint8x16SubSaturate, 2, 1)               \
    838   F(Uint8x16Mul, 2, 1)                       \
    839   F(Uint8x16Min, 2, 1)                       \
    840   F(Uint8x16Max, 2, 1)                       \
    841   F(Uint8x16And, 2, 1)                       \
    842   F(Uint8x16Or, 2, 1)                        \
    843   F(Uint8x16Xor, 2, 1)                       \
    844   F(Uint8x16Not, 1, 1)                       \
    845   F(Uint8x16ShiftLeftByScalar, 2, 1)         \
    846   F(Uint8x16ShiftRightByScalar, 2, 1)        \
    847   F(Uint8x16Equal, 2, 1)                     \
    848   F(Uint8x16NotEqual, 2, 1)                  \
    849   F(Uint8x16LessThan, 2, 1)                  \
    850   F(Uint8x16LessThanOrEqual, 2, 1)           \
    851   F(Uint8x16GreaterThan, 2, 1)               \
    852   F(Uint8x16GreaterThanOrEqual, 2, 1)        \
    853   F(Uint8x16Select, 3, 1)                    \
    854   F(Uint8x16Swizzle, 17, 1)                  \
    855   F(Uint8x16Shuffle, 18, 1)                  \
    856   F(Uint8x16FromInt8x16, 1, 1)               \
    857   F(Uint8x16FromFloat32x4Bits, 1, 1)         \
    858   F(Uint8x16FromInt32x4Bits, 1, 1)           \
    859   F(Uint8x16FromUint32x4Bits, 1, 1)          \
    860   F(Uint8x16FromInt16x8Bits, 1, 1)           \
    861   F(Uint8x16FromUint16x8Bits, 1, 1)          \
    862   F(Uint8x16FromInt8x16Bits, 1, 1)           \
    863   F(Uint8x16Load, 2, 1)                      \
    864   F(Uint8x16Store, 3, 1)                     \
    865   F(Bool8x16Check, 1, 1)                     \
    866   F(Bool8x16ExtractLane, 2, 1)               \
    867   F(Bool8x16ReplaceLane, 3, 1)               \
    868   F(Bool8x16And, 2, 1)                       \
    869   F(Bool8x16Or, 2, 1)                        \
    870   F(Bool8x16Xor, 2, 1)                       \
    871   F(Bool8x16Not, 1, 1)                       \
    872   F(Bool8x16AnyTrue, 1, 1)                   \
    873   F(Bool8x16AllTrue, 1, 1)                   \
    874   F(Bool8x16Swizzle, 17, 1)                  \
    875   F(Bool8x16Shuffle, 18, 1)
    876 
    877 
    878 #define FOR_EACH_INTRINSIC_STRINGS(F)     \
    879   F(StringReplaceOneCharWithString, 3, 1) \
    880   F(StringIndexOf, 3, 1)                  \
    881   F(StringLastIndexOf, 3, 1)              \
    882   F(StringLocaleCompare, 2, 1)            \
    883   F(SubString, 3, 1)                      \
    884   F(StringAdd, 2, 1)                      \
    885   F(InternalizeString, 1, 1)              \
    886   F(StringMatch, 3, 1)                    \
    887   F(StringCharCodeAtRT, 2, 1)             \
    888   F(StringCompare, 2, 1)                  \
    889   F(StringBuilderConcat, 3, 1)            \
    890   F(StringBuilderJoin, 3, 1)              \
    891   F(SparseJoinWithSeparator, 3, 1)        \
    892   F(StringToArray, 2, 1)                  \
    893   F(StringToLowerCase, 1, 1)              \
    894   F(StringToUpperCase, 1, 1)              \
    895   F(StringTrim, 3, 1)                     \
    896   F(TruncateString, 2, 1)                 \
    897   F(NewString, 2, 1)                      \
    898   F(StringEquals, 2, 1)                   \
    899   F(FlattenString, 1, 1)                  \
    900   F(StringCharFromCode, 1, 1)             \
    901   F(StringCharAt, 2, 1)                   \
    902   F(OneByteSeqStringGetChar, 2, 1)        \
    903   F(OneByteSeqStringSetChar, 3, 1)        \
    904   F(TwoByteSeqStringGetChar, 2, 1)        \
    905   F(TwoByteSeqStringSetChar, 3, 1)        \
    906   F(StringCharCodeAt, 2, 1)
    907 
    908 
    909 #define FOR_EACH_INTRINSIC_SYMBOL(F) \
    910   F(CreateSymbol, 1, 1)              \
    911   F(CreatePrivateSymbol, 1, 1)       \
    912   F(SymbolDescription, 1, 1)         \
    913   F(SymbolDescriptiveString, 1, 1)   \
    914   F(SymbolRegistry, 0, 1)            \
    915   F(SymbolIsPrivate, 1, 1)
    916 
    917 
    918 #define FOR_EACH_INTRINSIC_TEST(F)            \
    919   F(DeoptimizeFunction, 1, 1)                 \
    920   F(DeoptimizeNow, 0, 1)                      \
    921   F(RunningInSimulator, 0, 1)                 \
    922   F(IsConcurrentRecompilationSupported, 0, 1) \
    923   F(OptimizeFunctionOnNextCall, -1, 1)        \
    924   F(OptimizeOsr, -1, 1)                       \
    925   F(NeverOptimizeFunction, 1, 1)              \
    926   F(GetOptimizationStatus, -1, 1)             \
    927   F(UnblockConcurrentRecompilation, 0, 1)     \
    928   F(GetOptimizationCount, 1, 1)               \
    929   F(GetUndetectable, 0, 1)                    \
    930   F(ClearFunctionTypeFeedback, 1, 1)          \
    931   F(NotifyContextDisposed, 0, 1)              \
    932   F(SetAllocationTimeout, -1 /* 2 || 3 */, 1) \
    933   F(DebugPrint, 1, 1)                         \
    934   F(DebugTrace, 0, 1)                         \
    935   F(GlobalPrint, 1, 1)                        \
    936   F(SystemBreak, 0, 1)                        \
    937   F(SetFlags, 1, 1)                           \
    938   F(Abort, 1, 1)                              \
    939   F(AbortJS, 1, 1)                            \
    940   F(NativeScriptsCount, 0, 1)                 \
    941   F(GetV8Version, 0, 1)                       \
    942   F(DisassembleFunction, 1, 1)                \
    943   F(TraceEnter, 0, 1)                         \
    944   F(TraceExit, 1, 1)                          \
    945   F(HaveSameMap, 2, 1)                        \
    946   F(InNewSpace, 1, 1)                         \
    947   F(HasFastSmiElements, 1, 1)                 \
    948   F(HasFastObjectElements, 1, 1)              \
    949   F(HasFastSmiOrObjectElements, 1, 1)         \
    950   F(HasFastDoubleElements, 1, 1)              \
    951   F(HasFastHoleyElements, 1, 1)               \
    952   F(HasDictionaryElements, 1, 1)              \
    953   F(HasSloppyArgumentsElements, 1, 1)         \
    954   F(HasFixedTypedArrayElements, 1, 1)         \
    955   F(HasFastProperties, 1, 1)                  \
    956   F(HasFixedUint8Elements, 1, 1)              \
    957   F(HasFixedInt8Elements, 1, 1)               \
    958   F(HasFixedUint16Elements, 1, 1)             \
    959   F(HasFixedInt16Elements, 1, 1)              \
    960   F(HasFixedUint32Elements, 1, 1)             \
    961   F(HasFixedInt32Elements, 1, 1)              \
    962   F(HasFixedFloat32Elements, 1, 1)            \
    963   F(HasFixedFloat64Elements, 1, 1)            \
    964   F(HasFixedUint8ClampedElements, 1, 1)
    965 
    966 
    967 #define FOR_EACH_INTRINSIC_TYPEDARRAY(F)     \
    968   F(ArrayBufferGetByteLength, 1, 1)          \
    969   F(ArrayBufferSliceImpl, 4, 1)              \
    970   F(ArrayBufferNeuter, 1, 1)                 \
    971   F(TypedArrayInitialize, 6, 1)              \
    972   F(TypedArrayInitializeFromArrayLike, 4, 1) \
    973   F(ArrayBufferViewGetByteLength, 1, 1)      \
    974   F(ArrayBufferViewGetByteOffset, 1, 1)      \
    975   F(TypedArrayGetLength, 1, 1)               \
    976   F(DataViewGetBuffer, 1, 1)                 \
    977   F(TypedArrayGetBuffer, 1, 1)               \
    978   F(TypedArraySetFastCases, 3, 1)            \
    979   F(TypedArrayMaxSizeInHeap, 0, 1)           \
    980   F(IsTypedArray, 1, 1)                      \
    981   F(IsSharedTypedArray, 1, 1)                \
    982   F(IsSharedIntegerTypedArray, 1, 1)         \
    983   F(IsSharedInteger32TypedArray, 1, 1)       \
    984   F(DataViewInitialize, 4, 1)                \
    985   F(DataViewGetUint8, 3, 1)                  \
    986   F(DataViewGetInt8, 3, 1)                   \
    987   F(DataViewGetUint16, 3, 1)                 \
    988   F(DataViewGetInt16, 3, 1)                  \
    989   F(DataViewGetUint32, 3, 1)                 \
    990   F(DataViewGetInt32, 3, 1)                  \
    991   F(DataViewGetFloat32, 3, 1)                \
    992   F(DataViewGetFloat64, 3, 1)                \
    993   F(DataViewSetUint8, 4, 1)                  \
    994   F(DataViewSetInt8, 4, 1)                   \
    995   F(DataViewSetUint16, 4, 1)                 \
    996   F(DataViewSetInt16, 4, 1)                  \
    997   F(DataViewSetUint32, 4, 1)                 \
    998   F(DataViewSetInt32, 4, 1)                  \
    999   F(DataViewSetFloat32, 4, 1)                \
   1000   F(DataViewSetFloat64, 4, 1)
   1001 
   1002 
   1003 #define FOR_EACH_INTRINSIC_URI(F) \
   1004   F(URIEscape, 1, 1)              \
   1005   F(URIUnescape, 1, 1)
   1006 
   1007 
   1008 #define FOR_EACH_INTRINSIC_RETURN_PAIR(F) \
   1009   F(LoadLookupSlot, 2, 2)                 \
   1010   F(LoadLookupSlotNoReferenceError, 2, 2)
   1011 
   1012 
   1013 // Most intrinsics are implemented in the runtime/ directory, but ICs are
   1014 // implemented in ic.cc for now.
   1015 #define FOR_EACH_INTRINSIC_IC(F)             \
   1016   F(BinaryOpIC_Miss, 2, 1)                   \
   1017   F(BinaryOpIC_MissWithAllocationSite, 3, 1) \
   1018   F(CallIC_Miss, 3, 1)                       \
   1019   F(CompareIC_Miss, 3, 1)                    \
   1020   F(CompareNilIC_Miss, 1, 1)                 \
   1021   F(ElementsTransitionAndStoreIC_Miss, 5, 1) \
   1022   F(KeyedLoadIC_Miss, 4, 1)                  \
   1023   F(KeyedLoadIC_MissFromStubFailure, 4, 1)   \
   1024   F(KeyedStoreIC_Miss, 5, 1)                 \
   1025   F(KeyedStoreIC_MissFromStubFailure, 5, 1)  \
   1026   F(KeyedStoreIC_Slow, 5, 1)                 \
   1027   F(LoadElementWithInterceptor, 2, 1)        \
   1028   F(LoadIC_Miss, 4, 1)                       \
   1029   F(LoadIC_MissFromStubFailure, 4, 1)        \
   1030   F(LoadPropertyWithInterceptor, 3, 1)       \
   1031   F(LoadPropertyWithInterceptorOnly, 3, 1)   \
   1032   F(StoreCallbackProperty, 5, 1)             \
   1033   F(StoreIC_Miss, 5, 1)                      \
   1034   F(StoreIC_MissFromStubFailure, 5, 1)       \
   1035   F(StoreIC_Slow, 5, 1)                      \
   1036   F(StorePropertyWithInterceptor, 3, 1)      \
   1037   F(ToBooleanIC_Miss, 1, 1)                  \
   1038   F(Unreachable, 0, 1)
   1039 
   1040 
   1041 #define FOR_EACH_INTRINSIC_RETURN_OBJECT(F) \
   1042   FOR_EACH_INTRINSIC_IC(F)                  \
   1043   FOR_EACH_INTRINSIC_ARRAY(F)               \
   1044   FOR_EACH_INTRINSIC_ATOMICS(F)             \
   1045   FOR_EACH_INTRINSIC_CLASSES(F)             \
   1046   FOR_EACH_INTRINSIC_COLLECTIONS(F)         \
   1047   FOR_EACH_INTRINSIC_COMPILER(F)            \
   1048   FOR_EACH_INTRINSIC_DATE(F)                \
   1049   FOR_EACH_INTRINSIC_DEBUG(F)               \
   1050   FOR_EACH_INTRINSIC_FORIN(F)               \
   1051   FOR_EACH_INTRINSIC_INTERPRETER(F)         \
   1052   FOR_EACH_INTRINSIC_FUNCTION(F)            \
   1053   FOR_EACH_INTRINSIC_FUTEX(F)               \
   1054   FOR_EACH_INTRINSIC_GENERATOR(F)           \
   1055   FOR_EACH_INTRINSIC_I18N(F)                \
   1056   FOR_EACH_INTRINSIC_INTERNAL(F)            \
   1057   FOR_EACH_INTRINSIC_JSON(F)                \
   1058   FOR_EACH_INTRINSIC_LITERALS(F)            \
   1059   FOR_EACH_INTRINSIC_LIVEEDIT(F)            \
   1060   FOR_EACH_INTRINSIC_MATHS(F)               \
   1061   FOR_EACH_INTRINSIC_NUMBERS(F)             \
   1062   FOR_EACH_INTRINSIC_OBJECT(F)              \
   1063   FOR_EACH_INTRINSIC_OBSERVE(F)             \
   1064   FOR_EACH_INTRINSIC_OPERATORS(F)           \
   1065   FOR_EACH_INTRINSIC_PROXY(F)               \
   1066   FOR_EACH_INTRINSIC_REGEXP(F)              \
   1067   FOR_EACH_INTRINSIC_SCOPES(F)              \
   1068   FOR_EACH_INTRINSIC_SIMD(F)                \
   1069   FOR_EACH_INTRINSIC_STRINGS(F)             \
   1070   FOR_EACH_INTRINSIC_SYMBOL(F)              \
   1071   FOR_EACH_INTRINSIC_TEST(F)                \
   1072   FOR_EACH_INTRINSIC_TYPEDARRAY(F)          \
   1073   FOR_EACH_INTRINSIC_URI(F)
   1074 
   1075 // FOR_EACH_INTRINSIC defines the list of all intrinsics, coming in 2 flavors,
   1076 // either returning an object or a pair.
   1077 #define FOR_EACH_INTRINSIC(F)       \
   1078   FOR_EACH_INTRINSIC_RETURN_PAIR(F) \
   1079   FOR_EACH_INTRINSIC_RETURN_OBJECT(F)
   1080 
   1081 
   1082 #define F(name, nargs, ressize)                                 \
   1083   Object* Runtime_##name(int args_length, Object** args_object, \
   1084                          Isolate* isolate);
   1085 FOR_EACH_INTRINSIC_RETURN_OBJECT(F)
   1086 #undef F
   1087 
   1088 //---------------------------------------------------------------------------
   1089 // Runtime provides access to all C++ runtime functions.
   1090 
   1091 class Runtime : public AllStatic {
   1092  public:
   1093   enum FunctionId {
   1094 #define F(name, nargs, ressize) k##name,
   1095 #define I(name, nargs, ressize) kInline##name,
   1096   FOR_EACH_INTRINSIC(F)
   1097   FOR_EACH_INTRINSIC(I)
   1098 #undef I
   1099 #undef F
   1100     kNumFunctions,
   1101   };
   1102 
   1103   enum IntrinsicType { RUNTIME, INLINE };
   1104 
   1105   // Intrinsic function descriptor.
   1106   struct Function {
   1107     FunctionId function_id;
   1108     IntrinsicType intrinsic_type;
   1109     // The JS name of the function.
   1110     const char* name;
   1111 
   1112     // For RUNTIME functions, this is the C++ entry point.
   1113     // For INLINE functions this is the C++ entry point of the fall back.
   1114     Address entry;
   1115 
   1116     // The number of arguments expected. nargs is -1 if the function takes
   1117     // a variable number of arguments.
   1118     int8_t nargs;
   1119     // Size of result.  Most functions return a single pointer, size 1.
   1120     int8_t result_size;
   1121   };
   1122 
   1123   static const int kNotFound = -1;
   1124 
   1125   // Add internalized strings for all the intrinsic function names to a
   1126   // StringDictionary.
   1127   static void InitializeIntrinsicFunctionNames(Isolate* isolate,
   1128                                                Handle<NameDictionary> dict);
   1129 
   1130   // Get the intrinsic function with the given name, which must be internalized.
   1131   static const Function* FunctionForName(Handle<String> name);
   1132 
   1133   // Get the intrinsic function with the given FunctionId.
   1134   static const Function* FunctionForId(FunctionId id);
   1135 
   1136   // Get the intrinsic function with the given function entry address.
   1137   static const Function* FunctionForEntry(Address ref);
   1138 
   1139   // Get the runtime intrinsic function table.
   1140   static const Function* RuntimeFunctionTable(Isolate* isolate);
   1141 
   1142   MUST_USE_RESULT static Maybe<bool> DeleteObjectProperty(
   1143       Isolate* isolate, Handle<JSReceiver> receiver, Handle<Object> key,
   1144       LanguageMode language_mode);
   1145 
   1146   MUST_USE_RESULT static MaybeHandle<Object> SetObjectProperty(
   1147       Isolate* isolate, Handle<Object> object, Handle<Object> key,
   1148       Handle<Object> value, LanguageMode language_mode);
   1149 
   1150   MUST_USE_RESULT static MaybeHandle<Object> GetObjectProperty(
   1151       Isolate* isolate, Handle<Object> object, Handle<Object> key,
   1152       LanguageMode language_mode = SLOPPY);
   1153 
   1154   enum TypedArrayId {
   1155     // arrayIds below should be synchronized with typedarray.js natives.
   1156     ARRAY_ID_UINT8 = 1,
   1157     ARRAY_ID_INT8 = 2,
   1158     ARRAY_ID_UINT16 = 3,
   1159     ARRAY_ID_INT16 = 4,
   1160     ARRAY_ID_UINT32 = 5,
   1161     ARRAY_ID_INT32 = 6,
   1162     ARRAY_ID_FLOAT32 = 7,
   1163     ARRAY_ID_FLOAT64 = 8,
   1164     ARRAY_ID_UINT8_CLAMPED = 9,
   1165     ARRAY_ID_FIRST = ARRAY_ID_UINT8,
   1166     ARRAY_ID_LAST = ARRAY_ID_UINT8_CLAMPED
   1167   };
   1168 
   1169   static void ArrayIdToTypeAndSize(int array_id, ExternalArrayType* type,
   1170                                    ElementsKind* fixed_elements_kind,
   1171                                    size_t* element_size);
   1172 
   1173   // Used in runtime.cc and hydrogen's VisitArrayLiteral.
   1174   MUST_USE_RESULT static MaybeHandle<Object> CreateArrayLiteralBoilerplate(
   1175       Isolate* isolate, Handle<LiteralsArray> literals,
   1176       Handle<FixedArray> elements, bool is_strong);
   1177 
   1178   static MaybeHandle<JSArray> GetInternalProperties(Isolate* isolate,
   1179                                                     Handle<Object>);
   1180 };
   1181 
   1182 
   1183 class RuntimeState {
   1184  public:
   1185   unibrow::Mapping<unibrow::ToUppercase, 128>* to_upper_mapping() {
   1186     return &to_upper_mapping_;
   1187   }
   1188   unibrow::Mapping<unibrow::ToLowercase, 128>* to_lower_mapping() {
   1189     return &to_lower_mapping_;
   1190   }
   1191 
   1192   Runtime::Function* redirected_intrinsic_functions() {
   1193     return redirected_intrinsic_functions_.get();
   1194   }
   1195 
   1196   void set_redirected_intrinsic_functions(
   1197       Runtime::Function* redirected_intrinsic_functions) {
   1198     redirected_intrinsic_functions_.Reset(redirected_intrinsic_functions);
   1199   }
   1200 
   1201  private:
   1202   RuntimeState() {}
   1203   unibrow::Mapping<unibrow::ToUppercase, 128> to_upper_mapping_;
   1204   unibrow::Mapping<unibrow::ToLowercase, 128> to_lower_mapping_;
   1205 
   1206   base::SmartArrayPointer<Runtime::Function> redirected_intrinsic_functions_;
   1207 
   1208   friend class Isolate;
   1209   friend class Runtime;
   1210 
   1211   DISALLOW_COPY_AND_ASSIGN(RuntimeState);
   1212 };
   1213 
   1214 
   1215 std::ostream& operator<<(std::ostream&, Runtime::FunctionId);
   1216 
   1217 //---------------------------------------------------------------------------
   1218 // Constants used by interface to runtime functions.
   1219 
   1220 class AllocateDoubleAlignFlag : public BitField<bool, 0, 1> {};
   1221 class AllocateTargetSpace : public BitField<AllocationSpace, 1, 3> {};
   1222 
   1223 class DeclareGlobalsEvalFlag : public BitField<bool, 0, 1> {};
   1224 class DeclareGlobalsNativeFlag : public BitField<bool, 1, 1> {};
   1225 STATIC_ASSERT(LANGUAGE_END == 3);
   1226 class DeclareGlobalsLanguageMode : public BitField<LanguageMode, 2, 2> {};
   1227 
   1228 }  // namespace internal
   1229 }  // namespace v8
   1230 
   1231 #endif  // V8_RUNTIME_RUNTIME_H_
   1232