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

Function fxMeasureSlot

xs/sources/xsMarshall.c:828–1008  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

826}
827
828void fxMeasureSlot(txMachine* the, txSlot* theSlot, txMarshallBuffer* theBuffer, txBoolean alien)
829{
830 txSlot* aSlot;
831
832 if (!(theSlot->flag & XS_INTERNAL_FLAG) && !fxMeasureKey(the, theSlot->ID, theBuffer, alien))
833 return;
834 theBuffer->size += sizeof(txSlot);
835 if (theBuffer->size < 0)
836 fxMeasureThrow(the, theBuffer, "too big");
837 switch (theSlot->kind) {
838 case XS_UNDEFINED_KIND:
839 case XS_NULL_KIND:
840 case XS_BOOLEAN_KIND:
841 case XS_INTEGER_KIND:
842 case XS_NUMBER_KIND:
843 case XS_DATE_KIND:
844 case XS_STRING_X_KIND:
845 case XS_BIGINT_X_KIND:
846 case XS_DATA_VIEW_KIND:
847 case XS_KEY_X_KIND:
848 case XS_BUFFER_INFO_KIND:
849 break;
850
851 case XS_STRING_KIND:
852 fxMeasureChunk(the, theSlot->value.string, theBuffer);
853 break;
854 case XS_BIGINT_KIND:
855 fxMeasureChunk(the, theSlot->value.bigint.data, theBuffer);
856 break;
857 case XS_ARRAY_BUFFER_KIND:
858 if (theSlot->value.arrayBuffer.address)
859 fxMeasureChunk(the, theSlot->value.arrayBuffer.address, theBuffer);
860 break;
861 case XS_REGEXP_KIND:
862 if (theSlot->value.regexp.code)
863 fxMeasureChunk(the, theSlot->value.regexp.code, theBuffer);
864 if (theSlot->value.regexp.data)
865 fxMeasureChunk(the, theSlot->value.regexp.data, theBuffer);
866 break;
867 case XS_KEY_KIND:
868 if (theSlot->value.key.string)
869 fxMeasureChunk(the, theSlot->value.string, theBuffer);
870 break;
871
872 case XS_SYMBOL_KIND:
873 if (!fxMeasureKey(the, theSlot->value.symbol, theBuffer, alien))
874 fxMeasureThrow(the, theBuffer, "symbol");
875 break;
876
877 case XS_HOST_KIND:
878 if (theSlot->value.host.variant.destructor != fxReleaseSharedChunk)
879 fxMeasureThrow(the, theBuffer, "host object");
880 break;
881 case XS_MAP_KIND:
882 case XS_SET_KIND:
883 break;
884 case XS_TYPED_ARRAY_KIND:
885 break;

Callers 2

fxMarshallFunction · 0.70
fxMeasureReferenceFunction · 0.70

Calls 5

fxMeasureKeyFunction · 0.85
fxMeasureThrowFunction · 0.85
fxMeasureReferenceFunction · 0.85
fxGetIndexSizeFunction · 0.85
fxMeasureChunkFunction · 0.70

Tested by

no test coverage detected