• 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-inl.h"
22 #include "ecmascript/compiler/profiler_operation.h"
23 #include "ecmascript/compiler/share_gate_meta_data.h"
24 #include "ecmascript/compiler/variable_type.h"
25 
26 namespace panda::ecmascript::kungfu {
27 struct StringInfoGateRef;
28 using namespace panda::ecmascript;
29 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
30 #define DEFVARIABLE(varname, type, val) Variable varname(GetEnvironment(), type, NextVariableId(), val)
31 
32 #define SUBENTRY(messageId, condition)                                              \
33     GateRef glueArg = PtrArgument(0);                                               \
34     auto env = GetEnvironment();                                                    \
35     Label subEntry(env);                                                            \
36     env->SubCfgEntry(&subEntry);                                                    \
37     Label nextLabel(env);                                                           \
38     Assert(messageId, __LINE__, glueArg, condition, &nextLabel);                    \
39     Bind(&nextLabel)
40 #define SUBENTRY_WITH_GLUE(messageId, condition, glueArg)                           \
41     auto env = GetEnvironment();                                                    \
42     Label subEntry(env);                                                            \
43     env->SubCfgEntry(&subEntry);                                                    \
44     Label nextLabel(env);                                                           \
45     Assert(messageId, __LINE__, glueArg, condition, &nextLabel);                    \
46     Bind(&nextLabel)
47 
48 #ifndef NDEBUG
49 #define ASM_ASSERT(messageId, condition)                                            \
50     if (!GetEnvironment()->GetCircuit()->IsOptimizedJSFunctionFrame()) {            \
51         SUBENTRY(messageId, condition);                                             \
52         EXITENTRY();                                                                \
53     }
54 #define ASM_ASSERT_WITH_GLUE(messageId, condition, glue)                            \
55     SUBENTRY_WITH_GLUE(messageId, condition, glue)
56 #elif defined(ENABLE_ASM_ASSERT)
57 #define ASM_ASSERT(messageId, condition)                                            \
58     if (!GetEnvironment()->GetCircuit()->IsOptimizedJSFunctionFrame()) {            \
59         SUBENTRY(messageId, condition);                                             \
60         EXITENTRY();                                                                \
61     }
62 #define ASM_ASSERT_WITH_GLUE(messageId, condition, glue)                            \
63     SUBENTRY_WITH_GLUE(messageId, condition, glue)
64 #else
65 #define ASM_ASSERT(messageId, ...) ((void)0)
66 #define ASM_ASSERT_WITH_GLUE(messageId, ...) ((void)0)
67 #endif
68 
69 #ifndef NDEBUG
70 #define EXITENTRY()                                                                 \
71     GetEnvironment()->SubCfgExit()
72 #elif defined(ENABLE_ASM_ASSERT)
73 #define EXITENTRY()                                                                 \
74     GetEnvironment()->SubCfgExit()
75 #else
76 #define EXITENTRY() ((void)0)
77 #endif
78 
79 class StubBuilder {
80 public:
StubBuilder(StubBuilder * parent)81     explicit StubBuilder(StubBuilder *parent)
82         : callSignature_(parent->GetCallSignature()), env_(parent->GetEnvironment()) {}
StubBuilder(CallSignature * callSignature,Environment * env)83     StubBuilder(CallSignature *callSignature, Environment *env)
84         : callSignature_(callSignature), env_(env) {}
StubBuilder(Environment * env)85     explicit StubBuilder(Environment *env)
86         : env_(env) {}
87     virtual ~StubBuilder() = default;
88     NO_MOVE_SEMANTIC(StubBuilder);
89     NO_COPY_SEMANTIC(StubBuilder);
90     virtual void GenerateCircuit() = 0;
GetEnvironment()91     Environment *GetEnvironment() const
92     {
93         return env_;
94     }
GetCallSignature()95     CallSignature *GetCallSignature() const
96     {
97         return callSignature_;
98     }
NextVariableId()99     int NextVariableId()
100     {
101         return env_->NextVariableId();
102     }
103     // constant
104     GateRef Int8(int8_t value);
105     GateRef Int16(int16_t value);
106     GateRef Int32(int32_t value);
107     GateRef Int64(int64_t value);
108     GateRef StringPtr(std::string_view str);
109     GateRef IntPtr(int64_t value);
110     GateRef IntPtrSize();
111     GateRef RelocatableData(uint64_t value);
112     GateRef True();
113     GateRef False();
114     GateRef Boolean(bool value);
115     GateRef Double(double value);
116     GateRef Undefined();
117     GateRef Hole();
118     GateRef SpecialHole();
119     GateRef Null();
120     GateRef NullPtr();
121     GateRef Exception();
122     // parameter
123     GateRef Argument(size_t index);
124     GateRef Int1Argument(size_t index);
125     GateRef Int32Argument(size_t index);
126     GateRef Int64Argument(size_t index);
127     GateRef TaggedArgument(size_t index);
128     GateRef TaggedPointerArgument(size_t index);
129     GateRef PtrArgument(size_t index);
130     GateRef Float32Argument(size_t index);
131     GateRef Float64Argument(size_t index);
132     GateRef Alloca(int size);
133     // control flow
134     GateRef Return(GateRef value);
135     GateRef Return();
136     void Bind(Label *label);
137     void Jump(Label *label);
138     void Branch(GateRef condition, Label *trueLabel, Label *falseLabel);
139     void Switch(GateRef index, Label *defaultLabel, int64_t *keysValue, Label *keysLabel, int numberOfKeys);
140     void LoopBegin(Label *loopHead);
141     void LoopEnd(Label *loopHead);
142     // call operation
143     GateRef CallRuntime(GateRef glue, int index, const std::initializer_list<GateRef>& args);
144     GateRef CallRuntime(GateRef glue, int index, GateRef argc, GateRef argv);
145     GateRef CallNGCRuntime(GateRef glue, int index, const std::initializer_list<GateRef>& args);
146     GateRef FastCallOptimized(GateRef glue, GateRef code, const std::initializer_list<GateRef>& args);
147     GateRef CallOptimized(GateRef glue, GateRef code, const std::initializer_list<GateRef>& args);
148     GateRef GetAotCodeAddr(GateRef method);
149     GateRef CallStub(GateRef glue, int index, const std::initializer_list<GateRef>& args);
150     GateRef CallBuiltinRuntime(GateRef glue, const std::initializer_list<GateRef>& args,
151                                bool isNew = false, const char* comment = nullptr);
152     GateRef CallBuiltinRuntimeWithNewTarget(GateRef glue, const std::initializer_list<GateRef>& args,
153                                             const char* comment = nullptr);
154     void DebugPrint(GateRef thread, std::initializer_list<GateRef> args);
155     void FatalPrint(GateRef thread, std::initializer_list<GateRef> args);
156     // memory
157     GateRef Load(VariableType type, GateRef base, GateRef offset);
158     GateRef Load(VariableType type, GateRef base);
159     void Store(VariableType type,
160                GateRef glue,
161                GateRef base,
162                GateRef offset,
163                GateRef value,
164                MemoryOrder order = MemoryOrder::Default());
165     // arithmetic
166     GateRef TaggedCastToIntPtr(GateRef x);
167     GateRef Int16Add(GateRef x, GateRef y);
168     GateRef Int32Add(GateRef x, GateRef y);
169     GateRef Int64Add(GateRef x, GateRef y);
170     GateRef DoubleAdd(GateRef x, GateRef y);
171     GateRef PtrAdd(GateRef x, GateRef y);
172     GateRef PtrSub(GateRef x, GateRef y);
173     GateRef PtrMul(GateRef x, GateRef y);
174     GateRef IntPtrEqual(GateRef x, GateRef y);
175     GateRef Int16Sub(GateRef x, GateRef y);
176     GateRef Int32Sub(GateRef x, GateRef y);
177     GateRef Int64Sub(GateRef x, GateRef y);
178     GateRef DoubleSub(GateRef x, GateRef y);
179     GateRef Int32Mul(GateRef x, GateRef y);
180     GateRef Int64Mul(GateRef x, GateRef y);
181     GateRef DoubleMul(GateRef x, GateRef y);
182     GateRef DoubleDiv(GateRef x, GateRef y);
183     GateRef Int32Div(GateRef x, GateRef y);
184     GateRef Int32Mod(GateRef x, GateRef y);
185     GateRef DoubleMod(GateRef x, GateRef y);
186     GateRef Int64Div(GateRef x, GateRef y);
187     GateRef IntPtrDiv(GateRef x, GateRef y);
188     // bit operation
189     GateRef Int32Or(GateRef x, GateRef y);
190     GateRef Int8And(GateRef x, GateRef y);
191     GateRef Int32And(GateRef x, GateRef y);
192     GateRef IntPtrAnd(GateRef x, GateRef y);
193     GateRef BoolAnd(GateRef x, GateRef y);
194     GateRef BoolOr(GateRef x, GateRef y);
195     GateRef Int32Not(GateRef x);
196     GateRef IntPtrNot(GateRef x);
197     GateRef BoolNot(GateRef x);
198     GateRef Int32Xor(GateRef x, GateRef y);
199     GateRef FixLoadType(GateRef x);
200     GateRef Int64Or(GateRef x, GateRef y);
201     GateRef IntPtrOr(GateRef x, GateRef y);
202     GateRef Int64And(GateRef x, GateRef y);
203     GateRef Int64Xor(GateRef x, GateRef y);
204     GateRef Int64Not(GateRef x);
205     GateRef Int16LSL(GateRef x, GateRef y);
206     GateRef Int32LSL(GateRef x, GateRef y);
207     GateRef Int64LSL(GateRef x, GateRef y);
208     GateRef IntPtrLSL(GateRef x, GateRef y);
209     GateRef Int8LSR(GateRef x, GateRef y);
210     GateRef Int32LSR(GateRef x, GateRef y);
211     GateRef Int64LSR(GateRef x, GateRef y);
212     GateRef IntPtrLSR(GateRef x, GateRef y);
213     GateRef Int32ASR(GateRef x, GateRef y);
214     GateRef TaggedIsInt(GateRef x);
215     GateRef TaggedIsDouble(GateRef x);
216     GateRef TaggedIsObject(GateRef x);
217     GateRef TaggedIsNumber(GateRef x);
218     GateRef TaggedIsNumeric(GateRef x);
219     GateRef TaggedIsHole(GateRef x);
220     GateRef TaggedIsNotHole(GateRef x);
221     GateRef TaggedIsUndefined(GateRef x);
222     GateRef TaggedIsException(GateRef x);
223     GateRef TaggedIsSpecial(GateRef x);
224     GateRef TaggedIsRegularObject(GateRef x);
225     GateRef TaggedIsHeapObject(GateRef x);
226     GateRef TaggedIsAccessor(GateRef x);
227     GateRef ObjectAddressToRange(GateRef x);
228     GateRef InYoungGeneration(GateRef region);
229     GateRef TaggedIsGeneratorObject(GateRef x);
230     GateRef TaggedIsJSArray(GateRef x);
231     GateRef TaggedIsAsyncGeneratorObject(GateRef x);
232     GateRef TaggedIsJSGlobalObject(GateRef x);
233     GateRef TaggedIsWeak(GateRef x);
234     GateRef TaggedIsPrototypeHandler(GateRef x);
235     GateRef TaggedIsStoreTSHandler(GateRef x);
236     GateRef TaggedIsTransWithProtoHandler(GateRef x);
237     GateRef TaggedIsTransitionHandler(GateRef x);
238     GateRef TaggedIsString(GateRef obj);
239     GateRef TaggedIsShared(GateRef obj);
240     GateRef BothAreString(GateRef x, GateRef y);
241     GateRef TaggedIsStringOrSymbol(GateRef obj);
242     GateRef TaggedIsSymbol(GateRef obj);
243     GateRef TaggedIsProtoChangeMarker(GateRef obj);
244     GateRef GetNextPositionForHash(GateRef last, GateRef count, GateRef size);
245     GateRef DoubleIsNAN(GateRef x);
246     GateRef DoubleIsINF(GateRef x);
247     GateRef TaggedIsNull(GateRef x);
248     GateRef TaggedIsUndefinedOrNull(GateRef x);
249     GateRef TaggedIsTrue(GateRef x);
250     GateRef TaggedIsFalse(GateRef x);
251     GateRef TaggedIsBoolean(GateRef x);
252     GateRef TaggedGetInt(GateRef x);
253     GateRef NumberGetInt(GateRef glue, GateRef x);
254     GateRef TaggedGetNumber(GateRef x);
255     GateRef Int8ToTaggedInt(GateRef x);
256     GateRef Int16ToTaggedInt(GateRef x);
257     GateRef IntToTaggedPtr(GateRef x);
258     GateRef IntToTaggedInt(GateRef x);
259     GateRef Int64ToTaggedInt(GateRef x);
260     GateRef Int64ToTaggedIntPtr(GateRef x);
261     GateRef DoubleToTaggedDoublePtr(GateRef x);
262     GateRef TaggedPtrToTaggedDoublePtr(GateRef x);
263     GateRef TaggedPtrToTaggedIntPtr(GateRef x);
264     GateRef CastDoubleToInt64(GateRef x);
265     GateRef TaggedTrue();
266     GateRef TaggedFalse();
267     GateRef TaggedUndefined();
268     // compare operation
269     GateRef Int8Equal(GateRef x, GateRef y);
270     GateRef Equal(GateRef x, GateRef y);
271     GateRef Int32Equal(GateRef x, GateRef y);
272     GateRef Int32NotEqual(GateRef x, GateRef y);
273     GateRef Int64Equal(GateRef x, GateRef y);
274     GateRef DoubleEqual(GateRef x, GateRef y);
275     GateRef DoubleNotEqual(GateRef x, GateRef y);
276     GateRef Int64NotEqual(GateRef x, GateRef y);
277     GateRef DoubleLessThan(GateRef x, GateRef y);
278     GateRef DoubleLessThanOrEqual(GateRef x, GateRef y);
279     GateRef DoubleGreaterThan(GateRef x, GateRef y);
280     GateRef DoubleGreaterThanOrEqual(GateRef x, GateRef y);
281     GateRef Int32GreaterThan(GateRef x, GateRef y);
282     GateRef Int32LessThan(GateRef x, GateRef y);
283     GateRef Int32GreaterThanOrEqual(GateRef x, GateRef y);
284     GateRef Int32LessThanOrEqual(GateRef x, GateRef y);
285     GateRef Int32UnsignedGreaterThan(GateRef x, GateRef y);
286     GateRef Int32UnsignedLessThan(GateRef x, GateRef y);
287     GateRef Int32UnsignedGreaterThanOrEqual(GateRef x, GateRef y);
288     GateRef Int32UnsignedLessThanOrEqual(GateRef x, GateRef y);
289     GateRef Int64GreaterThan(GateRef x, GateRef y);
290     GateRef Int64LessThan(GateRef x, GateRef y);
291     GateRef Int64LessThanOrEqual(GateRef x, GateRef y);
292     GateRef Int64GreaterThanOrEqual(GateRef x, GateRef y);
293     GateRef Int64UnsignedLessThanOrEqual(GateRef x, GateRef y);
294     GateRef IntPtrGreaterThan(GateRef x, GateRef y);
295     // cast operation
296     GateRef ChangeInt64ToIntPtr(GateRef val);
297     GateRef ZExtInt32ToPtr(GateRef val);
298     GateRef ChangeIntPtrToInt32(GateRef val);
299     GateRef ToLength(GateRef glue, GateRef target);
300 
301     // math operation
302     GateRef Sqrt(GateRef x);
303     GateRef GetSetterFromAccessor(GateRef accessor);
304     GateRef GetElementsArray(GateRef object);
305     void SetElementsArray(VariableType type, GateRef glue, GateRef object, GateRef elementsArray);
306     GateRef GetPropertiesArray(GateRef object);
307     // SetProperties in js_object.h
308     void SetPropertiesArray(VariableType type, GateRef glue, GateRef object, GateRef propsArray);
309     void SetHash(GateRef glue, GateRef object, GateRef hash);
310     GateRef GetLengthOfTaggedArray(GateRef array);
311     GateRef GetExtractLengthOfTaggedArray(GateRef array);
312     // object operation
313     GateRef IsJSHClass(GateRef obj);
314     GateRef LoadHClass(GateRef object);
315     void StoreHClass(GateRef glue, GateRef object, GateRef hClass);
316     void StorePrototype(GateRef glue, GateRef hclass, GateRef prototype);
317     void CopyAllHClass(GateRef glue, GateRef dstHClass, GateRef scrHClass);
318     GateRef GetObjectType(GateRef hClass);
319     GateRef IsDictionaryMode(GateRef object);
320     GateRef IsDictionaryModeByHClass(GateRef hClass);
321     GateRef IsDictionaryElement(GateRef hClass);
322     GateRef IsStableElements(GateRef hClass);
323     GateRef HasConstructorByHClass(GateRef hClass);
324     GateRef HasConstructor(GateRef object);
325     GateRef IsClassConstructorFromBitField(GateRef bitfield);
326     GateRef IsClassConstructor(GateRef object);
327     GateRef IsClassPrototype(GateRef object);
328     GateRef IsExtensible(GateRef object);
329     GateRef TaggedObjectIsEcmaObject(GateRef obj);
330     GateRef IsEcmaObject(GateRef obj);
331     GateRef IsSymbol(GateRef obj);
332     GateRef IsString(GateRef obj);
333     GateRef IsLineString(GateRef obj);
334     GateRef IsSlicedString(GateRef obj);
335     GateRef IsConstantString(GateRef obj);
336     GateRef IsTreeString(GateRef obj);
337     GateRef TreeStringIsFlat(GateRef string);
338     GateRef TaggedIsBigInt(GateRef obj);
339     GateRef TaggedIsPropertyBox(GateRef obj);
340     GateRef TaggedObjectIsBigInt(GateRef obj);
341     GateRef IsJsProxy(GateRef obj);
342     GateRef IsJSShared(GateRef obj);
343     GateRef IsJSGlobalObject(GateRef obj);
344     GateRef IsModuleNamespace(GateRef obj);
345     GateRef ObjIsSpecialContainer(GateRef obj);
346     GateRef IsJSPrimitiveRef(GateRef obj);
347     GateRef IsJSFunctionBase(GateRef obj);
348     GateRef IsConstructor(GateRef object);
349     GateRef IsBase(GateRef func);
350     GateRef IsJsArray(GateRef obj);
351     GateRef IsByteArray(GateRef obj);
352     GateRef IsJsCOWArray(GateRef obj);
353     GateRef IsMutantTaggedArray(GateRef elements);
354     GateRef IsJSObject(GateRef obj);
355     GateRef IsEnumerable(GateRef attr);
356     GateRef IsWritable(GateRef attr);
357     GateRef IsConfigable(GateRef attr);
358     GateRef IsDefaultAttribute(GateRef attr);
359     GateRef IsArrayLengthWritable(GateRef glue, GateRef receiver);
360     GateRef IsAccessor(GateRef attr);
361     GateRef IsInlinedProperty(GateRef attr);
362     GateRef IsField(GateRef attr);
363     GateRef IsNonSharedStoreField(GateRef attr);
364     GateRef IsStoreShared(GateRef attr);
365     GateRef IsElement(GateRef attr);
366     GateRef IsStringElement(GateRef attr);
367     GateRef IsStringLength(GateRef attr);
368     GateRef IsTypedArrayElement(GateRef attr);
369     GateRef IsNonExist(GateRef attr);
370     GateRef IsJSAPIVector(GateRef attr);
371     GateRef IsJSAPIStack(GateRef obj);
372     GateRef IsJSAPIPlainArray(GateRef obj);
373     GateRef IsJSAPIQueue(GateRef obj);
374     GateRef IsJSAPIDeque(GateRef obj);
375     GateRef IsJSAPILightWeightMap(GateRef obj);
376     GateRef IsJSAPILightWeightSet(GateRef obj);
377     GateRef IsLinkedNode(GateRef obj);
378     GateRef IsJSAPIHashMap(GateRef obj);
379     GateRef IsJSAPIHashSet(GateRef obj);
380     GateRef IsJSAPILinkedList(GateRef obj);
381     GateRef IsJSAPIList(GateRef obj);
382     GateRef IsJSAPIArrayList(GateRef obj);
383     GateRef IsJSObjectType(GateRef obj, JSType jsType);
384     GateRef IsJSRegExp(GateRef obj);
385     GateRef GetTarget(GateRef proxyObj);
386     GateRef HandlerBaseIsAccessor(GateRef attr);
387     GateRef HandlerBaseIsJSArray(GateRef attr);
388     GateRef HandlerBaseIsInlinedProperty(GateRef attr);
389     GateRef HandlerBaseGetOffset(GateRef attr);
390     GateRef HandlerBaseGetAttrIndex(GateRef attr);
391     GateRef HandlerBaseGetRep(GateRef attr);
392     GateRef IsInvalidPropertyBox(GateRef obj);
393     GateRef IsAccessorPropertyBox(GateRef obj);
394     GateRef GetValueFromPropertyBox(GateRef obj);
395     void SetValueToPropertyBox(GateRef glue, GateRef obj, GateRef value);
396     GateRef GetTransitionHClass(GateRef obj);
397     GateRef GetTransitionHandlerInfo(GateRef obj);
398     GateRef GetTransWithProtoHClass(GateRef obj);
399     GateRef GetTransWithProtoHandlerInfo(GateRef obj);
400     GateRef IsInternalAccessor(GateRef attr);
401     GateRef GetProtoCell(GateRef object);
402     GateRef GetPrototypeHandlerHolder(GateRef object);
403     GateRef GetPrototypeHandlerHandlerInfo(GateRef object);
404     GateRef GetStoreTSHandlerHolder(GateRef object);
405     GateRef GetStoreTSHandlerHandlerInfo(GateRef object);
406     GateRef GetPrototype(GateRef glue, GateRef object);
407     GateRef GetHasChanged(GateRef object);
408     GateRef HclassIsPrototypeHandler(GateRef hClass);
409     GateRef HclassIsTransitionHandler(GateRef hClass);
410     GateRef HclassIsPropertyBox(GateRef hClass);
411     GateRef PropAttrGetOffset(GateRef attr);
412     GateRef GetCtorPrototype(GateRef ctor);
413     GateRef InstanceOf(GateRef glue, GateRef object, GateRef target, GateRef profileTypeInfo, GateRef slotId,
414         ProfileOperation callback);
415     GateRef OrdinaryHasInstance(GateRef glue, GateRef target, GateRef obj);
416     void TryFastHasInstance(GateRef glue, GateRef instof, GateRef target, GateRef object, Label *fastPath,
417                             Label *exit, Variable *result, ProfileOperation callback);
418     GateRef SameValue(GateRef glue, GateRef left, GateRef right);
419     GateRef SameValueZero(GateRef glue, GateRef left, GateRef right);
420     GateRef HasStableElements(GateRef glue, GateRef obj);
421     GateRef IsStableJSArguments(GateRef glue, GateRef obj);
422     GateRef IsStableJSArray(GateRef glue, GateRef obj);
423     GateRef IsTypedArray(GateRef obj);
424     GateRef IsStableArguments(GateRef hClass);
425     GateRef IsStableArray(GateRef hClass);
426     GateRef GetProfileTypeInfo(GateRef jsFunc);
427     GateRef UpdateProfileTypeInfo(GateRef glue, GateRef jsFunc);
428     // SetDictionaryOrder func in property_attribute.h
429     GateRef SetDictionaryOrderFieldInPropAttr(GateRef attr, GateRef value);
430     GateRef GetPrototypeFromHClass(GateRef hClass);
431     GateRef GetEnumCacheFromHClass(GateRef hClass);
432     GateRef GetProtoChangeMarkerFromHClass(GateRef hClass);
433     GateRef GetLayoutFromHClass(GateRef hClass);
434     GateRef GetBitFieldFromHClass(GateRef hClass);
435     GateRef GetLengthFromString(GateRef value);
436     GateRef GetHashcodeFromString(GateRef glue, GateRef value);
437     inline GateRef IsIntegerString(GateRef string);
438     inline void SetRawHashcode(GateRef glue, GateRef str, GateRef rawHashcode, GateRef isInteger);
439     inline GateRef GetRawHashFromString(GateRef value);
440     GateRef TryGetHashcodeFromString(GateRef string);
441     inline GateRef GetMixHashcode(GateRef string);
442     GateRef GetFirstFromTreeString(GateRef string);
443     GateRef GetSecondFromTreeString(GateRef string);
444     GateRef GetIsAllTaggedPropFromHClass(GateRef hclass);
445     void SetBitFieldToHClass(GateRef glue, GateRef hClass, GateRef bitfield);
446     void SetIsAllTaggedProp(GateRef glue, GateRef hclass, GateRef hasRep);
447     void SetPrototypeToHClass(VariableType type, GateRef glue, GateRef hClass, GateRef proto);
448     void SetProtoChangeDetailsToHClass(VariableType type, GateRef glue, GateRef hClass,
449                                        GateRef protoChange);
450     void SetLayoutToHClass(
451         VariableType type, GateRef glue, GateRef hClass, GateRef attr, MemoryOrder order = MemoryOrder::Default());
452     void SetHClassTypeIDToHClass(GateRef glue, GateRef hClass, GateRef id);
453     void SetEnumCacheToHClass(VariableType type, GateRef glue, GateRef hClass, GateRef key);
454     void SetTransitionsToHClass(VariableType type, GateRef glue, GateRef hClass, GateRef transition);
455     void SetParentToHClass(VariableType type, GateRef glue, GateRef hClass, GateRef parent);
456     void SetIsProtoTypeToHClass(GateRef glue, GateRef hClass, GateRef value);
457     inline void SetIsTS(GateRef glue, GateRef hClass, GateRef value);
458     GateRef IsProtoTypeHClass(GateRef hClass);
459     void SetPropertyInlinedProps(GateRef glue, GateRef obj, GateRef hClass,
460         GateRef value, GateRef attrOffset, VariableType type = VariableType::JS_ANY());
461     GateRef GetPropertyInlinedProps(GateRef obj, GateRef hClass,
462         GateRef index);
463     GateRef GetInlinedPropOffsetFromHClass(GateRef hclass, GateRef attrOffset);
464 
465     void IncNumberOfProps(GateRef glue, GateRef hClass);
466     GateRef GetNumberOfPropsFromHClass(GateRef hClass);
467     GateRef HasDeleteProperty(GateRef hClass);
468     GateRef IsTSHClass(GateRef hClass);
469     void SetNumberOfPropsToHClass(GateRef glue, GateRef hClass, GateRef value);
470     void SetElementsKindToTrackInfo(GateRef glue, GateRef trackInfo, GateRef elementsKind);
471     void SetSpaceFlagToTrackInfo(GateRef glue, GateRef trackInfo, GateRef spaceFlag);
472     GateRef GetElementsKindFromHClass(GateRef hClass);
473     GateRef GetObjectSizeFromHClass(GateRef hClass);
474     GateRef GetInlinedPropsStartFromHClass(GateRef hClass);
475     GateRef GetInlinedPropertiesFromHClass(GateRef hClass);
476     void ThrowTypeAndReturn(GateRef glue, int messageId, GateRef val);
477     GateRef GetValueFromTaggedArray(GateRef elements, GateRef index);
478     GateRef GetValueFromMutantTaggedArray(GateRef elements, GateRef index);
479     void CheckUpdateSharedType(bool isDicMode, Variable *result, GateRef glue, GateRef jsType, GateRef attr,
480                                GateRef value, Label *executeSetProp, Label *exit);
481     void MatchTrackType(Variable *result, GateRef glue, GateRef trackType, GateRef value, Label *executeSetProp,
482                                Label *exit);
483     GateRef GetTrackTypeFromHandler(GateRef attr);
484     GateRef ClearSharedStoreKind(GateRef handlerInfo);
485     GateRef GetTaggedValueWithElementsKind(GateRef receiver, GateRef index);
486     GateRef SetValueWithElementsKind(GateRef glue, GateRef receiver, GateRef rawValue, GateRef index,
487                                      GateRef needTransition, GateRef extraKind);
488     void SetValueToTaggedArrayWithAttr(
489         GateRef glue, GateRef array, GateRef index, GateRef key, GateRef val, GateRef attr);
490     void SetValueToTaggedArrayWithRep(
491         GateRef glue, GateRef array, GateRef index, GateRef val, GateRef rep, Label *repChange);
492     void SetValueToTaggedArray(VariableType valType, GateRef glue, GateRef array, GateRef index, GateRef val);
493     void UpdateValueAndAttributes(GateRef glue, GateRef elements, GateRef index, GateRef value, GateRef attr);
494     GateRef IsSpecialIndexedObj(GateRef jsType);
495     GateRef IsJSSharedType(GateRef jsType);
496     GateRef IsSpecialContainer(GateRef jsType);
497     GateRef IsAccessorInternal(GateRef value);
498     template<typename DictionaryT>
499     GateRef GetAttributesFromDictionary(GateRef elements, GateRef entry);
500     template<typename DictionaryT>
501     GateRef GetValueFromDictionary(GateRef elements, GateRef entry);
502     template<typename DictionaryT>
503     GateRef GetKeyFromDictionary(GateRef elements, GateRef entry);
504     GateRef GetPropAttrFromLayoutInfo(GateRef layout, GateRef entry);
505     void SetPropAttrToLayoutInfo(GateRef glue, GateRef layout, GateRef entry, GateRef attr);
506     GateRef GetPropertiesAddrFromLayoutInfo(GateRef layout);
507     GateRef GetPropertyMetaDataFromAttr(GateRef attr);
508     GateRef GetKeyFromLayoutInfo(GateRef layout, GateRef entry);
509     void MatchTrackType(GateRef trackType, GateRef value, Label *executeSetProp, Label *typeMismatch);
510     GateRef FindElementWithCache(GateRef glue, GateRef layoutInfo, GateRef hClass,
511         GateRef key, GateRef propsNum);
512     GateRef FindElementFromNumberDictionary(GateRef glue, GateRef elements, GateRef index);
513     GateRef FindEntryFromNameDictionary(GateRef glue, GateRef elements, GateRef key);
514     GateRef IsMatchInTransitionDictionary(GateRef element, GateRef key, GateRef metaData, GateRef attr);
515     GateRef FindEntryFromTransitionDictionary(GateRef glue, GateRef elements, GateRef key, GateRef metaData);
516     GateRef JSObjectGetProperty(GateRef obj, GateRef hClass, GateRef propAttr);
517     void JSObjectSetProperty(GateRef glue, GateRef obj, GateRef hClass, GateRef attr, GateRef key, GateRef value);
518     GateRef ShouldCallSetter(GateRef receiver, GateRef holder, GateRef accessor, GateRef attr);
519     GateRef CallSetterHelper(GateRef glue, GateRef holder, GateRef accessor,  GateRef value, ProfileOperation callback);
520     GateRef SetHasConstructorCondition(GateRef glue, GateRef receiver, GateRef key);
521     GateRef AddPropertyByName(GateRef glue, GateRef receiver, GateRef key, GateRef value, GateRef propertyAttributes,
522         ProfileOperation callback);
523     GateRef IsUtf16String(GateRef string);
524     GateRef IsUtf8String(GateRef string);
525     GateRef IsInternalString(GateRef string);
526     GateRef IsDigit(GateRef ch);
527     void TryToGetInteger(GateRef string, Variable *num, Label *success, Label *failed);
528     GateRef StringToElementIndex(GateRef glue, GateRef string);
529     GateRef ComputeElementCapacity(GateRef oldLength);
530     GateRef ComputeNonInlinedFastPropsCapacity(GateRef glue, GateRef oldLength,
531                                                GateRef maxNonInlinedFastPropsCapacity);
532     GateRef FindTransitions(GateRef glue, GateRef receiver, GateRef hClass, GateRef key, GateRef attr);
533     void TransitionForRepChange(GateRef glue, GateRef receiver, GateRef key, GateRef attr);
534     void TransitToElementsKind(GateRef glue, GateRef receiver, GateRef value, GateRef kind);
535     GateRef TaggedToRepresentation(GateRef value);
536     GateRef TaggedToElementKind(GateRef value);
537     GateRef LdGlobalRecord(GateRef glue, GateRef key);
538     GateRef LoadFromField(GateRef receiver, GateRef handlerInfo);
539     GateRef LoadGlobal(GateRef cell);
540     GateRef LoadElement(GateRef glue, GateRef receiver, GateRef key);
541     GateRef LoadStringElement(GateRef glue, GateRef receiver, GateRef key);
542     GateRef TryToElementsIndex(GateRef glue, GateRef key);
543     GateRef CheckPolyHClass(GateRef cachedValue, GateRef hClass);
544     GateRef LoadICWithHandler(
545         GateRef glue, GateRef receiver, GateRef holder, GateRef handler, ProfileOperation callback);
546     GateRef StoreICWithHandler(GateRef glue, GateRef receiver, GateRef holder,
547                                GateRef value, GateRef handler, ProfileOperation callback = ProfileOperation());
548     GateRef ICStoreElement(GateRef glue, GateRef receiver, GateRef key, GateRef value, GateRef handlerInfo);
549     GateRef GetArrayLength(GateRef object);
550     GateRef DoubleToInt(GateRef glue, GateRef x, size_t bits = base::INT32_BITS);
551     void SetArrayLength(GateRef glue, GateRef object, GateRef len);
552     GateRef StoreField(GateRef glue, GateRef receiver, GateRef value, GateRef handler, ProfileOperation callback);
553     GateRef StoreWithTransition(GateRef glue, GateRef receiver, GateRef value, GateRef handler,
554                              ProfileOperation callback, bool withPrototype = false);
555     GateRef StoreGlobal(GateRef glue, GateRef value, GateRef cell);
556     void JSHClassAddProperty(GateRef glue, GateRef receiver, GateRef key, GateRef attr);
557     void NotifyHClassChanged(GateRef glue, GateRef oldHClass, GateRef newHClass);
558     GateRef GetInt64OfTInt(GateRef x);
559     GateRef GetInt32OfTInt(GateRef x);
560     GateRef GetDoubleOfTInt(GateRef x);
561     GateRef GetDoubleOfTDouble(GateRef x);
562     GateRef GetDoubleOfTNumber(GateRef x);
563     GateRef LoadObjectFromWeakRef(GateRef x);
564     GateRef ExtFloat32ToDouble(GateRef x);
565     GateRef ChangeInt32ToFloat32(GateRef x);
566     GateRef ChangeInt32ToFloat64(GateRef x);
567     GateRef ChangeUInt32ToFloat64(GateRef x);
568     GateRef ChangeFloat64ToInt32(GateRef x);
569     GateRef DeletePropertyOrThrow(GateRef glue, GateRef obj, GateRef value);
570     GateRef ToObject(GateRef glue, GateRef obj);
571     GateRef DeleteProperty(GateRef glue, GateRef obj, GateRef value);
572     GateRef NewJSPrimitiveRef(GateRef glue, size_t index, GateRef obj);
573     GateRef ModuleNamespaceDeleteProperty(GateRef glue, GateRef obj, GateRef value);
574     GateRef Int64ToTaggedPtr(GateRef x);
575     GateRef TruncInt16ToInt8(GateRef x);
576     GateRef TruncInt32ToInt16(GateRef x);
577     GateRef TruncInt32ToInt8(GateRef x);
578     GateRef CastInt32ToFloat32(GateRef x);
579     GateRef CastInt64ToFloat64(GateRef x);
580     GateRef SExtInt32ToInt64(GateRef x);
581     GateRef SExtInt16ToInt64(GateRef x);
582     GateRef SExtInt16ToInt32(GateRef x);
583     GateRef SExtInt8ToInt64(GateRef x);
584     GateRef SExtInt8ToInt32(GateRef x);
585     GateRef SExtInt1ToInt64(GateRef x);
586     GateRef SExtInt1ToInt32(GateRef x);
587     GateRef ZExtInt8ToInt16(GateRef x);
588     GateRef ZExtInt32ToInt64(GateRef x);
589     GateRef ZExtInt1ToInt64(GateRef x);
590     GateRef ZExtInt1ToInt32(GateRef x);
591     GateRef ZExtInt8ToInt32(GateRef x);
592     GateRef ZExtInt8ToInt64(GateRef x);
593     GateRef ZExtInt8ToPtr(GateRef x);
594     GateRef ZExtInt16ToPtr(GateRef x);
595     GateRef SExtInt32ToPtr(GateRef x);
596     GateRef ZExtInt16ToInt32(GateRef x);
597     GateRef ZExtInt16ToInt64(GateRef x);
598     GateRef TruncInt64ToInt32(GateRef x);
599     GateRef TruncPtrToInt32(GateRef x);
600     GateRef TruncInt64ToInt1(GateRef x);
601     GateRef TruncInt32ToInt1(GateRef x);
602     GateRef GetGlobalConstantAddr(GateRef index);
603     GateRef GetGlobalConstantOffset(ConstantIndex index);
604     GateRef IsCallableFromBitField(GateRef bitfield);
605     GateRef IsCallable(GateRef obj);
606     GateRef GetOffsetFieldInPropAttr(GateRef attr);
607     GateRef SetOffsetFieldInPropAttr(GateRef attr, GateRef value);
608     GateRef SetIsInlinePropsFieldInPropAttr(GateRef attr, GateRef value);
609     GateRef SetTrackTypeInPropAttr(GateRef attr, GateRef type);
610     GateRef GetTrackTypeInPropAttr(GateRef attr);
611     GateRef GetDictTrackTypeInPropAttr(GateRef attr);
612     GateRef GetRepInPropAttr(GateRef attr);
613     GateRef IsIntRepInPropAttr(GateRef attr);
614     GateRef IsDoubleRepInPropAttr(GateRef attr);
615     GateRef SetTaggedRepInPropAttr(GateRef attr);
616     void SetHasConstructorToHClass(GateRef glue, GateRef hClass, GateRef value);
617     template<typename DictionaryT>
618     void UpdateValueInDict(GateRef glue, GateRef elements, GateRef index, GateRef value);
619     GateRef GetBitMask(GateRef bitoffset);
620     GateRef IntPtrEuqal(GateRef x, GateRef y);
621     void SetValueWithAttr(GateRef glue, GateRef obj, GateRef offset, GateRef key, GateRef value, GateRef attr);
622     void SetValueWithRep(GateRef glue, GateRef obj, GateRef offset, GateRef value, GateRef rep, Label *repChange);
623     void SetValueWithBarrier(GateRef glue, GateRef obj, GateRef offset, GateRef value);
624     GateRef GetPropertyByIndex(GateRef glue, GateRef receiver, GateRef index, ProfileOperation callback);
625     GateRef GetPropertyByName(GateRef glue, GateRef receiver, GateRef key,
626                               ProfileOperation callback, GateRef isInternal, bool canUseIsInternal = false);
627     GateRef FastGetPropertyByName(GateRef glue, GateRef obj, GateRef key, ProfileOperation callback);
628     GateRef FastGetPropertyByIndex(GateRef glue, GateRef obj, GateRef index, ProfileOperation callback);
629     GateRef GetPropertyByValue(GateRef glue, GateRef receiver, GateRef keyValue, ProfileOperation callback);
630     void FastSetPropertyByName(GateRef glue, GateRef obj, GateRef key, GateRef value,
631         ProfileOperation callback = ProfileOperation());
632     void FastSetPropertyByIndex(GateRef glue, GateRef obj, GateRef index, GateRef value);
633     GateRef SetPropertyByIndex(GateRef glue, GateRef receiver, GateRef index,
634         GateRef value, bool useOwn, ProfileOperation callback = ProfileOperation());
635     GateRef SetPropertyByName(GateRef glue, GateRef receiver, GateRef key,
636         GateRef value, bool useOwn, GateRef isInternal, ProfileOperation callback = ProfileOperation(),
637         bool canUseIsInternal = false); // Crawl prototype chain
638     GateRef SetPropertyByValue(GateRef glue, GateRef receiver, GateRef key, GateRef value, bool useOwn,
639         ProfileOperation callback = ProfileOperation());
640     GateRef GetParentEnv(GateRef object);
641     GateRef GetPropertiesFromLexicalEnv(GateRef object, GateRef index);
642     void SetPropertiesToLexicalEnv(GateRef glue, GateRef object, GateRef index, GateRef value);
643     GateRef GetHomeObjectFromJSFunction(GateRef object);
644     GateRef GetCallFieldFromMethod(GateRef method);
645     inline GateRef GetBuiltinId(GateRef method);
646     void SetLexicalEnvToFunction(GateRef glue, GateRef object, GateRef lexicalEnv);
647     void SetProtoOrHClassToFunction(GateRef glue, GateRef function, GateRef value);
648     void SetWorkNodePointerToFunction(GateRef glue, GateRef function, GateRef value);
649     void SetHomeObjectToFunction(GateRef glue, GateRef function, GateRef value);
650     void SetMethodToFunction(GateRef glue, GateRef function, GateRef value);
651     void SetLengthToFunction(GateRef glue, GateRef function, GateRef value);
652     GateRef GetGlobalObject(GateRef glue);
653     GateRef GetMethodFromFunction(GateRef function);
654     GateRef GetModuleFromFunction(GateRef function);
655     GateRef GetHomeObjectFromFunction(GateRef function);
656     GateRef GetEntryIndexOfGlobalDictionary(GateRef entry);
657     GateRef GetBoxFromGlobalDictionary(GateRef object, GateRef entry);
658     GateRef GetValueFromGlobalDictionary(GateRef object, GateRef entry);
659     GateRef GetPropertiesFromJSObject(GateRef object);
660     template<OpCode Op, MachineType Type>
661     GateRef BinaryOp(GateRef x, GateRef y);
662     template<OpCode Op, MachineType Type>
663     GateRef BinaryOpWithOverflow(GateRef x, GateRef y);
664     GateRef GetGlobalOwnProperty(GateRef glue, GateRef receiver, GateRef key, ProfileOperation callback);
665     GateRef AddElementInternal(GateRef glue, GateRef receiver, GateRef index, GateRef value, GateRef attr);
666     GateRef ShouldTransToDict(GateRef capcity, GateRef index);
667     void NotifyStableArrayElementsGuardians(GateRef glue, GateRef receiver);
668     GateRef GrowElementsCapacity(GateRef glue, GateRef receiver, GateRef capacity);
669 
670     inline GateRef GetObjectFromConstPool(GateRef constpool, GateRef index);
671     GateRef GetConstPoolFromFunction(GateRef jsFunc);
672     GateRef GetStringFromConstPool(GateRef glue, GateRef constpool, GateRef index);
673     GateRef GetMethodFromConstPool(GateRef glue, GateRef constpool, GateRef index, GateRef module);
674     GateRef GetArrayLiteralFromConstPool(GateRef glue, GateRef constpool, GateRef index, GateRef module);
675     GateRef GetObjectLiteralFromConstPool(GateRef glue, GateRef constpool, GateRef index, GateRef module);
676     void SetExtensibleToBitfield(GateRef glue, GateRef obj, bool isExtensible);
677     void SetCallableToBitfield(GateRef glue, GateRef obj, bool isCallable);
678 
679     // fast path
680     GateRef FastEqual(GateRef glue, GateRef left, GateRef right, ProfileOperation callback);
681     GateRef FastStrictEqual(GateRef glue, GateRef left, GateRef right, ProfileOperation callback);
682     GateRef FastStringEqual(GateRef glue, GateRef left, GateRef right);
683     GateRef FastMod(GateRef gule, GateRef left, GateRef right, ProfileOperation callback);
684     GateRef FastTypeOf(GateRef left, GateRef right);
685     GateRef FastMul(GateRef glue, GateRef left, GateRef right, ProfileOperation callback);
686     GateRef FastDiv(GateRef left, GateRef right, ProfileOperation callback);
687     GateRef FastAdd(GateRef glue, GateRef left, GateRef right, ProfileOperation callback);
688     GateRef FastSub(GateRef glue, GateRef left, GateRef right, ProfileOperation callback);
689     GateRef FastToBoolean(GateRef value, bool flag = true);
690 
691     // Add SpecialContainer
692     GateRef GetContainerProperty(GateRef glue, GateRef receiver, GateRef index, GateRef jsType);
693     GateRef JSAPIContainerGet(GateRef glue, GateRef receiver, GateRef index);
694 
695     // for-in
696     GateRef NextInternal(GateRef glue, GateRef iter);
697     GateRef GetLengthFromForInIterator(GateRef iter);
698     GateRef GetIndexFromForInIterator(GateRef iter);
699     GateRef GetKeysFromForInIterator(GateRef iter);
700     GateRef GetObjectFromForInIterator(GateRef iter);
701     GateRef GetCachedHclassFromForInIterator(GateRef iter);
702     void SetLengthOfForInIterator(GateRef glue, GateRef iter, GateRef length);
703     void SetIndexOfForInIterator(GateRef glue, GateRef iter, GateRef index);
704     void SetKeysOfForInIterator(GateRef glue, GateRef iter, GateRef keys);
705     void SetObjectOfForInIterator(GateRef glue, GateRef iter, GateRef object);
706     void SetCachedHclassOfForInIterator(GateRef glue, GateRef iter, GateRef hclass);
707     void IncreaseInteratorIndex(GateRef glue, GateRef iter, GateRef index);
708     void SetNextIndexOfArrayIterator(GateRef glue, GateRef iter, GateRef nextIndex);
709     void SetIteratedArrayOfArrayIterator(GateRef glue, GateRef iter, GateRef iteratedArray);
710     void SetBitFieldOfArrayIterator(GateRef glue, GateRef iter, GateRef kind);
711     GateRef GetEnumCacheKind(GateRef glue, GateRef enumCache);
712     GateRef GetEmptyArray(GateRef glue);
713     GateRef IsEnumCacheValid(GateRef receiver, GateRef cachedHclass, GateRef kind);
714     GateRef NeedCheckProperty(GateRef receiver);
715 
716     GateRef EnumerateObjectProperties(GateRef glue, GateRef obj);
717     GateRef GetFunctionPrototype(GateRef glue, size_t index);
718     GateRef ToPrototypeOrObj(GateRef glue, GateRef obj);
719     GateRef IsSpecialKeysObject(GateRef obj);
720     GateRef IsSlowKeysObject(GateRef obj);
721     GateRef TryGetEnumCache(GateRef glue, GateRef obj);
722     GateRef GetNumberOfElements(GateRef obj);
723     GateRef IsSimpleEnumCacheValid(GateRef obj);
724     GateRef IsEnumCacheWithProtoChainInfoValid(GateRef obj);
725 
726     // Exception handle
727     GateRef HasPendingException(GateRef glue);
728     void ReturnExceptionIfAbruptCompletion(GateRef glue);
729 
730     // method operator
731     GateRef IsJSFunction(GateRef obj);
732     GateRef IsBoundFunction(GateRef obj);
733     GateRef GetMethodFromJSFunction(GateRef jsfunc);
734     GateRef IsNativeMethod(GateRef method);
735     GateRef GetFuncKind(GateRef method);
736     GateRef HasPrototype(GateRef kind);
737     GateRef HasAccessor(GateRef kind);
738     GateRef IsClassConstructorKind(GateRef kind);
739     GateRef IsGeneratorKind(GateRef kind);
740     GateRef IsBaseKind(GateRef kind);
741 
742     GateRef IsAOTLiteralInfo(GateRef info);
743     GateRef GetIhcFromAOTLiteralInfo(GateRef info);
744     GateRef IsAotWithCallField(GateRef method);
745     GateRef IsFastCall(GateRef method);
746     GateRef JudgeAotAndFastCall(GateRef jsFunc, CircuitBuilder::JudgeMethodType type);
747     GateRef JudgeAotAndFastCallWithMethod(GateRef method, CircuitBuilder::JudgeMethodType type);
748     GateRef GetInternalString(GateRef glue, GateRef key);
749     GateRef GetExpectedNumOfArgs(GateRef method);
750     GateRef GetMethod(GateRef glue, GateRef obj, GateRef key, GateRef profileTypeInfo, GateRef slotId);
751     // proxy operator
752     GateRef GetMethodFromJSProxy(GateRef proxy);
753     GateRef GetHandlerFromJSProxy(GateRef proxy);
754     GateRef GetTargetFromJSProxy(GateRef proxy);
755     inline void SetHotnessCounter(GateRef glue, GateRef method, GateRef value);
756     inline void SaveHotnessCounterIfNeeded(GateRef glue, GateRef sp, GateRef hotnessCounter, JSCallMode mode);
757     inline void SavePcIfNeeded(GateRef glue);
758     inline void SaveJumpSizeIfNeeded(GateRef glue, GateRef jumpSize);
759     inline GateRef ComputeTaggedArraySize(GateRef length);
760     inline GateRef GetGlobalConstantValue(
761         VariableType type, GateRef glue, ConstantIndex index);
762     inline GateRef GetSingleCharTable(GateRef glue);
763     inline GateRef GetGlobalEnvValue(VariableType type, GateRef env, size_t index);
764     GateRef CallGetterHelper(
765         GateRef glue, GateRef receiver, GateRef holder, GateRef accessor, ProfileOperation callback);
766     GateRef ConstructorCheck(GateRef glue, GateRef ctor, GateRef outPut, GateRef thisObj);
767     GateRef GetCallSpreadArgs(GateRef glue, GateRef array, ProfileOperation callBack);
768     GateRef GetIterator(GateRef glue, GateRef obj, ProfileOperation callback);
769     GateRef JSCallDispatch(GateRef glue, GateRef func, GateRef actualNumArgs, GateRef jumpSize, GateRef hotnessCounter,
770                            JSCallMode mode, std::initializer_list<GateRef> args,
771                            ProfileOperation callback = ProfileOperation());
772     GateRef IsFastTypeArray(GateRef jsType);
773     GateRef GetTypeArrayPropertyByName(GateRef glue, GateRef receiver, GateRef holder, GateRef key, GateRef jsType);
774     GateRef SetTypeArrayPropertyByName(GateRef glue, GateRef receiver, GateRef holder, GateRef key, GateRef value,
775                                        GateRef jsType);
776     GateRef TryStringOrSymbolToElementIndex(GateRef glue, GateRef key);
777     inline GateRef DispatchBuiltins(GateRef glue, GateRef builtinsId, const std::initializer_list<GateRef>& args);
778     inline GateRef DispatchBuiltinsWithArgv(GateRef glue, GateRef builtinsId,
779                                             const std::initializer_list<GateRef>& args);
780     GateRef ComputeSizeUtf8(GateRef length);
781     GateRef ComputeSizeUtf16(GateRef length);
782     GateRef AlignUp(GateRef x, GateRef alignment);
783     void CallFastPath(GateRef glue, GateRef nativeCode, GateRef func, GateRef thisValue, GateRef actualNumArgs,
784                       GateRef callField, GateRef method, Label* notFastBuiltins, Label* exit, Variable* result,
785                       std::initializer_list<GateRef> args, JSCallMode mode);
786     inline void SetLength(GateRef glue, GateRef str, GateRef length, bool compressed);
787     inline void SetLength(GateRef glue, GateRef str, GateRef length, GateRef isCompressed);
788     void Assert(int messageId, int line, GateRef glue, GateRef condition, Label *nextLabel);
789 
790     GateRef GetNormalStringData(const StringInfoGateRef &stringInfoGate);
791 
792     void Comment(GateRef glue, const std::string &str);
793     GateRef ToNumber(GateRef glue, GateRef tagged);
794     inline GateRef LoadPfHeaderFromConstPool(GateRef jsFunc);
795     GateRef RemoveTaggedWeakTag(GateRef weak);
796     inline GateRef LoadHCIndexFromConstPool(GateRef cachedArray, GateRef cachedLength, GateRef traceId, Label *miss);
797     inline GateRef LoadHCIndexInfosFromConstPool(GateRef jsFunc);
798     inline GateRef GetAttrIndex(GateRef index);
799     inline GateRef GetAttr(GateRef layoutInfo, GateRef index);
800     inline GateRef GetKey(GateRef layoutInfo, GateRef index);
801     inline GateRef GetKeyIndex(GateRef index);
802     GateRef CalArrayRelativePos(GateRef index, GateRef arrayLen);
803     GateRef AppendSkipHole(GateRef glue, GateRef first, GateRef second, GateRef copyLength);
804     GateRef IntToEcmaString(GateRef glue, GateRef number);
805 
806 private:
807     using BinaryOperation = std::function<GateRef(Environment*, GateRef, GateRef)>;
808     GateRef ChangeTaggedPointerToInt64(GateRef x);
809     template<OpCode Op>
810     GateRef FastAddSubAndMul(GateRef glue, GateRef left, GateRef right, ProfileOperation callback);
811     GateRef FastIntDiv(GateRef left, GateRef right, Label *bailout, ProfileOperation callback);
812     template<OpCode Op>
813     GateRef FastBinaryOp(GateRef glue, GateRef left, GateRef right,
814                          const BinaryOperation& intOp, const BinaryOperation& floatOp, ProfileOperation callback);
815     void InitializeArguments();
816     void CheckDetectorName(GateRef glue, GateRef key, Label *fallthrough, Label *slow);
817     bool IsCallModeSupportPGO(JSCallMode mode);
818 
819     CallSignature *callSignature_ {nullptr};
820     Environment *env_;
821 };
822 }  // namespace panda::ecmascript::kungfu
823 #endif  // ECMASCRIPT_COMPILER_STUB_BUILDER_H
824