MCPcopy
hub / github.com/sql-js/sql.js / _realloc

Function _realloc

js/sql-debug.js:393026–393076  ·  view source on GitHub ↗
($0,$1)

Source from the content-addressed store, hash-verified

393024 return ($8|0);
393025}
393026function _realloc($0,$1) {
393027 $0 = $0|0;
393028 $1 = $1|0;
393029 var $$1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $20 = 0, $21 = 0, $22 = 0, $23 = 0, $24 = 0, $3 = 0, $4 = 0, $5 = 0;
393030 var $6 = 0, $7 = 0, $8 = 0, $9 = 0, label = 0, sp = 0;
393031 sp = STACKTOP;
393032 $2 = ($0|0)==(0|0);
393033 if ($2) {
393034 $3 = (_malloc($1)|0);
393035 $$1 = $3;
393036 return ($$1|0);
393037 }
393038 $4 = ($1>>>0)>(4294967231);
393039 if ($4) {
393040 $5 = (___errno_location()|0);
393041 HEAP32[$5>>2] = 12;
393042 $$1 = 0;
393043 return ($$1|0);
393044 }
393045 $6 = ($1>>>0)<(11);
393046 $7 = (($1) + 11)|0;
393047 $8 = $7 & -8;
393048 $9 = $6 ? 16 : $8;
393049 $10 = ((($0)) + -8|0);
393050 $11 = (_try_realloc_chunk($10,$9)|0);
393051 $12 = ($11|0)==(0|0);
393052 if (!($12)) {
393053 $13 = ((($11)) + 8|0);
393054 $$1 = $13;
393055 return ($$1|0);
393056 }
393057 $14 = (_malloc($1)|0);
393058 $15 = ($14|0)==(0|0);
393059 if ($15) {
393060 $$1 = 0;
393061 return ($$1|0);
393062 }
393063 $16 = ((($0)) + -4|0);
393064 $17 = HEAP32[$16>>2]|0;
393065 $18 = $17 & -8;
393066 $19 = $17 & 3;
393067 $20 = ($19|0)==(0);
393068 $21 = $20 ? 8 : 4;
393069 $22 = (($18) - ($21))|0;
393070 $23 = ($22>>>0)<($1>>>0);
393071 $24 = $23 ? $22 : $1;
393072 _memcpy(($14|0),($0|0),($24|0))|0;
393073 _free($0);
393074 $$1 = $14;
393075 return ($$1|0);
393076}
393077function _try_realloc_chunk($0,$1) {
393078 $0 = $0|0;
393079 $1 = $1|0;

Callers 1

_sqlite3MemReallocFunction · 0.85

Calls 5

_mallocFunction · 0.85
___errno_locationFunction · 0.85
_try_realloc_chunkFunction · 0.85
_memcpyFunction · 0.85
_freeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…