MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxSweepValue

Function fxSweepValue

xs/sources/xsMemory.c:2122–2198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2120}
2121
2122void fxSweepValue(txMachine* the, txSlot* theSlot)
2123{
2124 txSlot* aSlot;
2125 txByte* data;
2126
2127#define mxSweepChunk(_THE_DATA, _THE_DATA_TYPE) \
2128 if ((data = (txByte*)(((txChunk*)(((txByte*)(_THE_DATA)) - sizeof(txChunk)))->temporary))) \
2129 ((_THE_DATA)) = (_THE_DATA_TYPE)(data + sizeof(txChunk))
2130
2131 switch (theSlot->kind) {
2132 case XS_STRING_KIND:
2133 mxSweepChunk(theSlot->value.string, txString);
2134 break;
2135 case XS_BIGINT_KIND:
2136 mxSweepChunk(theSlot->value.bigint.data, txU4*);
2137 break;
2138
2139 case XS_ARGUMENTS_SLOPPY_KIND:
2140 case XS_ARGUMENTS_STRICT_KIND:
2141 case XS_ARRAY_KIND:
2142 case XS_STACK_KIND:
2143 if ((aSlot = theSlot->value.array.address)) {
2144#if mxNoChunks
2145 mxSweepChunk(theSlot->value.array.address, txSlot*);
2146 aSlot = theSlot->value.array.address;
2147#endif
2148 txChunk* chunk = (txChunk*)(((txByte*)aSlot) - sizeof(txChunk));
2149 txIndex aLength = chunk->size / sizeof(txSlot);
2150 if (aLength > theSlot->value.array.length)
2151 aLength = theSlot->value.array.length;
2152 while (aLength) {
2153 fxSweepValue(the, aSlot);
2154 aSlot++;
2155 aLength--;
2156 }
2157#if mxNoChunks
2158#else
2159 mxSweepChunk(theSlot->value.array.address, txSlot*);
2160#endif
2161 }
2162 break;
2163 case XS_ARRAY_BUFFER_KIND:
2164 if (theSlot->value.arrayBuffer.address)
2165 mxSweepChunk(theSlot->value.arrayBuffer.address, txByte*);
2166 break;
2167 case XS_CODE_KIND:
2168 mxSweepChunk(theSlot->value.code.address, txByte*);
2169 break;
2170 case XS_GLOBAL_KIND:
2171 mxSweepChunk(theSlot->value.table.address, txSlot**);
2172 break;
2173 case XS_HOST_KIND:
2174 if (theSlot->value.host.data) {
2175 if (theSlot->flag & XS_HOST_CHUNK_FLAG)
2176 mxSweepChunk(theSlot->value.host.data, void*);
2177 }
2178 break;
2179 case XS_IDS_KIND:

Callers 1

fxSweepFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected