There is no integer type in JavaScript.
There is Number type which is defined to be double precision
floating-point number.
ECMA-262 defined ToInteger(x) operation in section 9.2: roughly it is
just sign(x) * floor(abs(x)) plus several special cases for NaN, -0,
and infinities.
Integer type in V8 API should be treated as a convenient way of
representing and accessing result of this operation. It does not
extend underlying JavaScript type system, it just wraps value of
Number type.
--
Vyacheslav Egorov
> --
> v8-users mailing list
> v8-u...@googlegroups.com
> http://groups.google.com/group/v8-users
>
Sometimes :-)
Internally numbers in V8 can be represented in two forms:
- as so called SMall Integer or smi (31-bit on ia32 and ARM, 32-bit on
x64; passed as immediate value);
- HeapNumber (double allocated in the heap and passed by reference).
If value you pass into Integer::New fits into smi-representation V8
will store it as a smi otherwise it will allocate a HeapNumber.
> maybe I'm looking in the wrong place
v8::Integer::New is defined in api.cc
You can also check the comment in the beginning of objects.h for
details about object representation.
--
Vyacheslav Egorov