(ptr, pos, value, type)
| 515 | } |
| 516 | |
| 517 | function makeSetValueImpl(ptr, pos, value, type) { |
| 518 | if (type == 'i64' && !WASM_BIGINT) { |
| 519 | // If we lack BigInt support we must fall back to an reading a pair of I32 |
| 520 | // values. |
| 521 | // prettier-ignore |
| 522 | return '(tempI64 = [' + splitI64(value) + '], ' + |
| 523 | makeSetValueImpl(ptr, pos, 'tempI64[0]', 'i32') + ',' + |
| 524 | makeSetValueImpl(ptr, getFastValue(pos, '+', getNativeTypeSize('i32')), 'tempI64[1]', 'i32') + ')'; |
| 525 | } |
| 526 | |
| 527 | const offset = calcFastOffset(ptr, pos); |
| 528 | |
| 529 | if (type === 'i53') { |
| 530 | return `writeI53ToI64(${offset}, ${value})`; |
| 531 | } |
| 532 | |
| 533 | const slab = getHeapForType(type); |
| 534 | if (slab == 'HEAPU64' || slab == 'HEAP64') { |
| 535 | value = castToBigInt(value); |
| 536 | } |
| 537 | return `${slab}[${getHeapOffset(offset, type)}] = ${value}`; |
| 538 | } |
| 539 | |
| 540 | function makeHEAPView(which, start, end) { |
| 541 | // The makeHEAPView, for legacy reasons, takes a heap "suffix" |
no test coverage detected