Debian Codegraph @

js/src/jit/VMFunctionList-inl.h

raw
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: set ts=8 sts=2 et sw=2 tw=80:
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 #ifndef jit_VMFunctionList_inl_h
8 #define jit_VMFunctionList_inl_h
9
10 #include "mozilla/MacroArgs.h" // MOZ_CONCAT
11
12 #include "builtin/Eval.h"
13 #include "builtin/ModuleObject.h" // js::GetOrCreateModuleMetaObject
14 #include "builtin/Object.h" // js::ObjectCreateWithTemplate
15 #include "builtin/Promise.h" // js::AsyncFunctionAwait
16 #include "builtin/RegExp.h"
17 #include "builtin/String.h"
18 #include "builtin/TestingFunctions.h"
19 #include "jit/BaselineIC.h"
20 #include "jit/Ion.h"
21 #include "jit/IonIC.h"
22 #include "jit/TrialInlining.h"
23 #include "jit/VMFunctions.h"
24 #include "vm/AsyncFunction.h"
25 #include "vm/AsyncIteration.h"
26 #include "vm/BigIntType.h"
27 #include "vm/BoundFunctionObject.h"
28 #include "vm/EqualityOperations.h"
29 #include "vm/Interpreter.h"
30 #include "vm/Iteration.h"
31 #include "vm/TypedArrayObject.h"
32
33 #include "jit/BaselineFrame-inl.h"
34 #include "vm/Interpreter-inl.h"
35
36 namespace js {
37 namespace jit {
38
39 #ifdef FUZZING_JS_FUZZILLI
40 # define VMFUNCTION_FUZZILLI_LIST(_) \
41 _(FuzzilliHashObject, js::FuzzilliHashObject) \
42 _(FuzzilliHashObjectInl, js::FuzzilliHashObjectInl)
43 #else
44 # define VMFUNCTION_FUZZILLI_LIST(_)
45 #endif
46
47 // List of all VM functions to be used with callVM. Each entry stores the name
48 // (must be unique, used for the VMFunctionId enum and profiling) and the C++
49 // function to be called. If a third argument is specified, it is the number of
50 // non-argument Values the VM wrapper should pop from the stack. This is used
51 // for tail calls for Baseline ICs. This list must be sorted on the name field.
52 #define VMFUNCTION_LIST(_) \
53 IF_EXPLICIT_RESOURCE_MANAGEMENT(_(AddDisposableResourceToCapability, \
54 js::AddDisposableResourceToCapability)) \
55 _(AddOrUpdateSparseElementHelper, js::AddOrUpdateSparseElementHelper) \
56 _(AddSlotAndCallAddPropHook, js::AddSlotAndCallAddPropHook) \
57 _(ArgumentsObjectCreateForInlinedIon, \
58 js::ArgumentsObject::createForInlinedIon) \
59 _(ArgumentsObjectCreateForIon, js::ArgumentsObject::createForIon) \
60 _(ArgumentsSliceDense, js::ArgumentsSliceDense) \
61 _(ArrayConstructorOneArg, js::ArrayConstructorOneArg) \
62 _(ArrayFromArgumentsObject, js::ArrayFromArgumentsObject) \
63 _(ArrayJoin, js::jit::ArrayJoin) \
64 _(ArraySliceDense, js::ArraySliceDense) \
65 _(AsyncFunctionAwait, js::AsyncFunctionAwait) \
66 _(AsyncFunctionReject, js::AsyncFunctionReject) \
67 _(AsyncFunctionResolve, js::AsyncFunctionResolve) \
68 _(AtomicsAdd64, js::jit::AtomicsAdd64) \
69 _(AtomicsAnd64, js::jit::AtomicsAnd64) \
70 _(AtomicsCompareExchange64, js::jit::AtomicsCompareExchange64) \
71 _(AtomicsExchange64, js::jit::AtomicsExchange64) \
72 _(AtomicsLoad64, js::jit::AtomicsLoad64) \
73 _(AtomicsOr64, js::jit::AtomicsOr64) \
74 _(AtomicsSub64, js::jit::AtomicsSub64) \
75 _(AtomicsXor64, js::jit::AtomicsXor64) \
76 _(AtomizeString, js::AtomizeString) \
77 _(BaselineCompileFromBaselineInterpreter, \
78 js::jit::BaselineCompileFromBaselineInterpreter) \
79 _(BaselineDebugPrologue, js::jit::DebugPrologue) \
80 _(BaselineGetFunctionThis, js::jit::BaselineGetFunctionThis) \
81 _(BigIntAdd, JS::BigInt::add) \
82 _(BigIntAsIntN, js::jit::BigIntAsIntN) \
83 _(BigIntAsUintN, js::jit::BigIntAsUintN) \
84 _(BigIntBitAnd, JS::BigInt::bitAnd) \
85 _(BigIntBitNot, JS::BigInt::bitNot) \
86 _(BigIntBitOr, JS::BigInt::bitOr) \
87 _(BigIntBitXor, JS::BigInt::bitXor) \
88 _(BigIntCreateFromIntPtr, JS::BigInt::createFromIntPtr) \
89 _(BigIntDec, JS::BigInt::dec) \
90 _(BigIntDiv, JS::BigInt::div) \
91 _(BigIntInc, JS::BigInt::inc) \
92 _(BigIntLeftShift, JS::BigInt::lsh) \
93 _(BigIntMod, JS::BigInt::mod) \
94 _(BigIntMul, JS::BigInt::mul) \
95 _(BigIntNeg, JS::BigInt::neg) \
96 _(BigIntPow, JS::BigInt::pow) \
97 _(BigIntRightShift, JS::BigInt::rsh) \
98 _(BigIntStringEqual, \
99 js::jit::BigIntStringEqual<js::jit::EqualityKind::Equal>) \
100 _(BigIntStringGreaterThanOrEqual, \
101 js::jit::BigIntStringCompare<js::jit::ComparisonKind::GreaterThanOrEqual>) \
102 _(BigIntStringLessThan, \
103 js::jit::BigIntStringCompare<js::jit::ComparisonKind::LessThan>) \
104 _(BigIntStringNotEqual, \
105 js::jit::BigIntStringEqual<js::jit::EqualityKind::NotEqual>) \
106 _(BigIntSub, JS::BigInt::sub) \
107 _(BindVarOperation, js::BindVarOperation) \
108 _(BlockLexicalEnvironmentObjectCreateWithoutEnclosing, \
109 js::BlockLexicalEnvironmentObject::createWithoutEnclosing) \
110 _(BoxBoxableValue, js::wasm::AnyRef::boxValue) \
111 _(BoxNonStrictThis, js::BoxNonStrictThis) \
112 _(BuiltinObjectOperation, js::BuiltinObjectOperation) \
113 _(CallDOMGetter, js::jit::CallDOMGetter) \
114 _(CallDOMSetter, js::jit::CallDOMSetter) \
115 _(CallNativeGetter, js::jit::CallNativeGetter) \
116 _(CallNativeSetter, js::jit::CallNativeSetter) \
117 _(CallObjectCreateWithShape, js::CallObject::createWithShape) \
118 _(CanSkipAwait, js::CanSkipAwait) \
119 _(CharCodeAt, js::jit::CharCodeAt) \
120 _(CharCodeToLowerCase, js::jit::CharCodeToLowerCase) \
121 _(CharCodeToUpperCase, js::jit::CharCodeToUpperCase) \
122 _(CheckClassHeritageOperation, js::CheckClassHeritageOperation) \
123 _(CheckOverRecursed, js::jit::CheckOverRecursed) \
124 _(CheckOverRecursedBaseline, js::jit::CheckOverRecursedBaseline) \
125 _(CheckPrivateFieldOperation, js::CheckPrivateFieldOperation) \
126 _(CheckProxyGetByValueResult, js::jit::CheckProxyGetByValueResult) \
127 _(ClassBodyLexicalEnvironmentObjectCreateWithoutEnclosing, \
128 js::ClassBodyLexicalEnvironmentObject::createWithoutEnclosing) \
129 _(CloneRegExpObject, js::CloneRegExpObject) \
130 _(CloseIterOperation, js::CloseIterOperation) \
131 _(CodePointAt, js::jit::CodePointAt) \
132 _(ConcatStrings, js::ConcatStrings<js::CanGC>) \
133 _(CreateAsyncFromSyncIterator, js::CreateAsyncFromSyncIterator) \
134 _(CreateBigIntFromInt32, js::jit::CreateBigIntFromInt32) \
135 _(CreateBigIntFromInt64, js::jit::CreateBigIntFromInt64) \
136 _(CreateBigIntFromUint64, js::jit::CreateBigIntFromUint64) \
137 _(CreateGenerator, js::jit::CreateGenerator) \
138 _(CreateGeneratorFromFrame, js::jit::CreateGeneratorFromFrame) \
139 IF_EXPLICIT_RESOURCE_MANAGEMENT( \
140 _(CreateSuppressedError, js::CreateSuppressedError)) \
141 _(CreateThisFromIC, js::jit::CreateThisFromIC) \
142 _(CreateThisFromIon, js::jit::CreateThisFromIon) \
143 _(DebugAfterYield, js::jit::DebugAfterYield) \
144 _(DebugEpilogueOnBaselineReturn, js::jit::DebugEpilogueOnBaselineReturn) \
145 _(DebugLeaveLexicalEnv, js::jit::DebugLeaveLexicalEnv) \
146 _(DebugLeaveThenPopLexicalEnv, js::jit::DebugLeaveThenPopLexicalEnv) \
147 _(Debug_CheckSelfHosted, js::Debug_CheckSelfHosted) \
148 _(DebuggeeFreshenLexicalEnv, js::jit::DebuggeeFreshenLexicalEnv) \
149 _(DebuggeeRecreateLexicalEnv, js::jit::DebuggeeRecreateLexicalEnv) \
150 _(DelElemOperationNonStrict, js::DelElemOperation<false>) \
151 _(DelElemOperationStrict, js::DelElemOperation<true>) \
152 _(DelPropOperationNonStrict, js::DelPropOperation<false>) \
153 _(DelPropOperationStrict, js::DelPropOperation<true>) \
154 _(DeleteNameOperation, js::DeleteNameOperation) \
155 _(DispatchOffThreadBaselineBatch, js::jit::DispatchOffThreadBaselineBatch) \
156 _(DoBinaryArithFallback, js::jit::DoBinaryArithFallback, 2) \
157 _(DoBindNameFallback, js::jit::DoBindNameFallback) \
158 _(DoCallFallback, js::jit::DoCallFallback) \
159 _(DoCheckPrivateFieldFallback, js::jit::DoCheckPrivateFieldFallback, 2) \
160 _(DoCloseIterFallback, js::jit::DoCloseIterFallback) \
161 _(DoCompareFallback, js::jit::DoCompareFallback, 2) \
162 _(DoConcatStringObject, js::jit::DoConcatStringObject) \
163 _(DoGetElemFallback, js::jit::DoGetElemFallback, 2) \
164 _(DoGetElemSuperFallback, js::jit::DoGetElemSuperFallback, 3) \
165 _(DoGetImportFallback, js::jit::DoGetImportFallback) \
166 _(DoGetIteratorFallback, js::jit::DoGetIteratorFallback, 1) \
167 _(DoGetNameFallback, js::jit::DoGetNameFallback) \
168 _(DoGetPropFallback, js::jit::DoGetPropFallback, 1) \
169 _(DoGetPropSuperFallback, js::jit::DoGetPropSuperFallback) \
170 _(DoHasOwnFallback, js::jit::DoHasOwnFallback, 2) \
171 _(DoInFallback, js::jit::DoInFallback, 2) \
172 _(DoInstanceOfFallback, js::jit::DoInstanceOfFallback, 2) \
173 _(DoLambdaFallback, js::jit::DoLambdaFallback) \
174 _(DoLazyConstantFallback, js::jit::DoLazyConstantFallback) \
175 _(DoNewArrayFallback, js::jit::DoNewArrayFallback) \
176 _(DoNewObjectFallback, js::jit::DoNewObjectFallback) \
177 _(DoOptimizeGetIteratorFallback, js::jit::DoOptimizeGetIteratorFallback) \
178 _(DoOptimizeSpreadCallFallback, js::jit::DoOptimizeSpreadCallFallback) \
179 _(DoRestFallback, js::jit::DoRestFallback) \
180 _(DoSetElemFallback, js::jit::DoSetElemFallback, 2) \
181 _(DoSetPropFallback, js::jit::DoSetPropFallback, 1) \
182 _(DoSpreadCallFallback, js::jit::DoSpreadCallFallback) \
183 _(DoStringToInt64, js::jit::DoStringToInt64) \
184 _(DoToBoolFallback, js::jit::DoToBoolFallback) \
185 _(DoToPropertyKeyFallback, js::jit::DoToPropertyKeyFallback) \
186 _(DoTrialInlining, js::jit::DoTrialInlining) \
187 _(DoTypeOfEqFallback, js::jit::DoTypeOfEqFallback) \
188 _(DoTypeOfFallback, js::jit::DoTypeOfFallback) \
189 _(DoUnaryArithFallback, js::jit::DoUnaryArithFallback, 1) \
190 _(EnterWith, js::jit::EnterWith) \
191 _(ExtractAwaitValue, js::ExtractAwaitValue) \
192 _(FinalSuspend, js::jit::FinalSuspend) \
193 _(FreshenLexicalEnv, js::jit::FreshenLexicalEnv) \
194 _(FunWithProtoOperation, js::FunWithProtoOperation) \
195 _(FunctionBindCreate, js::BoundFunctionObject::createWithTemplate) \
196 _(FunctionBindImpl, js::BoundFunctionObject::functionBindImpl) \
197 _(FunctionBindSpecializedBaseline, \
198 js::BoundFunctionObject::functionBindSpecializedBaseline) \
199 VMFUNCTION_FUZZILLI_LIST(_) \
200 _(GeneratorThrowOrReturn, js::jit::GeneratorThrowOrReturn) \
201 _(GetAndClearException, js::GetAndClearException) \
202 _(GetElemMaybeCached, js::jit::GetElemMaybeCached) \
203 _(GetFirstDollarIndexRaw, js::GetFirstDollarIndexRaw) \
204 _(GetImportOperation, js::GetImportOperation) \
205 _(GetIntrinsicValue, js::jit::GetIntrinsicValue) \
206 _(GetIterator, js::GetIterator) \
207 _(GetIteratorWithIndices, js::GetIteratorWithIndices) \
208 _(GetNonSyntacticGlobalThis, js::GetNonSyntacticGlobalThis) \
209 _(GetOrCreateModuleMetaObject, js::GetOrCreateModuleMetaObject) \
210 _(GetPendingExceptionStack, js::GetPendingExceptionStack) \
211 _(GetPropMaybeCached, js::jit::GetPropMaybeCached) \
212 _(GetPrototypeOf, js::jit::GetPrototypeOf) \
213 _(GetSparseElementHelper, js::GetSparseElementHelper) \
214 _(GlobalDeclInstantiationFromIon, js::jit::GlobalDeclInstantiationFromIon) \
215 _(GlobalOrEvalDeclInstantiation, js::GlobalOrEvalDeclInstantiation) \
216 _(HandleDebugTrap, js::jit::HandleDebugTrap) \
217 _(ImplicitThisOperation, js::ImplicitThisOperation) \
218 _(ImportMetaOperation, js::ImportMetaOperation) \
219 _(InitElemGetterSetterOperation, js::InitElemGetterSetterOperation) \
220 _(InitFunctionEnvironmentObjects, js::jit::InitFunctionEnvironmentObjects) \
221 _(InitPropGetterSetterOperation, js::InitPropGetterSetterOperation) \
222 _(InitRestParameter, js::jit::InitRestParameter) \
223 _(Int32ToString, js::Int32ToString<js::CanGC>) \
224 _(Int32ToStringWithBase, js::Int32ToStringWithBase<js::CanGC>) \
225 _(InterpretResume, js::jit::InterpretResume) \
226 _(InterruptCheck, js::jit::InterruptCheck) \
227 _(InvokeFunction, js::jit::InvokeFunction) \
228 _(IonBinaryArithICUpdate, js::jit::IonBinaryArithIC::update) \
229 _(IonBindNameICUpdate, js::jit::IonBindNameIC::update) \
230 _(IonCheckPrivateFieldICUpdate, js::jit::IonCheckPrivateFieldIC::update) \
231 _(IonCloseIterICUpdate, js::jit::IonCloseIterIC::update) \
232 _(IonCompareICUpdate, js::jit::IonCompareIC::update) \
233 _(IonCompileScriptForBaselineAtEntry, \
234 js::jit::IonCompileScriptForBaselineAtEntry) \
235 _(IonCompileScriptForBaselineOSR, js::jit::IonCompileScriptForBaselineOSR) \
236 _(IonGetIteratorICUpdate, js::jit::IonGetIteratorIC::update) \
237 _(IonGetNameICUpdate, js::jit::IonGetNameIC::update) \
238 _(IonGetPropSuperICUpdate, js::jit::IonGetPropSuperIC::update) \
239 _(IonGetPropertyICUpdate, js::jit::IonGetPropertyIC::update) \
240 _(IonHasOwnICUpdate, js::jit::IonHasOwnIC::update) \
241 _(IonInICUpdate, js::jit::IonInIC::update) \
242 _(IonInstanceOfICUpdate, js::jit::IonInstanceOfIC::update) \
243 _(IonOptimizeGetIteratorICUpdate, js::jit::IonOptimizeGetIteratorIC::update) \
244 _(IonOptimizeSpreadCallICUpdate, js::jit::IonOptimizeSpreadCallIC::update) \
245 _(IonSetPropertyICUpdate, js::jit::IonSetPropertyIC::update) \
246 _(IonToPropertyKeyICUpdate, js::jit::IonToPropertyKeyIC::update) \
247 _(IonUnaryArithICUpdate, js::jit::IonUnaryArithIC::update) \
248 _(IsArrayFromJit, js::IsArrayFromJit) \
249 _(IsPossiblyWrappedTypedArray, js::jit::IsPossiblyWrappedTypedArray) \
250 _(IsPrototypeOf, js::IsPrototypeOf) \
251 _(LambdaBaselineFallback, js::LambdaBaselineFallback) \
252 _(LambdaOptimizedFallback, js::LambdaOptimizedFallback) \
253 _(LeaveWith, js::jit::LeaveWith) \
254 _(LinearizeForCharAccess, js::jit::LinearizeForCharAccess) \
255 _(LoadAliasedDebugVar, js::LoadAliasedDebugVar) \
256 _(MapObjectCreate, js::MapObject::create) \
257 _(MapObjectCreateFromIterable, js::MapObject::createFromIterable) \
258 _(MapObjectDelete, js::jit::MapObjectDelete) \
259 _(MapObjectGet, js::jit::MapObjectGet) \
260 _(MapObjectHas, js::jit::MapObjectHas) \
261 _(MapObjectSet, js::jit::MapObjectSet) \
262 _(MapObjectSetFromIC, js::jit::MapObjectSetFromIC) \
263 _(MutatePrototype, js::jit::MutatePrototype) \
264 _(NamedLambdaObjectCreateWithoutEnclosing, \
265 js::NamedLambdaObject::createWithoutEnclosing) \
266 _(NativeGetElement, js::NativeGetElement) \
267 _(NewArgumentsObject, js::jit::NewArgumentsObject) \
268 _(NewArrayIterator, js::NewArrayIterator) \
269 _(NewArrayObjectBaselineFallback, js::NewArrayObjectBaselineFallback) \
270 _(NewArrayObjectEnsureDenseInitLength, \
271 js::jit::NewArrayObjectEnsureDenseInitLength) \
272 _(NewArrayObjectOptimzedFallback, js::NewArrayObjectOptimizedFallback) \
273 _(NewArrayOperation, js::NewArrayOperation) \
274 _(NewArrayWithShape, js::NewArrayWithShape) \
275 _(NewObjectOperation, js::NewObjectOperation) \
276 _(NewPlainObjectBaselineFallback, js::NewPlainObjectBaselineFallback) \
277 _(NewPlainObjectOptimizedFallback, js::NewPlainObjectOptimizedFallback) \
278 _(NewPrivateName, js::NewPrivateName) \
279 _(NewRegExpStringIterator, js::NewRegExpStringIterator) \
280 _(NewStringIterator, js::NewStringIterator) \
281 _(NewStringObject, js::jit::NewStringObject) \
282 _(NewTypedArrayWithTemplateAndArray, js::NewTypedArrayWithTemplateAndArray) \
283 _(NewTypedArrayWithTemplateAndBuffer, \
284 js::NewTypedArrayWithTemplateAndBuffer) \
285 _(NewTypedArrayWithTemplateAndLength, \
286 js::NewTypedArrayWithTemplateAndLength) \
287 _(NormalSuspend, js::jit::NormalSuspend) \
288 _(NumberParseInt, js::NumberParseInt) \
289 _(NumberToString, js::NumberToString<js::CanGC>) \
290 _(ObjectCreateWithTemplate, js::ObjectCreateWithTemplate) \
291 _(ObjectKeys, js::jit::ObjectKeys) \
292 _(ObjectKeysLength, js::jit::ObjectKeysLength) \
293 _(ObjectWithProtoOperation, js::ObjectWithProtoOperation) \
294 _(OnDebuggerStatement, js::jit::OnDebuggerStatement) \
295 _(ProxyGetProperty, js::ProxyGetProperty) \
296 _(ProxyGetPropertyByValue, js::ProxyGetPropertyByValue) \
297 _(ProxyHas, js::ProxyHas) \
298 _(ProxyHasOwn, js::ProxyHasOwn) \
299 _(ProxySetProperty, js::ProxySetProperty) \
300 _(ProxySetPropertyByValue, js::ProxySetPropertyByValue) \
301 _(PushClassBodyEnv, js::jit::PushClassBodyEnv) \
302 _(PushLexicalEnv, js::jit::PushLexicalEnv) \
303 _(PushVarEnv, js::jit::PushVarEnv) \
304 _(RecreateLexicalEnv, js::jit::RecreateLexicalEnv) \
305 _(RegExpBuiltinExecMatchFromJit, js::RegExpBuiltinExecMatchFromJit) \
306 _(RegExpBuiltinExecTestFromJit, js::RegExpBuiltinExecTestFromJit) \
307 _(RegExpHasCaptureGroups, js::RegExpHasCaptureGroups) \
308 _(RegExpMatcherRaw, js::RegExpMatcherRaw) \
309 _(RegExpSearcherRaw, js::RegExpSearcherRaw) \
310 _(SameValue, js::SameValue) \
311 _(SetArrayLength, js::jit::SetArrayLength) \
312 _(SetElementMegamorphicNoCache, js::jit::SetElementMegamorphic<false>) \
313 _(SetElementMegamorphicYesCache, js::jit::SetElementMegamorphic<true>) \
314 _(SetElementSuper, js::SetElementSuper) \
315 _(SetFunctionName, js::SetFunctionName) \
316 _(SetIntrinsicOperation, js::SetIntrinsicOperation) \
317 _(SetObjectAdd, js::jit::SetObjectAdd) \
318 _(SetObjectAddFromIC, js::jit::SetObjectAddFromIC) \
319 _(SetObjectCreate, js::SetObject::create) \
320 _(SetObjectCreateFromIterable, js::SetObject::createFromIterable) \
321 _(SetObjectDelete, js::jit::SetObjectDelete) \
322 _(SetObjectHas, js::jit::SetObjectHas) \
323 _(SetPropertyMegamorphicNoCache, js::jit::SetPropertyMegamorphic<false>) \
324 _(SetPropertyMegamorphicYesCache, js::jit::SetPropertyMegamorphic<true>) \
325 _(SetPropertySuper, js::SetPropertySuper) \
326 _(StartDynamicModuleImport, js::StartDynamicModuleImport) \
327 _(StringBigIntGreaterThanOrEqual, \
328 js::jit::StringBigIntCompare<js::jit::ComparisonKind::GreaterThanOrEqual>) \
329 _(StringBigIntLessThan, \
330 js::jit::StringBigIntCompare<js::jit::ComparisonKind::LessThan>) \
331 _(StringEndsWith, js::StringEndsWith) \
332 _(StringFlatReplaceString, js::StringFlatReplaceString) \
333 _(StringFromCharCode, js::StringFromCharCode) \
334 _(StringFromCodePoint, js::StringFromCodePoint) \
335 _(StringIncludes, js::StringIncludes) \
336 _(StringIndexOf, js::StringIndexOf) \
337 _(StringLastIndexOf, js::StringLastIndexOf) \
338 _(StringReplace, js::jit::StringReplace) \
339 _(StringSplitString, js::StringSplitString) \
340 _(StringStartsWith, js::StringStartsWith) \
341 _(StringToLowerCase, js::StringToLowerCase) \
342 _(StringToNumber, js::StringToNumber) \
343 _(StringToUpperCase, js::StringToUpperCase) \
344 _(StringTrim, js::StringTrim) \
345 _(StringTrimEnd, js::StringTrimEnd) \
346 _(StringTrimStart, js::StringTrimStart) \
347 _(StringsCompareGreaterThanOrEquals, \
348 js::jit::StringsCompare<js::jit::ComparisonKind::GreaterThanOrEqual>) \
349 _(StringsCompareLessThan, \
350 js::jit::StringsCompare<js::jit::ComparisonKind::LessThan>) \
351 _(StringsEqual, js::jit::StringsEqual<js::jit::EqualityKind::Equal>) \
352 _(StringsNotEqual, js::jit::StringsEqual<js::jit::EqualityKind::NotEqual>) \
353 _(SubstringKernel, js::SubstringKernel) \
354 _(ThrowBadDerivedReturnOrUninitializedThis, \
355 js::jit::ThrowBadDerivedReturnOrUninitializedThis) \
356 _(ThrowCheckIsObject, js::ThrowCheckIsObject) \
357 _(ThrowInitializedThis, js::ThrowInitializedThis) \
358 _(ThrowMsgOperation, js::ThrowMsgOperation) \
359 _(ThrowObjectCoercible, js::ThrowObjectCoercible) \
360 _(ThrowOperation, js::ThrowOperation) \
361 _(ThrowRuntimeLexicalError, js::jit::ThrowRuntimeLexicalError) \
362 _(ThrowUninitializedThis, js::ThrowUninitializedThis) \
363 _(ThrowWithStackOperation, js::ThrowWithStackOperation) \
364 _(ToBigInt, js::ToBigInt) \
365 _(ToStringSlow, js::ToStringSlow<js::CanGC>) \
366 _(ValueToIterator, js::ValueToIterator) \
367 _(VarEnvironmentObjectCreateWithoutEnclosing, \
368 js::VarEnvironmentObject::createWithoutEnclosing)
369
370 #define DEF_ID(name, ...) name,
371 enum class VMFunctionId { VMFUNCTION_LIST(DEF_ID) Count };
372 #undef DEF_ID
373
374 // Define the VMFunctionToId template to map from signature + function to
375 // the VMFunctionId. This lets us verify the consumer/codegen code matches
376 // the C++ signature.
377 template <typename Function, Function fun>
378 struct VMFunctionToId; // Error here? Update VMFUNCTION_LIST?
379
380 // GCC warns when the signature does not have matching attributes (for example
381 // [[nodiscard]]). Squelch this warning to avoid a GCC-only footgun.
382 #if MOZ_IS_GCC
383 # pragma GCC diagnostic push
384 # pragma GCC diagnostic ignored "-Wignored-attributes"
385 #endif
386
387 // Note: the use of ::fp instead of fp is intentional to enforce use of
388 // fully-qualified names in the list above.
389 #define DEF_TEMPLATE(name, fp, ...) \
390 template <> \
391 struct VMFunctionToId<decltype(&fp), fp> { \
392 static constexpr VMFunctionId id = VMFunctionId::name; \
393 };
394 VMFUNCTION_LIST(DEF_TEMPLATE)
395 #undef DEF_TEMPLATE
396
397 #if MOZ_IS_GCC
398 # pragma GCC diagnostic pop
399 #endif
400
401 } // namespace jit
402 } // namespace js
403
404 // Make sure that all names are fully qualified (or at least, are resolvable
405 // within the toplevel namespace).
406 namespace check_fully_qualified {
407 #define CHECK_NS_VISIBILITY(name, fp, ...) \
408 [[maybe_unused]] static constexpr decltype(&fp) MOZ_CONCAT( \
409 fp_, __COUNTER__) = nullptr;
410 VMFUNCTION_LIST(CHECK_NS_VISIBILITY)
411 #undef CHECK_NS_VISIBILITY
412 } // namespace check_fully_qualified
413
414 #endif // jit_VMFunctionList_inl_h