• 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     size_t GetExpectedPropertyCount() const;
240 
241     bool IsDebug() const;
242     bool isDebuggerEvaluateExpressionMode() const;
243     bool EnableColumn() const;
244     std::string SourceFile() const;
245     uint32_t ParamCount() const;
246     uint32_t FormalParametersCount() const;
247     uint32_t InternalParamCount() const;
248     const util::StringView &InternalName() const;
249     const util::StringView &FunctionName() const;
250     binder::Binder *Binder() const;
251     pandasm::extensions::Language SourceLang() const;
252 
253     Label *AllocLabel();
254 
255     bool FunctionHasFinalizer() const;
256     bool IsAsyncFunction() const;
257     void FunctionInit(CatchTable* catchTable);
258     void FunctionEnter();
259     void FunctionExit();
260 
261     LiteralBuffer *NewLiteralBuffer();
262     int32_t AddLiteralBuffer(LiteralBuffer *buf);
263     int32_t AddLexicalVarNamesForDebugInfo(ArenaMap<uint32_t, std::pair<util::StringView, int>> &lexicalVars);
264 
265     void InitializeLexEnv(const ir::AstNode *node);
266     void CopyFunctionArguments(const ir::AstNode *node);
267     void GetFunctionObject(const ir::AstNode *node);
268     void GetNewTarget(const ir::AstNode *node);
269     void GetThis(const ir::AstNode *node);
270     void SetThis(const ir::AstNode *node);
271     void LoadVar(const ir::Identifier *node, const binder::ScopeFindResult &result);
272     void StoreVar(const ir::AstNode *node, const binder::ScopeFindResult &result, bool isDeclaration);
273 
274     void StLetOrClassToGlobalRecord(const ir::AstNode *node, const util::StringView &name);
275     void StConstToGlobalRecord(const ir::AstNode *node, const util::StringView &name);
276 
277     void StoreAccumulator(const ir::AstNode *node, VReg vreg);
278     void LoadAccFromArgs(const ir::AstNode *node);
279     void LoadObjProperty(const ir::AstNode *node, VReg obj, const Operand &prop);
280 
281     void LoadObjByName(const ir::AstNode *node, VReg obj, const util::StringView &prop);
282 
283     void StoreObjProperty(const ir::AstNode *node, VReg obj, const Operand &prop);
284     void DefineOwnProperty(const ir::AstNode *node, VReg obj, const Operand &prop);
285     void DefineClassPrivateField(const ir::AstNode *node, uint32_t level, uint32_t slot, VReg obj);
286     void StoreOwnProperty(const ir::AstNode *node, VReg obj, const Operand &prop, bool nameSetting = false);
287     void DeleteObjProperty(const ir::AstNode *node, VReg obj, const Operand &prop);
288     void LoadAccumulator(const ir::AstNode *node, VReg reg);
289     void LoadGlobalVar(const ir::AstNode *node, const util::StringView &name);
290     void StoreGlobalVar(const ir::AstNode *node, const util::StringView &name);
291 
292     void LoadObjByNameViaDebugger(const ir::AstNode *node, const util::StringView &name, bool throwUndefinedIfHole);
293     void TryLoadGlobalByName(const ir::AstNode *node, const util::StringView &name);
294     void StoreObjByNameViaDebugger(const ir::AstNode *node, const util::StringView &name);
295     void TryStoreGlobalByName(const ir::AstNode *node, const util::StringView &name);
296 
297     void LoadAccFromLexEnv(const ir::AstNode *node, const binder::ScopeFindResult &result);
298     void StoreAccToLexEnv(const ir::AstNode *node, const binder::ScopeFindResult &result, bool isDeclaration);
299 
300     void LoadAccumulatorString(const ir::AstNode *node, const util::StringView &str);
301     void LoadAccumulatorFloat(const ir::AstNode *node, double num);
302     void LoadAccumulatorInt(const ir::AstNode *node, int32_t num);
303     void LoadAccumulatorInt(const ir::AstNode *node, size_t num);
304     void LoadAccumulatorBigInt(const ir::AstNode *node, const util::StringView &num);
305 
306     void LoadConst(const ir::AstNode *node, Constant id);
307     void StoreConst(const ir::AstNode *node, VReg reg, Constant id);
308     void MoveVreg(const ir::AstNode *node, VReg vd, VReg vs);
309 
310     void SetLabel(const ir::AstNode *node, Label *label);
311     void Branch(const ir::AstNode *node, class Label *label);
312     bool CheckControlFlowChange() const;
313     Label *ControlFlowChangeBreak(const ir::Identifier *label = nullptr);
314     Label *ControlFlowChangeContinue(const ir::Identifier *label);
315     void ControlFlowChangeReturn();
316 
317     void Condition(const ir::AstNode *node, lexer::TokenType op, VReg lhs, class Label *ifFalse);
318     void Unary(const ir::AstNode *node, lexer::TokenType op, VReg operand);
319     void Binary(const ir::AstNode *node, lexer::TokenType op, VReg lhs);
320     void Equal(const ir::AstNode *node, VReg lhs);
321     void NotEqual(const ir::AstNode *node, VReg lhs);
322     void StrictEqual(const ir::AstNode *node, VReg lhs);
323     void StrictNotEqual(const ir::AstNode *node, VReg lhs);
324     void LessThan(const ir::AstNode *node, VReg lhs);
325     void LessEqual(const ir::AstNode *node, VReg lhs);
326     void GreaterThan(const ir::AstNode *node, VReg lhs);
327     void GreaterEqual(const ir::AstNode *node, VReg lhs);
328     void IsTrue(const ir::AstNode *node);
329 
330     void BranchIfUndefined(const ir::AstNode *node, class Label *target);
331     void BranchIfStrictUndefined(const ir::AstNode *node, class Label *target);
332     void BranchIfStrictNotUndefined(const ir::AstNode *node, class Label *target);
333     void BranchIfNotUndefined(const ir::AstNode *node, class Label *target);
334     void BranchIfHole(const ir::AstNode *node, class Label *target);
335     void BranchIfTrue(const ir::AstNode *node, class Label *target);
336     void BranchIfNotTrue(const ir::AstNode *node, class Label *target);
337     void BranchIfFalse(const ir::AstNode *node, class Label *target);
338     void BranchIfNotFalse(const ir::AstNode *node, class Label *target);
339     void BranchIfStrictNull(const ir::AstNode *node, class Label *target);
340 
341     void EmitThrow(const ir::AstNode *node);
342     void EmitRethrow(const ir::AstNode *node);
343     void EmitReturn(const ir::AstNode *node);
344     void EmitReturnUndefined(const ir::AstNode *node);
345     void ValidateClassDirectReturn(const ir::AstNode *node);
346     void DirectReturn(const ir::AstNode *node);
347     void ExplicitReturn(const ir::AstNode *node);
348     void ImplicitReturn(const ir::AstNode *node);
349     void EmitAwait(const ir::AstNode *node);
350 
351     void CallThis(const ir::AstNode *node, VReg startReg, size_t argCount);
352     void Call(const ir::AstNode *node, VReg startReg, size_t argCount);
353     void CallSpread(const ir::AstNode *node, VReg func, VReg thisReg, VReg args);
354     void SuperCall(const ir::AstNode *node, VReg startReg, size_t argCount);
355     void SuperCallSpread(const ir::AstNode *node, VReg vs);
356     void SuperCallForwardAllArgs(const ir::AstNode *node, VReg funcObj);
357     void NotifyConcurrentResult(const ir::AstNode *node);
358     void CallInit(const ir::AstNode *node, VReg thisReg);
359 
360     void NewObject(const ir::AstNode *node, VReg startReg, size_t argCount);
361     void DefineFunction(const ir::AstNode *node, const ir::ScriptFunction *realNode, const util::StringView &name);
362 
363     void TypeOf(const ir::AstNode *node);
364     void NewObjSpread(const ir::AstNode *node, VReg obj);
365     void GetUnmappedArgs(const ir::AstNode *node);
366 
367     void Negate(const ir::AstNode *node);
368     void ToNumber(const ir::AstNode *node, VReg arg);
369     void ToNumeric(const ir::AstNode *node, VReg arg);
370 
371     void CreateGeneratorObj(const ir::AstNode *node, VReg funcObj);
372     void ResumeGenerator(const ir::AstNode *node, VReg genObj);
373     void GetResumeMode(const ir::AstNode *node, VReg genObj);
374 
375     void AsyncFunctionEnter(const ir::AstNode *node);
376     void AsyncFunctionAwait(const ir::AstNode *node, VReg asyncFuncObj);
377     void AsyncFunctionResolve(const ir::AstNode *node, VReg asyncFuncObj);
378     void AsyncFunctionReject(const ir::AstNode *node, VReg asyncFuncObj);
379 
380     void GeneratorYield(const ir::AstNode *node, VReg genObj);
381     void GeneratorComplete(const ir::AstNode *node, VReg genObj);
382     void CreateAsyncGeneratorObj(const ir::AstNode *node, VReg funcObj);
383     void CreateIterResultObject(const ir::AstNode *node, VReg value, VReg done);
384     void SuspendGenerator(const ir::AstNode *node, VReg genObj);
385 
386     void AsyncGeneratorResolve(const ir::AstNode *node, VReg asyncGenObj, VReg value, VReg canSuspend);
387     void AsyncGeneratorReject(const ir::AstNode *node, VReg asyncGenObj);
388 
389     void GetTemplateObject(const ir::AstNode *node, VReg value);
390     void CopyRestArgs(const ir::AstNode *node, uint32_t index);
391 
392     void GetPropIterator(const ir::AstNode *node);
393     void GetNextPropName(const ir::AstNode *node, VReg iter);
394     void CreateEmptyObject(const ir::AstNode *node);
395     void CreateObjectWithBuffer(const ir::AstNode *node, uint32_t idx);
396     void SetObjectWithProto(const ir::AstNode *node, VReg proto, VReg obj);
397     void CopyDataProperties(const ir::AstNode *node, VReg dst);
398     void DefineGetterSetterByValue(const ir::AstNode *node, VReg obj, VReg name, VReg getter, VReg setter,
399                                    bool setName);
400     void CreateEmptyArray(const ir::AstNode *node);
401     void CreateArray(const ir::AstNode *node, const ArenaVector<ir::Expression *> &elements, VReg obj);
402     void CreateArrayWithBuffer(const ir::AstNode *node, uint32_t idx);
403     void StoreArraySpread(const ir::AstNode *node, VReg array, VReg index);
404 
405     void ThrowIfNotObject(const ir::AstNode *node, VReg obj);
406     void ThrowThrowNotExist(const ir::AstNode *node);
407     void GetIterator(const ir::AstNode *node);
408     void GetAsyncIterator(const ir::AstNode *node);
409 
410     void CreateObjectWithExcludedKeys(const ir::AstNode *node, VReg obj, VReg argStart, size_t argCount);
411     void ThrowObjectNonCoercible(const ir::AstNode *node);
412     void CloseIterator(const ir::AstNode *node, VReg iter);
413     void DefineClassWithBuffer(const ir::AstNode *node, const util::StringView &ctorId, int32_t litIdx, VReg base);
414     void DefineSendableClass(const ir::AstNode *node, const util::StringView &ctorId,
415                              int32_t litIdx, VReg base);
416     void LoadSendableClass(const ir::AstNode *node, int32_t level);
417 
418     void LoadLocalModuleVariable(const ir::AstNode *node, const binder::ModuleVariable *variable);
419     void LoadExternalModuleVariable(const ir::AstNode *node, const binder::ModuleVariable *variable);
420     void StoreModuleVariable(const ir::AstNode *node, const binder::ModuleVariable *variable);
421     void GetModuleNamespace(const ir::AstNode *node, uint32_t index);
422     void DynamicImportCall(const ir::AstNode *node);
423 
424     void StSuperByName(const ir::AstNode *node, VReg obj, const util::StringView &key);
425     void LdSuperByName(const ir::AstNode *node, VReg obj, const util::StringView &key);
426     void StSuperByValue(const ir::AstNode *node, VReg obj, VReg prop);
427     void LdSuperByValue(const ir::AstNode *node, VReg obj);
428     void StoreSuperProperty(const ir::AstNode *node, VReg obj, const Operand &prop);
429     void LoadSuperProperty(const ir::AstNode *node, VReg obj, const Operand &prop);
430 
431     void PopLexEnv(const ir::AstNode *node);
432     void GenDebugger(const ir::AstNode *node);
433     void NewLexicalEnv(const ir::AstNode *node, uint32_t num, binder::VariableScope *scope);
434     void NewLexEnv(const ir::AstNode *node, uint32_t num);
435     void NewSendableEnv(const ir::AstNode *node, uint32_t num);
436     void NewLexEnvWithScopeInfo(const ir::AstNode *node, uint32_t num, int32_t scopeInfoIdx);
437     void LoadLexicalVar(const ir::AstNode *node, uint32_t level, uint32_t slot);
438     void LoadSendableVar(const ir::AstNode *node, uint32_t level, uint32_t slot);
439     void LoadLexicalVar(const ir::AstNode *node, uint32_t level, uint32_t slot, const util::StringView &name);
440     void StoreLexicalVar(const ir::AstNode *node, uint32_t level, uint32_t slot);
441     void StoreSendableVar(const ir::AstNode *node, uint32_t level, uint32_t slot);
442     void StoreLexicalVar(const ir::AstNode *node, uint32_t level, uint32_t slot, const binder::LocalVariable *local);
443     void StoreLexicalVar(const ir::AstNode *node, uint32_t level, uint32_t slot, VReg value);
444 
445     void ThrowIfSuperNotCorrectCall(const ir::AstNode *node, int64_t num);
446     void ThrowUndefinedIfHole(const ir::AstNode *node, const util::StringView &name);
447     void ThrowConstAssignment(const ir::AstNode *node, const util::StringView &name);
448 
449     uint32_t TryDepth() const;
450     CatchTable *CreateCatchTable();
451     void SortCatchTables();
452 
453     void LoadObjByIndex(const ir::AstNode *node, VReg obj, int64_t index);
454     void LoadObjByValue(const ir::AstNode *node, VReg obj);
455 
456     void StoreObjByName(const ir::AstNode *node, VReg obj, const util::StringView &prop);
457     void StoreObjByIndex(const ir::AstNode *node, VReg obj, int64_t index);
458     void StoreObjByValue(const ir::AstNode *node, VReg obj, VReg prop);
459 
460     void DefineFieldByName(const ir::AstNode *node, VReg obj, const util::StringView &prop);
461     void DefineFieldByIndex(const ir::AstNode *node, VReg obj, int64_t index);
462     void DefineFieldByValue(const ir::AstNode *node, VReg obj, VReg prop);
463 
464     void StOwnByName(const ir::AstNode *node, VReg obj, const util::StringView &prop, bool nameSetting = false);
465     void StOwnByValue(const ir::AstNode *node, VReg obj, VReg prop, bool nameSetting = false);
466     void StOwnByIndex(const ir::AstNode *node, VReg obj, int64_t index);
467 
468     Operand ToNamedPropertyKey(const ir::Expression *prop, bool isComputed);
469     Operand ToPropertyKey(const ir::Expression *prop, bool isComputed);
470     VReg LoadPropertyKey(const ir::Expression *prop, bool isComputed);
471     void ToComputedPropertyKey(const ir::AstNode *node);
472 
473     void ReArrangeIc();
474 
475     void CreatePrivateProperty(const ir::AstNode *node, uint32_t num, int32_t bufIdx);
476     void TestIn(const ir::AstNode *node, uint32_t level, uint32_t slot);
477     void LoadPrivateProperty(const ir::AstNode *node, uint32_t level, uint32_t slot);
478     void StorePrivateProperty(const ir::AstNode *node, uint32_t level, uint32_t slot, VReg obj);
479     void ThrowTypeErrorIfFalse(const ir::AstNode *node, util::StringView str);
480     void ThrowTypeError(const ir::AstNode *node, util::StringView str);
481 
482     /*
483      * Since the [Function] is not implemented yet, We compile the test262's framework code
484      * which obtains the [global] Object as following into [LoadConst.Global] directly.
485      * ```
486      *    var __globalObject = Function("return this;")();
487      *    var __globalObject = new Function("return this;")();
488      * ```
489      */
490     bool TryCompileFunctionCallOrNewExpression(const ir::Expression *expr);
491 
SetFirstStmt(const ir::Statement * stmt)492     void SetFirstStmt(const ir::Statement *stmt)
493     {
494         debugInfo_.firstStmt = stmt;
495     }
496 
Unimplemented()497     [[noreturn]] static void Unimplemented()
498     {
499         throw Error(ErrorType::GENERIC, "Unimplemented code path");
500     }
501 
GetCurrentSlot()502     IcSizeType GetCurrentSlot() const
503     {
504         return currentSlot_;
505     }
506 
IncreaseCurrentSlot(ICSlot inc)507     void IncreaseCurrentSlot(ICSlot inc)
508     {
509         currentSlot_ += inc;
510     }
511 
ResetCurrentSlot(IcSizeType slotSize)512     void ResetCurrentSlot(IcSizeType slotSize)
513     {
514         currentSlot_ = slotSize;
515     }
516 
SetIcOverFlow()517     void SetIcOverFlow()
518     {
519         icOverFlow_ = true;
520     }
521 
IsIcOverFlow()522     bool IsIcOverFlow() const
523     {
524         return icOverFlow_;
525     }
526 
527 private:
528     ArenaAllocator *allocator_;
529     CompilerContext *context_;
530     FunctionBuilder *builder_;
531     DebugInfo debugInfo_;
532     binder::FunctionScope *topScope_;
533     binder::Scope *scope_;
534     const ir::AstNode *rootNode_;
535     ArenaList<IRNode *> insns_;
536     ArenaVector<CatchTable *> catchList_;
537     ArenaSet<util::StringView> strings_;
538     ArenaVector<LiteralBuffer *> buffStorage_;
539     EnvScope *envScope_ {};
540     DynamicContext *dynamicContext_ {};
541     OptionalChain *optionalChain_ {};
542     InlineCache ic_;
543     RegAllocator ra_;
544     IcSizeType currentSlot_ {0};
545 
546     uint32_t usedRegs_ {0};
547     uint32_t totalRegs_ {0};
548     friend class ScopeContext;
549     friend class RegScope;
550     friend class LocalRegScope;
551     friend class LoopRegScope;
552     friend class ParamRegScope;
553     friend class FunctionRegScope;
554     friend class EnvScope;
555     friend class LoopEnvScope;
556     friend class DynamicContext;
557     friend class OptionalChain;
558     size_t labelId_ {0};
559     panda::panda_file::FunctionKind funcKind_ {panda::panda_file::FunctionKind::NONE};
560     bool icOverFlow_ {false};
561     bool inSendable_ {false};
562 };
563 }  // namespace panda::es2panda::compiler
564 
565 #endif
566