1/*
2 * Copyright (C) 2011-2017 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#pragma once
27
28#if ENABLE(DFG_JIT)
29
30#include "DFGArithMode.h"
31#include "JITOperations.h"
32#include "TypedArrayType.h"
33
34namespace JSC {
35
36class DateInstance;
37
38namespace DFG {
39
40struct OSRExitBase;
41
42extern "C" {
43
44JSCell* JIT_OPERATION operationStringFromCharCode(JSGlobalObject*, int32_t) WTF_INTERNAL;
45EncodedJSValue JIT_OPERATION operationStringFromCharCodeUntyped(JSGlobalObject*, EncodedJSValue) WTF_INTERNAL;
46
47// These routines provide callbacks out to C++ implementations of operations too complex to JIT.
48JSCell* JIT_OPERATION operationCallObjectConstructor(JSGlobalObject*, EncodedJSValue encodedTarget) WTF_INTERNAL;
49JSCell* JIT_OPERATION operationToObject(JSGlobalObject*, EncodedJSValue encodedTarget, UniquedStringImpl*) WTF_INTERNAL;
50JSArray* JIT_OPERATION operationObjectKeys(JSGlobalObject*, EncodedJSValue) WTF_INTERNAL;
51JSArray* JIT_OPERATION operationObjectKeysObject(JSGlobalObject*, JSObject*) WTF_INTERNAL;
52JSCell* JIT_OPERATION operationObjectCreate(JSGlobalObject*, EncodedJSValue) WTF_INTERNAL;
53JSCell* JIT_OPERATION operationObjectCreateObject(JSGlobalObject*, JSObject*) WTF_INTERNAL;
54JSCell* JIT_OPERATION operationCreateThis(JSGlobalObject*, JSObject* constructor, uint32_t inlineCapacity) WTF_INTERNAL;
55JSCell* JIT_OPERATION operationCreatePromise(JSGlobalObject*, JSObject* constructor) WTF_INTERNAL;
56JSCell* JIT_OPERATION operationCreateInternalPromise(JSGlobalObject*, JSObject* constructor) WTF_INTERNAL;
57JSCell* JIT_OPERATION operationCreateGenerator(JSGlobalObject*, JSObject* constructor) WTF_INTERNAL;
58JSCell* JIT_OPERATION operationCreateAsyncGenerator(JSGlobalObject*, JSObject* constructor) WTF_INTERNAL;
59EncodedJSValue JIT_OPERATION operationToThis(JSGlobalObject*, EncodedJSValue encodedOp1) WTF_INTERNAL;
60EncodedJSValue JIT_OPERATION operationToThisStrict(JSGlobalObject*, EncodedJSValue encodedOp1) WTF_INTERNAL;
61EncodedJSValue JIT_OPERATION operationValueMod(JSGlobalObject*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL;
62EncodedJSValue JIT_OPERATION operationValueBitNot(JSGlobalObject*, EncodedJSValue encodedOp1) WTF_INTERNAL;
63EncodedJSValue JIT_OPERATION operationValueBitAnd(JSGlobalObject*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL;
64EncodedJSValue JIT_OPERATION operationValueBitOr(JSGlobalObject*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL;
65EncodedJSValue JIT_OPERATION operationValueBitXor(JSGlobalObject*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL;
66EncodedJSValue JIT_OPERATION operationValueBitLShift(JSGlobalObject*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL;
67EncodedJSValue JIT_OPERATION operationValueBitRShift(JSGlobalObject*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL;
68EncodedJSValue JIT_OPERATION operationValueBitURShift(JSGlobalObject*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL;
69EncodedJSValue JIT_OPERATION operationValueAddNotNumber(JSGlobalObject*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL;
70EncodedJSValue JIT_OPERATION operationValueDiv(JSGlobalObject*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL;
71EncodedJSValue JIT_OPERATION operationValuePow(JSGlobalObject*, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) WTF_INTERNAL;
72EncodedJSValue JIT_OPERATION operationInc(JSGlobalObject*, EncodedJSValue encodedOp1) WTF_INTERNAL;
73EncodedJSValue JIT_OPERATION operationDec(JSGlobalObject*, EncodedJSValue encodedOp1) WTF_INTERNAL;
74double JIT_OPERATION operationArithAbs(JSGlobalObject*, EncodedJSValue encodedOp1) WTF_INTERNAL;
75uint32_t JIT_OPERATION operationArithClz32(JSGlobalObject*, EncodedJSValue encodedOp1) WTF_INTERNAL;
76double JIT_OPERATION operationArithFRound(JSGlobalObject*, EncodedJSValue encodedOp1) WTF_INTERNAL;
77double JIT_OPERATION operationArithSqrt(JSGlobalObject*, EncodedJSValue encodedOp1) WTF_INTERNAL;
78
79#define DFG_ARITH_UNARY(capitalizedName, lowerName) \
80double JIT_OPERATION operationArith##capitalizedName(JSGlobalObject*, EncodedJSValue encodedOp1) WTF_INTERNAL;
81 FOR_EACH_DFG_ARITH_UNARY_OP(DFG_ARITH_UNARY)
82#undef DFG_ARITH_UNARY
83
84EncodedJSValue JIT_OPERATION operationArithRound(JSGlobalObject*, EncodedJSValue) WTF_INTERNAL;
85EncodedJSValue JIT_OPERATION operationArithFloor(JSGlobalObject*, EncodedJSValue) WTF_INTERNAL;
86EncodedJSValue JIT_OPERATION operationArithCeil(JSGlobalObject*, EncodedJSValue) WTF_INTERNAL;
87EncodedJSValue JIT_OPERATION operationArithTrunc(JSGlobalObject*, EncodedJSValue) WTF_INTERNAL;
88EncodedJSValue JIT_OPERATION operationGetByVal(JSGlobalObject*, EncodedJSValue encodedBase, EncodedJSValue encodedProperty) WTF_INTERNAL;
89EncodedJSValue JIT_OPERATION operationGetByValCell(JSGlobalObject*, JSCell*, EncodedJSValue encodedProperty) WTF_INTERNAL;
90EncodedJSValue JIT_OPERATION operationGetByValObjectInt(JSGlobalObject*, JSObject*, int32_t) WTF_INTERNAL;
91EncodedJSValue JIT_OPERATION operationGetByValStringInt(JSGlobalObject*, JSString*, int32_t) WTF_INTERNAL;
92EncodedJSValue JIT_OPERATION operationGetByValObjectString(JSGlobalObject*, JSCell*, JSCell* string) WTF_INTERNAL;
93EncodedJSValue JIT_OPERATION operationGetByValObjectSymbol(JSGlobalObject*, JSCell*, JSCell* symbol) WTF_INTERNAL;
94EncodedJSValue JIT_OPERATION operationToPrimitive(JSGlobalObject*, EncodedJSValue) WTF_INTERNAL;
95EncodedJSValue JIT_OPERATION operationToNumber(JSGlobalObject*, EncodedJSValue) WTF_INTERNAL;
96EncodedJSValue JIT_OPERATION operationToNumeric(JSGlobalObject*, EncodedJSValue) WTF_INTERNAL;
97EncodedJSValue JIT_OPERATION operationGetByValWithThis(JSGlobalObject*, EncodedJSValue, EncodedJSValue, EncodedJSValue) WTF_INTERNAL;
98EncodedJSValue JIT_OPERATION operationGetPrototypeOf(JSGlobalObject*, EncodedJSValue) WTF_INTERNAL;
99EncodedJSValue JIT_OPERATION operationGetPrototypeOfObject(JSGlobalObject*, JSObject*) WTF_INTERNAL;
100EncodedJSValue JIT_OPERATION operationHasGenericProperty(JSGlobalObject*, EncodedJSValue, JSCell*);
101size_t JIT_OPERATION operationHasIndexedPropertyByInt(JSGlobalObject*, JSCell*, int32_t, int32_t);
102JSCell* JIT_OPERATION operationGetPropertyEnumerator(JSGlobalObject*, EncodedJSValue);
103JSCell* JIT_OPERATION operationGetPropertyEnumeratorCell(JSGlobalObject*, JSCell*);
104JSCell* JIT_OPERATION operationToIndexString(JSGlobalObject*, int32_t);
105JSCell* JIT_OPERATION operationNewRegexpWithLastIndex(JSGlobalObject*, JSCell*, EncodedJSValue) WTF_INTERNAL;
106char* JIT_OPERATION operationNewArray(JSGlobalObject*, Structure*, void*, size_t) WTF_INTERNAL;
107char* JIT_OPERATION operationNewEmptyArray(VM*, Structure*) WTF_INTERNAL;
108char* JIT_OPERATION operationNewArrayWithSize(JSGlobalObject*, Structure*, int32_t, Butterfly*) WTF_INTERNAL;
109char* JIT_OPERATION operationNewArrayWithSizeAndHint(JSGlobalObject*, Structure*, int32_t, int32_t, Butterfly*) WTF_INTERNAL;
110char* JIT_OPERATION operationNewInt8ArrayWithSize(JSGlobalObject*, Structure*, int32_t, char*) WTF_INTERNAL;
111char* JIT_OPERATION operationNewInt8ArrayWithOneArgument(JSGlobalObject*, Structure*, EncodedJSValue) WTF_INTERNAL;
112char* JIT_OPERATION operationNewInt16ArrayWithSize(JSGlobalObject*, Structure*, int32_t, char*) WTF_INTERNAL;
113char* JIT_OPERATION operationNewInt16ArrayWithOneArgument(JSGlobalObject*, Structure*, EncodedJSValue) WTF_INTERNAL;
114char* JIT_OPERATION operationNewInt32ArrayWithSize(JSGlobalObject*, Structure*, int32_t, char*) WTF_INTERNAL;
115char* JIT_OPERATION operationNewInt32ArrayWithOneArgument(JSGlobalObject*, Structure*, EncodedJSValue) WTF_INTERNAL;
116char* JIT_OPERATION operationNewUint8ArrayWithSize(JSGlobalObject*, Structure*, int32_t, char*) WTF_INTERNAL;
117char* JIT_OPERATION operationNewUint8ArrayWithOneArgument(JSGlobalObject*, Structure*, EncodedJSValue) WTF_INTERNAL;
118char* JIT_OPERATION operationNewUint8ClampedArrayWithSize(JSGlobalObject*, Structure*, int32_t, char*) WTF_INTERNAL;
119char* JIT_OPERATION operationNewUint8ClampedArrayWithOneArgument(JSGlobalObject*, Structure*, EncodedJSValue) WTF_INTERNAL;
120char* JIT_OPERATION operationNewUint16ArrayWithSize(JSGlobalObject*, Structure*, int32_t, char*) WTF_INTERNAL;
121char* JIT_OPERATION operationNewUint16ArrayWithOneArgument(JSGlobalObject*, Structure*, EncodedJSValue) WTF_INTERNAL;
122char* JIT_OPERATION operationNewUint32ArrayWithSize(JSGlobalObject*, Structure*, int32_t, char*) WTF_INTERNAL;
123char* JIT_OPERATION operationNewUint32ArrayWithOneArgument(JSGlobalObject*, Structure*, EncodedJSValue) WTF_INTERNAL;
124char* JIT_OPERATION operationNewFloat32ArrayWithSize(JSGlobalObject*, Structure*, int32_t, char*) WTF_INTERNAL;
125char* JIT_OPERATION operationNewFloat32ArrayWithOneArgument(JSGlobalObject*, Structure*, EncodedJSValue) WTF_INTERNAL;
126char* JIT_OPERATION operationNewFloat64ArrayWithSize(JSGlobalObject*, Structure*, int32_t, char*) WTF_INTERNAL;
127char* JIT_OPERATION operationNewFloat64ArrayWithOneArgument(JSGlobalObject*, Structure*, EncodedJSValue) WTF_INTERNAL;
128void JIT_OPERATION operationPutByValStrict(JSGlobalObject*, EncodedJSValue encodedBase, EncodedJSValue encodedProperty, EncodedJSValue encodedValue) WTF_INTERNAL;
129void JIT_OPERATION operationPutByValNonStrict(JSGlobalObject*, EncodedJSValue encodedBase, EncodedJSValue encodedProperty, EncodedJSValue encodedValue) WTF_INTERNAL;
130void JIT_OPERATION operationPutByValCellStrict(JSGlobalObject*, JSCell*, EncodedJSValue encodedProperty, EncodedJSValue encodedValue) WTF_INTERNAL;
131void JIT_OPERATION operationPutByValCellNonStrict(JSGlobalObject*, JSCell*, EncodedJSValue encodedProperty, EncodedJSValue encodedValue) WTF_INTERNAL;
132void JIT_OPERATION operationPutByValCellStringStrict(JSGlobalObject*, JSCell*, JSCell* string, EncodedJSValue encodedValue) WTF_INTERNAL;
133void JIT_OPERATION operationPutByValCellStringNonStrict(JSGlobalObject*, JSCell*, JSCell* string, EncodedJSValue encodedValue) WTF_INTERNAL;
134void JIT_OPERATION operationPutByValCellSymbolStrict(JSGlobalObject*, JSCell*, JSCell* symbol, EncodedJSValue encodedValue) WTF_INTERNAL;
135void JIT_OPERATION operationPutByValCellSymbolNonStrict(JSGlobalObject*, JSCell*, JSCell* symbol, EncodedJSValue encodedValue) WTF_INTERNAL;
136void JIT_OPERATION operationPutByValBeyondArrayBoundsStrict(JSGlobalObject*, JSObject*, int32_t index, EncodedJSValue encodedValue) WTF_INTERNAL;
137void JIT_OPERATION operationPutByValBeyondArrayBoundsNonStrict(JSGlobalObject*, JSObject*, int32_t index, EncodedJSValue encodedValue) WTF_INTERNAL;
138void JIT_OPERATION operationPutByValDirectBeyondArrayBoundsNonStrict(JSGlobalObject*, JSObject*, int32_t index, EncodedJSValue encodedValue) WTF_INTERNAL;
139void JIT_OPERATION operationPutByValDirectStrict(JSGlobalObject*, EncodedJSValue encodedBase, EncodedJSValue encodedProperty, EncodedJSValue encodedValue) WTF_INTERNAL;
140void JIT_OPERATION operationPutByValDirectNonStrict(JSGlobalObject*, EncodedJSValue encodedBase, EncodedJSValue encodedProperty, EncodedJSValue encodedValue) WTF_INTERNAL;
141void JIT_OPERATION operationPutByValDirectCellStrict(JSGlobalObject*, JSCell*, EncodedJSValue encodedProperty, EncodedJSValue encodedValue) WTF_INTERNAL;
142void JIT_OPERATION operationPutByValDirectCellNonStrict(JSGlobalObject*, JSCell*, EncodedJSValue encodedProperty, EncodedJSValue encodedValue) WTF_INTERNAL;
143void JIT_OPERATION operationPutByValDirectCellStringStrict(JSGlobalObject*, JSCell*, JSCell* string, EncodedJSValue encodedValue) WTF_INTERNAL;
144void JIT_OPERATION operationPutByValDirectCellStringNonStrict(JSGlobalObject*, JSCell*, JSCell* string, EncodedJSValue encodedValue) WTF_INTERNAL;
145void JIT_OPERATION operationPutByValDirectCellSymbolStrict(JSGlobalObject*, JSCell*, JSCell* symbol, EncodedJSValue encodedValue) WTF_INTERNAL;
146void JIT_OPERATION operationPutByValDirectCellSymbolNonStrict(JSGlobalObject*, JSCell*, JSCell* symbol, EncodedJSValue encodedValue) WTF_INTERNAL;
147void JIT_OPERATION operationPutByValDirectBeyondArrayBoundsStrict(JSGlobalObject*, JSObject*, int32_t index, EncodedJSValue encodedValue) WTF_INTERNAL;
148void JIT_OPERATION operationPutByValDirectBeyondArrayBoundsNonStrict(JSGlobalObject*, JSObject*, int32_t index, EncodedJSValue encodedValue) WTF_INTERNAL;
149void JIT_OPERATION operationPutDoubleByValBeyondArrayBoundsStrict(JSGlobalObject*, JSObject*, int32_t index, double value) WTF_INTERNAL;
150void JIT_OPERATION operationPutDoubleByValBeyondArrayBoundsNonStrict(JSGlobalObject*, JSObject*, int32_t index, double value) WTF_INTERNAL;
151void JIT_OPERATION operationPutDoubleByValDirectBeyondArrayBoundsStrict(JSGlobalObject*, JSObject*, int32_t index, double value) WTF_INTERNAL;
152void JIT_OPERATION operationPutDoubleByValDirectBeyondArrayBoundsNonStrict(JSGlobalObject*, JSObject*, int32_t index, double value) WTF_INTERNAL;
153void JIT_OPERATION operationPutByIdWithThis(JSGlobalObject*, EncodedJSValue, EncodedJSValue, EncodedJSValue, UniquedStringImpl*) WTF_INTERNAL;
154void JIT_OPERATION operationPutByIdWithThisStrict(JSGlobalObject*, EncodedJSValue, EncodedJSValue, EncodedJSValue, UniquedStringImpl*) WTF_INTERNAL;
155void JIT_OPERATION operationPutByValWithThis(JSGlobalObject*, EncodedJSValue, EncodedJSValue, EncodedJSValue, EncodedJSValue) WTF_INTERNAL;
156void JIT_OPERATION operationPutByValWithThisStrict(JSGlobalObject*, EncodedJSValue, EncodedJSValue, EncodedJSValue, EncodedJSValue) WTF_INTERNAL;
157void JIT_OPERATION operationDefineDataProperty(JSGlobalObject*, JSObject*, EncodedJSValue, EncodedJSValue, int32_t) WTF_INTERNAL;
158void JIT_OPERATION operationDefineDataPropertyString(JSGlobalObject*, JSObject*, JSString*, EncodedJSValue, int32_t) WTF_INTERNAL;
159void JIT_OPERATION operationDefineDataPropertyStringIdent(JSGlobalObject*, JSObject*, UniquedStringImpl*, EncodedJSValue, int32_t) WTF_INTERNAL;
160void JIT_OPERATION operationDefineDataPropertySymbol(JSGlobalObject*, JSObject*, Symbol*, EncodedJSValue, int32_t) WTF_INTERNAL;
161void JIT_OPERATION operationDefineAccessorProperty(JSGlobalObject*, JSObject*, EncodedJSValue, JSObject*, JSObject*, int32_t) WTF_INTERNAL;
162void JIT_OPERATION operationDefineAccessorPropertyString(JSGlobalObject*, JSObject*, JSString*, JSObject*, JSObject*, int32_t) WTF_INTERNAL;
163void JIT_OPERATION operationDefineAccessorPropertyStringIdent(JSGlobalObject*, JSObject*, UniquedStringImpl*, JSObject*, JSObject*, int32_t) WTF_INTERNAL;
164void JIT_OPERATION operationDefineAccessorPropertySymbol(JSGlobalObject*, JSObject*, Symbol*, JSObject*, JSObject*, int32_t) WTF_INTERNAL;
165EncodedJSValue JIT_OPERATION operationArrayPush(JSGlobalObject*, EncodedJSValue encodedValue, JSArray*) WTF_INTERNAL;
166EncodedJSValue JIT_OPERATION operationArrayPushMultiple(JSGlobalObject*, JSArray*, void* buffer, int32_t elementCount) WTF_INTERNAL;
167EncodedJSValue JIT_OPERATION operationArrayPushDouble(JSGlobalObject*, double value, JSArray*) WTF_INTERNAL;
168EncodedJSValue JIT_OPERATION operationArrayPushDoubleMultiple(JSGlobalObject*, JSArray*, void* buffer, int32_t elementCount) WTF_INTERNAL;
169EncodedJSValue JIT_OPERATION operationArrayPop(JSGlobalObject*, JSArray*) WTF_INTERNAL;
170EncodedJSValue JIT_OPERATION operationArrayPopAndRecoverLength(JSGlobalObject*, JSArray*) WTF_INTERNAL;
171EncodedJSValue JIT_OPERATION operationRegExpExecString(JSGlobalObject*, RegExpObject*, JSString*) WTF_INTERNAL;
172EncodedJSValue JIT_OPERATION operationRegExpExec(JSGlobalObject*, RegExpObject*, EncodedJSValue) WTF_INTERNAL;
173EncodedJSValue JIT_OPERATION operationRegExpExecGeneric(JSGlobalObject*, EncodedJSValue, EncodedJSValue) WTF_INTERNAL;
174EncodedJSValue JIT_OPERATION operationRegExpExecNonGlobalOrSticky(JSGlobalObject*, RegExp*, JSString*) WTF_INTERNAL;
175EncodedJSValue JIT_OPERATION operationRegExpMatchFastGlobalString(JSGlobalObject*, RegExp*, JSString*) WTF_INTERNAL;
176EncodedJSValue JIT_OPERATION operationRegExpMatchFastString(JSGlobalObject*, RegExpObject*, JSString*) WTF_INTERNAL;
177// These comparisons return a boolean within a size_t such that the value is zero extended to fill the register.
178size_t JIT_OPERATION operationRegExpTestString(JSGlobalObject*, RegExpObject*, JSString*) WTF_INTERNAL;
179size_t JIT_OPERATION operationRegExpTest(JSGlobalObject*, RegExpObject*, EncodedJSValue) WTF_INTERNAL;
180size_t JIT_OPERATION operationRegExpTestGeneric(JSGlobalObject*, EncodedJSValue, EncodedJSValue) WTF_INTERNAL;
181size_t JIT_OPERATION operationCompareStrictEqCell(JSGlobalObject*, JSCell* op1, JSCell* op2) WTF_INTERNAL;
182JSCell* JIT_OPERATION operationSubBigInt(JSGlobalObject*, JSCell* op1, JSCell* op2) WTF_INTERNAL;
183JSCell* JIT_OPERATION operationMulBigInt(JSGlobalObject*, JSCell* op1, JSCell* op2) WTF_INTERNAL;
184JSCell* JIT_OPERATION operationModBigInt(JSGlobalObject*, JSCell* op1, JSCell* op2) WTF_INTERNAL;
185JSCell* JIT_OPERATION operationDivBigInt(JSGlobalObject*, JSCell* op1, JSCell* op2) WTF_INTERNAL;
186JSCell* JIT_OPERATION operationPowBigInt(JSGlobalObject*, JSCell* op1, JSCell* op2) WTF_INTERNAL;
187JSCell* JIT_OPERATION operationBitAndBigInt(JSGlobalObject*, JSCell* op1, JSCell* op2) WTF_INTERNAL;
188JSCell* JIT_OPERATION operationBitNotBigInt(JSGlobalObject*, JSCell* op1) WTF_INTERNAL;
189JSCell* JIT_OPERATION operationBitOrBigInt(JSGlobalObject*, JSCell* op1, JSCell* op2) WTF_INTERNAL;
190JSCell* JIT_OPERATION operationBitLShiftBigInt(JSGlobalObject*, JSCell* op1, JSCell* op2) WTF_INTERNAL;
191JSCell* JIT_OPERATION operationAddBigInt(JSGlobalObject*, JSCell* op1, JSCell* op2) WTF_INTERNAL;
192JSCell* JIT_OPERATION operationBitRShiftBigInt(JSGlobalObject*, JSCell* op1, JSCell* op2) WTF_INTERNAL;
193JSCell* JIT_OPERATION operationBitXorBigInt(JSGlobalObject*, JSCell* op1, JSCell* op2) WTF_INTERNAL;
194size_t JIT_OPERATION operationSameValue(JSGlobalObject*, EncodedJSValue, EncodedJSValue) WTF_INTERNAL;
195JSCell* JIT_OPERATION operationCreateActivationDirect(VM*, Structure*, JSScope*, SymbolTable*, EncodedJSValue);
196JSCell* JIT_OPERATION operationCreateDirectArguments(VM*, Structure*, uint32_t length, uint32_t minCapacity);
197JSCell* JIT_OPERATION operationCreateDirectArgumentsDuringExit(VM*, InlineCallFrame*, JSFunction*, uint32_t argumentCount);
198JSCell* JIT_OPERATION operationCreateScopedArguments(JSGlobalObject*, Structure*, Register* argumentStart, uint32_t length, JSFunction* callee, JSLexicalEnvironment*);
199JSCell* JIT_OPERATION operationCreateClonedArgumentsDuringExit(VM*, InlineCallFrame*, JSFunction*, uint32_t argumentCount);
200JSCell* JIT_OPERATION operationCreateClonedArguments(JSGlobalObject*, Structure*, Register* argumentStart, uint32_t length, JSFunction* callee);
201JSCell* JIT_OPERATION operationCreateRest(JSGlobalObject*, Register* argumentStart, unsigned numberOfArgumentsToSkip, unsigned arraySize);
202JSCell* JIT_OPERATION operationNewArrayBuffer(VM*, Structure*, JSCell*) WTF_INTERNAL;
203JSCell* JIT_OPERATION operationSetAdd(JSGlobalObject*, JSCell*, EncodedJSValue, int32_t) WTF_INTERNAL;
204JSCell* JIT_OPERATION operationMapSet(JSGlobalObject*, JSCell*, EncodedJSValue, EncodedJSValue, int32_t) WTF_INTERNAL;
205void JIT_OPERATION operationWeakSetAdd(VM*, JSCell*, JSCell*, int32_t) WTF_INTERNAL;
206void JIT_OPERATION operationWeakMapSet(VM*, JSCell*, JSCell*, EncodedJSValue, int32_t) WTF_INTERNAL;
207double JIT_OPERATION operationFModOnInts(int32_t, int32_t) WTF_INTERNAL;
208size_t JIT_OPERATION operationObjectIsObject(JSGlobalObject*, JSCell*) WTF_INTERNAL;
209size_t JIT_OPERATION operationObjectIsFunction(JSGlobalObject*, JSCell*) WTF_INTERNAL;
210JSCell* JIT_OPERATION operationTypeOfObject(JSGlobalObject*, JSCell*) WTF_INTERNAL;
211int32_t JIT_OPERATION operationTypeOfObjectAsTypeofType(JSGlobalObject*, JSCell*) WTF_INTERNAL;
212char* JIT_OPERATION operationAllocateSimplePropertyStorageWithInitialCapacity(VM*) WTF_INTERNAL;
213char* JIT_OPERATION operationAllocateSimplePropertyStorage(VM*, size_t newSize) WTF_INTERNAL;
214char* JIT_OPERATION operationAllocateComplexPropertyStorageWithInitialCapacity(VM*, JSObject*) WTF_INTERNAL;
215char* JIT_OPERATION operationAllocateComplexPropertyStorage(VM*, JSObject*, size_t newSize) WTF_INTERNAL;
216char* JIT_OPERATION operationEnsureInt32(VM*, JSCell*);
217char* JIT_OPERATION operationEnsureDouble(VM*, JSCell*);
218char* JIT_OPERATION operationEnsureContiguous(VM*, JSCell*);
219char* JIT_OPERATION operationEnsureArrayStorage(VM*, JSCell*);
220StringImpl* JIT_OPERATION operationResolveRope(JSGlobalObject*, JSString*);
221JSString* JIT_OPERATION operationSingleCharacterString(VM*, int32_t);
222
223JSCell* JIT_OPERATION operationStringSubstr(JSGlobalObject*, JSCell*, int32_t, int32_t);
224JSCell* JIT_OPERATION operationStringSlice(JSGlobalObject*, JSCell*, int32_t, int32_t);
225JSString* JIT_OPERATION operationStringValueOf(JSGlobalObject*, EncodedJSValue);
226JSString* JIT_OPERATION operationToLowerCase(JSGlobalObject*, JSString*, uint32_t);
227
228char* JIT_OPERATION operationInt32ToString(JSGlobalObject*, int32_t, int32_t);
229char* JIT_OPERATION operationInt52ToString(JSGlobalObject*, int64_t, int32_t);
230char* JIT_OPERATION operationDoubleToString(JSGlobalObject*, double, int32_t);
231char* JIT_OPERATION operationInt32ToStringWithValidRadix(JSGlobalObject*, int32_t, int32_t);
232char* JIT_OPERATION operationInt52ToStringWithValidRadix(JSGlobalObject*, int64_t, int32_t);
233char* JIT_OPERATION operationDoubleToStringWithValidRadix(JSGlobalObject*, double, int32_t);
234
235int32_t JIT_OPERATION operationMapHash(JSGlobalObject*, EncodedJSValue input);
236JSCell* JIT_OPERATION operationJSMapFindBucket(JSGlobalObject*, JSCell*, EncodedJSValue, int32_t);
237JSCell* JIT_OPERATION operationJSSetFindBucket(JSGlobalObject*, JSCell*, EncodedJSValue, int32_t);
238
239EncodedJSValue JIT_OPERATION operationParseIntNoRadixGeneric(JSGlobalObject*, EncodedJSValue);
240EncodedJSValue JIT_OPERATION operationParseIntStringNoRadix(JSGlobalObject*, JSString*);
241EncodedJSValue JIT_OPERATION operationParseIntString(JSGlobalObject*, JSString*, int32_t);
242EncodedJSValue JIT_OPERATION operationParseIntGeneric(JSGlobalObject*, EncodedJSValue, int32_t);
243
244Symbol* JIT_OPERATION operationNewSymbol(VM*);
245Symbol* JIT_OPERATION operationNewSymbolWithDescription(JSGlobalObject*, JSString*);
246JSCell* JIT_OPERATION operationNewStringObject(VM*, JSString*, Structure*);
247JSString* JIT_OPERATION operationToStringOnCell(JSGlobalObject*, JSCell*);
248JSString* JIT_OPERATION operationToString(JSGlobalObject*, EncodedJSValue);
249JSString* JIT_OPERATION operationCallStringConstructorOnCell(JSGlobalObject*, JSCell*);
250JSString* JIT_OPERATION operationCallStringConstructor(JSGlobalObject*, EncodedJSValue);
251JSString* JIT_OPERATION operationMakeRope2(JSGlobalObject*, JSString*, JSString*);
252JSString* JIT_OPERATION operationMakeRope3(JSGlobalObject*, JSString*, JSString*, JSString*);
253JSString* JIT_OPERATION operationStrCat2(JSGlobalObject*, EncodedJSValue, EncodedJSValue);
254JSString* JIT_OPERATION operationStrCat3(JSGlobalObject*, EncodedJSValue, EncodedJSValue, EncodedJSValue);
255char* JIT_OPERATION operationFindSwitchImmTargetForDouble(VM*, EncodedJSValue, size_t tableIndex);
256char* JIT_OPERATION operationSwitchString(JSGlobalObject*, size_t tableIndex, JSString*);
257int32_t JIT_OPERATION operationSwitchStringAndGetBranchOffset(JSGlobalObject*, size_t tableIndex, JSString*);
258uintptr_t JIT_OPERATION operationCompareStringImplLess(StringImpl*, StringImpl*);
259uintptr_t JIT_OPERATION operationCompareStringImplLessEq(StringImpl*, StringImpl*);
260uintptr_t JIT_OPERATION operationCompareStringImplGreater(StringImpl*, StringImpl*);
261uintptr_t JIT_OPERATION operationCompareStringImplGreaterEq(StringImpl*, StringImpl*);
262uintptr_t JIT_OPERATION operationCompareStringLess(JSGlobalObject*, JSString*, JSString*);
263uintptr_t JIT_OPERATION operationCompareStringLessEq(JSGlobalObject*, JSString*, JSString*);
264uintptr_t JIT_OPERATION operationCompareStringGreater(JSGlobalObject*, JSString*, JSString*);
265uintptr_t JIT_OPERATION operationCompareStringGreaterEq(JSGlobalObject*, JSString*, JSString*);
266void JIT_OPERATION operationNotifyWrite(VM*, WatchpointSet*);
267void JIT_OPERATION operationThrowStackOverflowForVarargs(JSGlobalObject*) WTF_INTERNAL;
268int32_t JIT_OPERATION operationSizeOfVarargs(JSGlobalObject*, EncodedJSValue arguments, uint32_t firstVarArgOffset);
269void JIT_OPERATION operationLoadVarargs(JSGlobalObject*, int32_t firstElementDest, EncodedJSValue arguments, uint32_t offset, uint32_t length, uint32_t mandatoryMinimum);
270void JIT_OPERATION operationThrowDFG(JSGlobalObject*, EncodedJSValue);
271void JIT_OPERATION operationThrowStaticError(JSGlobalObject*, JSString*, uint32_t);
272
273int32_t JIT_OPERATION operationHasOwnProperty(JSGlobalObject*, JSObject*, EncodedJSValue);
274
275int32_t JIT_OPERATION operationArrayIndexOfString(JSGlobalObject*, Butterfly*, JSString*, int32_t);
276int32_t JIT_OPERATION operationArrayIndexOfValue(JSGlobalObject*, Butterfly*, EncodedJSValue, int32_t);
277int32_t JIT_OPERATION operationArrayIndexOfValueDouble(JSGlobalObject*, Butterfly*, EncodedJSValue, int32_t);
278int32_t JIT_OPERATION operationArrayIndexOfValueInt32OrContiguous(JSGlobalObject*, Butterfly*, EncodedJSValue, int32_t);
279
280JSCell* JIT_OPERATION operationSpreadFastArray(JSGlobalObject*, JSCell*);
281JSCell* JIT_OPERATION operationSpreadGeneric(JSGlobalObject*, JSCell*);
282JSCell* JIT_OPERATION operationNewArrayWithSpreadSlow(JSGlobalObject*, void*, uint32_t);
283JSCell* JIT_OPERATION operationCreateFixedArray(JSGlobalObject*, unsigned length);
284
285JSCell* JIT_OPERATION operationResolveScope(JSGlobalObject*, JSScope*, UniquedStringImpl*);
286EncodedJSValue JIT_OPERATION operationResolveScopeForHoistingFuncDeclInEval(JSGlobalObject*, JSScope*, UniquedStringImpl*);
287EncodedJSValue JIT_OPERATION operationGetDynamicVar(JSGlobalObject*, JSObject* scope, UniquedStringImpl*, unsigned);
288void JIT_OPERATION operationPutDynamicVarStrict(JSGlobalObject*, JSObject* scope, EncodedJSValue, UniquedStringImpl*, unsigned);
289void JIT_OPERATION operationPutDynamicVarNonStrict(JSGlobalObject*, JSObject* scope, EncodedJSValue, UniquedStringImpl*, unsigned);
290
291int64_t JIT_OPERATION operationConvertBoxedDoubleToInt52(EncodedJSValue);
292int64_t JIT_OPERATION operationConvertDoubleToInt52(double);
293
294int32_t JIT_OPERATION operationNumberIsInteger(JSGlobalObject*, EncodedJSValue);
295
296size_t JIT_OPERATION operationDefaultHasInstance(JSGlobalObject*, JSCell* value, JSCell* proto);
297
298char* JIT_OPERATION operationNewRawObject(VM*, Structure*, int32_t, Butterfly*) WTF_INTERNAL;
299JSCell* JIT_OPERATION operationNewObjectWithButterfly(VM*, Structure*, Butterfly*) WTF_INTERNAL;
300JSCell* JIT_OPERATION operationNewObjectWithButterflyWithIndexingHeaderAndVectorLength(VM*, Structure*, unsigned length, Butterfly*) WTF_INTERNAL;
301
302void JIT_OPERATION operationLinkDirectCall(CallLinkInfo*, JSFunction*) WTF_INTERNAL;
303
304EncodedJSValue JIT_OPERATION operationDateGetFullYear(VM*, DateInstance*) WTF_INTERNAL;
305EncodedJSValue JIT_OPERATION operationDateGetUTCFullYear(VM*, DateInstance*) WTF_INTERNAL;
306EncodedJSValue JIT_OPERATION operationDateGetMonth(VM*, DateInstance*) WTF_INTERNAL;
307EncodedJSValue JIT_OPERATION operationDateGetUTCMonth(VM*, DateInstance*) WTF_INTERNAL;
308EncodedJSValue JIT_OPERATION operationDateGetDate(VM*, DateInstance*) WTF_INTERNAL;
309EncodedJSValue JIT_OPERATION operationDateGetUTCDate(VM*, DateInstance*) WTF_INTERNAL;
310EncodedJSValue JIT_OPERATION operationDateGetDay(VM*, DateInstance*) WTF_INTERNAL;
311EncodedJSValue JIT_OPERATION operationDateGetUTCDay(VM*, DateInstance*) WTF_INTERNAL;
312EncodedJSValue JIT_OPERATION operationDateGetHours(VM*, DateInstance*) WTF_INTERNAL;
313EncodedJSValue JIT_OPERATION operationDateGetUTCHours(VM*, DateInstance*) WTF_INTERNAL;
314EncodedJSValue JIT_OPERATION operationDateGetMinutes(VM*, DateInstance*) WTF_INTERNAL;
315EncodedJSValue JIT_OPERATION operationDateGetUTCMinutes(VM*, DateInstance*) WTF_INTERNAL;
316EncodedJSValue JIT_OPERATION operationDateGetSeconds(VM*, DateInstance*) WTF_INTERNAL;
317EncodedJSValue JIT_OPERATION operationDateGetUTCSeconds(VM*, DateInstance*) WTF_INTERNAL;
318EncodedJSValue JIT_OPERATION operationDateGetTimezoneOffset(VM*, DateInstance*) WTF_INTERNAL;
319EncodedJSValue JIT_OPERATION operationDateGetYear(VM*, DateInstance*) WTF_INTERNAL;
320
321void JIT_OPERATION operationProcessTypeProfilerLogDFG(VM*) WTF_INTERNAL;
322
323void JIT_OPERATION operationTriggerReoptimizationNow(CodeBlock* baselineCodeBlock, CodeBlock* optiimzedCodeBlock, OSRExitBase*) WTF_INTERNAL;
324void triggerReoptimizationNow(CodeBlock* baselineCodeBlock, CodeBlock* optiimzedCodeBlock, OSRExitBase*); // This is not JIT_OPERATION.
325
326#if USE(JSVALUE32_64)
327double JIT_OPERATION operationRandom(JSGlobalObject*);
328#endif
329
330#if ENABLE(FTL_JIT)
331void JIT_OPERATION operationTriggerTierUpNow(VM*) WTF_INTERNAL;
332void JIT_OPERATION operationTriggerTierUpNowInLoop(VM*, unsigned bytecodeIndexBits) WTF_INTERNAL;
333char* JIT_OPERATION operationTriggerOSREntryNow(VM*, unsigned bytecodeIndexBits) WTF_INTERNAL;
334#endif // ENABLE(FTL_JIT)
335
336} // extern "C"
337
338inline auto operationNewTypedArrayWithSizeForType(TypedArrayType type) -> decltype(&operationNewInt8ArrayWithSize)
339{
340 switch (type) {
341 case TypeInt8:
342 return operationNewInt8ArrayWithSize;
343 case TypeInt16:
344 return operationNewInt16ArrayWithSize;
345 case TypeInt32:
346 return operationNewInt32ArrayWithSize;
347 case TypeUint8:
348 return operationNewUint8ArrayWithSize;
349 case TypeUint8Clamped:
350 return operationNewUint8ClampedArrayWithSize;
351 case TypeUint16:
352 return operationNewUint16ArrayWithSize;
353 case TypeUint32:
354 return operationNewUint32ArrayWithSize;
355 case TypeFloat32:
356 return operationNewFloat32ArrayWithSize;
357 case TypeFloat64:
358 return operationNewFloat64ArrayWithSize;
359 case NotTypedArray:
360 case TypeDataView:
361 break;
362 }
363 RELEASE_ASSERT_NOT_REACHED();
364 return nullptr;
365}
366
367inline auto operationNewTypedArrayWithOneArgumentForType(TypedArrayType type) -> decltype(&operationNewInt8ArrayWithOneArgument)
368{
369 switch (type) {
370 case TypeInt8:
371 return operationNewInt8ArrayWithOneArgument;
372 case TypeInt16:
373 return operationNewInt16ArrayWithOneArgument;
374 case TypeInt32:
375 return operationNewInt32ArrayWithOneArgument;
376 case TypeUint8:
377 return operationNewUint8ArrayWithOneArgument;
378 case TypeUint8Clamped:
379 return operationNewUint8ClampedArrayWithOneArgument;
380 case TypeUint16:
381 return operationNewUint16ArrayWithOneArgument;
382 case TypeUint32:
383 return operationNewUint32ArrayWithOneArgument;
384 case TypeFloat32:
385 return operationNewFloat32ArrayWithOneArgument;
386 case TypeFloat64:
387 return operationNewFloat64ArrayWithOneArgument;
388 case NotTypedArray:
389 case TypeDataView:
390 break;
391 }
392 RELEASE_ASSERT_NOT_REACHED();
393 return nullptr;
394}
395
396} } // namespace JSC::DFG
397
398#endif
399