• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef ECMASCRIPT_COMPILER_STUB_BUILDER_H
17 #define ECMASCRIPT_COMPILER_STUB_BUILDER_H
18 
19 #include "ecmascript/base/config.h"
20 #include "ecmascript/compiler/call_signature.h"
21 #include "ecmascript/compiler/circuit_builder.h"
22 #include "ecmascript/compiler/lcr_gate_meta_data.h"
23 #include "ecmascript/compiler/profiler_operation.h"
24 #include "ecmascript/compiler/share_gate_meta_data.h"
25 #include "ecmascript/compiler/variable_type.h"
26 #include "ecmascript/ic/mega_ic_cache.h"
27 
28 namespace panda::ecmascript::kungfu {
29 struct StringInfoGateRef;
30 using namespace panda::ecmascript;
31 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
32 #define DEFVARIABLE(varname, type, val) Variable varname(GetEnvironment(), type, NextVariableId(), val)
33 
34 #define SUBENTRY(messageId, condition)                                              \
35     GateRef glueArg = PtrArgument(0);                                               \
36     auto env = GetEnvironment();                                                    \
37     Label subEntry(env);                                                            \
38     env->SubCfgEntry(&subEntry);                                                    \
39     Label nextLabel(env);                                                           \
40     Assert(messageId, __LINE__, glueArg, condition, &nextLabel);                    \
41     Bind(&nextLabel)
42 #define SUBENTRY_WITH_GLUE(messageId, condition, glueArg)                           \
43     auto env = GetEnvironment();                                                    \
44     Label subEntry(env);                                                            \
45     env->SubCfgEntry(&subEntry);                                                    \
46     Label nextLabel(env);                                                           \
47     Assert(messageId, __LINE__, glueArg, condition, &nextLabel);                    \
48     Bind(&nextLabel)
49 
50 #ifndef NDEBUG
51 #define ASM_ASSERT(messageId, condition)                                            \
52     if (!GetEnvironment()->GetCircuit()->IsOptimizedOrFastJit() &&                  \
53         !GetEnvironment()->IsBaselineBuiltin()) {                                   \
54         SUBENTRY(messageId, condition);                                             \
55         EXITENTRY();                                                                \
56     }
57 #define ASM_ASSERT_WITH_GLUE(messageId, condition, glue)                            \
58     SUBENTRY_WITH_GLUE(messageId, condition, glue)
59 #elif defined(ENABLE_ASM_ASSERT)
60 #define ASM_ASSERT(messageId, condition)                                            \
61     if (!GetEnvironment()->GetCircuit()->IsOptimizedOrFastJit() &&                  \
62         !GetEnvironment()->IsBaselineBuiltin()) {                                   \
63         SUBENTRY(messageId, condition);                                             \
64         EXITENTRY();                                                                \
65     }
66 #define ASM_ASSERT_WITH_GLUE(messageId, condition, glue)                            \
67     SUBENTRY_WITH_GLUE(messageId, condition, glue)
68 #else
69 #define ASM_ASSERT(messageId, ...) ((void)0)
70 #define ASM_ASSERT_WITH_GLUE(messageId, ...) ((void)0)
71 #endif
72 
73 #ifndef NDEBUG
74 #define EXITENTRY()                                                                 \
75     GetEnvironment()->SubCfgExit()
76 #elif defined(ENABLE_ASM_ASSERT)
77 #define EXITENTRY()                                                                 \
78     GetEnvironment()->SubCfgExit()
79 #else
80 #define EXITENTRY() ((void)0)
81 #endif
82 
83 class StubBuilder {
84 public:
StubBuilder(StubBuilder * parent)85     explicit StubBuilder(StubBuilder *parent)
86         : callSignature_(parent->GetCallSignature()), env_(parent->GetEnvironment()) {}
StubBuilder(CallSignature * callSignature,Environment * env)87     StubBuilder(CallSignature *callSignature, Environment *env)
88         : callSignature_(callSignature), env_(env) {}
StubBuilder(Environment * env)89     explicit StubBuilder(Environment *env)
90         : env_(env) {}
91     virtual ~StubBuilder() = default;
92     NO_MOVE_SEMANTIC(StubBuilder);
93     NO_COPY_SEMANTIC(StubBuilder);
94     virtual void GenerateCircuit() = 0;
GetEnvironment()95     Environment *GetEnvironment() const
96     {
97         return env_;
98     }
GetCallSignature()99     CallSignature *GetCallSignature() const
100     {
101         return callSignature_;
102     }
103     int NextVariableId();
104     // constant
105     GateRef Int8(int8_t value);
106     GateRef Int16(int16_t value);
107     GateRef Int32(int32_t value);
108     GateRef Int64(int64_t value);
109     GateRef TaggedInt(int32_t value);
110     GateRef StringPtr(std::string_view str);
111     GateRef IntPtr(int64_t value);
112     GateRef IntPtrSize();
113     GateRef RelocatableData(uint64_t value);
114     GateRef True();
115     GateRef False();
116     GateRef Boolean(bool value);
117     GateRef Double(double value);
118     GateRef Undefined();
119     GateRef Hole();
120     GateRef SpecialHole();
121     GateRef Null();
122     GateRef NullPtr();
123     GateRef Exception();
124     // parameter
125     GateRef Argument(size_t index);
126     GateRef Int1Argument(size_t index);
127     GateRef Int32Argument(size_t index);
128     GateRef Int64Argument(size_t index);
129     GateRef TaggedArgument(size_t index);
130     GateRef TaggedPointerArgument(size_t index);
131     GateRef PtrArgument(size_t index);
132     GateRef Float32Argument(size_t index);
133     GateRef Float64Argument(size_t index);
134     GateRef Alloca(int size);
135     // control flow
136     GateRef Return(GateRef value);
137     GateRef Return();
138     void Bind(Label *label);
139     void Jump(Label *label);
140     void Branch(GateRef condition, Label *trueLabel, Label *falseLabel,
141                        uint32_t trueWeight = BranchWeight::ONE_WEIGHT, uint32_t falseWeight = BranchWeight::ONE_WEIGHT,
142                        const char *comment = nullptr);
143 
144     void Switch(GateRef index, Label *defaultLabel,
145                 const int64_t *keysValue, Label *keysLabel, int numberOfKeys);
146     void Switch(GateRef index, Label *defaultLabel,
147                 const int64_t *keysValue, Label * const *keysLabel, int numberOfKeys);
148     void LoopBegin(Label *loopHead);
149     void LoopEnd(Label *loopHead);
150     // LoopEnd with safepoint
151     void LoopEnd(Label *loopHead, Environment *env, GateRef glue);
152     GateRef CheckSuspend(GateRef glue);
153     // call operation
154     GateRef CallRuntime(GateRef glue, int index, const std::vector<GateRef>& args);
155     GateRef CallRuntime(GateRef glue, int index, GateRef argc, GateRef argv);
156     GateRef CallNGCRuntime(GateRef glue, int index,
157                            const std::vector<GateRef>& args, GateRef hir = Circuit::NullGate());
158     GateRef FastCallOptimized(GateRef glue, GateRef code,
159                               const std::vector<GateRef>& args, GateRef hir = Circuit::NullGate());
160     GateRef CallOptimized(GateRef glue, GateRef code,
161                           const std::vector<GateRef>& args, GateRef hir = Circuit::NullGate());
162     GateRef GetAotCodeAddr(GateRef jsFunc);
163     GateRef CallStub(GateRef glue, int index, const std::initializer_list<GateRef>& args);
164     GateRef CallCommonStub(GateRef glue, int index, const std::initializer_list<GateRef>& args);
165     GateRef CallBuiltinRuntime(GateRef glue, const std::initializer_list<GateRef>& args, bool isNew = false);
166     GateRef CallBuiltinRuntimeWithNewTarget(GateRef glue, const std::initializer_list<GateRef>& args);
167     void DebugPrint(GateRef thread, std::initializer_list<GateRef> args);
168     void FatalPrint(GateRef thread, std::initializer_list<GateRef> args);
169     // memory
170     GateRef Load(VariableType type, GateRef base, GateRef offset);
171     GateRef Load(VariableType type, GateRef base);
172     void Store(VariableType type,
173                GateRef glue,
174                GateRef base,
175                GateRef offset,
176                GateRef value,
177                MemoryAttribute mAttr = MemoryAttribute::Default());
178     // arithmetic
179     GateRef TaggedCastToIntPtr(GateRef x);
180     GateRef Int16Add(GateRef x, GateRef y);
181     GateRef Int32Add(GateRef x, GateRef y);
182     GateRef Int64Add(GateRef x, GateRef y);
183     GateRef DoubleAdd(GateRef x, GateRef y);
184     GateRef PtrAdd(GateRef x, GateRef y);
185     GateRef PtrSub(GateRef x, GateRef y);
186     GateRef PtrMul(GateRef x, GateRef y);
187     GateRef IntPtrEqual(GateRef x, GateRef y);
188     GateRef Int16Sub(GateRef x, GateRef y);
189     GateRef Int32Sub(GateRef x, GateRef y);
190     GateRef Int64Sub(GateRef x, GateRef y);
191     GateRef DoubleSub(GateRef x, GateRef y);
192     GateRef Int32Mul(GateRef x, GateRef y);
193     GateRef Int64Mul(GateRef x, GateRef y);
194     GateRef DoubleMul(GateRef x, GateRef y);
195     GateRef DoubleDiv(GateRef x, GateRef y);
196     GateRef Int32Div(GateRef x, GateRef y);
197     GateRef Int32Mod(GateRef x, GateRef y);
198     GateRef DoubleMod(GateRef x, GateRef y);
199     GateRef Int64Div(GateRef x, GateRef y);
200     GateRef IntPtrDiv(GateRef x, GateRef y);
201     GateRef Int32Min(GateRef x, GateRef y);
202     GateRef Int32Max(GateRef x, GateRef y);
203     // bit operation
204     GateRef Int16Or(GateRef x, GateRef y);
205     GateRef Int16And(GateRef x, GateRef y);
206     GateRef Int32Or(GateRef x, GateRef y);
207     GateRef Int8And(GateRef x, GateRef y);
208     GateRef Int8Xor(GateRef x, GateRef y);
209     GateRef Int32And(GateRef x, GateRef y);
210     GateRef IntPtrAnd(GateRef x, GateRef y);
211     GateRef BitAnd(GateRef x, GateRef y);
212     GateRef BitOr(GateRef x, GateRef y);
213     GateRef Int32Not(GateRef x);
214     GateRef IntPtrNot(GateRef x);
215     GateRef BoolNot(GateRef x);
216     GateRef Int32Xor(GateRef x, GateRef y);
217     GateRef FixLoadType(GateRef x);
218     GateRef Int64Or(GateRef x, GateRef y);
219     GateRef IntPtrOr(GateRef x, GateRef y);
220     GateRef Int64And(GateRef x, GateRef y);
221     GateRef Int64Xor(GateRef x, GateRef y);
222     GateRef Int64Not(GateRef x);
223     GateRef Int16LSL(GateRef x, GateRef y);
224     GateRef Int32LSL(GateRef x, GateRef y);
225     GateRef Int64LSL(GateRef x, GateRef y);
226     GateRef IntPtrLSL(GateRef x, GateRef y);
227     GateRef Int8LSR(GateRef x, GateRef y);
228     GateRef Int16LSR(GateRef x, GateRef y);
229     GateRef Int32LSR(GateRef x, GateRef y);
230     GateRef Int64LSR(GateRef x, GateRef y);
231     GateRef IntPtrLSR(GateRef x, GateRef y);
232     GateRef Int32ASR(GateRef x, GateRef y);
233     GateRef TaggedIsInt(GateRef x);
234     GateRef TaggedIsDouble(GateRef x);
235     GateRef TaggedIsObject(GateRef x);
236     GateRef TaggedIsNumber(GateRef x);
237     GateRef TaggedIsNumeric(GateRef x);
238     GateRef TaggedIsHole(GateRef x);
239     GateRef TaggedIsNotHole(GateRef x);
240     GateRef TaggedIsUndefined(GateRef x);
241     GateRef TaggedIsException(GateRef x);
242     GateRef TaggedIsSpecial(GateRef x);
243     GateRef TaggedIsRegularObject(GateRef x);
244     GateRef TaggedIsHeapObject(GateRef x);
245     GateRef TaggedIsAccessor(GateRef x);
246     GateRef TaggedIsInternalAccessor(GateRef x);
247     GateRef ObjectAddressToRange(GateRef x);
248     GateRef RegionInSpace(GateRef region, RegionSpaceFlag space);
249     GateRef RegionInSpace(GateRef region, RegionSpaceFlag spaceBegin, RegionSpaceFlag spaceEnd);
250     GateRef InYoungGeneration(GateRef region);
251     GateRef InGeneralOldGeneration(GateRef region);
252     GateRef InSharedHeap(GateRef region);
253     GateRef InSharedSweepableSpace(GateRef region);
254     GateRef TaggedIsGeneratorObject(GateRef x);
255     GateRef TaggedIsJSArray(GateRef x);
256     GateRef IsTaggedArray(GateRef x);
257     GateRef TaggedIsAsyncGeneratorObject(GateRef x);
258     GateRef TaggedIsJSGlobalObject(GateRef x);
259     GateRef TaggedIsWeak(GateRef x);
260     GateRef TaggedIsPrototypeHandler(GateRef x);
261     GateRef TaggedIsStoreAOTHandler(GateRef x);
262     GateRef TaggedIsTransWithProtoHandler(GateRef x);
263     GateRef TaggedIsTransitionHandler(GateRef x);
264     GateRef TaggedIsString(GateRef obj);
265     GateRef TaggedIsStringIterator(GateRef obj);
266     GateRef TaggedIsSharedObj(GateRef obj);
267     GateRef BothAreString(GateRef x, GateRef y);
268     GateRef TaggedIsStringOrSymbol(GateRef obj);
269     GateRef TaggedIsSymbol(GateRef obj);
270     GateRef TaggedIsArrayIterator(GateRef obj);
271     GateRef TaggedIsArrayBuffer(GateRef obj);
272     GateRef TaggedIsProtoChangeMarker(GateRef obj);
273     GateRef GetNextPositionForHash(GateRef last, GateRef count, GateRef size);
274     GateRef DoubleIsNAN(GateRef x);
275     GateRef DoubleIsINF(GateRef x);
276     GateRef DoubleIsNanOrInf(GateRef x);
277     GateRef DoubleAbs(GateRef x);
278     GateRef DoubleIsInteger(GateRef x);
279     GateRef DoubleIsWithinInt32(GateRef x);
280     GateRef DoubleTrunc(GateRef x);
281     GateRef TaggedIsNull(GateRef x);
282     GateRef TaggedIsUndefinedOrNull(GateRef x);
283     GateRef TaggedIsUndefinedOrNullOrHole(GateRef x);
284     GateRef TaggedIsTrue(GateRef x);
285     GateRef TaggedIsFalse(GateRef x);
286     GateRef TaggedIsBoolean(GateRef x);
287     GateRef TaggedIsNativePointer(GateRef x);
288     GateRef TaggedGetInt(GateRef x);
289     GateRef NumberGetInt(GateRef glue, GateRef x);
290     GateRef TaggedGetNumber(GateRef x);
291     GateRef Int8ToTaggedInt(GateRef x);
292     GateRef Int16ToTaggedInt(GateRef x);
293     GateRef IntToTaggedPtr(GateRef x);
294     GateRef IntToTaggedInt(GateRef x);
295     GateRef Int64ToTaggedInt(GateRef x);
296     GateRef Int64ToTaggedIntPtr(GateRef x);
297     GateRef DoubleToTaggedDouble(GateRef x);
298     GateRef DoubleToTaggedDoublePtr(GateRef x);
299     GateRef BooleanToTaggedBooleanPtr(GateRef x);
300     GateRef TaggedPtrToTaggedDoublePtr(GateRef x);
301     GateRef TaggedPtrToTaggedIntPtr(GateRef x);
302     GateRef CastDoubleToInt64(GateRef x);
303     GateRef CastFloat32ToInt32(GateRef x);
304     GateRef TaggedTrue();
305     GateRef TaggedFalse();
306     GateRef TaggedUndefined();
307     GateRef Int64BitReverse(GateRef x);
308     GateRef Int32BitReverse(GateRef x);
309     GateRef Int16BitReverse(GateRef x);
310     GateRef Int8BitReverse(GateRef x);
311     // compare operation
312     GateRef Int8Equal(GateRef x, GateRef y);
313     GateRef Int8GreaterThanOrEqual(GateRef x, GateRef y);
314     GateRef Equal(GateRef x, GateRef y);
315     GateRef NotEqual(GateRef x, GateRef y);
316     GateRef Int32Equal(GateRef x, GateRef y);
317     GateRef Int32NotEqual(GateRef x, GateRef y);
318     GateRef Int64Equal(GateRef x, GateRef y);
319     GateRef DoubleEqual(GateRef x, GateRef y);
320     GateRef DoubleNotEqual(GateRef x, GateRef y);
321     GateRef Int64NotEqual(GateRef x, GateRef y);
322     GateRef DoubleLessThan(GateRef x, GateRef y);
323     GateRef DoubleLessThanOrEqual(GateRef x, GateRef y);
324     GateRef DoubleGreaterThan(GateRef x, GateRef y);
325     GateRef DoubleGreaterThanOrEqual(GateRef x, GateRef y);
326     GateRef Int32GreaterThan(GateRef x, GateRef y);
327     GateRef Int32LessThan(GateRef x, GateRef y);
328     GateRef Int32GreaterThanOrEqual(GateRef x, GateRef y);
329     GateRef Int32LessThanOrEqual(GateRef x, GateRef y);
330     GateRef Int32UnsignedGreaterThan(GateRef x, GateRef y);
331     GateRef Int32UnsignedLessThan(GateRef x, GateRef y);
332     GateRef Int32UnsignedGreaterThanOrEqual(GateRef x, GateRef y);
333     GateRef Int32UnsignedLessThanOrEqual(GateRef x, GateRef y);
334     GateRef Int64GreaterThan(GateRef x, GateRef y);
335     GateRef Int64LessThan(GateRef x, GateRef y);
336     GateRef Int64LessThanOrEqual(GateRef x, GateRef y);
337     GateRef Int64GreaterThanOrEqual(GateRef x, GateRef y);
338     GateRef Int64UnsignedLessThanOrEqual(GateRef x, GateRef y);
339     GateRef Int64UnsignedGreaterThan(GateRef x, GateRef y);
340     GateRef Int64UnsignedGreaterThanOrEqual(GateRef x, GateRef y);
341     GateRef IntPtrLessThan(GateRef x, GateRef y);
342     GateRef IntPtrLessThanOrEqual(GateRef x, GateRef y);
343     GateRef IntPtrGreaterThan(GateRef x, GateRef y);
344     GateRef IntPtrGreaterThanOrEqual(GateRef x, GateRef y);
345     // cast operation
346     GateRef ChangeInt64ToIntPtr(GateRef val);
347     GateRef ZExtInt32ToPtr(GateRef val);
348     GateRef ChangeIntPtrToInt32(GateRef val);
349     GateRef ToLength(GateRef glue, GateRef target);
350     GateRef ToIndex(GateRef glue, GateRef tagged);
351 
352     // math operation
353     GateRef Sqrt(GateRef x);
354     GateRef GetSetterFromAccessor(GateRef accessor);
355     GateRef GetElementsArray(GateRef object);
356     void SetElementsArray(VariableType type, GateRef glue, GateRef object, GateRef elementsArray,
357                           MemoryAttribute mAttr = MemoryAttribute::Default());
358     GateRef GetPropertiesArray(GateRef object);
359     // SetProperties in js_object.h
360     void SetPropertiesArray(VariableType type, GateRef glue, GateRef object, GateRef propsArray,
361                             MemoryAttribute mAttr = MemoryAttribute::Default());
362     GateRef GetHash(GateRef object);
363     void SetHash(GateRef glue, GateRef object, GateRef hash);
364     GateRef GetLengthOfTaggedArray(GateRef array);
365     GateRef GetLengthOfJSTypedArray(GateRef array);
366     GateRef GetExtraLengthOfTaggedArray(GateRef array);
367     void SetExtraLengthOfTaggedArray(GateRef glue, GateRef array, GateRef len);
368     // object operation
369     GateRef IsJSHClass(GateRef obj);
370     GateRef LoadHClass(GateRef object);
371     void CanNotConvertNotValidObject(GateRef obj);
372     void IsNotPropertyKey(GateRef obj);
373     GateRef CreateDataProperty(GateRef glue, GateRef obj, GateRef proKey, GateRef value);
374     GateRef CreateDataPropertyOrThrow(GateRef glue, GateRef onj, GateRef proKey, GateRef value);
375     GateRef DefineField(GateRef glue, GateRef obj, GateRef proKey, GateRef value);
376     void StoreHClass(GateRef glue, GateRef object, GateRef hClass);
377     void StoreHClassWithoutBarrier(GateRef glue, GateRef object, GateRef hClass);
378     void StoreBuiltinHClass(GateRef glue, GateRef object, GateRef hClass);
379     void StorePrototype(GateRef glue, GateRef hclass, GateRef prototype);
380     void CopyAllHClass(GateRef glue, GateRef dstHClass, GateRef scrHClass);
381     void FuncOrHClassCompare(GateRef glue, GateRef funcOrHClass,
382                              Label *match, Label *slowPath, size_t index);
383     void GetIteratorResult(GateRef glue, Variable *result, GateRef obj,
384                            Label *isPendingException, Label *noPendingException);
385     void HClassCompareAndCheckDetector(GateRef glue, GateRef hclass,
386                                        Label *match, Label *slowPath,
387                                        size_t indexHClass, size_t indexDetector);
388     void TryFastGetArrayIterator(GateRef glue, GateRef hclass, GateRef jsType,
389                                  Label *slowPath2, Label *matchArray);
390     void TryFastGetIterator(GateRef glue, GateRef obj, GateRef hclass,
391                             Variable &result, Label *slowPath, Label *exit,
392                             Label *isPendingException);
393     GateRef IsDetectorInvalid(GateRef glue, size_t indexDetector);
394     GateRef GetObjectType(GateRef hClass);
395     GateRef IsDictionaryMode(GateRef object);
396     GateRef IsDictionaryModeByHClass(GateRef hClass);
397     GateRef IsDictionaryElement(GateRef hClass);
398     GateRef IsJSArrayPrototypeModified(GateRef hClass);
399     GateRef IsStableElements(GateRef hClass);
400     GateRef HasConstructorByHClass(GateRef hClass);
401     GateRef HasConstructor(GateRef object);
402     GateRef IsClassConstructorFromBitField(GateRef bitfield);
403     GateRef IsClassConstructor(GateRef object);
404     GateRef IsClassPrototype(GateRef object);
405     GateRef IsExtensible(GateRef object);
406     GateRef TaggedObjectIsEcmaObject(GateRef obj);
407     GateRef IsEcmaObject(GateRef obj);
408     GateRef IsDataView(GateRef obj);
409     GateRef IsSymbol(GateRef obj);
410     GateRef IsString(GateRef obj);
411     GateRef IsLineString(GateRef obj);
412     GateRef IsSlicedString(GateRef obj);
413     GateRef IsConstantString(GateRef obj);
414     GateRef IsLiteralString(GateRef obj);
415     GateRef IsTreeString(GateRef obj);
416     GateRef TreeStringIsFlat(GateRef string);
417     GateRef TaggedIsBigInt(GateRef obj);
418     GateRef TaggedIsPropertyBox(GateRef obj);
419     GateRef TaggedObjectIsBigInt(GateRef obj);
420     GateRef IsJsProxy(GateRef obj);
421     GateRef IsJSShared(GateRef obj);
422     GateRef IsProfileTypeInfoCell0(GateRef obj);
423     GateRef IsJSGlobalObject(GateRef obj);
424     GateRef IsNativeModuleFailureInfo(GateRef obj);
425     GateRef IsModuleNamespace(GateRef obj);
426     GateRef IsNativePointer(GateRef obj);
427     GateRef IsSourceTextModule(GateRef obj);
428     GateRef IsSpecialContainer(GateRef obj);
429     GateRef IsJSPrimitiveRef(GateRef obj);
430     GateRef IsJSFunctionBase(GateRef obj);
431     GateRef IsConstructor(GateRef object);
432     GateRef IsBase(GateRef func);
433     GateRef IsDerived(GateRef func);
434     GateRef IsJsArray(GateRef obj);
435     GateRef IsJsSArray(GateRef obj);
436     GateRef IsByteArray(GateRef obj);
437     GateRef IsJsCOWArray(GateRef obj);
438     GateRef IsCOWArray(GateRef obj);
439     GateRef IsMutantTaggedArray(GateRef elements);
440     GateRef IsJSObject(GateRef obj);
441     GateRef IsEnumerable(GateRef attr);
442     GateRef IsWritable(GateRef attr);
443     GateRef IsConfigable(GateRef attr);
444     GateRef IsDefaultAttribute(GateRef attr);
445     GateRef IsArrayLengthWritable(GateRef glue, GateRef receiver);
446     GateRef IsArrayLengthWritableForNonDictMode(GateRef receiver);
447     GateRef IsAccessor(GateRef attr);
448     GateRef IsInlinedProperty(GateRef attr);
449     GateRef IsField(GateRef attr);
450     GateRef IsNonSharedStoreField(GateRef attr);
451     GateRef IsStoreShared(GateRef attr);
452     GateRef IsElement(GateRef attr);
453     GateRef IsStringElement(GateRef attr);
454     GateRef IsNumber(GateRef attr);
455     GateRef IsStringLength(GateRef attr);
456     GateRef IsTypedArrayElement(GateRef attr);
457     GateRef IsNonExist(GateRef attr);
458     GateRef IsJSAPIVector(GateRef attr);
459     GateRef IsJSAPIStack(GateRef obj);
460     GateRef IsJSAPIPlainArray(GateRef obj);
461     GateRef IsJSAPIQueue(GateRef obj);
462     GateRef IsJSAPIDeque(GateRef obj);
463     GateRef IsJSAPILightWeightMap(GateRef obj);
464     GateRef IsJSAPILightWeightSet(GateRef obj);
465     GateRef IsLinkedNode(GateRef obj);
466     GateRef IsJSAPIHashMap(GateRef obj);
467     GateRef IsJSAPIHashSet(GateRef obj);
468     GateRef IsJSAPILinkedList(GateRef obj);
469     GateRef IsJSAPIList(GateRef obj);
470     GateRef IsJSAPIArrayList(GateRef obj);
471     GateRef IsJSCollator(GateRef obj);
472     GateRef IsJSObjectType(GateRef obj, JSType jsType);
473     GateRef IsJSRegExp(GateRef obj);
474     GateRef GetTarget(GateRef proxyObj);
475     GateRef HandlerBaseIsAccessor(GateRef attr);
476     GateRef HandlerBaseIsJSArray(GateRef attr);
477     GateRef HandlerBaseIsInlinedProperty(GateRef attr);
478     GateRef HandlerBaseGetOffset(GateRef attr);
479     GateRef HandlerBaseGetAttrIndex(GateRef attr);
480     GateRef HandlerBaseGetRep(GateRef attr);
481     GateRef IsInvalidPropertyBox(GateRef obj);
482     GateRef IsAccessorPropertyBox(GateRef obj);
483     GateRef GetValueFromPropertyBox(GateRef obj);
484     void SetValueToPropertyBox(GateRef glue, GateRef obj, GateRef value);
485     GateRef GetTransitionHClass(GateRef obj);
486     GateRef GetTransitionHandlerInfo(GateRef obj);
487     GateRef GetTransWithProtoHClass(GateRef obj);
488     GateRef GetTransWithProtoHandlerInfo(GateRef obj);
489     GateRef GetPrototypeHandlerProtoCell(GateRef object);
490     GateRef GetTransWithProtoHandlerProtoCell(GateRef object);
491     GateRef GetStoreAOTHandlerProtoCell(GateRef object);
492     GateRef GetPrototypeHandlerHolder(GateRef object);
493     GateRef GetPrototypeHandlerHandlerInfo(GateRef object);
494     GateRef GetStoreAOTHandlerHolder(GateRef object);
495     GateRef GetStoreAOTHandlerHandlerInfo(GateRef object);
496     inline GateRef GetLengthOfJSArray(GateRef array);
497     inline GateRef GetPrototype(GateRef glue, GateRef object);
498     inline GateRef GetHasChanged(GateRef object);
499     inline GateRef GetNotFoundHasChanged(GateRef object);
500     GateRef HclassIsPrototypeHandler(GateRef hClass);
501     GateRef HclassIsTransitionHandler(GateRef hClass);
502     GateRef HclassIsPropertyBox(GateRef hClass);
503     GateRef PropAttrGetOffset(GateRef attr);
504     GateRef GetCtorPrototype(GateRef ctor);
505     GateRef HasFunctionPrototype(GateRef ctor);
506     GateRef InstanceOf(GateRef glue, GateRef object, GateRef target, GateRef profileTypeInfo, GateRef slotId,
507         ProfileOperation callback);
508     GateRef OrdinaryHasInstance(GateRef glue, GateRef target, GateRef obj);
509     void TryFastHasInstance(GateRef glue, GateRef instof, GateRef target, GateRef object, Label *fastPath,
510                             Label *exit, Variable *result, ProfileOperation callback);
511     GateRef ConvertTaggedValueWithElementsKind(GateRef glue, GateRef value, GateRef extraKind);
512     GateRef SameValue(GateRef glue, GateRef left, GateRef right);
513     GateRef SameValueZero(GateRef glue, GateRef left, GateRef right);
514     GateRef IsStableJSArguments(GateRef glue, GateRef obj);
515     GateRef IsStableJSArray(GateRef glue, GateRef obj);
516     GateRef IsTypedArray(GateRef obj);
517     GateRef IsSharedTypedArray(GateRef obj);
518     GateRef IsStableArguments(GateRef hClass);
519     GateRef IsStableArray(GateRef hClass);
520     GateRef GetProfileTypeInfo(GateRef jsFunc);
521     GateRef UpdateProfileTypeInfo(GateRef glue, GateRef jsFunc);
522     // SetDictionaryOrder func in property_attribute.h
523     GateRef SetDictionaryOrderFieldInPropAttr(GateRef attr, GateRef value);
524     GateRef GetPrototypeFromHClass(GateRef hClass);
525     GateRef GetEnumCacheFromHClass(GateRef hClass);
526     GateRef GetProtoChangeMarkerFromHClass(GateRef hClass);
527     GateRef GetLayoutFromHClass(GateRef hClass);
528     GateRef GetBitFieldFromHClass(GateRef hClass);
529     GateRef GetLengthFromString(GateRef value);
530     GateRef CalcHashcodeForInt(GateRef value);
531     void CalcHashcodeForDouble(GateRef value, Variable *res, Label *exit);
532     void CalcHashcodeForObject(GateRef glue, GateRef value, Variable *res, Label *exit);
533     GateRef GetHashcodeFromString(GateRef glue, GateRef value, GateRef hir = Circuit::NullGate());
534     inline GateRef IsIntegerString(GateRef string);
535     inline void SetRawHashcode(GateRef glue, GateRef str, GateRef rawHashcode, GateRef isInteger);
536     inline GateRef GetRawHashFromString(GateRef value);
537     GateRef TryGetHashcodeFromString(GateRef string);
538     inline GateRef GetMixHashcode(GateRef string);
539     GateRef GetFirstFromTreeString(GateRef string);
540     GateRef GetSecondFromTreeString(GateRef string);
541     GateRef GetIsAllTaggedPropFromHClass(GateRef hclass);
542     void SetBitFieldToHClass(GateRef glue, GateRef hClass, GateRef bitfield);
543     void SetIsAllTaggedProp(GateRef glue, GateRef hclass, GateRef hasRep);
544     void SetPrototypeToHClass(VariableType type, GateRef glue, GateRef hClass, GateRef proto);
545     GateRef GetProtoChangeDetails(GateRef hClass);
546     void SetProtoChangeDetailsToHClass(VariableType type, GateRef glue, GateRef hClass,
547                                        GateRef protoChange);
548     void SetLayoutToHClass(VariableType type, GateRef glue, GateRef hClass, GateRef attr,
549                            MemoryAttribute mAttr = MemoryAttribute::Default());
550     void SetHClassTypeIDToHClass(GateRef glue, GateRef hClass, GateRef id);
551     void SetEnumCacheToHClass(VariableType type, GateRef glue, GateRef hClass, GateRef key);
552     void SetTransitionsToHClass(VariableType type, GateRef glue, GateRef hClass, GateRef transition);
553     void SetParentToHClass(VariableType type, GateRef glue, GateRef hClass, GateRef parent);
554     void SetIsPrototypeToHClass(GateRef glue, GateRef hClass, GateRef value);
555     inline void SetIsAOT(GateRef glue, GateRef hClass, GateRef value);
556     GateRef IsPrototypeHClass(GateRef hClass);
557     void SetPropertyInlinedProps(GateRef glue, GateRef obj, GateRef hClass,
558                                  GateRef value, GateRef attrOffset, VariableType type = VariableType::JS_ANY(),
559                                  MemoryAttribute mAttr = MemoryAttribute::Default());
560     GateRef GetPropertyInlinedProps(GateRef obj, GateRef hClass,
561         GateRef index);
562     GateRef GetInlinedPropOffsetFromHClass(GateRef hclass, GateRef attrOffset);
563     inline GateRef IsObjSizeTrackingInProgress(GateRef hclass);
564     inline GateRef GetConstructionCounter(GateRef hclass);
565     inline void SetConstructionCounter(GateRef glue, GateRef hclass, GateRef count);
566 
567     void IncNumberOfProps(GateRef glue, GateRef hClass);
568     GateRef GetNumberOfPropsFromHClass(GateRef hClass);
569     GateRef HasDeleteProperty(GateRef hClass);
570     GateRef IsAOTHClass(GateRef hClass);
571     void SetNumberOfPropsToHClass(GateRef glue, GateRef hClass, GateRef value);
572     void SetElementsKindToTrackInfo(GateRef glue, GateRef trackInfo, GateRef elementsKind);
573     void SetSpaceFlagToTrackInfo(GateRef glue, GateRef trackInfo, GateRef spaceFlag);
574     GateRef GetElementsKindFromHClass(GateRef hClass);
575     GateRef GetObjectSizeFromHClass(GateRef hClass);
576     GateRef GetInlinedPropsStartFromHClass(GateRef hClass);
577     GateRef GetInlinedPropertiesFromHClass(GateRef hClass);
578     void ThrowTypeAndReturn(GateRef glue, int messageId, GateRef val);
579     GateRef GetValueFromTaggedArray(GateRef elements, GateRef index);
580     GateRef GetDataPtrInTaggedArray(GateRef array);
581     GateRef GetDataPtrInTaggedArray(GateRef array, GateRef index);
582     GateRef GetUnsharedConstpoolIndex(GateRef constpool);
583     GateRef GetUnsharedConstpoolFromGlue(GateRef glue, GateRef constpool);
584     GateRef GetUnsharedConstpool(GateRef array, GateRef index);
585     GateRef GetValueFromMutantTaggedArray(GateRef elements, GateRef index);
586     void SharedObjectStoreBarrierWithTypeCheck(bool isDicMode, Variable *result, GateRef glue, GateRef attr,
587         GateRef value, Variable *newValue, Label *executeSharedSetProp, Label *exit);
588     void SharedObjectStoreBarrierWithTypeCheck(bool isDicMode, Variable *result, GateRef glue, GateRef attr,
589         GateRef value, Variable *newValue, Label *executeSharedSetProp, Label *exit, GateRef SCheckModelIsCHECK);
590     void SharedObjectStoreBarrierWithTypeCheck(Variable *result, GateRef glue, GateRef fieldType, GateRef value,
591         Variable *newValue, Label *executeSharedSetProp, Label *exit);
592     void SharedObjectStoreBarrier(GateRef glue, GateRef value, Variable *newValue, Label *exit);
593     GateRef GetFieldTypeFromHandler(GateRef attr);
594     GateRef ClearSharedStoreKind(GateRef handlerInfo);
595     GateRef UpdateSOutOfBoundsForHandler(GateRef handlerInfo);
596     void RestoreElementsKindToGeneric(GateRef glue, GateRef jsHClass);
597     GateRef GetTaggedValueWithElementsKind(GateRef glue, GateRef receiver, GateRef index);
598     void FastSetValueWithElementsKind(GateRef glue, GateRef receiver, GateRef elements, GateRef rawValue,
599                                       GateRef index, ElementsKind kind, bool needTransition = false);
600     GateRef SetValueWithElementsKind(GateRef glue, GateRef receiver, GateRef rawValue, GateRef index,
601                                      GateRef needTransition, GateRef extraKind);
602     GateRef CopyJSArrayToTaggedArrayArgs(GateRef glue, GateRef srcObj);
603     void SetValueToTaggedArrayWithAttr(
604         GateRef glue, GateRef array, GateRef index, GateRef key, GateRef val, GateRef attr);
605     void SetValueToTaggedArrayWithRep(
606         GateRef glue, GateRef array, GateRef index, GateRef val, GateRef rep, Label *repChange);
607 
608     void SetValueToTaggedArray(VariableType valType, GateRef glue, GateRef array, GateRef index, GateRef val,
609                                MemoryAttribute mAttr = MemoryAttribute::Default());
610     void UpdateValueAndAttributes(GateRef glue, GateRef elements, GateRef index, GateRef value, GateRef attr);
611     GateRef IsSpecialIndexedObj(GateRef jsType);
612     GateRef IsArrayListOrVector(GateRef jsType);
613     GateRef IsSharedArray(GateRef jsType);
614     GateRef IsAccessorInternal(GateRef value);
615     template<typename DictionaryT>
616     GateRef GetAttributesFromDictionary(GateRef elements, GateRef entry);
617     template<typename DictionaryT>
618     GateRef GetValueFromDictionary(GateRef elements, GateRef entry);
619     template<typename DictionaryT>
620     GateRef GetKeyFromDictionary(GateRef elements, GateRef entry);
621     GateRef GetPropAttrFromLayoutInfo(GateRef layout, GateRef entry);
622     void UpdateFieldType(GateRef glue, GateRef hclass, GateRef attr);
623     GateRef GetPropertiesAddrFromLayoutInfo(GateRef layout);
624     GateRef GetPropertyMetaDataFromAttr(GateRef attr);
625     GateRef TranslateToRep(GateRef value);
626     GateRef GetKeyFromLayoutInfo(GateRef layout, GateRef entry);
627     void MatchFieldType(GateRef glue, GateRef fieldType, GateRef value, Label *executeSetProp, Label *typeMismatch);
628     GateRef FindElementWithCache(GateRef glue, GateRef layoutInfo, GateRef hClass,
629         GateRef key, GateRef propsNum, GateRef hir = Circuit::NullGate());
630     GateRef FindElementFromNumberDictionary(GateRef glue, GateRef elements, GateRef index);
631     GateRef FindEntryFromNameDictionary(GateRef glue, GateRef elements, GateRef key, GateRef hir = Circuit::NullGate());
632     GateRef IsMatchInTransitionDictionary(GateRef element, GateRef key, GateRef metaData, GateRef attr);
633     GateRef FindEntryFromTransitionDictionary(GateRef glue, GateRef elements, GateRef key, GateRef metaData);
634     GateRef JSObjectHasProperty(GateRef glue, GateRef obj, GateRef key, GateRef hir = Circuit::NullGate());
635     GateRef JSObjectGetProperty(GateRef obj, GateRef hClass, GateRef propAttr);
636     void JSObjectSetProperty(GateRef glue, GateRef obj, GateRef hClass, GateRef attr, GateRef key, GateRef value);
637     GateRef ShouldCallSetter(GateRef receiver, GateRef holder, GateRef accessor, GateRef attr);
638     GateRef CallSetterHelper(GateRef glue, GateRef holder, GateRef accessor,  GateRef value, ProfileOperation callback);
639     GateRef AddPropertyByName(GateRef glue, GateRef receiver, GateRef key, GateRef value, GateRef propertyAttributes,
640         ProfileOperation callback);
641     GateRef IsUtf16String(GateRef string);
642     GateRef IsUtf8String(GateRef string);
643     GateRef IsInternalString(GateRef string);
644     GateRef IsDigit(GateRef ch);
645     void TryToGetInteger(GateRef string, Variable *num, Label *success, Label *failed);
646     GateRef StringToElementIndex(GateRef glue, GateRef string);
647     GateRef ComputeElementCapacity(GateRef oldLength);
648     GateRef ComputeNonInlinedFastPropsCapacity(GateRef glue, GateRef oldLength,
649                                                GateRef maxNonInlinedFastPropsCapacity);
650     GateRef FindTransitions(GateRef glue, GateRef hClass, GateRef key, GateRef attr, GateRef value);
651     GateRef CheckHClassForRep(GateRef hClass, GateRef rep);
652     void TransitionForRepChange(GateRef glue, GateRef receiver, GateRef key, GateRef attr);
653     void TransitToElementsKind(GateRef glue, GateRef receiver, GateRef value, GateRef kind);
654     void TryMigrateToGenericKindForJSObject(GateRef glue, GateRef receiver, GateRef oldKind);
655     GateRef TaggedToRepresentation(GateRef value);
656     GateRef TaggedToElementKind(GateRef value);
657     GateRef LdGlobalRecord(GateRef glue, GateRef key);
658     GateRef LoadFromField(GateRef receiver, GateRef handlerInfo);
659     GateRef LoadGlobal(GateRef cell);
660     GateRef LoadElement(GateRef glue, GateRef receiver, GateRef key);
661     GateRef LoadStringElement(GateRef glue, GateRef receiver, GateRef key);
662     GateRef TryToElementsIndex(GateRef glue, GateRef key);
663     GateRef CheckPolyHClass(GateRef cachedValue, GateRef hClass);
664     GateRef LoadICWithHandler(
665         GateRef glue, GateRef receiver, GateRef holder, GateRef handler, ProfileOperation callback);
666     GateRef StoreICWithHandler(GateRef glue, GateRef receiver, GateRef holder,
667                                GateRef value, GateRef handler, ProfileOperation callback = ProfileOperation());
668     GateRef TaggedArraySetValue(GateRef glue, GateRef receiver, GateRef value, GateRef index, GateRef capacity);
669     GateRef ICStoreElement(GateRef glue, GateRef receiver, GateRef key, GateRef value, GateRef handlerInfo,
670                            bool updateHandler = false, GateRef profileTypeInfo = Gate::InvalidGateRef,
671                            GateRef slotId = Gate::InvalidGateRef);
672     GateRef GetArrayLength(GateRef object);
673     GateRef DoubleToInt(GateRef glue, GateRef x, size_t bits = base::INT32_BITS);
674     void SetArrayLength(GateRef glue, GateRef object, GateRef len);
675     GateRef StoreField(GateRef glue, GateRef receiver, GateRef value, GateRef handler, ProfileOperation callback);
676     GateRef StoreWithTransition(GateRef glue, GateRef receiver, GateRef value, GateRef handler,
677                              ProfileOperation callback, bool withPrototype = false);
678     GateRef StoreGlobal(GateRef glue, GateRef value, GateRef cell);
679     void JSHClassAddProperty(GateRef glue, GateRef receiver, GateRef key, GateRef attr, GateRef value);
680     void NotifyHClassChanged(GateRef glue, GateRef oldHClass, GateRef newHClass);
681     GateRef GetInt64OfTInt(GateRef x);
682     GateRef GetInt32OfTInt(GateRef x);
683     GateRef GetDoubleOfTInt(GateRef x);
684     GateRef GetDoubleOfTDouble(GateRef x);
685     GateRef GetInt32OfTNumber(GateRef x);
686     GateRef GetDoubleOfTNumber(GateRef x);
687     GateRef LoadObjectFromWeakRef(GateRef x);
688     GateRef ExtFloat32ToDouble(GateRef x);
689     GateRef ChangeInt32ToFloat32(GateRef x);
690     GateRef ChangeInt32ToFloat64(GateRef x);
691     GateRef ChangeUInt32ToFloat64(GateRef x);
692     GateRef ChangeFloat64ToInt32(GateRef x);
693     GateRef TruncDoubleToFloat32(GateRef x);
694     GateRef DeletePropertyOrThrow(GateRef glue, GateRef obj, GateRef value);
695     inline GateRef ToObject(GateRef glue, GateRef obj);
696     GateRef DeleteProperty(GateRef glue, GateRef obj, GateRef value);
697     inline GateRef OrdinaryNewJSObjectCreate(GateRef glue, GateRef proto);
698     inline GateRef NewJSPrimitiveRef(GateRef glue, size_t index, GateRef obj);
699     GateRef ModuleNamespaceDeleteProperty(GateRef glue, GateRef obj, GateRef value);
700     GateRef Int64ToTaggedPtr(GateRef x);
701     GateRef TruncInt16ToInt8(GateRef x);
702     GateRef TruncInt32ToInt16(GateRef x);
703     GateRef TruncInt32ToInt8(GateRef x);
704     GateRef TruncFloatToInt64(GateRef x);
705     GateRef CastInt32ToFloat32(GateRef x);
706     GateRef CastInt64ToFloat64(GateRef x);
707     GateRef SExtInt32ToInt64(GateRef x);
708     GateRef SExtInt16ToInt64(GateRef x);
709     GateRef SExtInt16ToInt32(GateRef x);
710     GateRef SExtInt8ToInt64(GateRef x);
711     GateRef SExtInt8ToInt32(GateRef x);
712     GateRef SExtInt1ToInt64(GateRef x);
713     GateRef SExtInt1ToInt32(GateRef x);
714     GateRef ZExtInt8ToInt16(GateRef x);
715     GateRef ZExtInt32ToInt64(GateRef x);
716     GateRef ZExtInt1ToInt64(GateRef x);
717     GateRef ZExtInt1ToInt32(GateRef x);
718     GateRef ZExtInt8ToInt32(GateRef x);
719     GateRef ZExtInt8ToInt64(GateRef x);
720     GateRef ZExtInt8ToPtr(GateRef x);
721     GateRef ZExtInt16ToPtr(GateRef x);
722     GateRef SExtInt32ToPtr(GateRef x);
723     GateRef ZExtInt16ToInt32(GateRef x);
724     GateRef ZExtInt16ToInt64(GateRef x);
725     GateRef TruncInt64ToInt32(GateRef x);
726     GateRef TruncPtrToInt32(GateRef x);
727     GateRef TruncInt64ToInt1(GateRef x);
728     GateRef TruncInt32ToInt1(GateRef x);
729     GateRef GetGlobalConstantAddr(GateRef index);
730     GateRef GetGlobalConstantOffset(ConstantIndex index);
731     GateRef IsCallableFromBitField(GateRef bitfield);
732     GateRef IsCallable(GateRef obj);
733     GateRef TaggedIsCallable(GateRef obj);
734     GateRef GetOffsetFieldInPropAttr(GateRef attr);
735     GateRef SetOffsetFieldInPropAttr(GateRef attr, GateRef value);
736     GateRef SetIsInlinePropsFieldInPropAttr(GateRef attr, GateRef value);
737     GateRef SetTrackTypeInPropAttr(GateRef attr, GateRef type);
738     GateRef GetTrackTypeInPropAttr(GateRef attr);
739     GateRef GetSharedFieldTypeInPropAttr(GateRef attr);
740     GateRef GetDictSharedFieldTypeInPropAttr(GateRef attr);
741     GateRef GetRepInPropAttr(GateRef attr);
742     GateRef IsIntRepInPropAttr(GateRef attr);
743     GateRef IsDoubleRepInPropAttr(GateRef attr);
744     GateRef IsTaggedRepInPropAttr(GateRef attr);
745     GateRef SetTaggedRepInPropAttr(GateRef attr);
746     template<class T>
747     void SetHClassBit(GateRef glue, GateRef hClass, GateRef value);
748     template<typename DictionaryT>
749     void UpdateValueInDict(GateRef glue, GateRef elements, GateRef index, GateRef value);
750     GateRef GetBitMask(GateRef bitoffset);
751     GateRef IntPtrEuqal(GateRef x, GateRef y);
752     GateRef IntPtrNotEqual(GateRef x, GateRef y);
753     void SetValueWithAttr(GateRef glue, GateRef obj, GateRef offset, GateRef key, GateRef value, GateRef attr);
754     void SetValueWithRep(GateRef glue, GateRef obj, GateRef offset, GateRef value, GateRef rep, Label *repChange);
755     void VerifyBarrier(GateRef glue, GateRef obj, GateRef offset, GateRef value);
756     void SetValueWithBarrier(GateRef glue, GateRef obj, GateRef offset, GateRef value,
757                              MemoryAttribute::ShareFlag share = MemoryAttribute::UNKNOWN);
758     GateRef GetPropertyByIndex(GateRef glue, GateRef receiver, GateRef index,
759                                ProfileOperation callback, GateRef hir = Circuit::NullGate());
760     GateRef GetPropertyByName(GateRef glue, GateRef receiver, GateRef key,
761                               ProfileOperation callback, GateRef isInternal,
762                               bool canUseIsInternal = false, GateRef hir = Circuit::NullGate());
763     GateRef FastGetPropertyByName(GateRef glue, GateRef obj, GateRef key,
764                                     ProfileOperation callback, GateRef hir = Circuit::NullGate());
765     GateRef FastGetPropertyByIndex(GateRef glue, GateRef obj, GateRef index,
766                                    ProfileOperation callback, GateRef hir = Circuit::NullGate());
767     GateRef GetPropertyByValue(GateRef glue, GateRef receiver, GateRef keyValue, ProfileOperation callback);
768     void FastSetPropertyByName(GateRef glue, GateRef obj, GateRef key, GateRef value,
769         ProfileOperation callback = ProfileOperation());
770     void FastSetPropertyByIndex(GateRef glue, GateRef obj, GateRef index, GateRef value);
771     GateRef SetPropertyByIndex(GateRef glue, GateRef receiver, GateRef index,
772         GateRef value, bool useOwn, ProfileOperation callback = ProfileOperation(), bool defineSemantics = false);
773     GateRef DefinePropertyByIndex(GateRef glue, GateRef receiver, GateRef index, GateRef value);
774     GateRef SetPropertyByName(GateRef glue, GateRef receiver, GateRef key,
775         GateRef value, bool useOwn, GateRef isInternal, ProfileOperation callback = ProfileOperation(),
776         bool canUseIsInternal = false, bool defineSemantics = false); // Crawl prototype chain
777     GateRef DefinePropertyByName(GateRef glue, GateRef receiver, GateRef key,
778         GateRef value, GateRef isInternal, GateRef SCheckModelIsCHECK,
779         ProfileOperation callback = ProfileOperation());
780     GateRef SetPropertyByValue(GateRef glue, GateRef receiver, GateRef key, GateRef value, bool useOwn,
781         ProfileOperation callback = ProfileOperation(), bool defineSemantics = false);
782     GateRef DefinePropertyByValue(GateRef glue, GateRef receiver, GateRef key, GateRef value,
783         GateRef SCheckModelIsCHECK, ProfileOperation callback = ProfileOperation());
784     GateRef GetParentEnv(GateRef object);
785     GateRef GetSendableParentEnv(GateRef object);
786     GateRef GetPropertiesFromLexicalEnv(GateRef object, GateRef index);
787     GateRef GetPropertiesFromSendableEnv(GateRef object, GateRef index);
788     GateRef GetKeyFromLexivalEnv(GateRef lexicalEnv, GateRef levelIndex, GateRef slotIndex);
789     void SetPropertiesToLexicalEnv(GateRef glue, GateRef object, GateRef index, GateRef value);
790     void SetPropertiesToSendableEnv(GateRef glue, GateRef object, GateRef index, GateRef value);
791     GateRef GetHomeObjectFromJSFunction(GateRef object);
792     GateRef GetCallFieldFromMethod(GateRef method);
793     GateRef GetSendableEnvFromModule(GateRef module);
794     GateRef GetProtoOrHClass(GateRef function);
795     GateRef GetViewedArrayBufferOrByteArray(GateRef typedArray);
796     GateRef IsSendableFunctionModule(GateRef module);
797     inline GateRef GetBuiltinId(GateRef method);
798     void SetLexicalEnvToFunction(GateRef glue, GateRef object, GateRef lexicalEnv,
799                                  MemoryAttribute mAttr = MemoryAttribute::Default());
800     void SetProtoOrHClassToFunction(GateRef glue, GateRef function, GateRef value,
801                                     MemoryAttribute mAttr = MemoryAttribute::Default());
802     void SetWorkNodePointerToFunction(GateRef glue, GateRef function, GateRef value,
803                                       MemoryAttribute mAttr = MemoryAttribute::Default());
804     void SetHomeObjectToFunction(GateRef glue, GateRef function, GateRef value,
805                                  MemoryAttribute mAttr = MemoryAttribute::Default());
806     void SetModuleToFunction(GateRef glue, GateRef function, GateRef value,
807                              MemoryAttribute mAttr = MemoryAttribute::Default());
808     void SetMethodToFunction(GateRef glue, GateRef function, GateRef value,
809                              MemoryAttribute mAttr = MemoryAttribute::Default());
810     void SetCodeEntryToFunctionFromMethod(GateRef glue, GateRef function, GateRef value);
811     void SetCodeEntryToFunctionFromFuncEntry(GateRef glue, GateRef function, GateRef value);
812     void SetNativePointerToFunctionFromMethod(GateRef glue, GateRef function, GateRef value);
813     void SetCompiledCodeFlagToFunctionFromMethod(GateRef glue, GateRef function, GateRef value);
814     void SetLengthToFunction(GateRef glue, GateRef function, GateRef value);
815     void SetRawProfileTypeInfoToFunction(GateRef glue, GateRef function, GateRef value,
816                                          MemoryAttribute mAttr = MemoryAttribute::Default());
817     void SetValueToProfileTypeInfoCell(GateRef glue, GateRef profileTypeInfoCell, GateRef value);
818     void UpdateProfileTypeInfoCellType(GateRef glue, GateRef profileTypeInfoCell);
819     void SetJSObjectTaggedField(GateRef glue, GateRef object, size_t offset, GateRef value);
820     void SetSendableEnvToModule(GateRef glue, GateRef module, GateRef value,
821                                 MemoryAttribute mAttr = MemoryAttribute::Default());
822     void SetCompiledCodeFlagToFunction(GateRef glue, GateRef function, GateRef value);
823     void SetCompiledFastCallFlagToFunction(GateRef glue, GateRef function, GateRef value);
824     void SetCompiledFuncEntry(GateRef glue, GateRef jsFunc, GateRef codeEntry, GateRef isFastCall);
825     GateRef GetFuncEntryDes(GateRef glue, GateRef machineCode, GateRef codeAddr);
826     GateRef GetFuncEntryDesAddress(GateRef machineCode);
827     GateRef IsAlign(GateRef address, GateRef alignByte);
828     void SetTaskConcurrentFuncFlagToFunction(GateRef glue, GateRef function, GateRef value);
829     void SetBitFieldToFunction(GateRef glue, GateRef function, GateRef value);
830     void SetMachineCodeToFunction(GateRef glue, GateRef function, GateRef value,
831                                   MemoryAttribute mAttr = MemoryAttribute::Default());
832     void SetBaselineJitCodeToFunction(GateRef glue, GateRef function, GateRef value,
833                                       MemoryAttribute mAttr = MemoryAttribute::Default());
834     void SetTypedArrayName(GateRef glue, GateRef typedArray, GateRef name,
835                            MemoryAttribute mAttr = MemoryAttribute::Default());
836     void SetContentType(GateRef glue, GateRef typedArray, GateRef type);
837     void SetViewedArrayBufferOrByteArray(GateRef glue, GateRef typedArray, GateRef data,
838                                          MemoryAttribute mAttr = MemoryAttribute::Default());
839     void SetByteLength(GateRef glue, GateRef typedArray, GateRef byteLength);
840     void SetByteOffset(GateRef glue, GateRef typedArray, GateRef offset);
841     void SetTypedArrayLength(GateRef glue, GateRef typedArray, GateRef arrayLength);
842     GateRef GetGlobalObject(GateRef glue);
843     GateRef GetMethodFromFunction(GateRef function);
844     GateRef GetModuleFromFunction(GateRef function);
845     GateRef GetLengthFromFunction(GateRef function);
846     GateRef GetHomeObjectFromFunction(GateRef function);
847     GateRef GetEntryIndexOfGlobalDictionary(GateRef entry);
848     GateRef GetBoxFromGlobalDictionary(GateRef object, GateRef entry);
849     GateRef GetValueFromGlobalDictionary(GateRef object, GateRef entry);
850     GateRef GetPropertiesFromJSObject(GateRef object);
851     template<OpCode Op, MachineType Type>
852     GateRef BinaryOp(GateRef x, GateRef y);
853     template<OpCode Op, MachineType Type>
854     GateRef BinaryOpWithOverflow(GateRef x, GateRef y);
855     GateRef GetGlobalOwnProperty(GateRef glue, GateRef receiver, GateRef key, ProfileOperation callback);
856     GateRef AddElementInternal(GateRef glue, GateRef receiver, GateRef index, GateRef value, GateRef attr);
857     GateRef ShouldTransToDict(GateRef capcity, GateRef index);
858     void NotifyArrayPrototypeChangedGuardians(GateRef glue, GateRef receiver);
859     GateRef GrowElementsCapacity(GateRef glue, GateRef receiver, GateRef capacity);
860 
861     inline GateRef GetObjectFromConstPool(GateRef constpool, GateRef index);
862     GateRef GetConstPoolFromFunction(GateRef jsFunc);
863     GateRef GetStringFromConstPool(GateRef glue, GateRef constpool, GateRef index);
864     GateRef GetMethodFromConstPool(GateRef glue, GateRef constpool, GateRef index);
865     GateRef GetArrayLiteralFromConstPool(GateRef glue, GateRef constpool, GateRef index, GateRef module);
866     GateRef GetObjectLiteralFromConstPool(GateRef glue, GateRef constpool, GateRef index, GateRef module);
867     void SetElementsKindToJSHClass(GateRef glue, GateRef jsHclass, GateRef elementsKind);
868     void SetExtensibleToBitfield(GateRef glue, GateRef obj, bool isExtensible);
869     void SetCallableToBitfield(GateRef glue, GateRef obj, bool isCallable);
870 
871     // fast path
872     GateRef FastEqual(GateRef glue, GateRef left, GateRef right, ProfileOperation callback);
873     GateRef FastStrictEqual(GateRef glue, GateRef left, GateRef right, ProfileOperation callback);
874     GateRef FastStringEqual(GateRef glue, GateRef left, GateRef right);
875     GateRef FastStringEqualWithoutRTStub(GateRef glue, GateRef left, GateRef right);
876     GateRef StringCompare(GateRef glue, GateRef left, GateRef right);
877     GateRef FastMod(GateRef gule, GateRef left, GateRef right, ProfileOperation callback);
878     GateRef FastTypeOf(GateRef left, GateRef right);
879     GateRef FastMul(GateRef glue, GateRef left, GateRef right, ProfileOperation callback);
880     GateRef FastDiv(GateRef left, GateRef right, ProfileOperation callback);
881     GateRef FastAdd(GateRef glue, GateRef left, GateRef right, ProfileOperation callback);
882     GateRef FastSub(GateRef glue, GateRef left, GateRef right, ProfileOperation callback);
883     GateRef FastToBoolean(GateRef value, bool flag = true);
884     GateRef FastToBooleanWithProfile(GateRef value, ProfileOperation callback, bool flag = true);
885     GateRef FastToBooleanWithProfileBaseline(GateRef value, ProfileOperation callback, bool flag = true);
886 
887     // Add SpecialContainer
888     GateRef JSAPIContainerGet(GateRef glue, GateRef receiver, GateRef index);
889 
890     // for-in
891     GateRef NextInternal(GateRef glue, GateRef iter);
892     GateRef GetLengthFromForInIterator(GateRef iter);
893     GateRef GetIndexFromForInIterator(GateRef iter);
894     GateRef GetKeysFromForInIterator(GateRef iter);
895     GateRef GetObjectFromForInIterator(GateRef iter);
896     GateRef GetCachedHclassFromForInIterator(GateRef iter);
897     void SetLengthOfForInIterator(GateRef glue, GateRef iter, GateRef length);
898     void SetIndexOfForInIterator(GateRef glue, GateRef iter, GateRef index);
899     void SetKeysOfForInIterator(GateRef glue, GateRef iter, GateRef keys);
900     void SetObjectOfForInIterator(GateRef glue, GateRef iter, GateRef object);
901     void SetCachedHclassOfForInIterator(GateRef glue, GateRef iter, GateRef hclass);
902     void IncreaseIteratorIndex(GateRef glue, GateRef iter, GateRef index);
903     void SetNextIndexOfArrayIterator(GateRef glue, GateRef iter, GateRef nextIndex);
904     void IncreaseArrayIteratorIndex(GateRef glue, GateRef iter, GateRef index);
905     void SetIteratedArrayOfArrayIterator(GateRef glue, GateRef iter, GateRef iteratedArray);
906     void SetBitFieldOfArrayIterator(GateRef glue, GateRef iter, GateRef kind);
907     GateRef GetArrayIterationKind(GateRef iter);
908     GateRef GetEnumCacheKind(GateRef glue, GateRef enumCache);
909     GateRef GetEmptyArray(GateRef glue);
910     GateRef IsEnumCacheValid(GateRef receiver, GateRef cachedHclass, GateRef kind);
911     GateRef NeedCheckProperty(GateRef receiver);
912 
913     GateRef EnumerateObjectProperties(GateRef glue, GateRef obj);
914     GateRef GetFunctionPrototype(GateRef glue, size_t index);
915     GateRef ToPrototypeOrObj(GateRef glue, GateRef obj);
916     GateRef ToPropertyKey(GateRef glue, GateRef tagged);
917     GateRef TaggedIsPropertyKey(GateRef obj);
918     GateRef HasProperty(GateRef glue, GateRef obj, GateRef key, GateRef hir = Circuit::NullGate());
919     GateRef IsIn(GateRef glue, GateRef prop, GateRef obj);
920     GateRef IsSpecialKeysObject(GateRef obj);
921     GateRef IsSlowKeysObject(GateRef obj);
922     GateRef TryGetEnumCache(GateRef glue, GateRef obj);
923     GateRef GetNumberOfElements(GateRef glue, GateRef obj);
924     GateRef IsSimpleEnumCacheValid(GateRef glue, GateRef obj);
925     GateRef IsEnumCacheWithProtoChainInfoValid(GateRef glue, GateRef obj);
926 
927     // Exception handle
928     GateRef HasPendingException(GateRef glue);
929     void ReturnExceptionIfAbruptCompletion(GateRef glue);
930 
931     // ElementsKind Operations
932     GateRef ValueIsSpecialHole(GateRef x);
933     GateRef ElementsKindIsInt(GateRef kind);
934     GateRef ElementsKindIsIntOrHoleInt(GateRef kind);
935     GateRef ElementsKindIsNumber(GateRef kind);
936     GateRef ElementsKindIsNumOrHoleNum(GateRef kind);
937     GateRef ElementsKindIsString(GateRef kind);
938     GateRef ElementsKindIsStringOrHoleString(GateRef kind);
939     GateRef ElementsKindIsHeapKind(GateRef kind);
940     GateRef ElementsKindHasHole(GateRef kind);
941     // dstAddr/srcAddr is the address will be copied to/from.
942     // It can be a derived pointer point to the middle of an object.
943     // Note: dstObj is the object address for dstAddr, it must point to the head of an object.
944     void ArrayCopyAndHoleToUndefined(GateRef glue, GateRef srcObj, GateRef srcAddr, GateRef dstObj,
945                                      GateRef dstAddr, GateRef length, GateRef needBarrier);
946     GateRef ThreeInt64Min(GateRef first, GateRef second, GateRef third);
947     void MigrateArrayWithKind(GateRef glue, GateRef object, GateRef oldKind, GateRef newKind);
948     GateRef MigrateFromRawValueToHeapValues(GateRef glue, GateRef object, GateRef needCOW, GateRef isIntKind);
949     GateRef MigrateFromHeapValueToRawValue(GateRef glue, GateRef object, GateRef needCOW, GateRef isIntKind);
950     void MigrateFromHoleIntToHoleNumber(GateRef glue, GateRef object);
951     void MigrateFromHoleNumberToHoleInt(GateRef glue, GateRef object);
952 
953     // method operator
954     GateRef IsJSFunction(GateRef obj);
955     GateRef IsBoundFunction(GateRef obj);
956     GateRef IsJSOrBoundFunction(GateRef obj);
957     GateRef GetMethodFromJSFunctionOrProxy(GateRef object);
958     GateRef IsNativeMethod(GateRef method);
959     GateRef GetFuncKind(GateRef method);
960     GateRef HasPrototype(GateRef kind);
961     GateRef HasAccessor(GateRef kind);
962     GateRef IsClassConstructorKind(GateRef kind);
963     GateRef IsGeneratorKind(GateRef kind);
964     GateRef IsBaseKind(GateRef kind);
965     GateRef IsBaseConstructorKind(GateRef kind);
966     GateRef IsSendableFunction(GateRef method);
967 
968     GateRef IsAOTLiteralInfo(GateRef info);
969     GateRef GetIhcFromAOTLiteralInfo(GateRef info);
970     GateRef IsAotWithCallField(GateRef method);
971     GateRef IsFastCall(GateRef method);
972     GateRef JudgeAotAndFastCall(GateRef jsFunc, CircuitBuilder::JudgeMethodType type);
973     GateRef GetInternalString(GateRef glue, GateRef key);
974     GateRef GetExpectedNumOfArgs(GateRef method);
975     GateRef GetMethod(GateRef glue, GateRef obj, GateRef key, GateRef profileTypeInfo, GateRef slotId);
976     // proxy operator
977     GateRef GetMethodFromJSProxy(GateRef proxy);
978     GateRef GetHandlerFromJSProxy(GateRef proxy);
979     GateRef GetTargetFromJSProxy(GateRef proxy);
980     inline void SetHotnessCounter(GateRef glue, GateRef method, GateRef value);
981     inline void SaveHotnessCounterIfNeeded(GateRef glue, GateRef sp, GateRef hotnessCounter, JSCallMode mode);
982     inline void SavePcIfNeeded(GateRef glue);
983     inline void SaveJumpSizeIfNeeded(GateRef glue, GateRef jumpSize);
984     inline GateRef ComputeTaggedArraySize(GateRef length);
985     inline GateRef GetGlobalConstantValue(
986         VariableType type, GateRef glue, ConstantIndex index);
987     GateRef GetGlobalConstantValue(VariableType type, GateRef glue, GateRef index);
988     inline GateRef GetSingleCharTable(GateRef glue);
989     inline GateRef IsEnableMutantArray(GateRef glue);
990     inline GateRef IsEnableElementsKind(GateRef glue);
991     inline GateRef GetGlobalEnvValue(VariableType type, GateRef env, size_t index);
992     GateRef CallGetterHelper(GateRef glue, GateRef receiver, GateRef holder,
993                              GateRef accessor, ProfileOperation callback, GateRef hir = Circuit::NullGate());
994     GateRef ConstructorCheck(GateRef glue, GateRef ctor, GateRef outPut, GateRef thisObj);
995     GateRef GetCallSpreadArgs(GateRef glue, GateRef array, ProfileOperation callBack);
996     GateRef GetIterator(GateRef glue, GateRef obj, ProfileOperation callback);
997     // For BaselineJIT
998     GateRef FastToBooleanBaseline(GateRef value, bool flag = true);
999     GateRef GetBaselineCodeAddr(GateRef baselineCode);
1000 
1001     GateRef IsFastTypeArray(GateRef jsType);
1002     GateRef GetTypeArrayPropertyByName(GateRef glue, GateRef receiver, GateRef holder, GateRef key, GateRef jsType);
1003     GateRef SetTypeArrayPropertyByName(GateRef glue, GateRef receiver, GateRef holder, GateRef key, GateRef value,
1004                                        GateRef jsType);
1005     GateRef TryStringOrSymbolToElementIndex(GateRef glue, GateRef key);
1006     inline GateRef DispatchBuiltins(GateRef glue, GateRef builtinsId, const std::vector<GateRef>& args,
1007                                     GateRef hir = Circuit::NullGate());
1008     inline GateRef DispatchBuiltinsWithArgv(GateRef glue, GateRef builtinsId, const std::vector<GateRef> &args);
1009     GateRef ComputeSizeUtf8(GateRef length);
1010     GateRef ComputeSizeUtf16(GateRef length);
1011     GateRef AlignUp(GateRef x, GateRef alignment);
1012     GateRef AlignDown(GateRef x, GateRef alignment);
1013     inline void SetLength(GateRef glue, GateRef str, GateRef length, bool compressed);
1014     inline void SetLength(GateRef glue, GateRef str, GateRef length, GateRef isCompressed);
1015     void Assert(int messageId, int line, GateRef glue, GateRef condition, Label *nextLabel);
1016 
1017     GateRef GetNormalStringData(const StringInfoGateRef &stringInfoGate);
1018 
1019     void Comment(GateRef glue, const std::string &str);
1020     GateRef ToNumber(GateRef glue, GateRef tagged);
1021     inline GateRef LoadPfHeaderFromConstPool(GateRef jsFunc);
1022     GateRef RemoveTaggedWeakTag(GateRef weak);
1023     inline GateRef LoadHCIndexFromConstPool(GateRef cachedArray, GateRef cachedLength, GateRef traceId, Label *miss);
1024     inline GateRef LoadHCIndexInfosFromConstPool(GateRef jsFunc);
1025     inline GateRef GetAttrIndex(GateRef index);
1026     inline GateRef GetAttr(GateRef layoutInfo, GateRef index);
1027     inline GateRef GetKey(GateRef layoutInfo, GateRef index);
1028     inline GateRef GetKeyIndex(GateRef index);
1029     GateRef CalArrayRelativePos(GateRef index, GateRef arrayLen);
1030     GateRef AppendSkipHole(GateRef glue, GateRef first, GateRef second, GateRef copyLength);
1031     GateRef IntToEcmaString(GateRef glue, GateRef number);
1032     GateRef ToCharCode(GateRef number);
1033     GateRef NumberToString(GateRef glue, GateRef number);
1034     inline GateRef GetAccGetter(GateRef accesstor);
1035     inline GateRef GetAccSetter(GateRef accesstor);
1036     inline GateRef GetViewedArrayBuffer(GateRef dataView);
1037     inline GateRef GetByteOffset(GateRef dataView);
1038     inline GateRef GetByteLength(GateRef dataView);
1039     inline GateRef GetArrayBufferData(GateRef buffer);
1040     inline GateRef GetArrayBufferByteLength(GateRef buffer);
1041     inline void SetArrayBufferByteLength(GateRef glue, GateRef buffer, GateRef length);
1042     GateRef IsDetachedBuffer(GateRef buffer);
1043     inline GateRef IsMarkerCellValid(GateRef cell);
1044     inline GateRef GetAccessorHasChanged(GateRef obj);
1045     inline GateRef ComputeTaggedTypedArraySize(GateRef elementSize, GateRef length);
1046     GateRef ChangeTaggedPointerToInt64(GateRef x);
1047     inline GateRef GetPropertiesCache(GateRef glue);
1048     inline GateRef GetMegaICCache(GateRef glue, MegaICCache::MegaICKind kind);
1049     inline void IncMegaProbeCount(GateRef glue);
1050     inline void IncMegaHitCount(GateRef glue);
1051     GateRef GetIndexFromPropertiesCache(GateRef glue, GateRef cache, GateRef cls, GateRef key,
1052                                         GateRef hir = Circuit::NullGate());
1053     GateRef GetHandlerFromMegaICCache(GateRef glue, GateRef cache, GateRef cls, GateRef key);
1054     inline void SetToPropertiesCache(GateRef glue, GateRef cache, GateRef cls, GateRef key, GateRef result,
1055                                      GateRef hir = Circuit::NullGate());
1056     GateRef HashFromHclassAndKey(GateRef glue, GateRef cls, GateRef key, GateRef hir = Circuit::NullGate());
1057     GateRef HashFromHclassAndStringKey(GateRef glue, GateRef cls, GateRef key);
1058     GateRef GetKeyHashCode(GateRef glue, GateRef key, GateRef hir = Circuit::NullGate());
1059     GateRef GetStringKeyHashCode(GateRef glue, GateRef key, GateRef hir = Circuit::NullGate());
1060     inline GateRef GetSortedKey(GateRef layoutInfo, GateRef index);
1061     inline GateRef GetSortedIndex(GateRef layoutInfo, GateRef index);
1062     inline GateRef GetSortedIndex(GateRef attr);
1063     inline void StoreWithoutBarrier(VariableType type, GateRef base, GateRef offset, GateRef value);
1064     GateRef DefineFunc(GateRef glue, GateRef constpool, GateRef index,
1065                        FunctionKind targetKind = FunctionKind::LAST_FUNCTION_KIND);
1066     GateRef BinarySearch(GateRef glue, GateRef layoutInfo, GateRef key, GateRef propsNum,
1067                          GateRef hir = Circuit::NullGate());
1068     GateRef GetLastLeaveFrame(GateRef glue);
1069     void UpdateProfileTypeInfoCellToFunction(GateRef glue, GateRef function,
1070                                              GateRef profileTypeInfo, GateRef slotId);
1071     GateRef Loadlocalmodulevar(GateRef glue, GateRef index, GateRef module);
1072     GateRef GetArgumentsElements(GateRef glue, GateRef argvTaggedArray, GateRef argv);
1073     void TryToJitReuseCompiledFunc(GateRef glue, GateRef jsFunc, GateRef profileTypeInfoCell);
1074     void TryToBaselineJitReuseCompiledFunc(GateRef glue, GateRef jsFunc, GateRef profileTypeInfoCell);
1075     void StartTraceLoadDetail(GateRef glue, GateRef receiver, GateRef profileTypeInfo, GateRef slotId);
1076     void StartTraceLoadGetter(GateRef glue);
1077     void StartTraceLoadSlowPath(GateRef glue);
1078     void EndTraceLoad(GateRef glue);
1079     GateRef GetIsFastCall(GateRef machineCode);
1080     // compute new elementKind from sub elements
1081     GateRef ComputeTaggedArrayElementKind(GateRef array, GateRef offset, GateRef end);
1082     GateRef GetElementsKindHClass(GateRef glue, GateRef elementKind);
1083     GateRef NeedBarrier(GateRef kind);
1084     GateRef JSTaggedValueToString(GateRef glue, GateRef val, GateRef hir = Circuit::NullGate());
1085     GateRef SpecialToString(GateRef glue, GateRef specialVal);
1086     GateRef ToPrimitive(GateRef glue, GateRef value, PreferredPrimitiveType type,
1087                         GateRef hir = Circuit::NullGate());
1088     GateRef GetPrimitiveTypeString(GateRef glue, PreferredPrimitiveType type);
1089     GateRef OrdinaryToPrimitive(GateRef glue, GateRef value,
1090                                 PreferredPrimitiveType type, GateRef hir = Circuit::NullGate());
1091     GateRef CallFunction(GateRef glue, GateRef func);
1092 
1093     enum CopyKind {
1094         SameArray,
1095         DifferentArray,
1096     };
1097 
1098     // dstAddr/srcAddr is the address will be copied to/from.
1099     // It can be a derived pointer point to the middle of an object.
1100     // Note: dstObj is the object address for dstAddr, it must point to the head of an object.
1101     void ArrayCopy(GateRef glue, GateRef srcObj, GateRef srcAddr, GateRef dstObj, GateRef dstAddr,
1102                    GateRef taggedValueCount, GateRef needBarrier, CopyKind copyKind);
1103 protected:
1104     static constexpr int LOOP_UNROLL_FACTOR = 2;
1105     static constexpr int ELEMENTS_KIND_HCLASS_NUM = 12;
1106     static constexpr int SPECIAL_VALUE_NUM = 5;
1107     static int64_t SPECIAL_VALUE[SPECIAL_VALUE_NUM];
1108     static ConstantIndex SPECIAL_STRING_INDEX[SPECIAL_VALUE_NUM];
1109 
1110 private:
1111     using BinaryOperation = std::function<GateRef(Environment*, GateRef, GateRef)>;
1112     template<OpCode Op>
1113     GateRef FastAddSubAndMul(GateRef glue, GateRef left, GateRef right, ProfileOperation callback);
1114     GateRef FastIntDiv(GateRef left, GateRef right, Label *bailout, ProfileOperation callback);
1115     template<OpCode Op>
1116     GateRef FastBinaryOp(GateRef glue, GateRef left, GateRef right,
1117                          const BinaryOperation& intOp, const BinaryOperation& floatOp, ProfileOperation callback);
1118     GateRef TryStringAdd(Environment *env, GateRef glue, GateRef left, GateRef right,
1119                          const BinaryOperation& intOp, const BinaryOperation& floatOp, ProfileOperation callback);
1120     GateRef NumberOperation(Environment *env, GateRef left, GateRef right,
1121                             const BinaryOperation& intOp,
1122                             const BinaryOperation& floatOp,
1123                             ProfileOperation callback);
1124     void SetSValueWithBarrier(GateRef glue, GateRef obj, GateRef offset, GateRef value, GateRef objectRegion,
1125                                       GateRef valueRegion);
1126 
1127     void SetNonSValueWithBarrier(GateRef glue, GateRef obj, GateRef offset, GateRef value, GateRef objectRegion,
1128                                      GateRef valueRegion);
1129     void InitializeArguments();
1130     void CheckDetectorName(GateRef glue, GateRef key, Label *fallthrough, Label *slow);
1131     GateRef CanDoubleRepresentInt(GateRef exp, GateRef expBits, GateRef fractionBits);
1132     GateRef CalIteratorKey(GateRef glue);
1133 
1134     template <class LabelPtrGetter>
1135     void SwitchGeneric(GateRef index, Label *defaultLabel, Span<const int64_t> keysValue,
1136                        LabelPtrGetter getIthLabelFn);
1137     GateRef StringCompareContents(GateRef glue, GateRef left, GateRef right, GateRef init, GateRef minLength);
1138 
1139     CallSignature *callSignature_ {nullptr};
1140     Environment *env_;
1141 };
1142 }  // namespace panda::ecmascript::kungfu
1143 #endif  // ECMASCRIPT_COMPILER_STUB_BUILDER_H
1144