| 221 | |
| 222 | |
| 223 | void genCode(CppiaCompiler *compiler, const JitVal &inDest, ExprType destType) HXCPP_OVERRIDE |
| 224 | { |
| 225 | ExprType elemType = (ExprType)ExprTypeOf<ELEM>::value; |
| 226 | ExprType rightHandType; |
| 227 | switch((int)FUNC::op) |
| 228 | { |
| 229 | case aoMult: |
| 230 | case aoDiv: |
| 231 | case aoSub: |
| 232 | case aoMod: |
| 233 | rightHandType = etFloat; |
| 234 | break; |
| 235 | |
| 236 | case aoAnd: |
| 237 | case aoOr: |
| 238 | case aoXOr: |
| 239 | case aoShl: |
| 240 | case aoShr: |
| 241 | case aoUShr: |
| 242 | rightHandType = etInt; |
| 243 | |
| 244 | default: |
| 245 | rightHandType = elemType; |
| 246 | } |
| 247 | |
| 248 | if ((int)FUNC::op==aoSet) |
| 249 | { |
| 250 | JitTemp thisVal(compiler,jtPointer); |
| 251 | thisExpr->genCode(compiler, thisVal, etObject); |
| 252 | |
| 253 | // sJitTemp1 = index |
| 254 | JitTemp index(compiler,jtInt); |
| 255 | args[0]->genCode(compiler, index, etInt); |
| 256 | |
| 257 | // Right-hand-size |
| 258 | JitTemp value(compiler,getJitType(rightHandType)); |
| 259 | args[1]->genCode(compiler, value, rightHandType); |
| 260 | |
| 261 | compiler->move(sJitTemp1,index); |
| 262 | |
| 263 | // sJitTemp0 = this |
| 264 | compiler->move(sJitTemp0, thisVal); |
| 265 | |
| 266 | |
| 267 | // Check length.. |
| 268 | JumpId lengthOk = compiler->compare( cmpI_LESS, sJitTemp1.as(jtInt), |
| 269 | sJitTemp0.star(jtInt, ArrayBase::lengthOffset()) ); |
| 270 | |
| 271 | |
| 272 | JumpId enough = compiler->compare( cmpI_LESS, sJitTemp1.as(jtInt), |
| 273 | sJitTemp0.star(jtInt, ArrayBase::allocOffset()) ); |
| 274 | // Make some room |
| 275 | compiler->callNative( (void *)array_expand_size, sJitTemp0.as(jtPointer), sJitTemp1.as(jtInt) ); |
| 276 | // sJitTemp0 is still this, restore length... |
| 277 | compiler->move( sJitTemp1,index); |
| 278 | |
| 279 | compiler->comeFrom(enough); |
| 280 |
no test coverage detected