Closed Bug 1052491 Opened 10 years ago Closed 10 years ago

Add support for symbol-keyed properties to jsinfer

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla35

People

(Reporter: jorendorff, Assigned: jorendorff)

Details

Attachments

(2 files)

Currently we treat symbol-keyed properties the same as indexed properties: they are all glommed into a single category. We'll infer more specific types if we support symbols, and I don't think it even requires any new code -- just let symbol jsids through.
I think this must have been written before there was an invariant that string jsids are never indexes.
Assignee: nobody → jorendorff
Attachment #8486485 - Flags: review?(bhackett1024)
Well -- I think it's really this simple. Passes all the jit-tests and js/tests locally.
Attachment #8486486 - Flags: review?(bhackett1024)
Comment on attachment 8486485 [details] [diff] [review]
bug-1052491-part-1-simplify-v1.patch

Review of attachment 8486485 [details] [diff] [review]:
-----------------------------------------------------------------

Nice, I've wanted to remove this for a while.  This is some of the oldest TI code still around, and does, yeah, date to before we canonicalized jsids.
Attachment #8486485 - Flags: review?(bhackett1024) → review+
Comment on attachment 8486486 [details] [diff] [review]
bug-1052491-part-2-symbols-v1.patch

Review of attachment 8486486 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/jsinferinlines.h
@@ +205,5 @@
>      JS_ASSERT(!JSID_IS_EMPTY(id));
>  
>      // All integers must map to the aggregate property for index types, including
>      // negative integers.
> +    return JSID_IS_STRING(id) || JSID_IS_SYMBOL(id) ? id : JSID_VOID;

Parens around JSID_IS_STRING(id) || JSID_IS_SYMBOL(id), to make this easier for humans to parse.  Or, change this to:

return JSID_IS_INT(id) ? JSID_VOID : id;

Also, missed this in the earlier patch, but the comment is wrong about negative integers.  The existing comment is kind of vague, so you can change it to:

// All properties which can be stored in an object's dense elements must map to the aggregate property for index types.
Attachment #8486486 - Flags: review?(bhackett1024) → review+
Cool. (This makes it even more ridiculous to have two patches -- hg rebase deleted my second changeset. So I'll just be pushing one changeset.)
Of course hg rebase was wrong to delete my second changeset, and the tree burned bright orange. Pushed the fix.
https://hg.mozilla.org/mozilla-central/rev/fd2cd2e8c258
https://hg.mozilla.org/mozilla-central/rev/eec8eb2b4dd6
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla35
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: