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