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

Function fxMarkValue

xs/sources/xsMemory.c:1290–1575  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1288}
1289
1290void fxMarkValue(txMachine* the, txSlot* theSlot)
1291{
1292#define mxMarkChunk(_THE_DATA) \
1293 ((txChunk*)(((txByte*)_THE_DATA) - sizeof(txChunk)))->size |= mxChunkFlag
1294
1295 txSlot* aSlot;
1296 switch (theSlot->kind) {
1297 case XS_STRING_KIND:
1298 mxMarkChunk(theSlot->value.string);
1299 break;
1300 case XS_BIGINT_KIND:
1301 mxMarkChunk(theSlot->value.bigint.data);
1302 break;
1303 case XS_REFERENCE_KIND:
1304 aSlot = theSlot->value.reference;
1305 if (!(aSlot->flag & XS_MARK_FLAG))
1306 fxMarkInstance(the, aSlot, fxMarkValue);
1307 break;
1308 case XS_CLOSURE_KIND:
1309 aSlot = theSlot->value.closure;
1310 if (aSlot && (!(aSlot->flag & XS_MARK_FLAG))) {
1311 aSlot->flag |= XS_MARK_FLAG;
1312 fxMarkValue(the, aSlot);
1313 }
1314 break;
1315 case XS_INSTANCE_KIND:
1316 if (!(theSlot->flag & XS_MARK_FLAG))
1317 fxMarkInstance(the, theSlot, fxMarkValue);
1318 break;
1319
1320 case XS_ARGUMENTS_SLOPPY_KIND:
1321 case XS_ARGUMENTS_STRICT_KIND:
1322 case XS_ARRAY_KIND:
1323 case XS_STACK_KIND:
1324 fxCheckCStack(the);
1325 if ((aSlot = theSlot->value.array.address)) {
1326 txChunk* chunk = (txChunk*)(((txByte*)aSlot) - sizeof(txChunk));
1327 if (!(chunk->size & mxChunkFlag)) {
1328 txIndex aLength = chunk->size / sizeof(txSlot);
1329 if (aLength > theSlot->value.array.length)
1330 aLength = theSlot->value.array.length;
1331 while (aLength) {
1332 fxMarkValue(the, aSlot);
1333 aSlot++;
1334 aLength--;
1335 }
1336 mxMarkChunk(theSlot->value.array.address);
1337 }
1338 }
1339 break;
1340 case XS_ARRAY_BUFFER_KIND:
1341 if (theSlot->value.arrayBuffer.address)
1342 mxMarkChunk(theSlot->value.arrayBuffer.address);
1343 break;
1344 case XS_CALLBACK_KIND:
1345 aSlot = theSlot->value.callback.closures;
1346 if (aSlot && !(aSlot->flag & XS_MARK_FLAG)) {
1347 fxCheckCStack(the);

Callers

nothing calls this directly

Calls 3

fxMarkInstanceFunction · 0.85
fxCheckCStackFunction · 0.85
fxMarkIDFunction · 0.85

Tested by

no test coverage detected