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

Function fxMarkInstance

xs/sources/xsMemory.c:874–1044  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

872}
873
874void fxMarkInstance(txMachine* the, txSlot* theCurrent, void (*theMarker)(txMachine*, txSlot*))
875{
876 txSlot* aProperty;
877 txSlot* aTemporary;
878
879 mxCheck(the, theCurrent->kind == XS_INSTANCE_KIND);
880 aProperty = theCurrent;
881 theCurrent->value.instance.garbage = C_NULL;
882 for (;;) {
883 if (aProperty) {
884 if (!(aProperty->flag & XS_MARK_FLAG)) {
885 aProperty->flag |= XS_MARK_FLAG;
886 switch (aProperty->kind) {
887 case XS_INSTANCE_KIND:
888 aTemporary = aProperty->value.instance.prototype;
889 if (aTemporary && !(aTemporary->flag & XS_MARK_FLAG)) {
890 aProperty->value.instance.prototype = theCurrent;
891 theCurrent = aTemporary;
892 theCurrent->value.instance.garbage = aProperty;
893 aProperty = theCurrent;
894 }
895 else
896 aProperty = aProperty->next;
897 break;
898 case XS_REFERENCE_KIND:
899 #if mxKeysGarbageCollection
900 if (the->collectFlag & XS_COLLECT_KEYS_FLAG) {
901 if (!(aProperty->flag & XS_INTERNAL_FLAG))
902 fxMarkID(the, aProperty->ID);
903 }
904 #endif
905 aTemporary = aProperty->value.reference;
906 if (!(aTemporary->flag & XS_MARK_FLAG)) {
907 aProperty->value.reference = theCurrent;
908 theCurrent = aTemporary;
909 theCurrent->value.instance.garbage = aProperty;
910 aProperty = theCurrent;
911 }
912 else
913 aProperty = aProperty->next;
914 break;
915
916 case XS_PROXY_KIND:
917 aTemporary = aProperty->value.proxy.handler;
918 if (aTemporary && !(aTemporary->flag & XS_MARK_FLAG)) {
919 aProperty->flag |= XS_INSPECTOR_FLAG;
920 aProperty->value.proxy.handler = theCurrent;
921 theCurrent = aTemporary;
922 theCurrent->value.instance.garbage = aProperty;
923 aProperty = theCurrent;
924 }
925 else {
926 aTemporary = aProperty->value.proxy.target;
927 if (aTemporary && !(aTemporary->flag & XS_MARK_FLAG)) {
928 aProperty->value.proxy.target = theCurrent;
929 theCurrent = aTemporary;
930 theCurrent->value.instance.garbage = aProperty;
931 aProperty = theCurrent;

Callers 2

fxMarkReferenceFunction · 0.85
fxMarkValueFunction · 0.85

Calls 1

fxMarkIDFunction · 0.85

Tested by

no test coverage detected