runtime.h 52.5 KB
Newer Older
1
// Copyright 2012 the V8 project authors. All rights reserved.
2 3
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
4

5 6
#ifndef V8_RUNTIME_RUNTIME_H_
#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 14
namespace v8 {
namespace internal {
15

16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
// * Each intrinsic is consistently exposed in JavaScript via 2 names:
//    * %#name, which is always a runtime call.
//    * %_#name, which can be inlined or just a runtime call, the compiler in
//      question decides.
//
// * IntrinsicTypes are Runtime::RUNTIME and Runtime::INLINE, respectively.
//
// * IDs are Runtime::k##name and Runtime::kInline##name, respectively.
//
// * All intrinsics have a C++ implementation Runtime_##name.
//
// * Each compiler has an explicit list of intrisics it supports, falling back
//   to a simple runtime call if necessary.


// Entries have the form F(name, number of arguments, number of values):

33 34
#define FOR_EACH_INTRINSIC_ARRAY(F)         \
  F(FinishArrayPrototypeSetup, 1, 1)        \
35
  F(SpecialArrayFunctions, 0, 1)            \
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
  F(TransitionElementsKind, 2, 1)           \
  F(PushIfAbsent, 2, 1)                     \
  F(RemoveArrayHoles, 2, 1)                 \
  F(MoveArrayContents, 2, 1)                \
  F(EstimateNumberOfElements, 1, 1)         \
  F(GetArrayKeys, 2, 1)                     \
  F(ArrayConstructor, -1, 1)                \
  F(ArrayConstructorWithSubclassing, -1, 1) \
  F(InternalArrayConstructor, -1, 1)        \
  F(NormalizeElements, 1, 1)                \
  F(GrowArrayElements, 2, 1)                \
  F(HasComplexElements, 1, 1)               \
  F(IsArray, 1, 1)                          \
  F(HasCachedArrayIndex, 1, 1)              \
  F(GetCachedArrayIndex, 1, 1)              \
  F(FixedArrayGet, 2, 1)                    \
  F(FixedArraySet, 3, 1)                    \
53 54 55
  F(FastOneByteArrayJoin, 2, 1)


binji's avatar
binji committed
56 57 58 59 60 61 62 63 64 65 66 67 68
#define FOR_EACH_INTRINSIC_ATOMICS(F) \
  F(AtomicsCompareExchange, 4, 1)     \
  F(AtomicsLoad, 2, 1)                \
  F(AtomicsStore, 3, 1)               \
  F(AtomicsAdd, 3, 1)                 \
  F(AtomicsSub, 3, 1)                 \
  F(AtomicsAnd, 3, 1)                 \
  F(AtomicsOr, 3, 1)                  \
  F(AtomicsXor, 3, 1)                 \
  F(AtomicsExchange, 3, 1)            \
  F(AtomicsIsLockFree, 1, 1)


binji's avatar
binji committed
69 70 71 72 73 74 75
#define FOR_EACH_INTRINSIC_FUTEX(F)  \
  F(AtomicsFutexWait, 4, 1)          \
  F(AtomicsFutexWake, 3, 1)          \
  F(AtomicsFutexWakeOrRequeue, 5, 1) \
  F(AtomicsFutexNumWaitersForTesting, 2, 1)


76 77 78 79 80 81 82 83
#define FOR_EACH_INTRINSIC_CLASSES(F)         \
  F(ThrowNonMethodError, 0, 1)                \
  F(ThrowUnsupportedSuperError, 0, 1)         \
  F(ThrowConstructorNonCallableError, 0, 1)   \
  F(ThrowArrayNotSubclassableError, 0, 1)     \
  F(ThrowStaticPrototypeError, 0, 1)          \
  F(ThrowIfStaticPrototype, 1, 1)             \
  F(HomeObjectSymbol, 0, 1)                   \
84
  F(DefineClass, 5, 1)                        \
85
  F(FinalizeClassDefinition, 2, 1)            \
86 87
  F(DefineClassMethod, 3, 1)                  \
  F(ClassGetSourceCode, 1, 1)                 \
88 89
  F(LoadFromSuper, 4, 1)                      \
  F(LoadKeyedFromSuper, 4, 1)                 \
90 91 92 93 94
  F(StoreToSuper_Strict, 4, 1)                \
  F(StoreToSuper_Sloppy, 4, 1)                \
  F(StoreKeyedToSuper_Strict, 4, 1)           \
  F(StoreKeyedToSuper_Sloppy, 4, 1)           \
  F(HandleStepInForDerivedConstructors, 1, 1) \
95
  F(DefaultConstructorCallSuper, 2, 1)
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120


#define FOR_EACH_INTRINSIC_COLLECTIONS(F) \
  F(StringGetRawHashField, 1, 1)          \
  F(TheHole, 0, 1)                        \
  F(JSCollectionGetTable, 1, 1)           \
  F(GenericHash, 1, 1)                    \
  F(SetInitialize, 1, 1)                  \
  F(SetGrow, 1, 1)                        \
  F(SetShrink, 1, 1)                      \
  F(SetClear, 1, 1)                       \
  F(SetIteratorInitialize, 3, 1)          \
  F(SetIteratorClone, 1, 1)               \
  F(SetIteratorNext, 2, 1)                \
  F(SetIteratorDetails, 1, 1)             \
  F(MapInitialize, 1, 1)                  \
  F(MapShrink, 1, 1)                      \
  F(MapClear, 1, 1)                       \
  F(MapGrow, 1, 1)                        \
  F(MapIteratorInitialize, 3, 1)          \
  F(MapIteratorClone, 1, 1)               \
  F(MapIteratorDetails, 1, 1)             \
  F(GetWeakMapEntries, 2, 1)              \
  F(MapIteratorNext, 2, 1)                \
  F(WeakCollectionInitialize, 1, 1)       \
121 122 123 124
  F(WeakCollectionGet, 3, 1)              \
  F(WeakCollectionHas, 3, 1)              \
  F(WeakCollectionDelete, 3, 1)           \
  F(WeakCollectionSet, 4, 1)              \
125 126 127 128 129 130 131 132 133 134 135
  F(GetWeakSetValues, 2, 1)               \
  F(ObservationWeakMapCreate, 0, 1)


#define FOR_EACH_INTRINSIC_COMPILER(F)  \
  F(CompileLazy, 1, 1)                  \
  F(CompileOptimized, 2, 1)             \
  F(NotifyStubFailure, 0, 1)            \
  F(NotifyDeoptimized, 1, 1)            \
  F(CompileForOnStackReplacement, 1, 1) \
  F(TryInstallOptimizedCode, 1, 1)      \
136 137
  F(CompileString, 2, 1)                \
  F(ResolvePossiblyDirectEval, 5, 1)
138 139 140 141 142


#define FOR_EACH_INTRINSIC_DATE(F) \
  F(DateMakeDay, 2, 1)             \
  F(DateSetValue, 3, 1)            \
143
  F(IsDate, 1, 1)                  \
144 145 146 147 148 149 150 151 152 153
  F(ThrowNotDateError, 0, 1)       \
  F(DateCurrentTime, 0, 1)         \
  F(DateParseString, 2, 1)         \
  F(DateLocalTimezone, 1, 1)       \
  F(DateToUTC, 1, 1)               \
  F(DateCacheVersion, 0, 1)        \
  F(DateField, 2 /* date object, field index */, 1)


#define FOR_EACH_INTRINSIC_DEBUG(F)            \
154
  F(HandleDebuggerStatement, 0, 1)             \
155 156 157
  F(DebugBreak, 0, 1)                          \
  F(SetDebugEventListener, 2, 1)               \
  F(ScheduleBreak, 0, 1)                       \
158
  F(DebugGetInternalProperties, 1, 1)          \
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
  F(DebugGetPropertyDetails, 2, 1)             \
  F(DebugGetProperty, 2, 1)                    \
  F(DebugPropertyTypeFromDetails, 1, 1)        \
  F(DebugPropertyAttributesFromDetails, 1, 1)  \
  F(DebugPropertyIndexFromDetails, 1, 1)       \
  F(DebugNamedInterceptorPropertyValue, 2, 1)  \
  F(DebugIndexedInterceptorElementValue, 2, 1) \
  F(CheckExecutionState, 1, 1)                 \
  F(GetFrameCount, 1, 1)                       \
  F(GetFrameDetails, 2, 1)                     \
  F(GetScopeCount, 2, 1)                       \
  F(GetStepInPositions, 2, 1)                  \
  F(GetScopeDetails, 4, 1)                     \
  F(GetAllScopesDetails, 4, 1)                 \
  F(GetFunctionScopeCount, 1, 1)               \
  F(GetFunctionScopeDetails, 2, 1)             \
  F(SetScopeVariableValue, 6, 1)               \
  F(DebugPrintScopes, 0, 1)                    \
  F(GetThreadCount, 1, 1)                      \
  F(GetThreadDetails, 2, 1)                    \
179
  F(SetBreakPointsActive, 1, 1)                \
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
  F(GetBreakLocations, 2, 1)                   \
  F(SetFunctionBreakPoint, 3, 1)               \
  F(SetScriptBreakPoint, 4, 1)                 \
  F(ClearBreakPoint, 1, 1)                     \
  F(ChangeBreakOnException, 2, 1)              \
  F(IsBreakOnException, 1, 1)                  \
  F(PrepareStep, 4, 1)                         \
  F(ClearStepping, 0, 1)                       \
  F(DebugEvaluate, 6, 1)                       \
  F(DebugEvaluateGlobal, 4, 1)                 \
  F(DebugGetLoadedScripts, 0, 1)               \
  F(DebugReferencedBy, 3, 1)                   \
  F(DebugConstructedBy, 2, 1)                  \
  F(DebugGetPrototype, 1, 1)                   \
  F(DebugSetScriptSource, 2, 1)                \
  F(FunctionGetInferredName, 1, 1)             \
  F(GetFunctionCodePositionFromSource, 2, 1)   \
  F(ExecuteInDebugContext, 1, 1)               \
  F(GetDebugContext, 0, 1)                     \
  F(CollectGarbage, 1, 1)                      \
  F(GetHeapUsage, 0, 1)                        \
  F(GetScript, 1, 1)                           \
  F(DebugCallbackSupportsStepping, 1, 1)       \
203
  F(DebugPrepareStepInIfStepping, 1, 1)        \
204
  F(DebugPushPromise, 3, 1)                    \
205 206 207
  F(DebugPopPromise, 0, 1)                     \
  F(DebugPromiseEvent, 1, 1)                   \
  F(DebugAsyncTaskEvent, 1, 1)                 \
208 209 210 211
  F(DebugIsActive, 0, 1)                       \
  F(DebugBreakInOptimizedCode, 0, 1)


212 213 214 215 216 217 218
#define FOR_EACH_INTRINSIC_FORIN(F) \
  F(ForInDone, 2, 1)                \
  F(ForInFilter, 2, 1)              \
  F(ForInNext, 4, 1)                \
  F(ForInStep, 1, 1)


219 220 221 222 223 224 225 226 227
#define FOR_EACH_INTRINSIC_INTERPRETER(F) \
  F(InterpreterEquals, 2, 1)              \
  F(InterpreterNotEquals, 2, 1)           \
  F(InterpreterStrictEquals, 2, 1)        \
  F(InterpreterStrictNotEquals, 2, 1)     \
  F(InterpreterLessThan, 2, 1)            \
  F(InterpreterGreaterThan, 2, 1)         \
  F(InterpreterLessThanOrEqual, 2, 1)     \
  F(InterpreterGreaterThanOrEqual, 2, 1)  \
228 229
  F(InterpreterToBoolean, 1, 1)           \
  F(InterpreterLogicalNot, 1, 1)          \
230
  F(InterpreterTypeOf, 1, 1)              \
231 232
  F(InterpreterNewClosure, 2, 1)          \
  F(InterpreterForInPrepare, 1, 1)
233 234


235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
#define FOR_EACH_INTRINSIC_FUNCTION(F)                      \
  F(FunctionGetName, 1, 1)                                  \
  F(FunctionSetName, 2, 1)                                  \
  F(FunctionNameShouldPrintAsAnonymous, 1, 1)               \
  F(FunctionMarkNameShouldPrintAsAnonymous, 1, 1)           \
  F(FunctionIsArrow, 1, 1)                                  \
  F(FunctionIsConciseMethod, 1, 1)                          \
  F(FunctionRemovePrototype, 1, 1)                          \
  F(FunctionGetScript, 1, 1)                                \
  F(FunctionGetSourceCode, 1, 1)                            \
  F(FunctionGetScriptSourcePosition, 1, 1)                  \
  F(FunctionGetPositionForOffset, 2, 1)                     \
  F(FunctionSetInstanceClassName, 2, 1)                     \
  F(FunctionSetLength, 2, 1)                                \
  F(FunctionSetPrototype, 2, 1)                             \
  F(FunctionIsAPIFunction, 1, 1)                            \
251
  F(FunctionHidesSource, 1, 1)                              \
252 253
  F(SetCode, 2, 1)                                          \
  F(SetNativeFlag, 1, 1)                                    \
254
  F(ThrowStrongModeTooFewArguments, 0, 1)                   \
255
  F(IsConstructor, 1, 1)                                    \
256
  F(SetForceInlineFlag, 1, 1)                               \
257 258 259 260 261
  F(FunctionBindArguments, 4, 1)                            \
  F(BoundFunctionGetBindings, 1, 1)                         \
  F(NewObjectFromBound, 1, 1)                               \
  F(Call, -1 /* >= 2 */, 1)                                 \
  F(Apply, 5, 1)                                            \
262
  F(GetOriginalConstructor, 0, 1)                           \
263
  F(ConvertReceiver, 1, 1)                                  \
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313
  F(CallFunction, -1 /* receiver + n args + function */, 1) \
  F(IsConstructCall, 0, 1)                                  \
  F(IsFunction, 1, 1)


#define FOR_EACH_INTRINSIC_GENERATOR(F) \
  F(CreateJSGeneratorObject, 0, 1)      \
  F(SuspendJSGeneratorObject, -1, 1)    \
  F(ResumeJSGeneratorObject, 3, 1)      \
  F(GeneratorClose, 1, 1)               \
  F(GeneratorGetFunction, 1, 1)         \
  F(GeneratorGetContext, 1, 1)          \
  F(GeneratorGetReceiver, 1, 1)         \
  F(GeneratorGetContinuation, 1, 1)     \
  F(GeneratorGetSourcePosition, 1, 1)   \
  F(FunctionIsGenerator, 1, 1)          \
  F(GeneratorNext, 2, 1)                \
  F(GeneratorThrow, 2, 1)


#ifdef V8_I18N_SUPPORT
#define FOR_EACH_INTRINSIC_I18N(F)           \
  F(CanonicalizeLanguageTag, 1, 1)           \
  F(AvailableLocalesOf, 1, 1)                \
  F(GetDefaultICULocale, 0, 1)               \
  F(GetLanguageTagVariants, 1, 1)            \
  F(IsInitializedIntlObject, 1, 1)           \
  F(IsInitializedIntlObjectOfType, 2, 1)     \
  F(MarkAsInitializedIntlObjectOfType, 3, 1) \
  F(GetImplFromInitializedIntlObject, 1, 1)  \
  F(CreateDateTimeFormat, 3, 1)              \
  F(InternalDateFormat, 2, 1)                \
  F(InternalDateParse, 2, 1)                 \
  F(CreateNumberFormat, 3, 1)                \
  F(InternalNumberFormat, 2, 1)              \
  F(InternalNumberParse, 2, 1)               \
  F(CreateCollator, 3, 1)                    \
  F(InternalCompare, 3, 1)                   \
  F(StringNormalize, 2, 1)                   \
  F(CreateBreakIterator, 3, 1)               \
  F(BreakIteratorAdoptText, 2, 1)            \
  F(BreakIteratorFirst, 1, 1)                \
  F(BreakIteratorNext, 1, 1)                 \
  F(BreakIteratorCurrent, 1, 1)              \
  F(BreakIteratorBreakType, 1, 1)
#else
#define FOR_EACH_INTRINSIC_I18N(F)
#endif


314 315
#define FOR_EACH_INTRINSIC_INTERNAL(F)        \
  F(CheckIsBootstrapping, 0, 1)               \
316 317
  F(ExportFromRuntime, 1, 1)                  \
  F(ExportExperimentalFromRuntime, 1, 1)      \
318
  F(InstallToContext, 1, 1)                   \
319 320
  F(Throw, 1, 1)                              \
  F(ReThrow, 1, 1)                            \
321
  F(UnwindAndFindExceptionHandler, 0, 1)      \
322 323
  F(PromoteScheduledException, 0, 1)          \
  F(ThrowReferenceError, 1, 1)                \
324 325 326
  F(NewTypeError, 2, 1)                       \
  F(NewSyntaxError, 2, 1)                     \
  F(NewReferenceError, 2, 1)                  \
327
  F(ThrowIteratorResultNotAnObject, 1, 1)     \
328
  F(ThrowStackOverflow, 0, 1)                 \
329
  F(ThrowStrongModeImplicitConversion, 0, 1)  \
330 331 332 333 334 335 336 337 338
  F(PromiseRejectEvent, 3, 1)                 \
  F(PromiseRevokeReject, 1, 1)                \
  F(StackGuard, 0, 1)                         \
  F(Interrupt, 0, 1)                          \
  F(AllocateInNewSpace, 1, 1)                 \
  F(AllocateInTargetSpace, 2, 1)              \
  F(CollectStackTrace, 2, 1)                  \
  F(MessageGetStartPosition, 1, 1)            \
  F(MessageGetScript, 1, 1)                   \
339
  F(ErrorToStringRT, 1, 1)                    \
340
  F(FormatMessageString, 4, 1)                \
341 342 343 344 345 346 347 348 349 350
  F(CallSiteGetFileNameRT, 1, 1)              \
  F(CallSiteGetFunctionNameRT, 1, 1)          \
  F(CallSiteGetScriptNameOrSourceUrlRT, 1, 1) \
  F(CallSiteGetMethodNameRT, 1, 1)            \
  F(CallSiteGetLineNumberRT, 1, 1)            \
  F(CallSiteGetColumnNumberRT, 1, 1)          \
  F(CallSiteIsNativeRT, 1, 1)                 \
  F(CallSiteIsToplevelRT, 1, 1)               \
  F(CallSiteIsEvalRT, 1, 1)                   \
  F(CallSiteIsConstructorRT, 1, 1)            \
351 352 353 354
  F(IS_VAR, 1, 1)                             \
  F(IncrementStatsCounter, 1, 1)              \
  F(Likely, 1, 1)                             \
  F(Unlikely, 1, 1)                           \
355
  F(HarmonyToString, 0, 1)                    \
356
  F(GetTypeFeedbackVector, 1, 1)              \
357
  F(GetCallerJSFunction, 0, 1)                \
358 359
  F(GetCodeStubExportsObject, 0, 1)           \
  F(ThrowCalledNonCallable, 1, 1)
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401


#define FOR_EACH_INTRINSIC_JSON(F) \
  F(QuoteJSONString, 1, 1)         \
  F(BasicJSONStringify, 1, 1)      \
  F(ParseJson, 1, 1)


#define FOR_EACH_INTRINSIC_LITERALS(F)   \
  F(CreateObjectLiteral, 4, 1)           \
  F(CreateArrayLiteral, 4, 1)            \
  F(CreateArrayLiteralStubBailout, 3, 1) \
  F(StoreArrayLiteralElement, 5, 1)


#define FOR_EACH_INTRINSIC_LIVEEDIT(F)              \
  F(LiveEditFindSharedFunctionInfosForScript, 1, 1) \
  F(LiveEditGatherCompileInfo, 2, 1)                \
  F(LiveEditReplaceScript, 3, 1)                    \
  F(LiveEditFunctionSourceUpdated, 1, 1)            \
  F(LiveEditReplaceFunctionCode, 2, 1)              \
  F(LiveEditFunctionSetScript, 2, 1)                \
  F(LiveEditReplaceRefToNestedFunction, 3, 1)       \
  F(LiveEditPatchFunctionPositions, 2, 1)           \
  F(LiveEditCheckAndDropActivations, 2, 1)          \
  F(LiveEditCompareStrings, 2, 1)                   \
  F(LiveEditRestartFrame, 2, 1)


#define FOR_EACH_INTRINSIC_MATHS(F) \
  F(MathAcos, 1, 1)                 \
  F(MathAsin, 1, 1)                 \
  F(MathAtan, 1, 1)                 \
  F(MathLogRT, 1, 1)                \
  F(DoubleHi, 1, 1)                 \
  F(DoubleLo, 1, 1)                 \
  F(ConstructDouble, 2, 1)          \
  F(RemPiO2, 2, 1)                  \
  F(MathAtan2, 2, 1)                \
  F(MathExpRT, 1, 1)                \
  F(MathClz32, 1, 1)                \
  F(MathFloor, 1, 1)                \
402
  F(MathPow, 2, 1)                  \
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418
  F(MathPowRT, 2, 1)                \
  F(RoundNumber, 1, 1)              \
  F(MathSqrt, 1, 1)                 \
  F(MathFround, 1, 1)               \
  F(IsMinusZero, 1, 1)


#define FOR_EACH_INTRINSIC_NUMBERS(F)  \
  F(NumberToRadixString, 2, 1)         \
  F(NumberToFixed, 2, 1)               \
  F(NumberToExponential, 2, 1)         \
  F(NumberToPrecision, 2, 1)           \
  F(IsValidSmi, 1, 1)                  \
  F(StringToNumber, 1, 1)              \
  F(StringParseInt, 2, 1)              \
  F(StringParseFloat, 1, 1)            \
419
  F(NumberToString, 1, 1)              \
420 421 422 423 424 425 426
  F(NumberToStringSkipCache, 1, 1)     \
  F(NumberToIntegerMapMinusZero, 1, 1) \
  F(NumberToSmi, 1, 1)                 \
  F(NumberImul, 2, 1)                  \
  F(SmiLexicographicCompare, 2, 1)     \
  F(MaxSmi, 0, 1)                      \
  F(IsSmi, 1, 1)                       \
427
  F(GetRootNaN, 0, 1)
428 429 430 431 432 433 434 435 436 437 438 439


#define FOR_EACH_INTRINSIC_OBJECT(F)                 \
  F(GetPrototype, 1, 1)                              \
  F(InternalSetPrototype, 2, 1)                      \
  F(SetPrototype, 2, 1)                              \
  F(GetOwnProperty, 2, 1)                            \
  F(PreventExtensions, 1, 1)                         \
  F(IsExtensible, 1, 1)                              \
  F(OptimizeObjectForAddingMultipleProperties, 2, 1) \
  F(ObjectFreeze, 1, 1)                              \
  F(ObjectSeal, 1, 1)                                \
440
  F(GetProperty, 2, 1)                               \
441
  F(GetPropertyStrong, 2, 1)                         \
442
  F(KeyedGetProperty, 2, 1)                          \
443
  F(KeyedGetPropertyStrong, 2, 1)                    \
444 445 446
  F(LoadGlobalViaContext, 1, 1)                      \
  F(StoreGlobalViaContext_Sloppy, 2, 1)              \
  F(StoreGlobalViaContext_Strict, 2, 1)              \
447 448
  F(AddNamedProperty, 4, 1)                          \
  F(SetProperty, 4, 1)                               \
449
  F(AddElement, 3, 1)                                \
arv's avatar
arv committed
450
  F(AppendElement, 2, 1)                             \
451 452
  F(DeleteProperty_Sloppy, 2, 1)                     \
  F(DeleteProperty_Strict, 2, 1)                     \
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482
  F(HasOwnProperty, 2, 1)                            \
  F(HasProperty, 2, 1)                               \
  F(IsPropertyEnumerable, 2, 1)                      \
  F(GetPropertyNamesFast, 1, 1)                      \
  F(GetOwnPropertyNames, 2, 1)                       \
  F(GetOwnElementNames, 1, 1)                        \
  F(GetInterceptorInfo, 1, 1)                        \
  F(GetNamedInterceptorPropertyNames, 1, 1)          \
  F(GetIndexedInterceptorElementNames, 1, 1)         \
  F(OwnKeys, 1, 1)                                   \
  F(ToFastProperties, 1, 1)                          \
  F(AllocateHeapNumber, 0, 1)                        \
  F(NewObject, 2, 1)                                 \
  F(FinalizeInstanceSize, 1, 1)                      \
  F(GlobalProxy, 1, 1)                               \
  F(LookupAccessor, 3, 1)                            \
  F(LoadMutableDouble, 2, 1)                         \
  F(TryMigrateInstance, 1, 1)                        \
  F(IsJSGlobalProxy, 1, 1)                           \
  F(DefineAccessorPropertyUnchecked, 5, 1)           \
  F(DefineDataPropertyUnchecked, 4, 1)               \
  F(GetDataProperty, 2, 1)                           \
  F(HasFastPackedElements, 1, 1)                     \
  F(ValueOf, 1, 1)                                   \
  F(SetValueOf, 2, 1)                                \
  F(JSValueGetValue, 1, 1)                           \
  F(HeapObjectGetMap, 1, 1)                          \
  F(MapGetInstanceType, 1, 1)                        \
  F(ObjectEquals, 2, 1)                              \
  F(IsSpecObject, 1, 1)                              \
483
  F(IsStrong, 1, 1)                                  \
484 485
  F(ClassOf, 1, 1)                                   \
  F(DefineGetterPropertyUnchecked, 4, 1)             \
486
  F(DefineSetterPropertyUnchecked, 4, 1)             \
487
  F(ToObject, 1, 1)                                  \
488 489 490 491
  F(ToPrimitive, 1, 1)                               \
  F(ToPrimitive_Number, 1, 1)                        \
  F(ToPrimitive_String, 1, 1)                        \
  F(ToNumber, 1, 1)                                  \
492 493
  F(ToInteger, 1, 1)                                 \
  F(ToLength, 1, 1)                                  \
494
  F(ToString, 1, 1)                                  \
495
  F(ToName, 1, 1)                                    \
496
  F(Equals, 2, 1)                                    \
497
  F(StrictEquals, 2, 1)                              \
498 499
  F(Compare, 3, 1)                                   \
  F(Compare_Strong, 3, 1)                            \
500
  F(InstanceOf, 2, 1)                                \
501
  F(HasInPrototypeChain, 2, 1)                       \
502
  F(CreateIterResultObject, 2, 1)                    \
503 504 505
  F(IsAccessCheckNeeded, 1, 1)                       \
  F(ObjectDefineProperties, 2, 1)                    \
  F(ObjectDefineProperty, 3, 1)
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521


#define FOR_EACH_INTRINSIC_OBSERVE(F)            \
  F(IsObserved, 1, 1)                            \
  F(SetIsObserved, 1, 1)                         \
  F(EnqueueMicrotask, 1, 1)                      \
  F(RunMicrotasks, 0, 1)                         \
  F(DeliverObservationChangeRecords, 2, 1)       \
  F(GetObservationState, 0, 1)                   \
  F(ObserverObjectAndRecordHaveSameOrigin, 3, 1) \
  F(ObjectWasCreatedInCurrentOrigin, 1, 1)       \
  F(GetObjectContextObjectObserve, 1, 1)         \
  F(GetObjectContextObjectGetNotifier, 1, 1)     \
  F(GetObjectContextNotifierPerformChange, 1, 1)


522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545
#define FOR_EACH_INTRINSIC_OPERATORS(F) \
  F(Multiply, 2, 1)                     \
  F(Multiply_Strong, 2, 1)              \
  F(Divide, 2, 1)                       \
  F(Divide_Strong, 2, 1)                \
  F(Modulus, 2, 1)                      \
  F(Modulus_Strong, 2, 1)               \
  F(Add, 2, 1)                          \
  F(Add_Strong, 2, 1)                   \
  F(Subtract, 2, 1)                     \
  F(Subtract_Strong, 2, 1)              \
  F(ShiftLeft, 2, 1)                    \
  F(ShiftLeft_Strong, 2, 1)             \
  F(ShiftRight, 2, 1)                   \
  F(ShiftRight_Strong, 2, 1)            \
  F(ShiftRightLogical, 2, 1)            \
  F(ShiftRightLogical_Strong, 2, 1)     \
  F(BitwiseAnd, 2, 1)                   \
  F(BitwiseAnd_Strong, 2, 1)            \
  F(BitwiseOr, 2, 1)                    \
  F(BitwiseOr_Strong, 2, 1)             \
  F(BitwiseXor, 2, 1)                   \
  F(BitwiseXor_Strong, 2, 1)

546 547 548 549 550 551 552 553 554 555 556 557 558
#define FOR_EACH_INTRINSIC_PROXY(F) \
  F(CreateJSProxy, 2, 1)            \
  F(CreateJSFunctionProxy, 4, 1)    \
  F(IsJSProxy, 1, 1)                \
  F(IsJSFunctionProxy, 1, 1)        \
  F(GetHandler, 1, 1)               \
  F(GetCallTrap, 1, 1)              \
  F(GetConstructTrap, 1, 1)         \
  F(Fix, 1, 1)


#define FOR_EACH_INTRINSIC_REGEXP(F)           \
  F(StringReplaceGlobalRegExpWithString, 4, 1) \
559
  F(StringSplit, 3, 1)                         \
560 561
  F(RegExpExec, 4, 1)                          \
  F(RegExpConstructResult, 3, 1)               \
562
  F(RegExpInitializeAndCompile, 3, 1)          \
563
  F(MaterializeRegExpLiteral, 4, 1)            \
564
  F(RegExpExecMultiple, 4, 1)                  \
565
  F(RegExpExecReThrow, 4, 1)                   \
566 567 568
  F(IsRegExp, 1, 1)


569 570 571 572 573
#define FOR_EACH_INTRINSIC_SCOPES(F)       \
  F(ThrowConstAssignError, 0, 1)           \
  F(DeclareGlobals, 2, 1)                  \
  F(InitializeVarGlobal, 3, 1)             \
  F(InitializeConstGlobal, 2, 1)           \
574
  F(DeclareLookupSlot, 3, 1)               \
575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592
  F(InitializeLegacyConstLookupSlot, 3, 1) \
  F(NewSloppyArguments_Generic, 1, 1)      \
  F(NewStrictArguments_Generic, 1, 1)      \
  F(NewSloppyArguments, 3, 1)              \
  F(NewStrictArguments, 3, 1)              \
  F(NewClosure, 1, 1)                      \
  F(NewClosure_Tenured, 1, 1)              \
  F(NewScriptContext, 2, 1)                \
  F(NewFunctionContext, 1, 1)              \
  F(PushWithContext, 2, 1)                 \
  F(PushCatchContext, 3, 1)                \
  F(PushBlockContext, 2, 1)                \
  F(IsJSModule, 1, 1)                      \
  F(PushModuleContext, 2, 1)               \
  F(DeclareModules, 1, 1)                  \
  F(DeleteLookupSlot, 2, 1)                \
  F(StoreLookupSlot, 4, 1)                 \
  F(ArgumentsLength, 0, 1)                 \
593 594 595
  F(Arguments, 1, 1)


596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899
#define FOR_EACH_INTRINSIC_SIMD(F)           \
  F(IsSimdValue, 1, 1)                       \
  F(SimdSameValue, 2, 1)                     \
  F(SimdSameValueZero, 2, 1)                 \
  F(CreateFloat32x4, 4, 1)                   \
  F(CreateInt32x4, 4, 1)                     \
  F(CreateUint32x4, 4, 1)                    \
  F(CreateBool32x4, 4, 1)                    \
  F(CreateInt16x8, 8, 1)                     \
  F(CreateUint16x8, 8, 1)                    \
  F(CreateBool16x8, 8, 1)                    \
  F(CreateInt8x16, 16, 1)                    \
  F(CreateUint8x16, 16, 1)                   \
  F(CreateBool8x16, 16, 1)                   \
  F(Float32x4Check, 1, 1)                    \
  F(Float32x4ExtractLane, 2, 1)              \
  F(Float32x4ReplaceLane, 3, 1)              \
  F(Float32x4Abs, 1, 1)                      \
  F(Float32x4Neg, 1, 1)                      \
  F(Float32x4Sqrt, 1, 1)                     \
  F(Float32x4RecipApprox, 1, 1)              \
  F(Float32x4RecipSqrtApprox, 1, 1)          \
  F(Float32x4Add, 2, 1)                      \
  F(Float32x4Sub, 2, 1)                      \
  F(Float32x4Mul, 2, 1)                      \
  F(Float32x4Div, 2, 1)                      \
  F(Float32x4Min, 2, 1)                      \
  F(Float32x4Max, 2, 1)                      \
  F(Float32x4MinNum, 2, 1)                   \
  F(Float32x4MaxNum, 2, 1)                   \
  F(Float32x4Equal, 2, 1)                    \
  F(Float32x4NotEqual, 2, 1)                 \
  F(Float32x4LessThan, 2, 1)                 \
  F(Float32x4LessThanOrEqual, 2, 1)          \
  F(Float32x4GreaterThan, 2, 1)              \
  F(Float32x4GreaterThanOrEqual, 2, 1)       \
  F(Float32x4Select, 3, 1)                   \
  F(Float32x4Swizzle, 5, 1)                  \
  F(Float32x4Shuffle, 6, 1)                  \
  F(Float32x4FromInt32x4, 1, 1)              \
  F(Float32x4FromUint32x4, 1, 1)             \
  F(Float32x4FromInt32x4Bits, 1, 1)          \
  F(Float32x4FromUint32x4Bits, 1, 1)         \
  F(Float32x4FromInt16x8Bits, 1, 1)          \
  F(Float32x4FromUint16x8Bits, 1, 1)         \
  F(Float32x4FromInt8x16Bits, 1, 1)          \
  F(Float32x4FromUint8x16Bits, 1, 1)         \
  F(Float32x4Load, 2, 1)                     \
  F(Float32x4Load1, 2, 1)                    \
  F(Float32x4Load2, 2, 1)                    \
  F(Float32x4Load3, 2, 1)                    \
  F(Float32x4Store, 3, 1)                    \
  F(Float32x4Store1, 3, 1)                   \
  F(Float32x4Store2, 3, 1)                   \
  F(Float32x4Store3, 3, 1)                   \
  F(Int32x4Check, 1, 1)                      \
  F(Int32x4ExtractLane, 2, 1)                \
  F(Int32x4ReplaceLane, 3, 1)                \
  F(Int32x4Neg, 1, 1)                        \
  F(Int32x4Add, 2, 1)                        \
  F(Int32x4Sub, 2, 1)                        \
  F(Int32x4Mul, 2, 1)                        \
  F(Int32x4Min, 2, 1)                        \
  F(Int32x4Max, 2, 1)                        \
  F(Int32x4And, 2, 1)                        \
  F(Int32x4Or, 2, 1)                         \
  F(Int32x4Xor, 2, 1)                        \
  F(Int32x4Not, 1, 1)                        \
  F(Int32x4ShiftLeftByScalar, 2, 1)          \
  F(Int32x4ShiftRightByScalar, 2, 1)         \
  F(Int32x4Equal, 2, 1)                      \
  F(Int32x4NotEqual, 2, 1)                   \
  F(Int32x4LessThan, 2, 1)                   \
  F(Int32x4LessThanOrEqual, 2, 1)            \
  F(Int32x4GreaterThan, 2, 1)                \
  F(Int32x4GreaterThanOrEqual, 2, 1)         \
  F(Int32x4Select, 3, 1)                     \
  F(Int32x4Swizzle, 5, 1)                    \
  F(Int32x4Shuffle, 6, 1)                    \
  F(Int32x4FromFloat32x4, 1, 1)              \
  F(Int32x4FromUint32x4, 1, 1)               \
  F(Int32x4FromFloat32x4Bits, 1, 1)          \
  F(Int32x4FromUint32x4Bits, 1, 1)           \
  F(Int32x4FromInt16x8Bits, 1, 1)            \
  F(Int32x4FromUint16x8Bits, 1, 1)           \
  F(Int32x4FromInt8x16Bits, 1, 1)            \
  F(Int32x4FromUint8x16Bits, 1, 1)           \
  F(Int32x4Load, 2, 1)                       \
  F(Int32x4Load1, 2, 1)                      \
  F(Int32x4Load2, 2, 1)                      \
  F(Int32x4Load3, 2, 1)                      \
  F(Int32x4Store, 3, 1)                      \
  F(Int32x4Store1, 3, 1)                     \
  F(Int32x4Store2, 3, 1)                     \
  F(Int32x4Store3, 3, 1)                     \
  F(Uint32x4Check, 1, 1)                     \
  F(Uint32x4ExtractLane, 2, 1)               \
  F(Uint32x4ReplaceLane, 3, 1)               \
  F(Uint32x4Add, 2, 1)                       \
  F(Uint32x4Sub, 2, 1)                       \
  F(Uint32x4Mul, 2, 1)                       \
  F(Uint32x4Min, 2, 1)                       \
  F(Uint32x4Max, 2, 1)                       \
  F(Uint32x4And, 2, 1)                       \
  F(Uint32x4Or, 2, 1)                        \
  F(Uint32x4Xor, 2, 1)                       \
  F(Uint32x4Not, 1, 1)                       \
  F(Uint32x4ShiftLeftByScalar, 2, 1)         \
  F(Uint32x4ShiftRightByScalar, 2, 1)        \
  F(Uint32x4Equal, 2, 1)                     \
  F(Uint32x4NotEqual, 2, 1)                  \
  F(Uint32x4LessThan, 2, 1)                  \
  F(Uint32x4LessThanOrEqual, 2, 1)           \
  F(Uint32x4GreaterThan, 2, 1)               \
  F(Uint32x4GreaterThanOrEqual, 2, 1)        \
  F(Uint32x4Select, 3, 1)                    \
  F(Uint32x4Swizzle, 5, 1)                   \
  F(Uint32x4Shuffle, 6, 1)                   \
  F(Uint32x4FromFloat32x4, 1, 1)             \
  F(Uint32x4FromInt32x4, 1, 1)               \
  F(Uint32x4FromFloat32x4Bits, 1, 1)         \
  F(Uint32x4FromInt32x4Bits, 1, 1)           \
  F(Uint32x4FromInt16x8Bits, 1, 1)           \
  F(Uint32x4FromUint16x8Bits, 1, 1)          \
  F(Uint32x4FromInt8x16Bits, 1, 1)           \
  F(Uint32x4FromUint8x16Bits, 1, 1)          \
  F(Uint32x4Load, 2, 1)                      \
  F(Uint32x4Load1, 2, 1)                     \
  F(Uint32x4Load2, 2, 1)                     \
  F(Uint32x4Load3, 2, 1)                     \
  F(Uint32x4Store, 3, 1)                     \
  F(Uint32x4Store1, 3, 1)                    \
  F(Uint32x4Store2, 3, 1)                    \
  F(Uint32x4Store3, 3, 1)                    \
  F(Bool32x4Check, 1, 1)                     \
  F(Bool32x4ExtractLane, 2, 1)               \
  F(Bool32x4ReplaceLane, 3, 1)               \
  F(Bool32x4And, 2, 1)                       \
  F(Bool32x4Or, 2, 1)                        \
  F(Bool32x4Xor, 2, 1)                       \
  F(Bool32x4Not, 1, 1)                       \
  F(Bool32x4AnyTrue, 1, 1)                   \
  F(Bool32x4AllTrue, 1, 1)                   \
  F(Bool32x4Swizzle, 5, 1)                   \
  F(Bool32x4Shuffle, 6, 1)                   \
  F(Int16x8Check, 1, 1)                      \
  F(Int16x8ExtractLane, 2, 1)                \
  F(Int16x8ReplaceLane, 3, 1)                \
  F(Int16x8Neg, 1, 1)                        \
  F(Int16x8Add, 2, 1)                        \
  F(Int16x8AddSaturate, 2, 1)                \
  F(Int16x8Sub, 2, 1)                        \
  F(Int16x8SubSaturate, 2, 1)                \
  F(Int16x8Mul, 2, 1)                        \
  F(Int16x8Min, 2, 1)                        \
  F(Int16x8Max, 2, 1)                        \
  F(Int16x8And, 2, 1)                        \
  F(Int16x8Or, 2, 1)                         \
  F(Int16x8Xor, 2, 1)                        \
  F(Int16x8Not, 1, 1)                        \
  F(Int16x8ShiftLeftByScalar, 2, 1)          \
  F(Int16x8ShiftRightByScalar, 2, 1)         \
  F(Int16x8Equal, 2, 1)                      \
  F(Int16x8NotEqual, 2, 1)                   \
  F(Int16x8LessThan, 2, 1)                   \
  F(Int16x8LessThanOrEqual, 2, 1)            \
  F(Int16x8GreaterThan, 2, 1)                \
  F(Int16x8GreaterThanOrEqual, 2, 1)         \
  F(Int16x8Select, 3, 1)                     \
  F(Int16x8Swizzle, 9, 1)                    \
  F(Int16x8Shuffle, 10, 1)                   \
  F(Int16x8FromUint16x8, 1, 1)               \
  F(Int16x8FromFloat32x4Bits, 1, 1)          \
  F(Int16x8FromInt32x4Bits, 1, 1)            \
  F(Int16x8FromUint32x4Bits, 1, 1)           \
  F(Int16x8FromUint16x8Bits, 1, 1)           \
  F(Int16x8FromInt8x16Bits, 1, 1)            \
  F(Int16x8FromUint8x16Bits, 1, 1)           \
  F(Int16x8Load, 2, 1)                       \
  F(Int16x8Store, 3, 1)                      \
  F(Uint16x8Check, 1, 1)                     \
  F(Uint16x8ExtractLane, 2, 1)               \
  F(Uint16x8ReplaceLane, 3, 1)               \
  F(Uint16x8Add, 2, 1)                       \
  F(Uint16x8AddSaturate, 2, 1)               \
  F(Uint16x8Sub, 2, 1)                       \
  F(Uint16x8SubSaturate, 2, 1)               \
  F(Uint16x8Mul, 2, 1)                       \
  F(Uint16x8Min, 2, 1)                       \
  F(Uint16x8Max, 2, 1)                       \
  F(Uint16x8And, 2, 1)                       \
  F(Uint16x8Or, 2, 1)                        \
  F(Uint16x8Xor, 2, 1)                       \
  F(Uint16x8Not, 1, 1)                       \
  F(Uint16x8ShiftLeftByScalar, 2, 1)         \
  F(Uint16x8ShiftRightByScalar, 2, 1)        \
  F(Uint16x8Equal, 2, 1)                     \
  F(Uint16x8NotEqual, 2, 1)                  \
  F(Uint16x8LessThan, 2, 1)                  \
  F(Uint16x8LessThanOrEqual, 2, 1)           \
  F(Uint16x8GreaterThan, 2, 1)               \
  F(Uint16x8GreaterThanOrEqual, 2, 1)        \
  F(Uint16x8Select, 3, 1)                    \
  F(Uint16x8Swizzle, 9, 1)                   \
  F(Uint16x8Shuffle, 10, 1)                  \
  F(Uint16x8FromInt16x8, 1, 1)               \
  F(Uint16x8FromFloat32x4Bits, 1, 1)         \
  F(Uint16x8FromInt32x4Bits, 1, 1)           \
  F(Uint16x8FromUint32x4Bits, 1, 1)          \
  F(Uint16x8FromInt16x8Bits, 1, 1)           \
  F(Uint16x8FromInt8x16Bits, 1, 1)           \
  F(Uint16x8FromUint8x16Bits, 1, 1)          \
  F(Uint16x8Load, 2, 1)                      \
  F(Uint16x8Store, 3, 1)                     \
  F(Bool16x8Check, 1, 1)                     \
  F(Bool16x8ExtractLane, 2, 1)               \
  F(Bool16x8ReplaceLane, 3, 1)               \
  F(Bool16x8And, 2, 1)                       \
  F(Bool16x8Or, 2, 1)                        \
  F(Bool16x8Xor, 2, 1)                       \
  F(Bool16x8Not, 1, 1)                       \
  F(Bool16x8AnyTrue, 1, 1)                   \
  F(Bool16x8AllTrue, 1, 1)                   \
  F(Bool16x8Swizzle, 9, 1)                   \
  F(Bool16x8Shuffle, 10, 1)                  \
  F(Int8x16Check, 1, 1)                      \
  F(Int8x16ExtractLane, 2, 1)                \
  F(Int8x16ReplaceLane, 3, 1)                \
  F(Int8x16Neg, 1, 1)                        \
  F(Int8x16Add, 2, 1)                        \
  F(Int8x16AddSaturate, 2, 1)                \
  F(Int8x16Sub, 2, 1)                        \
  F(Int8x16SubSaturate, 2, 1)                \
  F(Int8x16Mul, 2, 1)                        \
  F(Int8x16Min, 2, 1)                        \
  F(Int8x16Max, 2, 1)                        \
  F(Int8x16And, 2, 1)                        \
  F(Int8x16Or, 2, 1)                         \
  F(Int8x16Xor, 2, 1)                        \
  F(Int8x16Not, 1, 1)                        \
  F(Int8x16ShiftLeftByScalar, 2, 1)          \
  F(Int8x16ShiftRightByScalar, 2, 1)         \
  F(Int8x16Equal, 2, 1)                      \
  F(Int8x16NotEqual, 2, 1)                   \
  F(Int8x16LessThan, 2, 1)                   \
  F(Int8x16LessThanOrEqual, 2, 1)            \
  F(Int8x16GreaterThan, 2, 1)                \
  F(Int8x16GreaterThanOrEqual, 2, 1)         \
  F(Int8x16Select, 3, 1)                     \
  F(Int8x16Swizzle, 17, 1)                   \
  F(Int8x16Shuffle, 18, 1)                   \
  F(Int8x16FromUint8x16, 1, 1)               \
  F(Int8x16FromFloat32x4Bits, 1, 1)          \
  F(Int8x16FromInt32x4Bits, 1, 1)            \
  F(Int8x16FromUint32x4Bits, 1, 1)           \
  F(Int8x16FromInt16x8Bits, 1, 1)            \
  F(Int8x16FromUint16x8Bits, 1, 1)           \
  F(Int8x16FromUint8x16Bits, 1, 1)           \
  F(Int8x16Load, 2, 1)                       \
  F(Int8x16Store, 3, 1)                      \
  F(Uint8x16Check, 1, 1)                     \
  F(Uint8x16ExtractLane, 2, 1)               \
  F(Uint8x16ReplaceLane, 3, 1)               \
  F(Uint8x16Add, 2, 1)                       \
  F(Uint8x16AddSaturate, 2, 1)               \
  F(Uint8x16Sub, 2, 1)                       \
  F(Uint8x16SubSaturate, 2, 1)               \
  F(Uint8x16Mul, 2, 1)                       \
  F(Uint8x16Min, 2, 1)                       \
  F(Uint8x16Max, 2, 1)                       \
  F(Uint8x16And, 2, 1)                       \
  F(Uint8x16Or, 2, 1)                        \
  F(Uint8x16Xor, 2, 1)                       \
  F(Uint8x16Not, 1, 1)                       \
  F(Uint8x16ShiftLeftByScalar, 2, 1)         \
  F(Uint8x16ShiftRightByScalar, 2, 1)        \
  F(Uint8x16Equal, 2, 1)                     \
  F(Uint8x16NotEqual, 2, 1)                  \
  F(Uint8x16LessThan, 2, 1)                  \
  F(Uint8x16LessThanOrEqual, 2, 1)           \
  F(Uint8x16GreaterThan, 2, 1)               \
  F(Uint8x16GreaterThanOrEqual, 2, 1)        \
  F(Uint8x16Select, 3, 1)                    \
  F(Uint8x16Swizzle, 17, 1)                  \
  F(Uint8x16Shuffle, 18, 1)                  \
  F(Uint8x16FromInt8x16, 1, 1)               \
  F(Uint8x16FromFloat32x4Bits, 1, 1)         \
  F(Uint8x16FromInt32x4Bits, 1, 1)           \
  F(Uint8x16FromUint32x4Bits, 1, 1)          \
  F(Uint8x16FromInt16x8Bits, 1, 1)           \
  F(Uint8x16FromUint16x8Bits, 1, 1)          \
  F(Uint8x16FromInt8x16Bits, 1, 1)           \
  F(Uint8x16Load, 2, 1)                      \
  F(Uint8x16Store, 3, 1)                     \
  F(Bool8x16Check, 1, 1)                     \
  F(Bool8x16ExtractLane, 2, 1)               \
  F(Bool8x16ReplaceLane, 3, 1)               \
  F(Bool8x16And, 2, 1)                       \
  F(Bool8x16Or, 2, 1)                        \
  F(Bool8x16Xor, 2, 1)                       \
  F(Bool8x16Not, 1, 1)                       \
  F(Bool8x16AnyTrue, 1, 1)                   \
  F(Bool8x16AllTrue, 1, 1)                   \
  F(Bool8x16Swizzle, 17, 1)                  \
900
  F(Bool8x16Shuffle, 18, 1)
901 902


903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935
#define FOR_EACH_INTRINSIC_STRINGS(F)           \
  F(StringReplaceOneCharWithString, 3, 1)       \
  F(StringIndexOf, 3, 1)                        \
  F(StringLastIndexOf, 3, 1)                    \
  F(StringLocaleCompare, 2, 1)                  \
  F(SubString, 3, 1)                            \
  F(StringAdd, 2, 1)                            \
  F(InternalizeString, 1, 1)                    \
  F(StringMatch, 3, 1)                          \
  F(StringCharCodeAtRT, 2, 1)                   \
  F(CharFromCode, 1, 1)                         \
  F(StringCompare, 2, 1)                        \
  F(StringBuilderConcat, 3, 1)                  \
  F(StringBuilderJoin, 3, 1)                    \
  F(SparseJoinWithSeparator, 3, 1)              \
  F(StringToArray, 2, 1)                        \
  F(StringToLowerCase, 1, 1)                    \
  F(StringToUpperCase, 1, 1)                    \
  F(StringTrim, 3, 1)                           \
  F(TruncateString, 2, 1)                       \
  F(NewString, 2, 1)                            \
  F(StringEquals, 2, 1)                         \
  F(FlattenString, 1, 1)                        \
  F(StringCharFromCode, 1, 1)                   \
  F(StringCharAt, 2, 1)                         \
  F(OneByteSeqStringGetChar, 2, 1)              \
  F(OneByteSeqStringSetChar, 3, 1)              \
  F(TwoByteSeqStringGetChar, 2, 1)              \
  F(TwoByteSeqStringSetChar, 3, 1)              \
  F(StringCharCodeAt, 2, 1)                     \
  F(StringGetLength, 1, 1)


936 937 938 939
#define FOR_EACH_INTRINSIC_SYMBOL(F) \
  F(CreateSymbol, 1, 1)              \
  F(CreatePrivateSymbol, 1, 1)       \
  F(SymbolDescription, 1, 1)         \
940
  F(SymbolDescriptiveString, 1, 1)   \
941
  F(SymbolRegistry, 0, 1)            \
942 943 944 945 946 947 948 949 950 951 952 953 954 955
  F(SymbolIsPrivate, 1, 1)


#define FOR_EACH_INTRINSIC_TEST(F)            \
  F(DeoptimizeFunction, 1, 1)                 \
  F(DeoptimizeNow, 0, 1)                      \
  F(RunningInSimulator, 0, 1)                 \
  F(IsConcurrentRecompilationSupported, 0, 1) \
  F(OptimizeFunctionOnNextCall, -1, 1)        \
  F(OptimizeOsr, -1, 1)                       \
  F(NeverOptimizeFunction, 1, 1)              \
  F(GetOptimizationStatus, -1, 1)             \
  F(UnblockConcurrentRecompilation, 0, 1)     \
  F(GetOptimizationCount, 1, 1)               \
956
  F(GetUndetectable, 0, 1)                    \
957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972
  F(ClearFunctionTypeFeedback, 1, 1)          \
  F(NotifyContextDisposed, 0, 1)              \
  F(SetAllocationTimeout, -1 /* 2 || 3 */, 1) \
  F(DebugPrint, 1, 1)                         \
  F(DebugTrace, 0, 1)                         \
  F(GlobalPrint, 1, 1)                        \
  F(SystemBreak, 0, 1)                        \
  F(SetFlags, 1, 1)                           \
  F(Abort, 1, 1)                              \
  F(AbortJS, 1, 1)                            \
  F(NativeScriptsCount, 0, 1)                 \
  F(GetV8Version, 0, 1)                       \
  F(DisassembleFunction, 1, 1)                \
  F(TraceEnter, 0, 1)                         \
  F(TraceExit, 1, 1)                          \
  F(HaveSameMap, 2, 1)                        \
ben's avatar
ben committed
973
  F(InNewSpace, 1, 1)                         \
974 975 976 977 978 979 980
  F(HasFastSmiElements, 1, 1)                 \
  F(HasFastObjectElements, 1, 1)              \
  F(HasFastSmiOrObjectElements, 1, 1)         \
  F(HasFastDoubleElements, 1, 1)              \
  F(HasFastHoleyElements, 1, 1)               \
  F(HasDictionaryElements, 1, 1)              \
  F(HasSloppyArgumentsElements, 1, 1)         \
981
  F(HasFixedTypedArrayElements, 1, 1)         \
982 983 984 985 986 987 988 989 990 991 992 993 994
  F(HasFastProperties, 1, 1)                  \
  F(HasFixedUint8Elements, 1, 1)              \
  F(HasFixedInt8Elements, 1, 1)               \
  F(HasFixedUint16Elements, 1, 1)             \
  F(HasFixedInt16Elements, 1, 1)              \
  F(HasFixedUint32Elements, 1, 1)             \
  F(HasFixedInt32Elements, 1, 1)              \
  F(HasFixedFloat32Elements, 1, 1)            \
  F(HasFixedFloat64Elements, 1, 1)            \
  F(HasFixedUint8ClampedElements, 1, 1)


#define FOR_EACH_INTRINSIC_TYPEDARRAY(F)     \
binji's avatar
binji committed
995
  F(ArrayBufferInitialize, 3, 1)             \
996 997 998 999
  F(ArrayBufferGetByteLength, 1, 1)          \
  F(ArrayBufferSliceImpl, 3, 1)              \
  F(ArrayBufferIsView, 1, 1)                 \
  F(ArrayBufferNeuter, 1, 1)                 \
1000
  F(TypedArrayInitialize, 6, 1)              \
1001 1002 1003 1004 1005 1006 1007 1008 1009
  F(TypedArrayInitializeFromArrayLike, 4, 1) \
  F(ArrayBufferViewGetByteLength, 1, 1)      \
  F(ArrayBufferViewGetByteOffset, 1, 1)      \
  F(TypedArrayGetLength, 1, 1)               \
  F(DataViewGetBuffer, 1, 1)                 \
  F(TypedArrayGetBuffer, 1, 1)               \
  F(TypedArraySetFastCases, 3, 1)            \
  F(TypedArrayMaxSizeInHeap, 0, 1)           \
  F(IsTypedArray, 1, 1)                      \
binji's avatar
binji committed
1010 1011
  F(IsSharedTypedArray, 1, 1)                \
  F(IsSharedIntegerTypedArray, 1, 1)         \
1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033
  F(DataViewInitialize, 4, 1)                \
  F(DataViewGetUint8, 3, 1)                  \
  F(DataViewGetInt8, 3, 1)                   \
  F(DataViewGetUint16, 3, 1)                 \
  F(DataViewGetInt16, 3, 1)                  \
  F(DataViewGetUint32, 3, 1)                 \
  F(DataViewGetInt32, 3, 1)                  \
  F(DataViewGetFloat32, 3, 1)                \
  F(DataViewGetFloat64, 3, 1)                \
  F(DataViewSetUint8, 4, 1)                  \
  F(DataViewSetInt8, 4, 1)                   \
  F(DataViewSetUint16, 4, 1)                 \
  F(DataViewSetInt16, 4, 1)                  \
  F(DataViewSetUint32, 4, 1)                 \
  F(DataViewSetInt32, 4, 1)                  \
  F(DataViewSetFloat32, 4, 1)                \
  F(DataViewSetFloat64, 4, 1)


#define FOR_EACH_INTRINSIC_URI(F) \
  F(URIEscape, 1, 1)              \
  F(URIUnescape, 1, 1)
1034 1035


1036 1037
#define FOR_EACH_INTRINSIC_RETURN_PAIR(F) \
  F(LoadLookupSlot, 2, 2)                 \
1038
  F(LoadLookupSlotNoReferenceError, 2, 2)
1039 1040


1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068
// Most intrinsics are implemented in the runtime/ directory, but ICs are
// implemented in ic.cc for now.
#define FOR_EACH_INTRINSIC_IC(F)             \
  F(LoadIC_Miss, 3, 1)                       \
  F(KeyedLoadIC_Miss, 3, 1)                  \
  F(CallIC_Miss, 3, 1)                       \
  F(StoreIC_Miss, 3, 1)                      \
  F(StoreIC_Slow, 3, 1)                      \
  F(KeyedStoreIC_Miss, 3, 1)                 \
  F(KeyedStoreIC_Slow, 3, 1)                 \
  F(StoreCallbackProperty, 5, 1)             \
  F(LoadPropertyWithInterceptorOnly, 3, 1)   \
  F(LoadPropertyWithInterceptor, 3, 1)       \
  F(LoadElementWithInterceptor, 2, 1)        \
  F(StorePropertyWithInterceptor, 3, 1)      \
  F(CompareIC_Miss, 3, 1)                    \
  F(BinaryOpIC_Miss, 2, 1)                   \
  F(CompareNilIC_Miss, 1, 1)                 \
  F(Unreachable, 0, 1)                       \
  F(ToBooleanIC_Miss, 1, 1)                  \
  F(KeyedLoadIC_MissFromStubFailure, 4, 1)   \
  F(KeyedStoreIC_MissFromStubFailure, 3, 1)  \
  F(StoreIC_MissFromStubFailure, 3, 1)       \
  F(ElementsTransitionAndStoreIC_Miss, 4, 1) \
  F(BinaryOpIC_MissWithAllocationSite, 3, 1) \
  F(LoadIC_MissFromStubFailure, 0, 1)


1069
#define FOR_EACH_INTRINSIC_RETURN_OBJECT(F) \
1070
  FOR_EACH_INTRINSIC_IC(F)                  \
1071
  FOR_EACH_INTRINSIC_ARRAY(F)               \
binji's avatar
binji committed
1072
  FOR_EACH_INTRINSIC_ATOMICS(F)             \
1073 1074 1075 1076 1077
  FOR_EACH_INTRINSIC_CLASSES(F)             \
  FOR_EACH_INTRINSIC_COLLECTIONS(F)         \
  FOR_EACH_INTRINSIC_COMPILER(F)            \
  FOR_EACH_INTRINSIC_DATE(F)                \
  FOR_EACH_INTRINSIC_DEBUG(F)               \
1078
  FOR_EACH_INTRINSIC_FORIN(F)               \
1079
  FOR_EACH_INTRINSIC_INTERPRETER(F)         \
1080
  FOR_EACH_INTRINSIC_FUNCTION(F)            \
binji's avatar
binji committed
1081
  FOR_EACH_INTRINSIC_FUTEX(F)               \
1082 1083 1084 1085 1086 1087 1088 1089 1090 1091
  FOR_EACH_INTRINSIC_GENERATOR(F)           \
  FOR_EACH_INTRINSIC_I18N(F)                \
  FOR_EACH_INTRINSIC_INTERNAL(F)            \
  FOR_EACH_INTRINSIC_JSON(F)                \
  FOR_EACH_INTRINSIC_LITERALS(F)            \
  FOR_EACH_INTRINSIC_LIVEEDIT(F)            \
  FOR_EACH_INTRINSIC_MATHS(F)               \
  FOR_EACH_INTRINSIC_NUMBERS(F)             \
  FOR_EACH_INTRINSIC_OBJECT(F)              \
  FOR_EACH_INTRINSIC_OBSERVE(F)             \
1092
  FOR_EACH_INTRINSIC_OPERATORS(F)           \
1093 1094 1095
  FOR_EACH_INTRINSIC_PROXY(F)               \
  FOR_EACH_INTRINSIC_REGEXP(F)              \
  FOR_EACH_INTRINSIC_SCOPES(F)              \
1096
  FOR_EACH_INTRINSIC_SIMD(F)                \
1097 1098 1099 1100 1101
  FOR_EACH_INTRINSIC_STRINGS(F)             \
  FOR_EACH_INTRINSIC_SYMBOL(F)              \
  FOR_EACH_INTRINSIC_TEST(F)                \
  FOR_EACH_INTRINSIC_TYPEDARRAY(F)          \
  FOR_EACH_INTRINSIC_URI(F)
1102 1103 1104 1105 1106 1107 1108 1109

// FOR_EACH_INTRINSIC defines the list of all intrinsics, coming in 2 flavors,
// either returning an object or a pair.
#define FOR_EACH_INTRINSIC(F)       \
  FOR_EACH_INTRINSIC_RETURN_PAIR(F) \
  FOR_EACH_INTRINSIC_RETURN_OBJECT(F)


1110 1111 1112 1113 1114 1115
#define F(name, nargs, ressize)                                 \
  Object* Runtime_##name(int args_length, Object** args_object, \
                         Isolate* isolate);
FOR_EACH_INTRINSIC_RETURN_OBJECT(F)
#undef F

1116
//---------------------------------------------------------------------------
1117 1118 1119 1120 1121
// Runtime provides access to all C++ runtime functions.

class Runtime : public AllStatic {
 public:
  enum FunctionId {
1122
#define F(name, nargs, ressize) k##name,
1123
#define I(name, nargs, ressize) kInline##name,
1124 1125
  FOR_EACH_INTRINSIC(F)
  FOR_EACH_INTRINSIC(I)
1126
#undef I
1127
#undef F
1128
    kNumFunctions,
1129 1130
  };

1131
  enum IntrinsicType { RUNTIME, INLINE };
1132

1133
  // Intrinsic function descriptor.
1134
  struct Function {
1135 1136
    FunctionId function_id;
    IntrinsicType intrinsic_type;
1137 1138 1139
    // The JS name of the function.
    const char* name;

1140 1141 1142
    // For RUNTIME functions, this is the C++ entry point.
    // For INLINE functions this is the C++ entry point of the fall back.
    Address entry;
1143

1144 1145
    // The number of arguments expected. nargs is -1 if the function takes
    // a variable number of arguments.
1146
    int8_t nargs;
1147
    // Size of result.  Most functions return a single pointer, size 1.
1148
    int8_t result_size;
1149 1150
  };

1151 1152
  static const int kNotFound = -1;

1153 1154
  // Add internalized strings for all the intrinsic function names to a
  // StringDictionary.
1155 1156
  static void InitializeIntrinsicFunctionNames(Isolate* isolate,
                                               Handle<NameDictionary> dict);
1157

1158 1159
  // Get the intrinsic function with the given name, which must be internalized.
  static const Function* FunctionForName(Handle<String> name);
1160

1161
  // Get the intrinsic function with the given FunctionId.
1162
  static const Function* FunctionForId(FunctionId id);
1163

1164 1165 1166
  // Get the intrinsic function with the given function entry address.
  static const Function* FunctionForEntry(Address ref);

1167 1168 1169
  // Get the runtime intrinsic function table.
  static const Function* RuntimeFunctionTable(Isolate* isolate);

1170 1171 1172 1173
  MUST_USE_RESULT static MaybeHandle<Object> DeleteObjectProperty(
      Isolate* isolate, Handle<JSReceiver> receiver, Handle<Object> key,
      LanguageMode language_mode);

1174
  MUST_USE_RESULT static MaybeHandle<Object> SetObjectProperty(
1175
      Isolate* isolate, Handle<Object> object, Handle<Object> key,
1176
      Handle<Object> value, LanguageMode language_mode);
1177

1178
  MUST_USE_RESULT static MaybeHandle<Object> GetObjectProperty(
1179 1180 1181
      Isolate* isolate, Handle<Object> object, Handle<Object> key,
      LanguageMode language_mode = SLOPPY);

1182
  enum TypedArrayId {
1183
    // arrayIds below should be synchronized with typedarray.js natives.
1184 1185 1186 1187 1188 1189 1190 1191
    ARRAY_ID_UINT8 = 1,
    ARRAY_ID_INT8 = 2,
    ARRAY_ID_UINT16 = 3,
    ARRAY_ID_INT16 = 4,
    ARRAY_ID_UINT32 = 5,
    ARRAY_ID_INT32 = 6,
    ARRAY_ID_FLOAT32 = 7,
    ARRAY_ID_FLOAT64 = 8,
1192 1193 1194
    ARRAY_ID_UINT8_CLAMPED = 9,
    ARRAY_ID_FIRST = ARRAY_ID_UINT8,
    ARRAY_ID_LAST = ARRAY_ID_UINT8_CLAMPED
1195 1196
  };

1197 1198 1199
  static void ArrayIdToTypeAndSize(int array_id, ExternalArrayType* type,
                                   ElementsKind* fixed_elements_kind,
                                   size_t* element_size);
1200

1201
  // Used in runtime.cc and hydrogen's VisitArrayLiteral.
1202
  MUST_USE_RESULT static MaybeHandle<Object> CreateArrayLiteralBoilerplate(
1203
      Isolate* isolate, Handle<LiteralsArray> literals,
1204
      Handle<FixedArray> elements, bool is_strong);
yurys's avatar
yurys committed
1205

1206 1207
  static MaybeHandle<JSArray> GetInternalProperties(Isolate* isolate,
                                                    Handle<Object>);
binji's avatar
binji committed
1208

1209 1210 1211 1212 1213 1214 1215 1216
  // Find the arguments of the JavaScript function invocation that called
  // into C++ code. Collect these in a newly allocated array of handles
  // (possibly prefixed by a number of empty handles).
  // TODO(mstarzinger): Temporary workaround until this is only used by the
  // %_Arguments and %_ArgumentsLength intrinsics. Make this function local to
  // runtime-scopes.cc then.
  static base::SmartArrayPointer<Handle<Object>> GetCallerArguments(
      Isolate* isolate, int prefix_argc, int* total_argc);
1217 1218
};

1219

1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251
class RuntimeState {
 public:
  unibrow::Mapping<unibrow::ToUppercase, 128>* to_upper_mapping() {
    return &to_upper_mapping_;
  }
  unibrow::Mapping<unibrow::ToLowercase, 128>* to_lower_mapping() {
    return &to_lower_mapping_;
  }

