Dart VM uses
pointer tagging to avoid boxing "small" integer values (abbreviated as smi in the code base).
When you have a pointer (RawObject*) it can be either:
- a pointer to an object in the heap
- an immediate smi value which "pretends" to be a pointer.
These two situations are distiguished by the least significant bit of the value - if it is 1 then the value is a pointer into the heap, if it is 0 then it is a small integer.
- If the value is a tagged pointer (least significant bit is 1) then the actual pointer can be obtained by subtracting 1 from it
- If the value is a tagged small integer (least significant bit is 0) then the actual integer value can be obtained by shifting the value to right by 1.