Re:Mozilla’s new (internal) JavaScript value representation
by andhow on Tuesday August 03, 2010 @01:37AM
(#1570244)
It is also used in WebKit's JSC. Using the NaN space goes back much further than LuaJIT. E.g., you can see it mention in this 1993 survey paper: http://lambda-the-ultimate.org/node/3912.
quoting http://article.gmane.org/gmane.comp.lang.lua.general/58908
- NaN-tagging: 64 bit tagged values are used for stack slots and table slots. Unboxed floating-point numbers (doubles) are overlayed with tagged object references. The latter can be distinguished from numbers via the use of special NaNs as tags. It's a remote descendant of pointer-tagging.