| /arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/mpl2mpl/src/ |
| D | ext_constantfold.cpp | 23 StmtNode *ExtConstantFold::ExtSimplify(StmtNode *node) in ExtSimplify() argument 25 CHECK_NULL_FATAL(node); in ExtSimplify() 26 switch (node->GetOpCode()) { in ExtSimplify() 28 return ExtSimplifyBlock(static_cast<BlockNode *>(node)); in ExtSimplify() 30 return ExtSimplifyIf(static_cast<IfStmtNode *>(node)); in ExtSimplify() 32 return ExtSimplifyDassign(static_cast<DassignNode *>(node)); in ExtSimplify() 34 return ExtSimplifyIassign(static_cast<IassignNode *>(node)); in ExtSimplify() 37 return ExtSimplifyWhile(static_cast<WhileStmtNode *>(node)); in ExtSimplify() 39 return node; in ExtSimplify() 43 BaseNode *ExtConstantFold::DispatchFold(BaseNode *node) in DispatchFold() argument [all …]
|
| /arkcompiler/ets_frontend/arkguard/src/utils/ |
| D | NodeUtils.ts | 49 public static isPropertyDeclarationNode(node: Node): boolean { 50 let parent: Node | undefined = node.parent; 57 return parent.name === node; 60 if (isComputedPropertyName(parent) && parent.expression === node) { 65 if (isBindingElement(parent) && parent.propertyName === node) { 70 if (isPropertySignature(parent) && parent.name === node) { 75 if (isMethodSignature(parent) && parent.name === node) { 80 if (isEnumMember(parent) && parent.name === node) { 85 if (isPropertyDeclaration(parent) && parent.name === node) { 90 if (isMethodDeclaration(parent) && parent.name === node) { [all …]
|
| D | ScopeAnalyzer.ts | 152 …constructor(name: string, node: Node, type: ScopeKind, lexicalScope: boolean = false, upper?: Scop… 155 this.block = node; 235 …export function createLabel(node: LabeledStatement, scope: Scope, parent?: Label | undefined): Lab… 236 let labelName: string = '$' + scope.labels.length + '_' + node.label.text; 238 'name': node.label.text, 240 'refs': [node.label], 276 getScopeOfNode(node: Node): Scope | undefined; 310 function addSymbolInScope(node: Node): void { 311 let defSymbols: SymbolTable = node?.locals; 344 function addExportSymbolInScope(node: Node): void { [all …]
|
| /arkcompiler/ets_frontend/arkguard/test/ut/utils/ |
| D | NodeUtils.spec.ts | 27 const node = ts.factory.createIdentifier('name'); constant 28 expect(NodeUtils.isPropertyDeclarationNode(node)).to.be.false; 31 const node = ts.factory.createIdentifier('name'); constant 32 … const parent = ts.factory.createPropertyAssignment(node, ts.factory.createNumericLiteral('1')); 33 (node as Mutable<ts.Node>).parent = parent; 34 expect(NodeUtils.isPropertyDeclarationNode(node)).to.be.true; 37 const node = ts.factory.createIdentifier('name'); constant 38 const parent = ts.factory.createComputedPropertyName(node); 39 (node as Mutable<ts.Node>).parent = parent; 40 expect(NodeUtils.isPropertyDeclarationNode(node)).to.be.true; [all …]
|
| /arkcompiler/ets_frontend/es2panda/compiler/function/ |
| D | asyncGeneratorFunctionBuilder.cpp | 23 void AsyncGeneratorFunctionBuilder::Prepare(const ir::ScriptFunction *node) in Prepare() argument 26 VReg callee = FunctionReg(node); in Prepare() 30 pg_->CreateAsyncGeneratorObj(node, callee); in Prepare() 31 pg_->StoreAccumulator(node, funcObj_); in Prepare() 33 pg_->SetLabel(node, catchTable_->LabelSet().TryBegin()); in Prepare() 35 pg_->LoadConst(node, Constant::JS_UNDEFINED); in Prepare() 36 SuspendResumeExecution(node, completionType, completionValue); in Prepare() 39 void AsyncGeneratorFunctionBuilder::CleanUp(const ir::ScriptFunction *node) const in CleanUp() 46 pg_->SetLabel(node, labelSet.TryEnd()); in CleanUp() 47 pg_->SetLabel(node, labelSet.CatchBegin()); in CleanUp() [all …]
|
| D | functionBuilder.cpp | 38 void FunctionBuilder::DirectReturn(const ir::AstNode *node) const in DirectReturn() 40 pg_->NotifyConcurrentResult(node); in DirectReturn() 41 pg_->EmitReturn(node); in DirectReturn() 44 void FunctionBuilder::ImplicitReturn(const ir::AstNode *node) const in ImplicitReturn() 50 pg_->NotifyConcurrentResult(node); in ImplicitReturn() 52 pg_->EmitReturn(node); in ImplicitReturn() 55 pg_->LoadConst(node, Constant::JS_UNDEFINED); in ImplicitReturn() 56 pg_->NotifyConcurrentResult(node); in ImplicitReturn() 58 pg_->EmitReturnUndefined(node); in ImplicitReturn() 62 pg_->GetThis(node); in ImplicitReturn() [all …]
|
| D | generatorFunctionBuilder.cpp | 24 void GeneratorFunctionBuilder::Prepare(const ir::ScriptFunction *node) in Prepare() argument 26 VReg callee = FunctionReg(node); in Prepare() 30 pg_->CreateGeneratorObj(node, callee); in Prepare() 31 pg_->StoreAccumulator(node, funcObj_); in Prepare() 32 pg_->LoadConst(node, Constant::JS_UNDEFINED); in Prepare() 33 SuspendResumeExecution(node, completionType, completionValue); in Prepare() 34 HandleCompletion(node, completionType, completionValue); in Prepare() 37 void GeneratorFunctionBuilder::CleanUp(const ir::ScriptFunction *node) const in CleanUp() 41 pg_->SetLabel(node, labelSet.TryEnd()); in CleanUp() 42 pg_->SetLabel(node, labelSet.CatchBegin()); in CleanUp() [all …]
|
| D | asyncFunctionBuilder.cpp | 24 void AsyncFunctionBuilder::DirectReturn(const ir::AstNode *node) const in DirectReturn() 26 pg_->AsyncFunctionResolve(node, funcObj_); // retVal is in acc in DirectReturn() 27 pg_->NotifyConcurrentResult(node); in DirectReturn() 31 pg_->EmitReturn(node); in DirectReturn() 34 void AsyncFunctionBuilder::ImplicitReturn(const ir::AstNode *node) const in ImplicitReturn() 37 pg_->LoadConst(node, Constant::JS_UNDEFINED); in ImplicitReturn() 38 DirectReturn(node); in ImplicitReturn() 41 void AsyncFunctionBuilder::ExplicitReturn(const ir::AstNode *node) const in ExplicitReturn() 43 DirectReturn(node); in ExplicitReturn() 46 void AsyncFunctionBuilder::Prepare(const ir::ScriptFunction *node) in Prepare() argument [all …]
|
| /arkcompiler/ets_frontend/ets2panda/compiler/function/ |
| D | functionBuilder.cpp | 36 void FunctionBuilder::DirectReturn(const ir::AstNode *node) const in DirectReturn() 38 pg_->EmitReturn(node); in DirectReturn() 41 void FunctionBuilder::ImplicitReturn(const ir::AstNode *node) const in ImplicitReturn() 46 pg_->EmitReturnUndefined(node); in ImplicitReturn() 52 pg_->EmitReturn(node); in ImplicitReturn() 55 void FunctionBuilder::AsyncYield(const ir::AstNode *node, VReg completionType, VReg completionValue… in AsyncYield() argument 59 pg_->GeneratorYield(node, funcObj_); in AsyncYield() 60 pg_->SuspendAsyncGenerator(node, funcObj_); in AsyncYield() 62 ResumeGenerator(node, completionType, completionValue); in AsyncYield() 65 void FunctionBuilder::SuspendResumeExecution(const ir::AstNode *node, VReg completionType, VReg com… in SuspendResumeExecution() argument [all …]
|
| D | asyncGeneratorFunctionBuilder.cpp | 23 void AsyncGeneratorFunctionBuilder::Prepare(const ir::ScriptFunction *node) const in Prepare() 25 VReg callee = FunctionReg(node); in Prepare() 27 pg_->CreateAsyncGeneratorObj(node, callee); in Prepare() 28 pg_->StoreAccumulator(node, funcObj_); in Prepare() 29 pg_->SuspendGenerator(node, funcObj_); in Prepare() 30 pg_->SetLabel(node, catchTable_->LabelSet().TryBegin()); in Prepare() 33 void AsyncGeneratorFunctionBuilder::CleanUp(const ir::ScriptFunction *node) const in CleanUp() 37 pg_->SetLabel(node, labelSet.TryEnd()); in CleanUp() 38 pg_->SetLabel(node, labelSet.CatchBegin()); in CleanUp() 39 pg_->AsyncGeneratorReject(node, funcObj_); in CleanUp() [all …]
|
| D | generatorFunctionBuilder.cpp | 23 void GeneratorFunctionBuilder::Prepare(const ir::ScriptFunction *node) const in Prepare() 25 VReg callee = FunctionReg(node); in Prepare() 27 pg_->CreateGeneratorObj(node, callee); in Prepare() 28 pg_->StoreAccumulator(node, funcObj_); in Prepare() 29 pg_->SuspendGenerator(node, funcObj_); in Prepare() 30 pg_->SetLabel(node, catchTable_->LabelSet().TryBegin()); in Prepare() 33 void GeneratorFunctionBuilder::CleanUp(const ir::ScriptFunction *node) const in CleanUp() 37 pg_->SetLabel(node, labelSet.TryEnd()); in CleanUp() 38 pg_->SetLabel(node, labelSet.CatchBegin()); in CleanUp() 39 pg_->GeneratorComplete(node, funcObj_); in CleanUp() [all …]
|
| D | asyncFunctionBuilder.cpp | 23 void AsyncFunctionBuilder::DirectReturn(const ir::AstNode *node) const in DirectReturn() 25 pg_->AsyncFunctionResolve(node, funcObj_); in DirectReturn() 26 pg_->EmitReturn(node); in DirectReturn() 29 void AsyncFunctionBuilder::ImplicitReturn(const ir::AstNode *node) const in ImplicitReturn() 31 pg_->LoadConst(node, Constant::JS_UNDEFINED); in ImplicitReturn() 32 DirectReturn(node); in ImplicitReturn() 35 void AsyncFunctionBuilder::Prepare(const ir::ScriptFunction *node) const in Prepare() 37 pg_->AsyncFunctionEnter(node); in Prepare() 38 pg_->StoreAccumulator(node, funcObj_); in Prepare() 39 pg_->SetLabel(node, catchTable_->LabelSet().TryBegin()); in Prepare() [all …]
|
| /arkcompiler/ets_runtime/ecmascript/mem/ |
| D | ecma_list.h | 30 explicit EcmaList(T *node) : first_(node), last_(node) in EcmaList() argument 32 node->LinkPrev(nullptr); in EcmaList() 33 node->LinkNext(nullptr); in EcmaList() 38 void AddNode(T *node) in AddNode() argument 40 ASSERT(node != nullptr); in AddNode() 43 node->LinkNext(lastNext); in AddNode() 44 node->LinkPrev(last_); in AddNode() 45 last_->LinkNext(node); in AddNode() 47 lastNext->LinkPrev(node); in AddNode() 49 last_ = node; in AddNode() [all …]
|
| /arkcompiler/ets_frontend/es2panda/compiler/core/ |
| D | pandagen.cpp | 253 void PandaGen::InitializeLexEnv(const ir::AstNode *node) in InitializeLexEnv() argument 258 NewLexicalEnv(node, topScope_->LexicalSlots(), topScope_); in InitializeLexEnv() 262 NewSendableEnv(node, topScope_->SendableSlots()); in InitializeLexEnv() 266 void PandaGen::CopyFunctionArguments(const ir::AstNode *node) in CopyFunctionArguments() argument 273 StoreLexicalVar(node, 0, param->LexIdx(), targetReg++); in CopyFunctionArguments() 276 MoveVreg(node, param->Vreg(), targetReg++); in CopyFunctionArguments() 310 void PandaGen::GetFunctionObject(const ir::AstNode *node) in GetFunctionObject() argument 312 LoadAccFromLexEnv(node, scope_->Find(binder::Binder::MANDATORY_PARAM_FUNC)); in GetFunctionObject() 315 void PandaGen::GetNewTarget(const ir::AstNode *node) in GetNewTarget() argument 317 LoadAccFromLexEnv(node, scope_->Find(binder::Binder::MANDATORY_PARAM_NEW_TARGET)); in GetNewTarget() [all …]
|
| D | pandagen.h | 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); 271 void StLetOrClassToGlobalRecord(const ir::AstNode *node, const util::StringView &name); 272 void StConstToGlobalRecord(const ir::AstNode *node, const util::StringView &name); [all …]
|
| /arkcompiler/ets_frontend/ets2panda/compiler/core/ |
| D | pandagen.h | 70 void StoreAccumulator(const ir::AstNode *node, VReg vreg); 71 void LoadAccumulator(const ir::AstNode *node, VReg reg); 73 [[nodiscard]] IRNode *AllocMov(const ir::AstNode *node, VReg vd, VReg vs) override; 74 [[nodiscard]] IRNode *AllocMov(const ir::AstNode *node, OutVReg vd, VReg vs) override; 75 void MoveVreg(const ir::AstNode *node, VReg vd, VReg vs); 77 void LoadAccumulatorDouble(const ir::AstNode *node, double num); 78 void LoadAccumulatorInt(const ir::AstNode *node, size_t num); 80 void LoadConst(const ir::AstNode *node, Constant id); 81 void StoreConst(const ir::AstNode *node, VReg reg, Constant id); 83 void GetFunctionObject(const ir::AstNode *node); [all …]
|
| D | pandagen.cpp | 49 explicit EcmaDisabled(const ir::AstNode *node, [[maybe_unused]] Args &&...args) : IRNode(node) in EcmaDisabled() argument 331 void PandaGen::StoreAccumulator(const ir::AstNode *node, VReg vreg) in StoreAccumulator() argument 333 Ra().Emit<StaDyn>(node, vreg); in StoreAccumulator() 336 void PandaGen::LoadAccumulator(const ir::AstNode *node, VReg reg) in LoadAccumulator() argument 338 Ra().Emit<LdaDyn>(node, reg); in LoadAccumulator() 341 IRNode *PandaGen::AllocMov(const ir::AstNode *node, const VReg vd, const VReg vs) in AllocMov() argument 343 return Allocator()->New<MovDyn>(node, vd, vs); in AllocMov() 346 IRNode *PandaGen::AllocMov(const ir::AstNode *node, OutVReg vd, const VReg vs) in AllocMov() argument 349 return Allocator()->New<MovDyn>(node, *vd.reg, vs); in AllocMov() 352 void PandaGen::MoveVreg(const ir::AstNode *node, VReg vd, VReg vs) in MoveVreg() argument [all …]
|
| D | ETSGen.cpp | 123 void ETSGen::ApplyConversionAndStoreAccumulator(const ir::AstNode *const node, const VReg vreg, in ApplyConversionAndStoreAccumulator() argument 126 ApplyConversion(node, targetType); in ApplyConversionAndStoreAccumulator() 127 StoreAccumulator(node, vreg); in ApplyConversionAndStoreAccumulator() 130 VReg ETSGen::StoreException(const ir::AstNode *node) in StoreException() argument 133 Ra().Emit<StaObj>(node, exception); in StoreException() 140 void ETSGen::StoreAccumulator(const ir::AstNode *const node, const VReg vreg) in StoreAccumulator() argument 146 Ra().Emit<StaObj>(node, vreg); in StoreAccumulator() 148 Ra().Emit<StaWide>(node, vreg); in StoreAccumulator() 150 Ra().Emit<Sta>(node, vreg); in StoreAccumulator() 156 void ETSGen::LoadAccumulator(const ir::AstNode *node, VReg vreg) in LoadAccumulator() argument [all …]
|
| D | ETSGen.h | 46 [[nodiscard]] VReg StoreException(const ir::AstNode *node); 47 …void ApplyConversionAndStoreAccumulator(const ir::AstNode *node, VReg vreg, const checker::Type *t… 48 void StoreAccumulator(const ir::AstNode *node, VReg vreg); 49 void LoadAccumulator(const ir::AstNode *node, VReg vreg); 50 [[nodiscard]] IRNode *AllocMov(const ir::AstNode *node, VReg vd, VReg vs) override; 51 [[nodiscard]] IRNode *AllocMov(const ir::AstNode *node, OutVReg vd, VReg vs) override; 52 void MoveVreg(const ir::AstNode *node, VReg vd, VReg vs); 56 void LoadVar(const ir::Identifier *node, varbinder::Variable const *var); 57 void LoadDynamicModuleVariable(const ir::AstNode *node, varbinder::Variable const *var); 58 void LoadDynamicNamespaceVariable(const ir::AstNode *node, varbinder::Variable const *var); [all …]
|
| /arkcompiler/ets_runtime/ecmascript/ |
| D | waiter_list.cpp | 20 void WaiterList::AddNode(WaiterListNode *node) in AddNode() argument 22 ASSERT(node->prev_ == nullptr); in AddNode() 23 ASSERT(node->next_ == nullptr); in AddNode() 24 auto iter = locationListMap_.find(node->waitPointer_); in AddNode() 26 iter->second.pTail->next_ = node; in AddNode() 27 node->prev_ = iter->second.pTail; in AddNode() 28 iter->second.pTail = node; in AddNode() 30 locationListMap_.emplace(node->waitPointer_, HeadAndTail {node, node}); in AddNode() 34 void WaiterList::DeleteNode(WaiterListNode *node) in DeleteNode() argument 36 auto iter = locationListMap_.find(node->waitPointer_); in DeleteNode() [all …]
|
| /arkcompiler/ets_frontend/arkguard/src/transformers/rename/ |
| D | RenamePropertiesTransformer.ts | 89 function renamePropertiesTransformer(node: Node): Node { 90 if (isSourceFile(node) && ArkObfuscator.isKeptCurrentFile) { 91 return node; 94 collectReservedNames(node); 97 let ret: Node = renameProperties(node); 104 function renameProperties(node: Node): Node { 105 if (isConstructorDeclaration(node)) { 109 if (NodeUtils.isClassPropertyInConstructorParams(node)) { 110 currentConstructorParams.add((node as Identifier).escapedText.toString()); 111 return renameProperty(node, false); [all …]
|
| D | ShorthandPropertyTransformer.ts | 61 function shorthandPropertyTransformer(node: Node): Node { 62 if (isSourceFile(node) && ArkObfuscator.isKeptCurrentFile) { 63 return node; 67 let ret = transformShortHandProperty(node); 73 function transformShortHandProperty(node: Node): Node { 82 if (isShorthandPropertyAssignment((node))) { 83 let initializer = node.objectAssignmentInitializer; 84 let expression: Expression = node.name; 86 expression = factory.createBinaryExpression(node.name, node.equalsToken, initializer); 89 let identifier = factory.createIdentifier(node.name.text); [all …]
|
| /arkcompiler/ets_frontend/ets2panda/checker/ets/ |
| D | etsWarningAnalyzer.cpp | 120 void ETSWarningAnalyzer::ETSWarningSuggestFinal(const ir::AstNode *node) in ETSWarningSuggestFinal() argument 122 …if (node->IsClassDeclaration() && !program_->NodeContainsETSNolint(node, ETSWarnings::SUGGEST_FINA… in ETSWarningSuggestFinal() 123 if (node->AsClassDeclaration()->Definition()->IsClassDefinition()) { in ETSWarningSuggestFinal() 124 AnalyzeClassDefForFinalModifier(node->AsClassDeclaration()->Definition()); in ETSWarningSuggestFinal() 127 const auto classBody = node->AsClassDeclaration()->Definition()->Body(); in ETSWarningSuggestFinal() 130 …AnalyzeClassMethodForFinalModifier(it->AsMethodDefinition(), node->AsClassDeclaration()->Definitio… in ETSWarningSuggestFinal() 134 node->Iterate([&](auto *childNode) { ETSWarningSuggestFinal(childNode); }); in ETSWarningSuggestFinal() 172 void ETSWarningAnalyzer::ETSWarningsProhibitTopLevelStatements(const ir::AstNode *node) in ETSWarningsProhibitTopLevelStatements() argument 174 if (!node->IsClassDeclaration() || in ETSWarningsProhibitTopLevelStatements() 175 program_->NodeContainsETSNolint(node, ETSWarnings::PROHIBIT_TOP_LEVEL_STATEMENTS)) { in ETSWarningsProhibitTopLevelStatements() [all …]
|
| /arkcompiler/ets_frontend/es2panda/compiler/base/ |
| D | lexenv.cpp | 30 static bool CheckTdz(const ir::AstNode *node) in CheckTdz() argument 32 return node->IsIdentifier() && node->AsIdentifier()->IsTdz(); in CheckTdz() 35 static void CheckConstAssignment(PandaGen *pg, const ir::AstNode *node, binder::Variable *variable) in CheckConstAssignment() argument 41 pg->ThrowConstAssignment(node, variable->Name()); in CheckConstAssignment() 46 static void ExpandLoadLexVar(PandaGen *pg, const ir::AstNode *node, const binder::ScopeFindResult &… in ExpandLoadLexVar() argument 55 if (classDef == util::Helpers::GetContainingSendableClass(node) && in ExpandLoadLexVar() 57 pg->LoadSendableClass(node, result.lexLevel); in ExpandLoadLexVar() 64 pg->LoadSendableVar(node, result.sendableLevel, local->LexIdx()); in ExpandLoadLexVar() 66 pg->LoadLexicalVar(node, result.lexLevel, local->LexIdx(), result.variable->Name()); in ExpandLoadLexVar() 70 pg->ThrowUndefinedIfHole(node, result.variable->Name()); in ExpandLoadLexVar() [all …]
|
| /arkcompiler/ets_frontend/ets2panda/compiler/base/ |
| D | lexenv.cpp | 27 static bool CheckTdz(const ir::AstNode *node) in CheckTdz() argument 29 return node->IsIdentifier() && node->AsIdentifier()->IsTdz(); in CheckTdz() 32 static void CheckConstAssignment(PandaGen *pg, const ir::AstNode *node, varbinder::Variable *variab… in CheckConstAssignment() argument 38 pg->ThrowConstAssignment(node, variable->Name()); in CheckConstAssignment() 43 static void ExpandLoadLexVar(PandaGen *pg, const ir::AstNode *node, const varbinder::ConstScopeFind… in ExpandLoadLexVar() argument 46 pg->LoadLexicalVar(node, result.lexLevel, result.variable->AsLocalVariable()->LexIdx()); in ExpandLoadLexVar() 48 … pg->LoadLexical(node, result.name, result.lexLevel, result.variable->AsLocalVariable()->LexIdx()); in ExpandLoadLexVar() 52 static void ExpandLoadNormalVar(PandaGen *pg, const ir::AstNode *node, const varbinder::ConstScopeF… in ExpandLoadNormalVar() argument 56 if (CheckTdz(node)) { in ExpandLoadNormalVar() 57 pg->ThrowTdz(node, local->Name()); in ExpandLoadNormalVar() [all …]
|