TM: Add JSValueShiftedTag enum for 64-bit shifted tags.

RESOLVED FIXED

Status

()

Core
JavaScript Engine
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: sstangl, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 attachment)

(Reporter)

Description

8 years ago
Created attachment 459114 [details] [diff] [review]
Add JSValueShiftedTag enum.

The x86_64 JM port stores and operates on tags in the canonical shifted position, e.g., JSVAL_SHIFTED_TAG_INT32. Currently, these tags are only available as defines. This patch adds a JSValueShiftedTag enum when compiling with C++, so that functions may take a shifted tag as an argument, letting the type system catch some errors. The justification for existence is the same as for JSValueTag.
Attachment #459114 - Flags: review?(lw)

Comment 1

8 years ago
Comment on attachment 459114 [details] [diff] [review]
Add JSValueShiftedTag enum.

>+} JS_ENUM_FOOTER(JSValueTag);
>+
>+JS_STATIC_ASSERT(sizeof(JSValueTag) == sizeof(uint32));
>+
>+JS_ENUM_HEADER(JSValueShiftedTag, uint64)
>+{
>+    JSVAL_SHIFTED_TAG_MAX_DOUBLE   = (((uint64)JSVAL_TAG_MAX_DOUBLE) << JSVAL_TAG_SHIFT),
>+    JSVAL_SHIFTED_TAG_INT32        = (((uint64)JSVAL_TAG_INT32)      << JSVAL_TAG_SHIFT),
>+    JSVAL_SHIFTED_TAG_UNDEFINED    = (((uint64)JSVAL_TAG_UNDEFINED)  << JSVAL_TAG_SHIFT),
>+    JSVAL_SHIFTED_TAG_STRING       = (((uint64)JSVAL_TAG_STRING)     << JSVAL_TAG_SHIFT),
>+    JSVAL_SHIFTED_TAG_BOOLEAN      = (((uint64)JSVAL_TAG_BOOLEAN)    << JSVAL_TAG_SHIFT),
>+    JSVAL_SHIFTED_TAG_MAGIC        = (((uint64)JSVAL_TAG_MAGIC)      << JSVAL_TAG_SHIFT),
>+    JSVAL_SHIFTED_TAG_NULL         = (((uint64)JSVAL_TAG_NULL)       << JSVAL_TAG_SHIFT),
>+    JSVAL_SHIFTED_TAG_OBJECT       = (((uint64)JSVAL_TAG_OBJECT)     << JSVAL_TAG_SHIFT)
>+} JS_ENUM_FOOTER(JSValueShiftedTag);
>+
>+JS_STATIC_ASSERT(sizeof(JSValueShiftedTag) == sizeof(uint64));
> 
> JS_STATIC_ASSERT(sizeof(JSValueTag) == 4);

Nix that straggler at the end.
Attachment #459114 - Flags: review?(lw) → review+

Comment 2

8 years ago
http://hg.mozilla.org/tracemonkey/rev/471b8cd1dae6
Whiteboard: fixed-in-tracemonkey

Comment 3

8 years ago
http://hg.mozilla.org/mozilla-central/rev/471b8cd1dae6
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.