  Runtime::Function* redirected_intrinsic_functions() {
    return redirected_intrinsic_functions_.get();
  }

  void set_redirected_intrinsic_functions(
      Runtime::Function* redirected_intrinsic_functions) {
    redirected_intrinsic_functions_.Reset(redirected_intrinsic_functions);
  }

 private:
  RuntimeState() {}
  unibrow::Mapping<unibrow::ToUppercase, 128> to_upper_mapping_;
  unibrow::Mapping<unibrow::ToLowercase, 128> to_lower_mapping_;

  base::SmartArrayPointer<Runtime::Function> redirected_intrinsic_functions_;

  friend class Isolate;
  friend class Runtime;

  DISALLOW_COPY_AND_ASSIGN(RuntimeState);
};


1252 1253
std::ostream& operator<<(std::ostream&, Runtime::FunctionId);

1254 1255 1256
//---------------------------------------------------------------------------
// Constants used by interface to runtime functions.

1257 1258
class AllocateDoubleAlignFlag : public BitField<bool, 0, 1> {};
class AllocateTargetSpace : public BitField<AllocationSpace, 1, 3> {};
1259

1260 1261
class DeclareGlobalsEvalFlag : public BitField<bool, 0, 1> {};
class DeclareGlobalsNativeFlag : public BitField<bool, 1, 1> {};
marja's avatar
marja committed
1262 1263
STATIC_ASSERT(LANGUAGE_END == 3);
class DeclareGlobalsLanguageMode : public BitField<LanguageMode, 2, 2> {};
1264 1265 1266

}  // namespace internal
}  // namespace v8
1267

1268
#endif  // V8_RUNTIME_RUNTIME_H_