| 419 | } |
| 420 | |
| 421 | void fxSetIndexSize(txMachine* the, txSlot* array, txIndex target, txBoolean growable) |
| 422 | { |
| 423 | txSlot* address = array->value.array.address; |
| 424 | txSlot* chunk = C_NULL; |
| 425 | txIndex current = (address) ? (((txChunk*)(((txByte*)address) - sizeof(txChunk)))->size) / sizeof(txSlot) : 0; |
| 426 | txSize size; |
| 427 | if (current != target) { |
| 428 | if (array->flag & XS_DONT_SET_FLAG) |
| 429 | mxTypeError("set length: not writable"); |
| 430 | size = fxMultiplyChunkSizes(the, target, sizeof(txSlot)); |
| 431 | if (address) { |
| 432 | if (target) { |
| 433 | chunk = (txSlot*)fxRenewChunk(the, address, size); |
| 434 | if (!chunk) { |
| 435 | #ifndef mxNoArrayOverallocation |
| 436 | if (growable) { |
| 437 | txSize capacity = fxSizeToCapacity(the, size); |
| 438 | chunk = (txSlot*)fxNewGrowableChunk(the, size, capacity); |
| 439 | } |
| 440 | else |
| 441 | #endif |
| 442 | chunk = (txSlot*)fxNewChunk(the, size); |
| 443 | address = array->value.array.address; |
| 444 | if (current < target) |
| 445 | c_memcpy(chunk, address, current * sizeof(txSlot)); |
| 446 | else |
| 447 | c_memcpy(chunk, address, size); |
| 448 | } |
| 449 | } |
| 450 | } |
| 451 | else { |
| 452 | #ifndef mxNoArrayOverallocation |
| 453 | if (growable) { |
| 454 | txSize capacity = fxSizeToCapacity(the, size); |
| 455 | chunk = (txSlot*)fxNewGrowableChunk(the, size, capacity); |
| 456 | } |
| 457 | else |
| 458 | #endif |
| 459 | chunk = (txSlot*)fxNewChunk(the, size); |
| 460 | } |
| 461 | if (current < target) |
| 462 | c_memset(chunk + current, 0, (target - current) * sizeof(txSlot)); |
| 463 | array->value.array.length = target; |
| 464 | array->value.array.address = chunk; |
| 465 | } |
| 466 | } |
| 467 | |
| 468 | txBoolean fxDefinePrivateProperty(txMachine* the, txSlot* instance, txSlot* check, txID id, txSlot* slot, txFlag mask) |
| 469 | { |
no test coverage detected