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

Function fxIndexInstance

xs/sources/xsSnapshot.c:749–892  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

747extern const txTypeAtomics gxTypeAtomics[];
748
749void fxIndexInstance(txMachine* the, txSnapshot* snapshot, txSlot* theCurrent)
750{
751 txSlot* aProperty;
752 txSlot* aTemporary;
753
754 mxCheck(the, theCurrent->kind == XS_INSTANCE_KIND);
755 aProperty = theCurrent;
756 theCurrent->value.instance.garbage = C_NULL;
757 for (;;) {
758 if (aProperty) {
759 if (!(aProperty->flag & XS_MARK_FLAG)) {
760 fxIndexSlot(the, snapshot, aProperty);
761
762 switch (aProperty->kind) {
763 case XS_INSTANCE_KIND:
764 aTemporary = aProperty->value.instance.prototype;
765 if (aTemporary && !(aTemporary->flag & XS_MARK_FLAG)) {
766 aProperty->value.instance.prototype = theCurrent;
767 theCurrent = aTemporary;
768 theCurrent->value.instance.garbage = aProperty;
769 aProperty = theCurrent;
770 }
771 else
772 aProperty = aProperty->next;
773 break;
774 case XS_REFERENCE_KIND:
775 aTemporary = aProperty->value.reference;
776 if (!(aTemporary->flag & XS_MARK_FLAG)) {
777 aProperty->value.reference = theCurrent;
778 theCurrent = aTemporary;
779 theCurrent->value.instance.garbage = aProperty;
780 aProperty = theCurrent;
781 }
782 else
783 aProperty = aProperty->next;
784 break;
785
786 case XS_PROXY_KIND:
787 aTemporary = aProperty->value.proxy.handler;
788 if (aTemporary && !(aTemporary->flag & XS_MARK_FLAG)) {
789 aProperty->flag |= XS_INSPECTOR_FLAG;
790 aProperty->value.proxy.handler = theCurrent;
791 theCurrent = aTemporary;
792 theCurrent->value.instance.garbage = aProperty;
793 aProperty = theCurrent;
794 }
795 else {
796 aTemporary = aProperty->value.proxy.target;
797 if (aTemporary && !(aTemporary->flag & XS_MARK_FLAG)) {
798 aProperty->value.proxy.target = theCurrent;
799 theCurrent = aTemporary;
800 theCurrent->value.instance.garbage = aProperty;
801 aProperty = theCurrent;
802 }
803 else
804 aProperty = aProperty->next;
805 }
806 break;

Callers 1

fxIndexReferenceFunction · 0.85

Calls 2

fxIndexReferenceFunction · 0.85
fxIndexSlotFunction · 0.70

Tested by

no test coverage detected