If I do the following operation
a = PRIVATE_TO_JSVAL(7);
b = JSVAL_TO_PRIVATE(a);
I get b's value as '6'. !
Can't I set anyt integar value to private?
Can this operation be done only on pointers?
Thanks & regards
Rethish
This e-mail and attachments contain confidential information from HUAWEI,
which is intended only for the person or entity whose address is listed
above. Any use of the information contained herein in any way (including,
but not limited to, total or partial disclosure, reproduction, or
dissemination) by persons other than the intended recipient's) is
prohibited. If you receive this e-mail in error, please notify the sender by
phone or email immediately and delete it
John.
Yes. In fact, the private pointer needs to be 8-byte aligned.
-Boris
Hey Boris,
I'm curious why you added the comment about 8-byte alignment. The
PRIVATE macros just tag and untag the 0th bit. From the engine's
perspective, this makes a private jsval indistinguishable from any
other int jsval. That bit is all it takes for the engine to know this
is not a gcthing. Why would the 'full' 31 bits not be available to the
api user? I can't think of any way that the engine would care about
the state of the other 2 low bits. Am I missing something?
John.
>
> -Boris
Ah, right. We're talking about private pointers, not gcthing pointers being
stored in a jsval. The latter need to be 8-byte aligned. The private pointers
just need to be 2-byte aligned...
-Boris