Lines Matching refs:etsg

102 Condition::Result Condition::CheckConstantExpr(ETSGen *etsg, const ir::Expression *expr)
117 if (etsg->Checker()->IsNullLikeOrVoidExpression(resultingExpression)) {
129 void Condition::CompileLogicalOrExpr(ETSGen *etsg, const ir::BinaryExpression *binExpr, Label *falseLabel)
131 auto ttctx = TargetTypeContext(etsg, binExpr->OperationType());
132 RegScope rs(etsg);
133 VReg lhs = etsg->AllocReg();
134 VReg rhs = etsg->AllocReg();
135 auto *returnLeftLabel = etsg->AllocLabel();
136 auto *returnRightTrueLabel = etsg->AllocLabel();
137 auto *returnRightFalseLabel = etsg->AllocLabel();
139 binExpr->Left()->Compile(etsg);
140 etsg->ApplyConversionAndStoreAccumulator(binExpr->Left(), lhs, binExpr->OperationType());
141 etsg->ResolveConditionalResultIfTrue(binExpr->Left(), returnLeftLabel);
142 etsg->BranchIfTrue(binExpr, returnLeftLabel);
144 binExpr->Right()->Compile(etsg);
145 etsg->ApplyConversionAndStoreAccumulator(binExpr->Right(), rhs, binExpr->OperationType());
146 etsg->ResolveConditionalResultIfFalse(binExpr->Right(), returnRightFalseLabel);
147 etsg->BranchIfFalse(binExpr, returnRightFalseLabel);
148 etsg->LoadAccumulator(binExpr, rhs);
149 etsg->Branch(binExpr, returnRightTrueLabel);
151 etsg->SetLabel(binExpr, returnRightFalseLabel);
152 etsg->LoadAccumulator(binExpr, rhs);
153 etsg->Branch(binExpr, falseLabel);
154 etsg->SetLabel(binExpr, returnLeftLabel);
155 etsg->LoadAccumulator(binExpr, lhs);
156 etsg->SetLabel(binExpr, returnRightTrueLabel);
159 void Condition::CompileLogicalAndExpr(ETSGen *etsg, const ir::BinaryExpression *binExpr, Label *falseLabel)
161 auto ttctx = TargetTypeContext(etsg, binExpr->OperationType());
162 RegScope rs(etsg);
163 VReg lhs = etsg->AllocReg();
164 VReg rhs = etsg->AllocReg();
165 auto *returnLeftLabel = etsg->AllocLabel();
166 auto *returnRightTrueLabel = etsg->AllocLabel();
167 auto *returnRightFalseLabel = etsg->AllocLabel();
169 binExpr->Left()->Compile(etsg);
170 etsg->ApplyConversionAndStoreAccumulator(binExpr->Left(), lhs, binExpr->OperationType());
171 etsg->ResolveConditionalResultIfFalse(binExpr->Left(), returnLeftLabel);
172 etsg->BranchIfFalse(binExpr, returnLeftLabel);
174 binExpr->Right()->Compile(etsg);
175 etsg->ApplyConversionAndStoreAccumulator(binExpr->Right(), rhs, binExpr->OperationType());
176 etsg->ResolveConditionalResultIfFalse(binExpr->Right(), returnRightFalseLabel);
177 etsg->BranchIfFalse(binExpr, returnRightFalseLabel);
178 etsg->LoadAccumulator(binExpr, rhs);
179 etsg->Branch(binExpr, returnRightTrueLabel);
181 etsg->SetLabel(binExpr, returnLeftLabel);
182 etsg->LoadAccumulator(binExpr, lhs);
183 etsg->Branch(binExpr, falseLabel);
184 etsg->SetLabel(binExpr, returnRightFalseLabel);
185 etsg->LoadAccumulator(binExpr, rhs);
186 etsg->Branch(binExpr, falseLabel);
187 etsg->SetLabel(binExpr, returnRightTrueLabel);
190 bool Condition::CompileBinaryExprForBigInt(ETSGen *etsg, const ir::BinaryExpression *expr, Label *falseLabel)
223 auto ttctx = TargetTypeContext(etsg, expr->OperationType());
224 RegScope rs(etsg);
225 VReg lhs = etsg->AllocReg();
226 expr->Left()->Compile(etsg);
227 etsg->ApplyConversionAndStoreAccumulator(expr->Left(), lhs, expr->OperationType());
228 expr->Right()->Compile(etsg);
229 etsg->ApplyConversion(expr->Right(), expr->OperationType());
230 compiler::VReg rhs = etsg->AllocReg();
231 etsg->StoreAccumulator(expr, rhs);
232 etsg->CallBigIntBinaryComparison(expr, lhs, rhs, signature);
233 etsg->BranchIfFalse(expr, falseLabel);
238 void Condition::CompileInstanceofExpr(ETSGen *etsg, const ir::BinaryExpression *binExpr, Label *falseLabel)
241 binExpr->Compile(etsg);
242 etsg->BranchIfFalse(binExpr, falseLabel);
245 bool Condition::CompileBinaryExpr(ETSGen *etsg, const ir::BinaryExpression *binExpr, Label *falseLabel)
247 if (CompileBinaryExprForBigInt(etsg, binExpr, falseLabel)) {
258 auto ttctx = TargetTypeContext(etsg, binExpr->OperationType());
260 RegScope rs(etsg);
261 VReg lhs = etsg->AllocReg();
263 binExpr->CompileOperands(etsg, lhs);
264 etsg->Condition(binExpr, binExpr->OperatorType(), lhs, falseLabel);
268 CompileLogicalAndExpr(etsg, binExpr, falseLabel);
272 CompileLogicalOrExpr(etsg, binExpr, falseLabel);
276 CompileInstanceofExpr(etsg, binExpr, falseLabel);
286 void Condition::Compile(ETSGen *etsg, const ir::Expression *expr, Label *falseLabel)
289 if (CompileBinaryExpr(etsg, expr->AsBinaryExpression(), falseLabel)) {
294 expr->AsUnaryExpression()->Argument()->Compile(etsg);
295 etsg->ApplyConversion(expr->AsUnaryExpression()->Argument(), etsg->Checker()->GlobalETSBooleanType());
296 etsg->ResolveConditionalResultIfTrue(expr, falseLabel);
297 etsg->BranchIfTrue(expr, falseLabel);
301 expr->Compile(etsg);
302 etsg->ApplyConversion(expr, etsg->Checker()->GlobalETSBooleanType());
303 etsg->ResolveConditionalResultIfFalse(expr, falseLabel);
304 etsg->BranchIfFalse(expr, falseLabel);