• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <memory>
9 
10 #include "include/v8-maybe.h"
11 #include "src/base/bit-field.h"
12 #include "src/base/platform/time.h"
13 #include "src/common/globals.h"
14 #include "src/handles/handles.h"
15 #include "src/objects/elements-kind.h"
16 #include "src/strings/unicode.h"
17 #include "src/utils/allocation.h"
18 #include "src/zone/zone.h"
19 
20 namespace v8 {
21 namespace internal {
22 
23 // * Each intrinsic is exposed in JavaScript via:
24 //    * %#name, which is always a runtime call.
25 //    * (optionally) %_#name, which can be inlined or just a runtime call, the
26 //      compiler in question decides.
27 //
28 // * IntrinsicTypes are Runtime::RUNTIME and Runtime::INLINE, respectively.
29 //
30 // * IDs are Runtime::k##name and Runtime::kInline##name, respectively.
31 //
32 // * All intrinsics have a C++ implementation Runtime_##name.
33 //
34 // * Each compiler has an explicit list of intrisics it supports, falling back
35 //   to a simple runtime call if necessary.
36 
37 // Entries have the form F(name, number of arguments, number of return values):
38 // A variable number of arguments is specified by a -1, additional restrictions
39 // are specified by inline comments. To declare only the runtime version (no
40 // inline), use the F macro below. To declare the runtime version and the inline
41 // version simultaneously, use the I macro below.
42 
43 #define FOR_EACH_INTRINSIC_ARRAY(F, I) \
44   F(ArrayIncludes_Slow, 3, 1)          \
45   F(ArrayIndexOf, 3, 1)                \
46   F(ArrayIsArray, 1, 1)                \
47   F(ArraySpeciesConstructor, 1, 1)     \
48   F(GrowArrayElements, 2, 1)           \
49   F(IsArray, 1, 1)                     \
50   F(NewArray, -1 /* >= 3 */, 1)        \
51   F(NormalizeElements, 1, 1)           \
52   F(TransitionElementsKind, 2, 1)      \
53   F(TransitionElementsKindWithKind, 2, 1)
54 
55 #define FOR_EACH_INTRINSIC_ATOMICS(F, I)               \
56   F(AtomicsLoad64, 2, 1)                               \
57   F(AtomicsStore64, 3, 1)                              \
58   F(AtomicsAdd, 3, 1)                                  \
59   F(AtomicsAnd, 3, 1)                                  \
60   F(AtomicsCompareExchange, 4, 1)                      \
61   F(AtomicsExchange, 3, 1)                             \
62   F(AtomicsNumWaitersForTesting, 2, 1)                 \
63   F(AtomicsNumAsyncWaitersForTesting, 0, 1)            \
64   F(AtomicsNumUnresolvedAsyncPromisesForTesting, 2, 1) \
65   F(AtomicsOr, 3, 1)                                   \
66   F(AtomicsSub, 3, 1)                                  \
67   F(AtomicsXor, 3, 1)                                  \
68   F(SetAllowAtomicsWait, 1, 1)                         \
69   F(AtomicsLoadSharedStructField, 2, 1)                \
70   F(AtomicsStoreSharedStructField, 3, 1)               \
71   F(AtomicsExchangeSharedStructField, 3, 1)
72 
73 #define FOR_EACH_INTRINSIC_BIGINT(F, I) \
74   F(BigIntBinaryOp, 3, 1)               \
75   F(BigIntCompareToBigInt, 3, 1)        \
76   F(BigIntCompareToNumber, 3, 1)        \
77   F(BigIntCompareToString, 3, 1)        \
78   F(BigIntEqualToBigInt, 2, 1)          \
79   F(BigIntEqualToNumber, 2, 1)          \
80   F(BigIntEqualToString, 2, 1)          \
81   F(BigIntMaxLengthBits, 0, 1)          \
82   F(BigIntToBoolean, 1, 1)              \
83   F(BigIntToNumber, 1, 1)               \
84   F(BigIntUnaryOp, 2, 1)                \
85   F(ToBigInt, 1, 1)
86 
87 #define FOR_EACH_INTRINSIC_CLASSES(F, I)    \
88   F(DefineClass, -1 /* >= 3 */, 1)          \
89   F(LoadFromSuper, 3, 1)                    \
90   F(LoadKeyedFromSuper, 3, 1)               \
91   F(StoreKeyedToSuper, 4, 1)                \
92   F(StoreToSuper, 4, 1)                     \
93   F(ThrowConstructorNonCallableError, 1, 1) \
94   F(ThrowNotSuperConstructor, 2, 1)         \
95   F(ThrowStaticPrototypeError, 0, 1)        \
96   F(ThrowSuperAlreadyCalledError, 0, 1)     \
97   F(ThrowSuperNotCalled, 0, 1)              \
98   F(ThrowUnsupportedSuperError, 0, 1)
99 
100 #define FOR_EACH_INTRINSIC_COLLECTIONS(F, I) \
101   F(MapGrow, 1, 1)                           \
102   F(MapShrink, 1, 1)                         \
103   F(SetGrow, 1, 1)                           \
104   F(SetShrink, 1, 1)                         \
105   F(TheHole, 0, 1)                           \
106   F(WeakCollectionDelete, 3, 1)              \
107   F(WeakCollectionSet, 4, 1)
108 
109 #define FOR_EACH_INTRINSIC_COMPILER(F, I) \
110   F(CompileOptimizedOSR, 0, 1)            \
111   F(CompileLazy, 1, 1)                    \
112   F(CompileBaseline, 1, 1)                \
113   F(CompileMaglev_Concurrent, 1, 1)       \
114   F(CompileMaglev_Synchronous, 1, 1)      \
115   F(CompileTurbofan_Concurrent, 1, 1)     \
116   F(CompileTurbofan_Synchronous, 1, 1)    \
117   F(InstallBaselineCode, 1, 1)            \
118   F(HealOptimizedCodeSlot, 1, 1)          \
119   F(InstantiateAsmJs, 4, 1)               \
120   F(NotifyDeoptimized, 0, 1)              \
121   F(ObserveNode, 1, 1)                    \
122   F(ResolvePossiblyDirectEval, 6, 1)      \
123   F(VerifyType, 1, 1)
124 
125 #define FOR_EACH_INTRINSIC_DATE(F, I) F(DateCurrentTime, 0, 1)
126 
127 #define FOR_EACH_INTRINSIC_DEBUG(F, I)          \
128   F(ClearStepping, 0, 1)                        \
129   F(CollectGarbage, 1, 1)                       \
130   F(DebugAsyncFunctionSuspended, 4, 1)          \
131   F(DebugBreakAtEntry, 1, 1)                    \
132   F(DebugCollectCoverage, 0, 1)                 \
133   F(DebugGetLoadedScriptIds, 0, 1)              \
134   F(DebugOnFunctionCall, 2, 1)                  \
135   F(DebugPopPromise, 0, 1)                      \
136   F(DebugPrepareStepInSuspendedGenerator, 0, 1) \
137   F(DebugPromiseThen, 1, 1)                     \
138   F(DebugPushPromise, 1, 1)                     \
139   F(DebugToggleBlockCoverage, 1, 1)             \
140   F(DebugTogglePreciseCoverage, 1, 1)           \
141   F(FunctionGetInferredName, 1, 1)              \
142   F(GetBreakLocations, 1, 1)                    \
143   F(GetGeneratorScopeCount, 1, 1)               \
144   F(GetGeneratorScopeDetails, 2, 1)             \
145   F(HandleDebuggerStatement, 0, 1)              \
146   F(IsBreakOnException, 1, 1)                   \
147   F(LiveEditPatchScript, 2, 1)                  \
148   F(ProfileCreateSnapshotDataBlob, 0, 1)        \
149   F(ScheduleBreak, 0, 1)                        \
150   F(ScriptLocationFromLine2, 4, 1)              \
151   F(SetGeneratorScopeVariableValue, 4, 1)       \
152   I(IncBlockCounter, 2, 1)
153 
154 #define FOR_EACH_INTRINSIC_FORIN(F, I) \
155   F(ForInEnumerate, 1, 1)              \
156   F(ForInHasProperty, 2, 1)
157 
158 #ifdef V8_TRACE_UNOPTIMIZED
159 #define FOR_EACH_INTRINSIC_TRACE_UNOPTIMIZED(F, I) \
160   F(TraceUnoptimizedBytecodeEntry, 3, 1)           \
161   F(TraceUnoptimizedBytecodeExit, 3, 1)
162 #else
163 #define FOR_EACH_INTRINSIC_TRACE_UNOPTIMIZED(F, I)
164 #endif
165 
166 #ifdef V8_TRACE_FEEDBACK_UPDATES
167 #define FOR_EACH_INTRINSIC_TRACE_FEEDBACK(F, I) F(TraceUpdateFeedback, 3, 1)
168 #else
169 #define FOR_EACH_INTRINSIC_TRACE_FEEDBACK(F, I)
170 #endif
171 
172 #define FOR_EACH_INTRINSIC_TRACE(F, I)       \
173   FOR_EACH_INTRINSIC_TRACE_UNOPTIMIZED(F, I) \
174   FOR_EACH_INTRINSIC_TRACE_FEEDBACK(F, I)
175 
176 #define FOR_EACH_INTRINSIC_FUNCTION(F, I)  \
177   F(Call, -1 /* >= 2 */, 1)                \
178   F(FunctionGetScriptSource, 1, 1)         \
179   F(FunctionGetScriptId, 1, 1)             \
180   F(FunctionGetScriptSourcePosition, 1, 1) \
181   F(FunctionGetSourceCode, 1, 1)           \
182   F(FunctionIsAPIFunction, 1, 1)           \
183   F(IsFunction, 1, 1)
184 
185 #define FOR_EACH_INTRINSIC_GENERATOR(F, I)    \
186   I(AsyncFunctionAwaitCaught, 2, 1)           \
187   I(AsyncFunctionAwaitUncaught, 2, 1)         \
188   I(AsyncFunctionEnter, 2, 1)                 \
189   I(AsyncFunctionReject, 2, 1)                \
190   I(AsyncFunctionResolve, 2, 1)               \
191   I(AsyncGeneratorAwaitCaught, 2, 1)          \
192   I(AsyncGeneratorAwaitUncaught, 2, 1)        \
193   F(AsyncGeneratorHasCatchHandlerForPC, 1, 1) \
194   I(AsyncGeneratorReject, 2, 1)               \
195   I(AsyncGeneratorResolve, 3, 1)              \
196   I(AsyncGeneratorYield, 3, 1)                \
197   I(CreateJSGeneratorObject, 2, 1)            \
198   I(GeneratorClose, 1, 1)                     \
199   F(GeneratorGetFunction, 1, 1)               \
200   I(GeneratorGetResumeMode, 1, 1)
201 
202 #ifdef V8_INTL_SUPPORT
203 #define FOR_EACH_INTRINSIC_INTL(F, I) \
204   F(FormatList, 2, 1)                 \
205   F(FormatListToParts, 2, 1)          \
206   F(StringToLowerCaseIntl, 1, 1)      \
207   F(StringToUpperCaseIntl, 1, 1)  // End of macro.
208 #else
209 #define FOR_EACH_INTRINSIC_INTL(F, I)
210 #endif  // V8_INTL_SUPPORT
211 
212 #define FOR_EACH_INTRINSIC_INTERNAL(F, I)            \
213   F(AccessCheck, 1, 1)                               \
214   F(AllocateByteArray, 1, 1)                         \
215   F(AllocateInYoungGeneration, 2, 1)                 \
216   F(AllocateInOldGeneration, 2, 1)                   \
217   F(AllocateSeqOneByteString, 1, 1)                  \
218   F(AllocateSeqTwoByteString, 1, 1)                  \
219   F(AllowDynamicFunction, 1, 1)                      \
220   I(CreateAsyncFromSyncIterator, 1, 1)               \
221   F(CreateListFromArrayLike, 1, 1)                   \
222   F(DoubleToStringWithRadix, 2, 1)                   \
223   F(FatalProcessOutOfMemoryInAllocateRaw, 0, 1)      \
224   F(FatalProcessOutOfMemoryInvalidArrayLength, 0, 1) \
225   F(GetAndResetRuntimeCallStats, -1 /* <= 2 */, 1)   \
226   F(GetTemplateObject, 3, 1)                         \
227   F(IncrementUseCounter, 1, 1)                       \
228   F(BytecodeBudgetInterrupt, 1, 1)                   \
229   F(BytecodeBudgetInterruptWithStackCheck, 1, 1)     \
230   F(NewError, 2, 1)                                  \
231   F(NewForeign, 0, 1)                                \
232   F(NewReferenceError, 2, 1)                         \
233   F(NewSyntaxError, 2, 1)                            \
234   F(NewTypeError, -1 /* [1, 4] */, 1)                \
235   F(OrdinaryHasInstance, 2, 1)                       \
236   F(PromoteScheduledException, 0, 1)                 \
237   F(ReportMessageFromMicrotask, 1, 1)                \
238   F(ReThrow, 1, 1)                                   \
239   F(ReThrowWithMessage, 2, 1)                        \
240   F(RunMicrotaskCallback, 2, 1)                      \
241   F(PerformMicrotaskCheckpoint, 0, 1)                \
242   F(SharedValueBarrierSlow, 1, 1)                    \
243   F(StackGuard, 0, 1)                                \
244   F(StackGuardWithGap, 1, 1)                         \
245   F(Throw, 1, 1)                                     \
246   F(ThrowApplyNonFunction, 1, 1)                     \
247   F(ThrowCalledNonCallable, 1, 1)                    \
248   F(ThrowConstructedNonConstructable, 1, 1)          \
249   F(ThrowConstructorReturnedNonObject, 0, 1)         \
250   F(ThrowInvalidStringLength, 0, 1)                  \
251   F(ThrowInvalidTypedArrayAlignment, 2, 1)           \
252   F(ThrowIteratorError, 1, 1)                        \
253   F(ThrowSpreadArgError, 2, 1)                       \
254   F(ThrowIteratorResultNotAnObject, 1, 1)            \
255   F(ThrowNoAccess, 0, 1)                             \
256   F(ThrowNotConstructor, 1, 1)                       \
257   F(ThrowPatternAssignmentNonCoercible, 1, 1)        \
258   F(ThrowRangeError, -1 /* >= 1 */, 1)               \
259   F(ThrowReferenceError, 1, 1)                       \
260   F(ThrowAccessedUninitializedVariable, 1, 1)        \
261   F(ThrowStackOverflow, 0, 1)                        \
262   F(ThrowSymbolAsyncIteratorInvalid, 0, 1)           \
263   F(ThrowSymbolIteratorInvalid, 0, 1)                \
264   F(ThrowThrowMethodMissing, 0, 1)                   \
265   F(ThrowTypeError, -1 /* >= 1 */, 1)                \
266   F(ThrowTypeErrorIfStrict, -1 /* >= 1 */, 1)        \
267   F(Typeof, 1, 1)                                    \
268   F(UnwindAndFindExceptionHandler, 0, 1)
269 
270 #define FOR_EACH_INTRINSIC_LITERALS(F, I)           \
271   F(CreateArrayLiteral, 4, 1)                       \
272   F(CreateArrayLiteralWithoutAllocationSite, 2, 1)  \
273   F(CreateObjectLiteral, 4, 1)                      \
274   F(CreateObjectLiteralWithoutAllocationSite, 2, 1) \
275   F(CreateRegExpLiteral, 4, 1)
276 
277 #define FOR_EACH_INTRINSIC_MODULE(F, I)    \
278   F(DynamicImportCall, -1 /* [2, 3] */, 1) \
279   I(GetImportMetaObject, 0, 1)             \
280   F(GetModuleNamespace, 1, 1)
281 
282 #define FOR_EACH_INTRINSIC_NUMBERS(F, I) \
283   F(ArrayBufferMaxByteLength, 0, 1)      \
284   F(GetHoleNaNLower, 0, 1)               \
285   F(GetHoleNaNUpper, 0, 1)               \
286   F(IsSmi, 1, 1)                         \
287   F(MaxSmi, 0, 1)                        \
288   F(NumberToStringSlow, 1, 1)            \
289   F(StringParseFloat, 1, 1)              \
290   F(StringParseInt, 2, 1)                \
291   F(StringToNumber, 1, 1)                \
292   F(TypedArrayMaxLength, 0, 1)
293 
294 #define FOR_EACH_INTRINSIC_OBJECT(F, I)                                \
295   F(AddDictionaryProperty, 3, 1)                                       \
296   F(AddPrivateBrand, 4, 1)                                             \
297   F(AllocateHeapNumber, 0, 1)                                          \
298   F(CollectTypeProfile, 3, 1)                                          \
299   F(CompleteInobjectSlackTrackingForMap, 1, 1)                         \
300   I(CopyDataProperties, 2, 1)                                          \
301   I(CopyDataPropertiesWithExcludedPropertiesOnStack, -1 /* >= 1 */, 1) \
302   I(CreateDataProperty, 3, 1)                                          \
303   I(CreateIterResultObject, 2, 1)                                      \
304   F(CreatePrivateAccessors, 2, 1)                                      \
305   F(DefineAccessorPropertyUnchecked, 5, 1)                             \
306   F(DefineKeyedOwnPropertyInLiteral, 6, 1)                             \
307   F(DefineGetterPropertyUnchecked, 4, 1)                               \
308   F(DefineSetterPropertyUnchecked, 4, 1)                               \
309   F(DeleteProperty, 3, 1)                                              \
310   F(GetDerivedMap, 2, 1)                                               \
311   F(GetFunctionName, 1, 1)                                             \
312   F(GetOwnPropertyDescriptor, 2, 1)                                    \
313   F(GetOwnPropertyKeys, 2, 1)                                          \
314   F(GetProperty, -1 /* [2, 3] */, 1)                                   \
315   F(HasFastPackedElements, 1, 1)                                       \
316   F(HasInPrototypeChain, 2, 1)                                         \
317   F(HasProperty, 2, 1)                                                 \
318   F(InternalSetPrototype, 2, 1)                                        \
319   F(IsJSReceiver, 1, 1)                                                \
320   F(JSReceiverPreventExtensionsDontThrow, 1, 1)                        \
321   F(JSReceiverPreventExtensionsThrow, 1, 1)                            \
322   F(JSReceiverGetPrototypeOf, 1, 1)                                    \
323   F(JSReceiverSetPrototypeOfDontThrow, 2, 1)                           \
324   F(JSReceiverSetPrototypeOfThrow, 2, 1)                               \
325   F(LoadPrivateGetter, 1, 1)                                           \
326   F(LoadPrivateSetter, 1, 1)                                           \
327   F(NewObject, 2, 1)                                                   \
328   F(ObjectCreate, 2, 1)                                                \
329   F(ObjectEntries, 1, 1)                                               \
330   F(ObjectEntriesSkipFastPath, 1, 1)                                   \
331   F(ObjectGetOwnPropertyNames, 1, 1)                                   \
332   F(ObjectGetOwnPropertyNamesTryFast, 1, 1)                            \
333   F(ObjectHasOwnProperty, 2, 1)                                        \
334   F(ObjectIsExtensible, 1, 1)                                          \
335   F(ObjectKeys, 1, 1)                                                  \
336   F(ObjectValues, 1, 1)                                                \
337   F(ObjectValuesSkipFastPath, 1, 1)                                    \
338   F(OptimizeObjectForAddingMultipleProperties, 2, 1)                   \
339   F(SetDataProperties, 2, 1)                                           \
340   F(SetKeyedProperty, 3, 1)                                            \
341   F(DefineObjectOwnProperty, 3, 1)                                     \
342   F(SetNamedProperty, 3, 1)                                            \
343   F(SetOwnPropertyIgnoreAttributes, 4, 1)                              \
344   F(DefineKeyedOwnPropertyInLiteral_Simple, 3, 1)                      \
345   F(ShrinkNameDictionary, 1, 1)                                        \
346   F(ShrinkSwissNameDictionary, 1, 1)                                   \
347   F(ToFastProperties, 1, 1)                                            \
348   F(ToLength, 1, 1)                                                    \
349   F(ToName, 1, 1)                                                      \
350   F(ToNumber, 1, 1)                                                    \
351   F(ToNumeric, 1, 1)                                                   \
352   F(ToObject, 1, 1)                                                    \
353   F(ToString, 1, 1)                                                    \
354   F(TryMigrateInstance, 1, 1)                                          \
355   F(SwissTableAdd, 4, 1)                                               \
356   F(SwissTableAllocate, 1, 1)                                          \
357   F(SwissTableDelete, 2, 1)                                            \
358   F(SwissTableDetailsAt, 2, 1)                                         \
359   F(SwissTableElementsCount, 1, 1)                                     \
360   F(SwissTableEquals, 2, 1)                                            \
361   F(SwissTableFindEntry, 2, 1)                                         \
362   F(SwissTableUpdate, 4, 1)                                            \
363   F(SwissTableValueAt, 2, 1)                                           \
364   F(SwissTableKeyAt, 2, 1)
365 
366 #define FOR_EACH_INTRINSIC_OPERATORS(F, I) \
367   F(Add, 2, 1)                             \
368   F(Equal, 2, 1)                           \
369   F(GreaterThan, 2, 1)                     \
370   F(GreaterThanOrEqual, 2, 1)              \
371   F(LessThan, 2, 1)                        \
372   F(LessThanOrEqual, 2, 1)                 \
373   F(NotEqual, 2, 1)                        \
374   F(StrictEqual, 2, 1)                     \
375   F(StrictNotEqual, 2, 1)                  \
376   F(ReferenceEqual, 2, 1)
377 
378 #define FOR_EACH_INTRINSIC_PROMISE(F, I) \
379   F(EnqueueMicrotask, 1, 1)              \
380   F(PromiseHookAfter, 1, 1)              \
381   F(PromiseHookBefore, 1, 1)             \
382   F(PromiseHookInit, 2, 1)               \
383   F(PromiseRejectEventFromStack, 2, 1)   \
384   F(PromiseRevokeReject, 1, 1)           \
385   F(PromiseStatus, 1, 1)                 \
386   F(RejectPromise, 3, 1)                 \
387   F(ResolvePromise, 2, 1)                \
388   F(PromiseRejectAfterResolved, 2, 1)    \
389   F(PromiseResolveAfterResolved, 2, 1)   \
390   F(ConstructAggregateErrorHelper, 4, 1) \
391   F(ConstructInternalAggregateErrorHelper, -1 /* <= 5*/, 1)
392 
393 #define FOR_EACH_INTRINSIC_PROXY(F, I) \
394   F(CheckProxyGetSetTrapResult, 2, 1)  \
395   F(CheckProxyHasTrapResult, 2, 1)     \
396   F(CheckProxyDeleteTrapResult, 2, 1)  \
397   F(GetPropertyWithReceiver, 3, 1)     \
398   F(IsJSProxy, 1, 1)                   \
399   F(JSProxyGetHandler, 1, 1)           \
400   F(JSProxyGetTarget, 1, 1)            \
401   F(SetPropertyWithReceiver, 4, 1)
402 
403 #define FOR_EACH_INTRINSIC_REGEXP(F, I)                          \
404   F(IsRegExp, 1, 1)                                              \
405   F(RegExpBuildIndices, 3, 1)                                    \
406   F(RegExpExec, 4, 1)                                            \
407   F(RegExpExecTreatMatchAtEndAsFailure, 4, 1)                    \
408   F(RegExpExperimentalOneshotExec, 4, 1)                         \
409   F(RegExpExperimentalOneshotExecTreatMatchAtEndAsFailure, 4, 1) \
410   F(RegExpExecMultiple, 4, 1)                                    \
411   F(RegExpInitializeAndCompile, 3, 1)                            \
412   F(RegExpReplaceRT, 3, 1)                                       \
413   F(RegExpSplit, 3, 1)                                           \
414   F(RegExpStringFromFlags, 1, 1)                                 \
415   F(StringReplaceNonGlobalRegExpWithFunction, 3, 1)              \
416   F(StringSplit, 3, 1)
417 
418 #define FOR_EACH_INTRINSIC_SCOPES(F, I)            \
419   F(DeclareEvalFunction, 2, 1)                     \
420   F(DeclareEvalVar, 1, 1)                          \
421   F(DeclareGlobals, 2, 1)                          \
422   F(DeclareModuleExports, 2, 1)                    \
423   F(DeleteLookupSlot, 1, 1)                        \
424   F(LoadLookupSlot, 1, 1)                          \
425   F(LoadLookupSlotInsideTypeof, 1, 1)              \
426                                                    \
427   F(NewClosure, 2, 1)                              \
428   F(NewClosure_Tenured, 2, 1)                      \
429   F(NewFunctionContext, 1, 1)                      \
430   F(NewRestParameter, 1, 1)                        \
431   F(NewSloppyArguments, 1, 1)                      \
432   F(NewStrictArguments, 1, 1)                      \
433   F(PushBlockContext, 1, 1)                        \
434   F(PushCatchContext, 2, 1)                        \
435   F(PushWithContext, 2, 1)                         \
436   F(StoreGlobalNoHoleCheckForReplLetOrConst, 2, 1) \
437   F(StoreLookupSlot_Sloppy, 2, 1)                  \
438   F(StoreLookupSlot_SloppyHoisting, 2, 1)          \
439   F(StoreLookupSlot_Strict, 2, 1)                  \
440   F(ThrowConstAssignError, 0, 1)
441 
442 #define FOR_EACH_INTRINSIC_SHADOW_REALM(F, I) \
443   F(ShadowRealmWrappedFunctionCreate, 2, 1)
444 
445 #define FOR_EACH_INTRINSIC_STRINGS(F, I)  \
446   F(FlattenString, 1, 1)                  \
447   F(GetSubstitution, 5, 1)                \
448   F(InternalizeString, 1, 1)              \
449   F(StringAdd, 2, 1)                      \
450   F(StringBuilderConcat, 3, 1)            \
451   F(StringCharCodeAt, 2, 1)               \
452   F(StringEqual, 2, 1)                    \
453   F(StringEscapeQuotes, 1, 1)             \
454   F(StringGreaterThan, 2, 1)              \
455   F(StringGreaterThanOrEqual, 2, 1)       \
456   F(StringLastIndexOf, 2, 1)              \
457   F(StringLessThan, 2, 1)                 \
458   F(StringLessThanOrEqual, 2, 1)          \
459   F(StringMaxLength, 0, 1)                \
460   F(StringReplaceOneCharWithString, 3, 1) \
461   F(StringSubstring, 3, 1)                \
462   F(StringToArray, 2, 1)
463 
464 #define FOR_EACH_INTRINSIC_SYMBOL(F, I)    \
465   F(CreatePrivateNameSymbol, 1, 1)         \
466   F(CreatePrivateBrandSymbol, 1, 1)        \
467   F(CreatePrivateSymbol, -1 /* <= 1 */, 1) \
468   F(SymbolDescriptiveString, 1, 1)         \
469   F(SymbolIsPrivate, 1, 1)
470 
471 #define FOR_EACH_INTRINSIC_TEST(F, I)         \
472   F(Abort, 1, 1)                              \
473   F(AbortCSADcheck, 1, 1)                     \
474   F(AbortJS, 1, 1)                            \
475   F(ActiveTierIsMaglev, 1, 1)                 \
476   F(ArrayIteratorProtector, 0, 1)             \
477   F(ArraySpeciesProtector, 0, 1)              \
478   F(BaselineOsr, -1, 1)                       \
479   F(BenchMaglev, 2, 1)                        \
480   F(ClearFunctionFeedback, 1, 1)              \
481   F(ClearMegamorphicStubCache, 0, 1)          \
482   F(CompleteInobjectSlackTracking, 1, 1)      \
483   F(ConstructConsString, 2, 1)                \
484   F(ConstructDouble, 2, 1)                    \
485   F(ConstructSlicedString, 2, 1)              \
486   F(DebugPrint, 1, 1)                         \
487   F(DebugPrintPtr, 1, 1)                      \
488   F(DebugTrace, 0, 1)                         \
489   F(DebugTrackRetainingPath, -1, 1)           \
490   F(DeoptimizeFunction, 1, 1)                 \
491   F(DisableOptimizationFinalization, 0, 1)    \
492   F(DisallowCodegenFromStrings, 1, 1)         \
493   F(DisassembleFunction, 1, 1)                \
494   F(EnableCodeLoggingForTesting, 0, 1)        \
495   F(EnsureFeedbackVectorForFunction, 1, 1)    \
496   F(FinalizeOptimization, 0, 1)               \
497   F(GetCallable, 0, 1)                        \
498   F(GetInitializerFunction, 1, 1)             \
499   F(GetOptimizationStatus, 1, 1)              \
500   F(GetUndetectable, 0, 1)                    \
501   F(GetWeakCollectionSize, 1, 1)              \
502   F(GlobalPrint, 1, 1)                        \
503   F(HasDictionaryElements, 1, 1)              \
504   F(HasDoubleElements, 1, 1)                  \
505   F(HasElementsInALargeObjectSpace, 1, 1)     \
506   F(HasFastElements, 1, 1)                    \
507   F(HasFastProperties, 1, 1)                  \
508   F(HasFixedBigInt64Elements, 1, 1)           \
509   F(HasFixedBigUint64Elements, 1, 1)          \
510   F(HasFixedFloat32Elements, 1, 1)            \
511   F(HasFixedFloat64Elements, 1, 1)            \
512   F(HasFixedInt16Elements, 1, 1)              \
513   F(HasFixedInt32Elements, 1, 1)              \
514   F(HasFixedInt8Elements, 1, 1)               \
515   F(HasFixedUint16Elements, 1, 1)             \
516   F(HasFixedUint32Elements, 1, 1)             \
517   F(HasFixedUint8ClampedElements, 1, 1)       \
518   F(HasFixedUint8Elements, 1, 1)              \
519   F(HasHoleyElements, 1, 1)                   \
520   F(HasObjectElements, 1, 1)                  \
521   F(HasOwnConstDataProperty, 2, 1)            \
522   F(HasPackedElements, 1, 1)                  \
523   F(HasSloppyArgumentsElements, 1, 1)         \
524   F(HasSmiElements, 1, 1)                     \
525   F(HasSmiOrObjectElements, 1, 1)             \
526   F(HaveSameMap, 2, 1)                        \
527   F(HeapObjectVerify, 1, 1)                   \
528   F(ICsAreEnabled, 0, 1)                      \
529   F(InLargeObjectSpace, 1, 1)                 \
530   F(InYoungGeneration, 1, 1)                  \
531   F(Is64Bit, 0, 1)                            \
532   F(IsAtomicsWaitAllowed, 0, 1)               \
533   F(IsBeingInterpreted, 0, 1)                 \
534   F(IsConcatSpreadableProtector, 0, 1)        \
535   F(IsConcurrentRecompilationSupported, 0, 1) \
536   F(IsDictPropertyConstTrackingEnabled, 0, 1) \
537   F(IsSameHeapObject, 2, 1)                   \
538   F(IsSharedString, 1, 1)                     \
539   F(MapIteratorProtector, 0, 1)               \
540   F(NeverOptimizeFunction, 1, 1)              \
541   F(NewRegExpWithBacktrackLimit, 3, 1)        \
542   F(NotifyContextDisposed, 0, 1)              \
543   F(OptimizeMaglevOnNextCall, 1, 1)           \
544   F(OptimizeFunctionOnNextCall, -1, 1)        \
545   F(OptimizeOsr, -1, 1)                       \
546   F(PrepareFunctionForOptimization, -1, 1)    \
547   F(PretenureAllocationSite, 1, 1)            \
548   F(PrintWithNameForAssert, 2, 1)             \
549   F(PromiseSpeciesProtector, 0, 1)            \
550   F(RegExpSpeciesProtector, 0, 1)             \
551   F(RegexpHasBytecode, 2, 1)                  \
552   F(RegexpHasNativeCode, 2, 1)                \
553   F(RegexpIsUnmodified, 1, 1)                 \
554   F(RegexpTypeTag, 1, 1)                      \
555   F(RunningInSimulator, 0, 1)                 \
556   F(RuntimeEvaluateREPL, 1, 1)                \
557   F(ScheduleGCInStackCheck, 0, 1)             \
558   F(SerializeDeserializeNow, 0, 1)            \
559   F(SetAllocationTimeout, -1 /* 2 || 3 */, 1) \
560   F(SetForceSlowPath, 1, 1)                   \
561   F(SetIteratorProtector, 0, 1)               \
562   F(SharedGC, 0, 1)                           \
563   F(SimulateNewspaceFull, 0, 1)               \
564   F(StringIteratorProtector, 0, 1)            \
565   F(SystemBreak, 0, 1)                        \
566   F(TakeHeapSnapshot, -1, 1)                  \
567   F(TraceEnter, 0, 1)                         \
568   F(TraceExit, 1, 1)                          \
569   F(TurbofanStaticAssert, 1, 1)               \
570   F(TypedArraySpeciesProtector, 0, 1)         \
571   F(WaitForBackgroundOptimization, 0, 1)      \
572   F(WebSnapshotDeserialize, -1, 1)            \
573   F(WebSnapshotSerialize, -1, 1)              \
574   I(DeoptimizeNow, 0, 1)
575 
576 #define FOR_EACH_INTRINSIC_TYPEDARRAY(F, I)    \
577   F(ArrayBufferDetach, 1, 1)                   \
578   F(GrowableSharedArrayBufferByteLength, 1, 1) \
579   F(TypedArrayCopyElements, 3, 1)              \
580   F(TypedArrayGetBuffer, 1, 1)                 \
581   F(TypedArraySet, 2, 1)                       \
582   F(TypedArraySortFast, 1, 1)
583 
584 #define FOR_EACH_INTRINSIC_WASM(F, I) \
585   F(ThrowWasmError, 1, 1)             \
586   F(ThrowWasmStackOverflow, 0, 1)     \
587   F(WasmI32AtomicWait, 4, 1)          \
588   F(WasmI64AtomicWait, 5, 1)          \
589   F(WasmAtomicNotify, 3, 1)           \
590   F(WasmMemoryGrow, 2, 1)             \
591   F(WasmStackGuard, 0, 1)             \
592   F(WasmThrow, 2, 1)                  \
593   F(WasmReThrow, 1, 1)                \
594   F(WasmThrowJSTypeError, 0, 1)       \
595   F(WasmRefFunc, 1, 1)                \
596   F(WasmFunctionTableGet, 3, 1)       \
597   F(WasmFunctionTableSet, 4, 1)       \
598   F(WasmTableInit, 6, 1)              \
599   F(WasmTableCopy, 6, 1)              \
600   F(WasmTableGrow, 3, 1)              \
601   F(WasmTableFill, 5, 1)              \
602   F(WasmIsValidRefValue, 3, 1)        \
603   F(WasmCompileLazy, 2, 1)            \
604   F(WasmCompileWrapper, 2, 1)         \
605   F(WasmTriggerTierUp, 1, 1)          \
606   F(WasmDebugBreak, 0, 1)             \
607   F(WasmArrayCopy, 5, 1)              \
608   F(WasmArrayInitFromData, 5, 1)      \
609   F(WasmAllocateContinuation, 1, 1)   \
610   F(WasmSyncStackLimit, 0, 1)         \
611   F(WasmCreateResumePromise, 2, 1)
612 
613 #define FOR_EACH_INTRINSIC_WASM_TEST(F, I) \
614   F(DeserializeWasmModule, 2, 1)           \
615   F(DisallowWasmCodegen, 1, 1)             \
616   F(FreezeWasmLazyCompilation, 1, 1)       \
617   F(GetWasmExceptionTagId, 2, 1)           \
618   F(GetWasmExceptionValues, 1, 1)          \
619   F(GetWasmRecoveredTrapCount, 0, 1)       \
620   F(IsAsmWasmCode, 1, 1)                   \
621   F(IsLiftoffFunction, 1, 1)               \
622   F(IsTurboFanFunction, 1, 1)              \
623   F(IsThreadInWasm, 0, 1)                  \
624   F(IsWasmCode, 1, 1)                      \
625   F(IsWasmTrapHandlerEnabled, 0, 1)        \
626   F(SerializeWasmModule, 1, 1)             \
627   F(SetWasmCompileControls, 2, 1)          \
628   F(SetWasmInstantiateControls, 0, 1)      \
629   F(WasmGetNumberOfInstances, 1, 1)        \
630   F(WasmNumCodeSpaces, 1, 1)               \
631   F(WasmTierDown, 0, 1)                    \
632   F(WasmTierUp, 0, 1)                      \
633   F(WasmTierUpFunction, 2, 1)              \
634   F(WasmTraceEnter, 0, 1)                  \
635   F(WasmTraceExit, 1, 1)                   \
636   F(WasmTraceMemory, 1, 1)
637 
638 #define FOR_EACH_INTRINSIC_WEAKREF(F, I)                             \
639   F(JSFinalizationRegistryRegisterWeakCellWithUnregisterToken, 4, 1) \
640   F(JSWeakRefAddToKeptObjects, 1, 1)                                 \
641   F(ShrinkFinalizationRegistryUnregisterTokenMap, 1, 1)
642 
643 #define FOR_EACH_INTRINSIC_RETURN_PAIR_IMPL(F, I) \
644   F(DebugBreakOnBytecode, 1, 2)                   \
645   F(LoadLookupSlotForCall, 1, 2)
646 
647 // Most intrinsics are implemented in the runtime/ directory, but ICs are
648 // implemented in ic.cc for now.
649 #define FOR_EACH_INTRINSIC_IC(F, I)          \
650   F(ElementsTransitionAndStoreIC_Miss, 6, 1) \
651   F(KeyedLoadIC_Miss, 4, 1)                  \
652   F(KeyedStoreIC_Miss, 5, 1)                 \
653   F(DefineKeyedOwnIC_Miss, 5, 1)             \
654   F(StoreInArrayLiteralIC_Miss, 5, 1)        \
655   F(DefineNamedOwnIC_Slow, 3, 1)             \
656   F(KeyedStoreIC_Slow, 3, 1)                 \
657   F(DefineKeyedOwnIC_Slow, 3, 1)             \
658   F(LoadElementWithInterceptor, 2, 1)        \
659   F(LoadGlobalIC_Miss, 4, 1)                 \
660   F(LoadGlobalIC_Slow, 3, 1)                 \
661   F(LoadIC_Miss, 4, 1)                       \
662   F(LoadNoFeedbackIC_Miss, 4, 1)             \
663   F(LoadWithReceiverIC_Miss, 5, 1)           \
664   F(LoadWithReceiverNoFeedbackIC_Miss, 3, 1) \
665   F(LoadPropertyWithInterceptor, 5, 1)       \
666   F(StoreCallbackProperty, 5, 1)             \
667   F(StoreGlobalIC_Miss, 4, 1)                \
668   F(StoreGlobalICNoFeedback_Miss, 2, 1)      \
669   F(StoreGlobalIC_Slow, 5, 1)                \
670   F(StoreIC_Miss, 5, 1)                      \
671   F(DefineNamedOwnIC_Miss, 5, 1)             \
672   F(StoreInArrayLiteralIC_Slow, 5, 1)        \
673   F(StorePropertyWithInterceptor, 5, 1)      \
674   F(CloneObjectIC_Miss, 4, 1)                \
675   F(KeyedHasIC_Miss, 4, 1)                   \
676   F(HasElementWithInterceptor, 2, 1)
677 
678 #define FOR_EACH_INTRINSIC_RETURN_OBJECT_IMPL(F, I) \
679   FOR_EACH_INTRINSIC_ARRAY(F, I)                    \
680   FOR_EACH_INTRINSIC_ATOMICS(F, I)                  \
681   FOR_EACH_INTRINSIC_BIGINT(F, I)                   \
682   FOR_EACH_INTRINSIC_CLASSES(F, I)                  \
683   FOR_EACH_INTRINSIC_COLLECTIONS(F, I)              \
684   FOR_EACH_INTRINSIC_COMPILER(F, I)                 \
685   FOR_EACH_INTRINSIC_DATE(F, I)                     \
686   FOR_EACH_INTRINSIC_DEBUG(F, I)                    \
687   FOR_EACH_INTRINSIC_FORIN(F, I)                    \
688   FOR_EACH_INTRINSIC_FUNCTION(F, I)                 \
689   FOR_EACH_INTRINSIC_GENERATOR(F, I)                \
690   FOR_EACH_INTRINSIC_IC(F, I)                       \
691   FOR_EACH_INTRINSIC_INTERNAL(F, I)                 \
692   FOR_EACH_INTRINSIC_TRACE(F, I)                    \
693   FOR_EACH_INTRINSIC_INTL(F, I)                     \
694   FOR_EACH_INTRINSIC_LITERALS(F, I)                 \
695   FOR_EACH_INTRINSIC_MODULE(F, I)                   \
696   FOR_EACH_INTRINSIC_NUMBERS(F, I)                  \
697   FOR_EACH_INTRINSIC_OBJECT(F, I)                   \
698   FOR_EACH_INTRINSIC_OPERATORS(F, I)                \
699   FOR_EACH_INTRINSIC_PROMISE(F, I)                  \
700   FOR_EACH_INTRINSIC_PROXY(F, I)                    \
701   FOR_EACH_INTRINSIC_REGEXP(F, I)                   \
702   FOR_EACH_INTRINSIC_SCOPES(F, I)                   \
703   FOR_EACH_INTRINSIC_SHADOW_REALM(F, I)             \
704   FOR_EACH_INTRINSIC_STRINGS(F, I)                  \
705   FOR_EACH_INTRINSIC_SYMBOL(F, I)                   \
706   FOR_EACH_INTRINSIC_TEST(F, I)                     \
707   FOR_EACH_INTRINSIC_TYPEDARRAY(F, I)               \
708   IF_WASM(FOR_EACH_INTRINSIC_WASM, F, I)            \
709   IF_WASM(FOR_EACH_INTRINSIC_WASM_TEST, F, I)       \
710   FOR_EACH_INTRINSIC_WEAKREF(F, I)
711 
712 // Defines the list of all intrinsics, coming in 2 flavors, either returning an
713 // object or a pair.
714 #define FOR_EACH_INTRINSIC_IMPL(F, I)       \
715   FOR_EACH_INTRINSIC_RETURN_PAIR_IMPL(F, I) \
716   FOR_EACH_INTRINSIC_RETURN_OBJECT_IMPL(F, I)
717 
718 #define FOR_EACH_INTRINSIC_RETURN_OBJECT(F) \
719   FOR_EACH_INTRINSIC_RETURN_OBJECT_IMPL(F, F)
720 
721 #define FOR_EACH_INTRINSIC_RETURN_PAIR(F) \
722   FOR_EACH_INTRINSIC_RETURN_PAIR_IMPL(F, F)
723 
724 // The list of all intrinsics, including those that have inline versions, but
725 // not the inline versions themselves.
726 #define FOR_EACH_INTRINSIC(F) FOR_EACH_INTRINSIC_IMPL(F, F)
727 
728 // The list of all inline intrinsics only.
729 #define FOR_EACH_INLINE_INTRINSIC(I) FOR_EACH_INTRINSIC_IMPL(NOTHING, I)
730 
731 #define F(name, nargs, ressize)                                 \
732   Address Runtime_##name(int args_length, Address* args_object, \
733                          Isolate* isolate);
FOR_EACH_INTRINSIC_RETURN_OBJECT(F)734 FOR_EACH_INTRINSIC_RETURN_OBJECT(F)
735 #undef F
736 
737 //---------------------------------------------------------------------------
738 // Runtime provides access to all C++ runtime functions.
739 
740 class Runtime : public AllStatic {
741  public:
742   enum FunctionId : int32_t {
743 #define F(name, nargs, ressize) k##name,
744 #define I(name, nargs, ressize) kInline##name,
745     FOR_EACH_INTRINSIC(F) FOR_EACH_INLINE_INTRINSIC(I)
746 #undef I
747 #undef F
748         kNumFunctions,
749   };
750 
751   static constexpr int kNumInlineFunctions =
752 #define COUNT(...) +1
753       FOR_EACH_INLINE_INTRINSIC(COUNT);
754 #undef COUNT
755 
756   enum IntrinsicType { RUNTIME, INLINE };
757 
758   // Intrinsic function descriptor.
759   struct Function {
760     FunctionId function_id;
761     IntrinsicType intrinsic_type;
762     // The JS name of the function.
763     const char* name;
764 
765     // For RUNTIME functions, this is the C++ entry point.
766     // For INLINE functions this is the C++ entry point of the fall back.
767     Address entry;
768 
769     // The number of arguments expected. nargs is -1 if the function takes
770     // a variable number of arguments.
771     int8_t nargs;
772     // Size of result.  Most functions return a single pointer, size 1.
773     int8_t result_size;
774   };
775 
776   static const int kNotFound = -1;
777 
778   // Checks whether the runtime function with the given {id} depends on the
779   // "current context", i.e. because it does scoped lookups, or whether it's
780   // fine to just pass any context within the same "native context".
781   static bool NeedsExactContext(FunctionId id);
782 
783   // Checks whether the runtime function with the given {id} never returns
784   // to it's caller normally, i.e. whether it'll always raise an exception.
785   // More specifically: The C++ implementation returns the Heap::exception
786   // sentinel, always.
787   static bool IsNonReturning(FunctionId id);
788 
789   // Check if a runtime function with the given {id} may trigger a heap
790   // allocation.
791   static bool MayAllocate(FunctionId id);
792 
793   // Check if a runtime function with the given {id} is allowlisted for
794   // using it with fuzzers.
795   static bool IsAllowListedForFuzzing(FunctionId id);
796 
797   // Get the intrinsic function with the given name.
798   static const Function* FunctionForName(const unsigned char* name, int length);
799 
800   // Get the intrinsic function with the given FunctionId.
801   V8_EXPORT_PRIVATE static const Function* FunctionForId(FunctionId id);
802 
803   // Get the intrinsic function with the given function entry address.
804   static const Function* FunctionForEntry(Address ref);
805 
806   // Get the runtime intrinsic function table.
807   static const Function* RuntimeFunctionTable(Isolate* isolate);
808 
809   V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT static Maybe<bool>
810   DeleteObjectProperty(Isolate* isolate, Handle<JSReceiver> receiver,
811                        Handle<Object> key, LanguageMode language_mode);
812 
813   // Perform a property store on object. If the key is a private name (i.e. this
814   // is a private field assignment), this method throws if the private field
815   // does not exist on object.
816   V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT static MaybeHandle<Object>
817   SetObjectProperty(Isolate* isolate, Handle<Object> object, Handle<Object> key,
818                     Handle<Object> value, StoreOrigin store_origin,
819                     Maybe<ShouldThrow> should_throw = Nothing<ShouldThrow>());
820 
821   // Defines a property on object. If the key is a private name (i.e. this is a
822   // private field definition), this method throws if the field already exists
823   // on object.
824   V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT static MaybeHandle<Object>
825   DefineObjectOwnProperty(Isolate* isolate, Handle<Object> object,
826                           Handle<Object> key, Handle<Object> value,
827                           StoreOrigin store_origin);
828 
829   // When "receiver" is not passed, it defaults to "lookup_start_object".
830   V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT static MaybeHandle<Object>
831   GetObjectProperty(Isolate* isolate, Handle<Object> lookup_start_object,
832                     Handle<Object> key,
833                     Handle<Object> receiver = Handle<Object>(),
834                     bool* is_found = nullptr);
835 
836   V8_WARN_UNUSED_RESULT static MaybeHandle<Object> HasProperty(
837       Isolate* isolate, Handle<Object> object, Handle<Object> key);
838 
839   V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT static MaybeHandle<JSArray>
840   GetInternalProperties(Isolate* isolate, Handle<Object>);
841 
842   V8_WARN_UNUSED_RESULT static MaybeHandle<Object> ThrowIteratorError(
843       Isolate* isolate, Handle<Object> object);
844 };
845 
846 class RuntimeState {
847  public:
848   RuntimeState(const RuntimeState&) = delete;
849   RuntimeState& operator=(const RuntimeState&) = delete;
850 #ifndef V8_INTL_SUPPORT
to_upper_mapping()851   unibrow::Mapping<unibrow::ToUppercase, 128>* to_upper_mapping() {
852     return &to_upper_mapping_;
853   }
to_lower_mapping()854   unibrow::Mapping<unibrow::ToLowercase, 128>* to_lower_mapping() {
855     return &to_lower_mapping_;
856   }
857 #endif
858 
redirected_intrinsic_functions()859   Runtime::Function* redirected_intrinsic_functions() {
860     return redirected_intrinsic_functions_.get();
861   }
862 
set_redirected_intrinsic_functions(Runtime::Function * redirected_intrinsic_functions)863   void set_redirected_intrinsic_functions(
864       Runtime::Function* redirected_intrinsic_functions) {
865     redirected_intrinsic_functions_.reset(redirected_intrinsic_functions);
866   }
867 
868  private:
869   RuntimeState() = default;
870 #ifndef V8_INTL_SUPPORT
871   unibrow::Mapping<unibrow::ToUppercase, 128> to_upper_mapping_;
872   unibrow::Mapping<unibrow::ToLowercase, 128> to_lower_mapping_;
873 #endif
874 
875   std::unique_ptr<Runtime::Function[]> redirected_intrinsic_functions_;
876 
877   friend class Isolate;
878   friend class Runtime;
879 };
880 
881 V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, Runtime::FunctionId);
882 
883 //---------------------------------------------------------------------------
884 // Constants used by interface to runtime functions.
885 
886 using AllocateDoubleAlignFlag = base::BitField<bool, 0, 1>;
887 
888 using AllowLargeObjectAllocationFlag = base::BitField<bool, 1, 1>;
889 
890 // A set of bits returned by Runtime_GetOptimizationStatus.
891 // These bits must be in sync with bits defined in test/mjsunit/mjsunit.js
892 enum class OptimizationStatus {
893   kIsFunction = 1 << 0,
894   kNeverOptimize = 1 << 1,
895   kAlwaysOptimize = 1 << 2,
896   kMaybeDeopted = 1 << 3,
897   kOptimized = 1 << 4,
898   kMaglevved = 1 << 5,
899   kTurboFanned = 1 << 6,
900   kInterpreted = 1 << 7,
901   kMarkedForOptimization = 1 << 8,
902   kMarkedForConcurrentOptimization = 1 << 9,
903   kOptimizingConcurrently = 1 << 10,
904   kIsExecuting = 1 << 11,
905   kTopmostFrameIsTurboFanned = 1 << 12,
906   kLiteMode = 1 << 13,
907   kMarkedForDeoptimization = 1 << 14,
908   kBaseline = 1 << 15,
909   kTopmostFrameIsInterpreted = 1 << 16,
910   kTopmostFrameIsBaseline = 1 << 17,
911 };
912 
913 }  // namespace internal
914 }  // namespace v8
915 
916 #endif  // V8_RUNTIME_RUNTIME_H_
917