/arkcompiler/ets_frontend/ts2panda/src/function/ |
D | generatorFunctionBuilder.ts | 39 constructor(pandaGen: PandaGen, compiler: Compiler) { 40 super(pandaGen); 41 this.funcObj = pandaGen.getTemp(); 42 this.resumeVal = pandaGen.getTemp(); 47 let pandaGen = this.pg; 50 pandaGen.createGeneratorObj(node, getVregisterCache(pandaGen, CacheList.FUNC)); 51 pandaGen.storeAccumulator(node, this.funcObj); 52 pandaGen.loadAccumulator(node, getVregisterCache(pandaGen, CacheList.UNDEFINED)); 53 pandaGen.suspendGenerator(node, this.funcObj); 54 pandaGen.resumeGenerator(node, this.funcObj); [all …]
|
D | asyncFunctionBuilder.ts | 39 constructor(pandaGen: PandaGen) { 40 super(pandaGen); 41 this.funcObj = pandaGen.getTemp(); 42 this.resumeVal = pandaGen.getTemp(); 48 let pandaGen = this.pg; 50 pandaGen.asyncFunctionEnter(NodeKind.INVALID); 51 pandaGen.storeAccumulator(NodeKind.INVALID, this.funcObj); 53 pandaGen.label(node, this.beginLabel); 75 let pandaGen = this.pg; 76 let modeType = pandaGen.getTemp(); [all …]
|
D | asyncGeneratorFunctionBuilder.ts | 48 constructor(pandaGen: PandaGen, compiler: Compiler) { 49 super(pandaGen); 50 this.funcObj = pandaGen.getTemp(); 51 this.resumeVal = pandaGen.getTemp(); 52 this.resumeType = pandaGen.getTemp(); 314 let pandaGen = this.pg; 316 pandaGen.getResumeMode(node, this.funcObj); 317 pandaGen.storeAccumulator(node, this.resumeType); 320 pandaGen.loadAccumulatorInt(node, ResumeMode.THROW); 324 pandaGen.condition(node, ts.SyntaxKind.EqualsEqualsToken, this.resumeType, notThrowLabel); [all …]
|
/arkcompiler/ets_frontend/ts2panda/src/expression/ |
D | templateExpression.ts | 20 function genRawString(pandaGen: PandaGen, expr: ts.TemplateExpression | ts.NoSubstitutionTemplateLi… 29 pandaGen.loadAccumulatorString(expr, text); 32 function genCookedString(pandaGen: PandaGen, expr: ts.TemplateExpression | ts.NoSubstitutionTemplat… 45 pandaGen.loadAccumulatorString(expr, text); 48 function genTemplateArrayArg(pandaGen: PandaGen, expr: ts.TemplateExpression | ts.NoSubstitutionTem… 55 let indexReg = pandaGen.getTemp(); 56 let rawArrTmp = pandaGen.getTemp(); 57 let cookedArrTmp = pandaGen.getTemp(); 59 pandaGen.createEmptyArray(expr); 60 pandaGen.storeAccumulator(expr, rawArrTmp); [all …]
|
D | arrayLiteralExpression.ts | 26 let pandaGen = compiler.getPandaGen(); 27 let arrayObj = pandaGen.getTemp(); 29 pandaGen.freeTemps(arrayObj); 33 let pandaGen = compiler.getPandaGen(); 36 pandaGen.createEmptyArray(node); 37 pandaGen.storeAccumulator(node, arrayObj); 42 let indexReg = pandaGen.getTemp(); 55 emitCreateArrayWithBuffer(pandaGen, literalBuffer, element); 56 pandaGen.storeAccumulator(element, arrayObj); 64 storeElementIfSpreadExisted(pandaGen, element, arrayObj, indexReg); [all …]
|
D | objectLiteralExpression.ts | 29 let pandaGen = compiler.getPandaGen(); 34 let objReg = pandaGen.getTemp(); 39 pandaGen.createEmptyObject(expr); 40 pandaGen.storeAccumulator(expr, objReg); 41 pandaGen.freeTemps(objReg); 49 createObject(expr, pandaGen, objReg, literalBuffer, hasMethod, compiler); 52 setUncompiledProperties(compiler, pandaGen, properties, objReg); 54 pandaGen.loadAccumulator(expr, objReg); 55 pandaGen.freeTemps(objReg); 110 function createObject(expr: ts.ObjectLiteralExpression, pandaGen: PandaGen, objReg: VReg, [all …]
|
D | callExpression.ts | 28 let pandaGen = compiler.getPandaGen(); 34 pandaGen.dynamicImportCall(expr); 49 pandaGen.freeTemps(...args); 57 pandaGen.freeTemps(...args); 61 let pandaGen = compiler.getPandaGen(); 64 let funcReg = pandaGen.getTemp(); 67 let thisReg = pandaGen.getTemp(); 68 let propReg = pandaGen.getTemp(); 75 pandaGen.loadObjProperty( 81 pandaGen.storeAccumulator(expr, funcReg); [all …]
|
D | newExpression.ts | 23 let pandaGen = compiler.getPandaGen(); 24 let ctorReg = pandaGen.getTemp(); 28 pandaGen.storeAccumulator(expr, ctorReg); 31 let argRegs = pandaGen.getTemp(); 34 pandaGen.newObjSpread(expr, ctorReg); 35 pandaGen.freeTemps(ctorReg, argRegs); 53 let argReg = pandaGen.getTemp(); 55 pandaGen.storeAccumulator(expr, argReg); 61 pandaGen.newObject(expr, argRegs); 64 pandaGen.freeTemps(...argRegs);
|
D | numericLiteral.ts | 38 export function compileNumericLiteral(pandaGen: PandaGen, lit: ts.NumericLiteral): void { 43 pandaGen.loadAccumulator(lit, getVregisterCache(pandaGen, CacheList.NAN)); 46 pandaGen.loadAccumulator(lit, getVregisterCache(pandaGen, CacheList.INFINITY)); 49 pandaGen.loadAccumulatorInt(lit, value); 51 pandaGen.loadAccumulatorFloat(lit, value);
|
/arkcompiler/ets_frontend/ts2panda/src/ |
D | compilerUtils.ts | 39 export function compileDestructuring(pattern: ts.BindingOrAssignmentPattern, pandaGen: PandaGen, co… 40 let rhs = pandaGen.getTemp(); 41 pandaGen.storeAccumulator(pattern, rhs); 44 compileArrayDestructuring(<ts.ArrayBindingOrAssignmentPattern>pattern, pandaGen, compiler); 48 … compileObjectDestructuring(<ts.ObjectBindingOrAssignmentPattern>pattern, pandaGen, compiler); 51 pandaGen.loadAccumulator(pattern, rhs); 52 pandaGen.freeTemps(rhs); 55 function compileArrayDestructuring(arr: ts.ArrayBindingOrAssignmentPattern, pandaGen: PandaGen, com… 56 let iter = pandaGen.getTemp(); 57 let nextMethod = pandaGen.getTemp(); [all …]
|
D | compiler.ts | 133 private pandaGen: PandaGen; property in Compiler 140 …constructor(node: ts.SourceFile | ts.FunctionLikeDeclaration, pandaGen: PandaGen, compilerDriver: … 142 this.pandaGen = pandaGen; 145 this.funcBuilder = new FunctionBuilder(pandaGen); 149 this.scope = this.pandaGen.getScope()!; 153 this.pandaGen.getVregForVariable(parameters[i]); 157 getVregisterCache(this.pandaGen, CacheList.LEXENV); 159 this.pandaGen.loadAccFromArgs(this.rootNode); 195 this.pandaGen.loadAccumulator(NodeKind.FIRST_NODE_OF_FUNCTION, 196 getVregisterCache(this.pandaGen, CacheList.FUNC)); [all …]
|
D | hoisting.ts | 36 export function hoisting(rootNode: ts.SourceFile | ts.FunctionLikeDeclaration, pandaGen: PandaGen, 43 hoistVar(decl, variableScope, pandaGen); 46 hoistFunction(decl, variableScope, pandaGen, compiler, compilerDriver); 53 export function hoistVar(decl: VarDecl, scope: Scope, pandaGen: PandaGen): void { 57 pandaGen.loadAccumulator(decl.node, getVregisterCache(pandaGen, CacheList.UNDEFINED)); 58 pandaGen.storeGlobalVar(decl.node, name); 61 …pandaGen.loadAccumulator(NodeKind.FIRST_NODE_OF_FUNCTION, getVregisterCache(pandaGen, CacheList.UN… 63 pandaGen.storeModuleVariable(NodeKind.FIRST_NODE_OF_FUNCTION, v); 65 pandaGen.storeAccToLexEnv(NodeKind.FIRST_NODE_OF_FUNCTION, scope, 0, v, true); 72 export function hoistFunction(decl: FuncDecl, scope: Scope, pandaGen: PandaGen, compiler: Compiler,… [all …]
|
D | lexenv.ts | 64 abstract expand(pandaGen: PandaGen, compiler: Compiler): Array<IRNode>; 72 expand(pandaGen: PandaGen): Array<IRNode> { 74 return this.loadLexEnvVar(pandaGen); 76 return this.loadLocalVar(pandaGen); 80 private loadLocalVar(pandaGen: PandaGen): Array<IRNode> { 83 let bindVreg = pandaGen.getVregForVariable(v); 87 insns.push(loadAccumulator(getVregisterCache(pandaGen, CacheList.HOLE))); 96 private loadLexEnvVar(pandaGen: PandaGen): Array<IRNode> { 121 expand(pandaGen: PandaGen): Array<IRNode> { 123 return this.storeLexEnvVar(pandaGen); [all …]
|
/arkcompiler/ets_frontend/ts2panda/src/statement/ |
D | returnStatement.ts | 26 let pandaGen = compiler.getPandaGen(); 27 let returnValue = pandaGen.getTemp(); 34 pandaGen.freeTemps(returnValue); 38 let pandaGen = compiler.getPandaGen(); 41 let need2CheckSuper = pandaGen.getTemp(); 44 pandaGen.moveVreg(stmt, need2CheckSuper, getVregisterCache(pandaGen, CacheList.TRUE)); 48 pandaGen.freeTemps(need2CheckSuper); 53 pandaGen.moveVreg(stmt, need2CheckSuper, getVregisterCache(pandaGen, CacheList.TRUE)); 56 …pandaGen.binary(stmt, ts.SyntaxKind.EqualsEqualsEqualsToken, getVregisterCache(pandaGen, CacheList… 57 pandaGen.storeAccumulator(stmt, need2CheckSuper); [all …]
|
D | loopStatement.ts | 37 let pandaGen = compiler.getPandaGen(); 50 pandaGen.label(stmt, loopStartLabel); 52 pandaGen.createLexEnv(stmt, loopScope); 56 pandaGen.label(stmt, conditionLabel); 60 pandaGen.popLexicalEnv(stmt); 63 pandaGen.branch(stmt, loopStartLabel); 64 pandaGen.label(stmt, loopEndLabel); 67 pandaGen.popLexicalEnv(stmt); 77 let pandaGen = compiler.getPandaGen(); 88 pandaGen.label(stmt, loopStartLabel); [all …]
|
D | tryStatement.ts | 76 constructor(pandaGen: PandaGen, catchBeginLabel: Label, labelPair: LabelPair) { 81 pandaGen.getCatchMap().set(catchBeginLabel, this); 186 protected pandaGen: PandaGen; property in TryBuilderBase 190 constructor(compiler: Compiler, pandaGen: PandaGen, Stmt: ts.Statement) { 192 this.pandaGen = pandaGen; 206 constructor(compiler: Compiler, pandaGen: PandaGen, tryStmt: ts.TryStatement) { 207 super(compiler, pandaGen, tryStmt); 241 let exceptionVreg = this.pandaGen.getTemp(); 242 this.pandaGen.storeAccumulator(this.stmt, exceptionVreg); 244 this.pandaGen.loadAccumulator(this.stmt, exceptionVreg); [all …]
|
D | classStatement.ts | 62 let pandaGen = compiler.getPandaGen(); 68 let classReg = pandaGen.getTemp(); 78 let tmpVreg = pandaGen.getTemp(); 84 pandaGen.storeAccumulator(prop.getValue(), tmpVreg); 108 pandaGen.storeAccumulator(prop.getValue(), tmpVreg); 114 pandaGen.freeTemps(tmpVreg); 127 pandaGen.loadAccumulator(stmt, classReg); 133 let v: ModuleVariable = <ModuleVariable>(pandaGen.getScope().findLocal(className)); 135 pandaGen.storeModuleVariable(stmt, v); 137 … let defaultV: ModuleVariable = <ModuleVariable>(pandaGen.getScope().findLocal("*default*")); [all …]
|
D | forOfStatement.ts | 58 let pandaGen = compiler.getPandaGen(); 62 let doneReg = pandaGen.getTemp(); 63 let method = pandaGen.getTemp(); 64 let object = pandaGen.getTemp(); 68 let loopEnv = pandaGen.getTemp(); 74 pandaGen.createLexEnv(stmt, loopScope); 79 let iterator: IteratorRecord = getIteratorRecord(pandaGen, stmt, method, object, type); 82 pandaGen.popLexicalEnv(stmt); 86 pandaGen.loadAccumulator(stmt, getVregisterCache(pandaGen, CacheList.FALSE)); 87 pandaGen.storeAccumulator(stmt, doneReg); [all …]
|
D | switchStatement.ts | 31 private pandaGen: PandaGen; property in SwitchBase 37 this.pandaGen = compiler.getPandaGen(); 51 this.pandaGen.label(caseTarget, this.caseLabels[index]); 56 this.pandaGen.storeAccumulator(this.stmt.expression, tagReg); 67 let pandaGen = this.pandaGen; 71 …pandaGen.condition(caseTarget, ts.SyntaxKind.ExclamationEqualsEqualsToken, tag, this.caseLabels[in… 76 this.pandaGen.branch(defaultTarget, this.caseLabels[defaultIndex]); 86 this.pandaGen.branch(this.stmt, this.switchEndLabel); 90 this.pandaGen.label(this.stmt, this.switchEndLabel); 95 let pandaGen = compiler.getPandaGen(); [all …]
|
/arkcompiler/ets_frontend/ts2panda/src/base/ |
D | builtIn.ts | 33 export function expandHole(pandaGen: PandaGen): IRNode[] { 34 let vreg = getVregisterCache(pandaGen, CacheList.HOLE); 41 export function expandNaN(pandaGen: PandaGen): IRNode[] { 42 let vreg = getVregisterCache(pandaGen, CacheList.NAN); 49 export function expandInfinity(pandaGen: PandaGen): IRNode[] { 50 let vreg = getVregisterCache(pandaGen, CacheList.INFINITY); 57 export function expandGlobal(pandaGen: PandaGen): IRNode[] { 58 let vreg = getVregisterCache(pandaGen, CacheList.GLOBAL); 65 export function expandUndefined(pandaGen: PandaGen): IRNode[] { 66 let vreg = getVregisterCache(pandaGen, CacheList.UNDEFINED); [all …]
|
D | iterator.ts | 32 private pandaGen: PandaGen; property in Iterator 38 … pandaGen: PandaGen, node: ts.Node, kind ? : IteratorType, funcBuilder ? : FunctionBuilder) { 42 this.pandaGen = pandaGen; 54 let pandaGen = this.pandaGen; 58 …this.kind === IteratorType.Normal ? pandaGen.getIterator(this.node) : pandaGen.getAsyncIterator(th… 59 pandaGen.storeAccumulator(this.node, iterator); 62 pandaGen.loadObjProperty(this.node, iterator, "next"); 63 pandaGen.storeAccumulator(this.node, this.iterRecord.nextMethod); 71 this.pandaGen.loadObjProperty(this.node, this.iterRecord.iterator, id); 72 this.pandaGen.storeAccumulator(this.node, this.iterRecord.nextMethod); [all …]
|
D | lreference.ts | 63 let pandaGen = this.compiler.getPandaGen(); variable 72 pandaGen.loadObjProperty(this.node, <VReg>this.obj, prop); 85 let pandaGen = this.compiler.getPandaGen(); variable 95 let thisReg = pandaGen.getTemp(); 97 pandaGen.storeSuperProperty(this.node, thisReg, prop); 98 pandaGen.freeTemps(thisReg); 100 pandaGen.storeObjProperty(this.node, <VReg>this.obj, prop); 102 pandaGen.freeTemps(...[<VReg>this.obj, <VReg>this.prop]); 109 …ileDestructuring(<ts.BindingOrAssignmentPattern>this.destructuringTarget, pandaGen, this.compiler); 116 setObjectAndProperty(pandaGen: PandaGen, obj: VReg, prop: VReg | number | string): void { [all …]
|
D | lexEnv.ts | 28 function createLexEnv(pandaGen: PandaGen, scope: VariableScope): IRNode[] { 34 scopeInfoId = pandaGen.appendScopeInfo(lexVarInfo); 39 storeAccumulator(getVregisterCache(pandaGen, CacheList.LEXENV)) 45 export function expandLexEnv(pandaGen: PandaGen): IRNode[] { 46 let scope = pandaGen.getScope()!.getNearestVariableScope(); 54 insns = createLexEnv(pandaGen, scope);
|
/arkcompiler/ets_frontend/ts2panda/tests/expression/ |
D | numericLiteral.test.ts | 32 let pandaGen = new PandaGen("ignored", creatAstFromSnippet("NaN"), 0, undefined); variable 34 compileNumericLiteral(pandaGen, node); 35 let insns = pandaGen.getInsns(); 41 let pandaGen = new PandaGen("ignored", creatAstFromSnippet("10e10000"), 0, undefined); variable 43 compileNumericLiteral(pandaGen, node); 44 let insns = pandaGen.getInsns(); 49 let pandaGen = new PandaGen("ignored", creatAstFromSnippet("1"), 0, undefined); variable 51 compileNumericLiteral(pandaGen, node); 52 let insns = pandaGen.getInsns(); 57 let pandaGen = new PandaGen("ignored", creatAstFromSnippet("2147483648"), 0, undefined); variable [all …]
|
/arkcompiler/ets_frontend/ts2panda/tests/ |
D | regAllocator.test.ts | 229 let pandaGen = new PandaGen('', creatAstFromSnippet(""), 0); variable 230 let para1 = pandaGen.getTemp(); 231 let para2 = pandaGen.getTemp(); 232 let para3 = pandaGen.getTemp(); 233 let para4 = pandaGen.getTemp(); 234 let para5 = pandaGen.getTemp(); 235 let para6 = pandaGen.getTemp(); 237 pandaGen.call(ts.createNode(0), [para1, para2, para3, para4, para5, para6], false); 239 pandaGen.freeTemps(para1, para3, para2); 242 new RegAlloc().run(pandaGen); [all …]
|