• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2021-2024 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 ES2PANDA_COMPILER_CORE_PANDAGEN_H
17 #define ES2PANDA_COMPILER_CORE_PANDAGEN_H
18 
19 #include <compiler/base/optionalChain.h>
20 #include <compiler/core/envScope.h>
21 #include <compiler/core/inlineCache.h>
22 #include <compiler/core/regAllocator.h>
23 #include <compiler/core/regScope.h>
24 #include <ir/irnode.h>
25 #include <lexer/token/tokenType.h>
26 #include <libpandafile/file_items.h>
27 #include <macros.h>
28 #include <util/enumbitops.h>
29 
30 #include <regex>
31 
32 namespace panda::es2panda::binder {
33 class FunctionScope;
34 class ModuleVaribale;
35 class ScopeFindResult;
36 class Scope;
37 }  // namespace panda::es2panda::binder
38 
39 namespace panda::es2panda::ir {
40 class AstNode;
41 class ScriptFunction;
42 class Statement;
43 class Expression;
44 class Identifier;
45 }  // namespace panda::es2panda::ir
46 
47 DEFINE_BITOPS(panda::panda_file::FunctionKind);
48 
49 namespace panda::es2panda::compiler {
50 class FunctionBuilder;
51 class CompilerContext;
52 class LiteralBuffer;
53 class DynamicContext;
54 class CatchTable;
55 
56 enum class Constant {
57     JS_NAN,
58     JS_HOLE,
59     JS_INFINITY,
60     JS_UNDEFINED,
61     JS_NULL,
62     JS_TRUE,
63     JS_FALSE,
64     JS_SYMBOL,
65     JS_GLOBAL,
66 };
67 
68 class DebugInfo {
69 public:
DebugInfo(ArenaAllocator * allocator)70     explicit DebugInfo(ArenaAllocator *allocator) : variableDebugInfo(allocator->Adapter()) {};
71     DEFAULT_COPY_SEMANTIC(DebugInfo);
72     DEFAULT_MOVE_SEMANTIC(DebugInfo);
73     ~DebugInfo() = default;
74 
75     ArenaVector<const binder::Scope *> variableDebugInfo;
76     const ir::Statement *firstStmt {};
77 };
78 
79 class PandaGen {
80 public:
PandaGen(ArenaAllocator * allocator,CompilerContext * context,binder::FunctionScope * scope)81     explicit PandaGen(ArenaAllocator *allocator, CompilerContext *context, binder::FunctionScope *scope)
82         : allocator_(allocator),
83           context_(context),
84           builder_(nullptr),
85           debugInfo_(allocator_),
86           topScope_(scope),
87           scope_(topScope_),
88           rootNode_(scope->Node()),
89           insns_(allocator_->Adapter()),
90           catchList_(allocator_->Adapter()),
91           strings_(allocator_->Adapter()),
92           buffStorage_(allocator_->Adapter()),
93           ra_(this)
94     {
95     }
96     ~PandaGen() = default;
97     NO_COPY_SEMANTIC(PandaGen);
98     NO_MOVE_SEMANTIC(PandaGen);
99 
Allocator()100     inline ArenaAllocator *Allocator() const
101     {
102         return allocator_;
103     }
104 
Context()105     inline CompilerContext *Context() const
106     {
107         return context_;
108     }
109 
Strings()110     const ArenaSet<util::StringView> &Strings() const
111     {
112         return strings_;
113     }
114 
CatchList()115     const ArenaVector<CatchTable *> &CatchList() const
116     {
117         return catchList_;
118     }
119 
TopScope()120     binder::FunctionScope *TopScope() const
121     {
122         return topScope_;
123     }
124 
Scope()125     binder::Scope *Scope() const
126     {
127         return scope_;
128     }
129 
RootNode()130     const ir::AstNode *RootNode() const
131     {
132         return rootNode_;
133     }
134 
Insns()135     ArenaList<IRNode *> &Insns()
136     {
137         return insns_;
138     }
139 
Insns()140     const ArenaList<IRNode *> &Insns() const
141     {
142         return insns_;
143     }
144 
SetInsns(ArenaList<IRNode * > & newInsns)145     void SetInsns(ArenaList<IRNode *> &newInsns)
146     {
147         insns_.assign(newInsns.begin(), newInsns.end());
148     }
149 
AllocReg()150     VReg AllocReg()
151     {
152         if (usedRegs_ > UINT16_MAX) {
153             throw Error(ErrorType::GENERIC, "Can't alloc new reg because all regs ran out");
154         }
155         return usedRegs_++;
156     }
157 
NextReg()158     VReg NextReg() const
159     {
160         return usedRegs_;
161     }
162 
TotalRegsNum()163     uint32_t TotalRegsNum() const
164     {
165         return totalRegs_;
166     }
167 
LabelCount()168     size_t LabelCount() const
169     {
170         return labelId_;
171     }
172 
Debuginfo()173     const DebugInfo &Debuginfo() const
174     {
175         return debugInfo_;
176     }
177 
FuncBuilder()178     FunctionBuilder *FuncBuilder() const
179     {
180         return builder_;
181     }
182 
GetEnvScope()183     EnvScope *GetEnvScope() const
184     {
185         return envScope_;
186     }
187 
BuffStorage()188     const ArenaVector<compiler::LiteralBuffer *> &BuffStorage() const
189     {
190         return buffStorage_;
191     }
192 
GetOptionalChain()193     OptionalChain *GetOptionalChain() const
194     {
195         return optionalChain_;
196     }
197 
IcSize()198     uint32_t IcSize() const
199     {
200         return ic_.Size();
201     }
202 
SetSourceLocationFlag(lexer::SourceLocationFlag flag)203     void SetSourceLocationFlag(lexer::SourceLocationFlag flag)
204     {
205         ra_.SetSourceLocationFlag(flag);
206     }
207 
AdjustSpillInsns()208     void AdjustSpillInsns()
209     {
210         ra_.AdjustInsRegWhenHasSpill();
211         totalRegs_ += ra_.GetSpillRegsCount();
212     }
213 
GetSpillRegsCount()214     uint16_t GetSpillRegsCount() const
215     {
216         if (ra_.HasSpill()) {
217             return ra_.GetSpillRegsCount();
218         }
219         return 0;
220     }
221 
GetFunctionKind()222     panda::panda_file::FunctionKind GetFunctionKind() const
223     {
224         return funcKind_;
225     }
226 
IsConcurrent()227     bool IsConcurrent() const
228     {
229         return funcKind_ == panda::panda_file::FunctionKind::CONCURRENT_FUNCTION;
230     }
231 
IsSendable()232     bool IsSendable() const
233     {
234         return (funcKind_ & panda::panda_file::FunctionKind::SENDABLE_FUNCTION) != 0;
235     }
236 
237     void SetFunctionKind();
238     void SetInSendable();
239 
240     bool IsDebug() const;
241     bool isDebuggerEvaluateExpressionMode() const;
242     std::string SourceFile() const;
243     uint32_t ParamCount() const;
244     uint32_t FormalParametersCount() const;
245     uint32_t InternalParamCount() const;
246     const util::StringView &InternalName() const;
247     const util::StringView &FunctionName() const;
248     binder::Binder *Binder() const;
249 
250     Label *AllocLabel();
251 
252     bool FunctionHasFinalizer() const;
253     bool IsAsyncFunction() const;
254     void FunctionInit(CatchTable* catchTable);
255     void FunctionEnter();
256     void FunctionExit();
257 
258     LiteralBuffer *NewLiteralBuffer();
259     int32_t AddLiteralBuffer(LiteralBuffer *buf);
260     int32_t AddLexicalVarNamesForDebugInfo(ArenaMap<uint32_t, std::pair<util::StringView, int>> &lexicalVars);
261 
262     void InitializeLexEnv(const ir::AstNode *node);
263     void CopyFunctionArguments(const ir::AstNode *node);
264     void GetFunctionObject(const ir::AstNode *node);
265     void GetNewTarget(const ir::AstNode *node);
266     void GetThis(const ir::AstNode *node);
267     void SetThis(const ir::AstNode *node);
268     void LoadVar(const ir::Identifier *node, const binder::ScopeFindResult &result);
269     void StoreVar(const ir::AstNode *node, const binder::ScopeFindResult &result, bool isDeclaration);
270 
271     void StLetOrClassToGlobalRecord(const ir::AstNode *node, const util::StringView &name);
272     void StConstToGlobalRecord(const ir::AstNode *node, const util::StringView &name);
273 
274     void StoreAccumulator(const ir::AstNode *node, VReg vreg);
275     void LoadAccFromArgs(const ir::AstNode *node);
276     void LoadObjProperty(const ir::AstNode *node, VReg obj, const Operand &prop);
277 
278     void LoadObjByName(const ir::AstNode *node, VReg obj, const util::StringView &prop);
279 
280     void StoreObjProperty(const ir::AstNode *node, VReg obj, const Operand &prop);
281     void DefineOwnProperty(const ir::AstNode *node, VReg obj, const Operand &prop);
282     void DefineClassPrivateField(const ir::AstNode *node, uint32_t level, uint32_t slot, VReg obj);
283     void StoreOwnProperty(const ir::AstNode *node, VReg obj, const Operand &prop, bool nameSetting = false);
284     void DeleteObjProperty(const ir::AstNode *node, VReg obj, const Operand &prop);
285     void LoadAccumulator(const ir::AstNode *node, VReg reg);
286     void LoadGlobalVar(const ir::AstNode *node, const util::StringView &name);
287     void StoreGlobalVar(const ir::AstNode *node, const util::StringView &name);
288 
289     void LoadObjByNameViaDebugger(const ir::AstNode *node, const util::StringView &name, bool throwUndefinedIfHole);
290     void TryLoadGlobalByName(const ir::AstNode *node, const util::StringView &name);
291     void StoreObjByNameViaDebugger(const ir::AstNode *node, const util::StringView &name);
292     void TryStoreGlobalByName(const ir::AstNode *node, const util::StringView &name);
293 
294     void LoadAccFromLexEnv(const ir::AstNode *node, const binder::ScopeFindResult &result);
295     void StoreAccToLexEnv(const ir::AstNode *node, const binder::ScopeFindResult &result, bool isDeclaration);
296 
297     void LoadAccumulatorString(const ir::AstNode *node, const util::StringView &str);
298     void LoadAccumulatorFloat(const ir::AstNode *node, double num);
299     void LoadAccumulatorInt(const ir::AstNode *node, int32_t num);
300     void LoadAccumulatorInt(const ir::AstNode *node, size_t num);
301     void LoadAccumulatorBigInt(const ir::AstNode *node, const util::StringView &num);
302 
303     void LoadConst(const ir::AstNode *node, Constant id);
304     void StoreConst(const ir::AstNode *node, VReg reg, Constant id);
305     void MoveVreg(const ir::AstNode *node, VReg vd, VReg vs);
306 
307     void SetLabel(const ir::AstNode *node, Label *label);
308     void Branch(const ir::AstNode *node, class Label *label);
309     bool CheckControlFlowChange() const;
310     Label *ControlFlowChangeBreak(const ir::Identifier *label = nullptr);
311     Label *ControlFlowChangeContinue(const ir::Identifier *label);
312     void ControlFlowChangeReturn();
313 
314     void Condition(const ir::AstNode *node, lexer::TokenType op, VReg lhs, class Label *ifFalse);
315     void Unary(const ir::AstNode *node, lexer::TokenType op, VReg operand);
316     void Binary(const ir::AstNode *node, lexer::TokenType op, VReg lhs);
317     void Equal(const ir::AstNode *node, VReg lhs);
318     void NotEqual(const ir::AstNode *node, VReg lhs);
319     void StrictEqual(const ir::AstNode *node, VReg lhs);
320     void StrictNotEqual(const ir::AstNode *node, VReg lhs);
321     void LessThan(const ir::AstNode *node, VReg lhs);
322     void LessEqual(const ir::AstNode *node, VReg lhs);
323     void GreaterThan(const ir::AstNode *node, VReg lhs);
324     void GreaterEqual(const ir::AstNode *node, VReg lhs);
325     void IsTrue(const ir::AstNode *node);
326 
327     void BranchIfUndefined(const ir::AstNode *node, class Label *target);
328     void BranchIfStrictUndefined(const ir::AstNode *node, class Label *target);
329     void BranchIfStrictNotUndefined(const ir::AstNode *node, class Label *target);
330     void BranchIfNotUndefined(const ir::AstNode *node, class Label *target);
331     void BranchIfHole(const ir::AstNode *node, class Label *target);
332     void BranchIfTrue(const ir::AstNode *node, class Label *target);
333     void BranchIfNotTrue(const ir::AstNode *node, class Label *target);
334     void BranchIfFalse(const ir::AstNode *node, class Label *target);
335     void BranchIfNotFalse(const ir::AstNode *node, class Label *target);
336     void BranchIfStrictNull(const ir::AstNode *node, class Label *target);
337 
338     void EmitThrow(const ir::AstNode *node);
339     void EmitRethrow(const ir::AstNode *node);
340     void EmitReturn(const ir::AstNode *node);
341     void EmitReturnUndefined(const ir::AstNode *node);
342     void ValidateClassDirectReturn(const ir::AstNode *node);
343     void DirectReturn(const ir::AstNode *node);
344     void ExplicitReturn(const ir::AstNode *node);
345     void ImplicitReturn(const ir::AstNode *node);
346     void EmitAwait(const ir::AstNode *node);
347 
348     void CallThis(const ir::AstNode *node, VReg startReg, size_t argCount);
349     void Call(const ir::AstNode *node, VReg startReg, size_t argCount);
350     void CallSpread(const ir::AstNode *node, VReg func, VReg thisReg, VReg args);
351     void SuperCall(const ir::AstNode *node, VReg startReg, size_t argCount);
352     void SuperCallSpread(const ir::AstNode *node, VReg vs);
353     void NotifyConcurrentResult(const ir::AstNode *node);
354     void CallInit(const ir::AstNode *node, VReg thisReg);
355 
356     void NewObject(const ir::AstNode *node, VReg startReg, size_t argCount);
357     void DefineFunction(const ir::AstNode *node, const ir::ScriptFunction *realNode, const util::StringView &name);
358 
359     void TypeOf(const ir::AstNode *node);
360     void NewObjSpread(const ir::AstNode *node, VReg obj);
361     void GetUnmappedArgs(const ir::AstNode *node);
362 
363     void Negate(const ir::AstNode *node);
364     void ToNumber(const ir::AstNode *node, VReg arg);
365     void ToNumeric(const ir::AstNode *node, VReg arg);
366 
367     void CreateGeneratorObj(const ir::AstNode *node, VReg funcObj);
368     void ResumeGenerator(const ir::AstNode *node, VReg genObj);
369     void GetResumeMode(const ir::AstNode *node, VReg genObj);
370 
371     void AsyncFunctionEnter(const ir::AstNode *node);
372     void AsyncFunctionAwait(const ir::AstNode *node, VReg asyncFuncObj);
373     void AsyncFunctionResolve(const ir::AstNode *node, VReg asyncFuncObj);
374     void AsyncFunctionReject(const ir::AstNode *node, VReg asyncFuncObj);
375 
376     void GeneratorYield(const ir::AstNode *node, VReg genObj);
377     void GeneratorComplete(const ir::AstNode *node, VReg genObj);
378     void CreateAsyncGeneratorObj(const ir::AstNode *node, VReg funcObj);
379     void CreateIterResultObject(const ir::AstNode *node, VReg value, VReg done);
380     void SuspendGenerator(const ir::AstNode *node, VReg genObj);
381 
382     void AsyncGeneratorResolve(const ir::AstNode *node, VReg asyncGenObj, VReg value, VReg canSuspend);
383     void AsyncGeneratorReject(const ir::AstNode *node, VReg asyncGenObj);
384 
385     void GetTemplateObject(const ir::AstNode *node, VReg value);
386     void CopyRestArgs(const ir::AstNode *node, uint32_t index);
387 
388     void GetPropIterator(const ir::AstNode *node);
389     void GetNextPropName(const ir::AstNode *node, VReg iter);
390     void CreateEmptyObject(const ir::AstNode *node);
391     void CreateObjectWithBuffer(const ir::AstNode *node, uint32_t idx);
392     void SetObjectWithProto(const ir::AstNode *node, VReg proto, VReg obj);
393     void CopyDataProperties(const ir::AstNode *node, VReg dst);
394     void DefineGetterSetterByValue(const ir::AstNode *node, VReg obj, VReg name, VReg getter, VReg setter,
395                                    bool setName);
396     void CreateEmptyArray(const ir::AstNode *node);
397     void CreateArray(const ir::AstNode *node, const ArenaVector<ir::Expression *> &elements, VReg obj);
398     void CreateArrayWithBuffer(const ir::AstNode *node, uint32_t idx);
399     void StoreArraySpread(const ir::AstNode *node, VReg array, VReg index);
400 
401     void ThrowIfNotObject(const ir::AstNode *node, VReg obj);
402     void ThrowThrowNotExist(const ir::AstNode *node);
403     void GetIterator(const ir::AstNode *node);
404     void GetAsyncIterator(const ir::AstNode *node);
405 
406     void CreateObjectWithExcludedKeys(const ir::AstNode *node, VReg obj, VReg argStart, size_t argCount);
407     void ThrowObjectNonCoercible(const ir::AstNode *node);
408     void CloseIterator(const ir::AstNode *node, VReg iter);
409     void DefineClassWithBuffer(const ir::AstNode *node, const util::StringView &ctorId, int32_t litIdx, VReg base);
410     void DefineSendableClass(const ir::AstNode *node, const util::StringView &ctorId,
411                              int32_t litIdx, VReg base);
412     void LoadSendableClass(const ir::AstNode *node, int32_t level);
413 
414     void LoadLocalModuleVariable(const ir::AstNode *node, const binder::ModuleVariable *variable);
415     void LoadExternalModuleVariable(const ir::AstNode *node, const binder::ModuleVariable *variable);
416     void StoreModuleVariable(const ir::AstNode *node, const binder::ModuleVariable *variable);
417     void GetModuleNamespace(const ir::AstNode *node, uint32_t index);
418     void DynamicImportCall(const ir::AstNode *node);
419 
420     void StSuperByName(const ir::AstNode *node, VReg obj, const util::StringView &key);
421     void LdSuperByName(const ir::AstNode *node, VReg obj, const util::StringView &key);
422     void StSuperByValue(const ir::AstNode *node, VReg obj, VReg prop);
423     void LdSuperByValue(const ir::AstNode *node, VReg obj);
424     void StoreSuperProperty(const ir::AstNode *node, VReg obj, const Operand &prop);
425     void LoadSuperProperty(const ir::AstNode *node, VReg obj, const Operand &prop);
426 
427     void PopLexEnv(const ir::AstNode *node);
428     void GenDebugger(const ir::AstNode *node);
429     void NewLexicalEnv(const ir::AstNode *node, uint32_t num, binder::VariableScope *scope);
430     void NewLexEnv(const ir::AstNode *node, uint32_t num);
431     void NewSendableEnv(const ir::AstNode *node, uint32_t num);
432     void NewLexEnvWithScopeInfo(const ir::AstNode *node, uint32_t num, int32_t scopeInfoIdx);
433     void LoadLexicalVar(const ir::AstNode *node, uint32_t level, uint32_t slot);
434     void LoadSendableVar(const ir::AstNode *node, uint32_t level, uint32_t slot);
435     void LoadLexicalVar(const ir::AstNode *node, uint32_t level, uint32_t slot, const util::StringView &name);
436     void StoreLexicalVar(const ir::AstNode *node, uint32_t level, uint32_t slot);
437     void StoreSendableVar(const ir::AstNode *node, uint32_t level, uint32_t slot);
438     void StoreLexicalVar(const ir::AstNode *node, uint32_t level, uint32_t slot, const binder::LocalVariable *local);
439     void StoreLexicalVar(const ir::AstNode *node, uint32_t level, uint32_t slot, VReg value);
440 
441     void ThrowIfSuperNotCorrectCall(const ir::AstNode *node, int64_t num);
442     void ThrowUndefinedIfHole(const ir::AstNode *node, const util::StringView &name);
443     void ThrowConstAssignment(const ir::AstNode *node, const util::StringView &name);
444 
445     uint32_t TryDepth() const;
446     CatchTable *CreateCatchTable();
447     void SortCatchTables();
448 
449     void LoadObjByIndex(const ir::AstNode *node, VReg obj, int64_t index);
450     void LoadObjByValue(const ir::AstNode *node, VReg obj);
451 
452     void StoreObjByName(const ir::AstNode *node, VReg obj, const util::StringView &prop);
453     void StoreObjByIndex(const ir::AstNode *node, VReg obj, int64_t index);
454     void StoreObjByValue(const ir::AstNode *node, VReg obj, VReg prop);
455 
456     void DefineFieldByName(const ir::AstNode *node, VReg obj, const util::StringView &prop);
457     void DefineFieldByIndex(const ir::AstNode *node, VReg obj, int64_t index);
458     void DefineFieldByValue(const ir::AstNode *node, VReg obj, VReg prop);
459 
460     void StOwnByName(const ir::AstNode *node, VReg obj, const util::StringView &prop, bool nameSetting = false);
461     void StOwnByValue(const ir::AstNode *node, VReg obj, VReg prop, bool nameSetting = false);
462     void StOwnByIndex(const ir::AstNode *node, VReg obj, int64_t index);
463 
464     Operand ToNamedPropertyKey(const ir::Expression *prop, bool isComputed);
465     Operand ToPropertyKey(const ir::Expression *prop, bool isComputed);
466     VReg LoadPropertyKey(const ir::Expression *prop, bool isComputed);
467     void ToComputedPropertyKey(const ir::AstNode *node);
468 
469     void ReArrangeIc();
470 
471     void CreatePrivateProperty(const ir::AstNode *node, uint32_t num, int32_t bufIdx);
472     void TestIn(const ir::AstNode *node, uint32_t level, uint32_t slot);
473     void LoadPrivateProperty(const ir::AstNode *node, uint32_t level, uint32_t slot);
474     void StorePrivateProperty(const ir::AstNode *node, uint32_t level, uint32_t slot, VReg obj);
475     void ThrowTypeErrorIfFalse(const ir::AstNode *node, util::StringView str);
476     void ThrowTypeError(const ir::AstNode *node, util::StringView str);
477 
478     /*
479      * Since the [Function] is not implemented yet, We compile the test262's framework code
480      * which obtains the [global] Object as following into [LoadConst.Global] directly.
481      * ```
482      *    var __globalObject = Function("return this;")();
483      *    var __globalObject = new Function("return this;")();
484      * ```
485      */
486     bool TryCompileFunctionCallOrNewExpression(const ir::Expression *expr);
487 
SetFirstStmt(const ir::Statement * stmt)488     void SetFirstStmt(const ir::Statement *stmt)
489     {
490         debugInfo_.firstStmt = stmt;
491     }
492 
Unimplemented()493     [[noreturn]] static void Unimplemented()
494     {
495         throw Error(ErrorType::GENERIC, "Unimplemented code path");
496     }
497 
GetCurrentSlot()498     IcSizeType GetCurrentSlot() const
499     {
500         return currentSlot_;
501     }
502 
IncreaseCurrentSlot(ICSlot inc)503     void IncreaseCurrentSlot(ICSlot inc)
504     {
505         currentSlot_ += inc;
506     }
507 
ResetCurrentSlot(IcSizeType slotSize)508     void ResetCurrentSlot(IcSizeType slotSize)
509     {
510         currentSlot_ = slotSize;
511     }
512 
SetIcOverFlow()513     void SetIcOverFlow()
514     {
515         icOverFlow_ = true;
516     }
517 
IsIcOverFlow()518     bool IsIcOverFlow() const
519     {
520         return icOverFlow_;
521     }
522 
523 private:
524     ArenaAllocator *allocator_;
525     CompilerContext *context_;
526     FunctionBuilder *builder_;
527     DebugInfo debugInfo_;
528     binder::FunctionScope *topScope_;
529     binder::Scope *scope_;
530     const ir::AstNode *rootNode_;
531     ArenaList<IRNode *> insns_;
532     ArenaVector<CatchTable *> catchList_;
533     ArenaSet<util::StringView> strings_;
534     ArenaVector<LiteralBuffer *> buffStorage_;
535     EnvScope *envScope_ {};
536     DynamicContext *dynamicContext_ {};
537     OptionalChain *optionalChain_ {};
538     InlineCache ic_;
539     RegAllocator ra_;
540     IcSizeType currentSlot_ {0};
541 
542     uint32_t usedRegs_ {0};
543     uint32_t totalRegs_ {0};
544     friend class ScopeContext;
545     friend class RegScope;
546     friend class LocalRegScope;
547     friend class LoopRegScope;
548     friend class ParamRegScope;
549     friend class FunctionRegScope;
550     friend class EnvScope;
551     friend class LoopEnvScope;
552     friend class DynamicContext;
553     friend class OptionalChain;
554     size_t labelId_ {0};
555     panda::panda_file::FunctionKind funcKind_ {panda::panda_file::FunctionKind::NONE};
556     bool icOverFlow_ {false};
557     bool inSendable_ {false};
558 };
559 }  // namespace panda::es2panda::compiler
560 
561 #endif
562