Closed Bug 1034972 Opened 7 years ago Closed 7 years ago

Do *not* support object shorthands in asm.js

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla33

People

(Reporter: Swatinem, Assigned: bbouvier)

References

Details

Attachments

(1 file)

As per discussion in bug 875002, the support for PNK_SHORTHAND (shorthand properties of objects) should be reverted in asm.js.

(In reply to Jason Orendorff [:jorendorff] from comment #22)
> (In reply to Luke Wagner [:luke] from comment #19)
> > Are there any complications, or
> > can you just remove the "|| pn->isKind(PNK_SHORTHAND)" that was added in
> > this patch?
> 
> No complications.
> 
> Swatinem, if you haven't already, please file the follow-up bug to remove
> this feature from asm.js. Instead of removing the PNK_SHORTHAND check from
> the assertion, I think you'll have to add a PNK_SHORTHAND check to the
> return value in IsNormalObjectField.
> 
> As for rationale: In general, asm.js's syntax is deliberately extremely
> simple, and asm.js code runs in all recent browsers.


I’m a little tied up right now and would like to refresh my destructuring-rest patch first before I tackle this. So if anyone wants to take this on, please go ahead.
Attached patch Patch and testSplinter Review
Assignee: nobody → benj
Status: NEW → ASSIGNED
Attachment #8451482 - Flags: review?(luke)
Comment on attachment 8451482 [details] [diff] [review]
Patch and test

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

Thanks!

::: js/src/jit/AsmJS.cpp
@@ +5792,5 @@
>  {
>      JS_ASSERT(object->isKind(PNK_OBJECT));
>  
>      for (ParseNode *pn = ListHead(object); pn; pn = NextNode(pn)) {
> +        if (!pn->isKind(PNK_COLON) || !IsNormalObjectField(m.cx(), pn))

Could you instead put this test in IsNormalObjectField (replacing the assert).  Also, can you rename ObjectFieldInitializer to ObjectNormalFieldInitializer and JS_ASSERT(IsNormalObjectField(pn))?
Attachment #8451482 - Flags: review?(luke) → review+
https://hg.mozilla.org/mozilla-central/rev/ccebb68bdf07
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
You need to log in before you can comment on or make changes to this bug.