Last Comment Bug 691993 - Fully split up deleteProperty into property/element/special/generic forms
: Fully split up deleteProperty into property/element/special/generic forms
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: All All
: -- normal (vote)
: mozilla10
Assigned To: Jeff Walden [:Waldo] (remove +bmo to email)
:
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-04 17:56 PDT by Jeff Walden [:Waldo] (remove +bmo to email)
Modified: 2011-10-20 03:05 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch (20.78 KB, patch)
2011-10-04 17:56 PDT, Jeff Walden [:Waldo] (remove +bmo to email)
bhackett1024: review+
Details | Diff | Splinter Review

Description Jeff Walden [:Waldo] (remove +bmo to email) 2011-10-04 17:56:13 PDT
Created attachment 564723 [details] [diff] [review]
Patch

More dreariness.

This one in particular would be much nicer, generally, if the opcode format were split such that we had delprop, delelem, delval -- that is, we had specific bytecodes for deleting named properties and deleting index properties.  I tend to think that sort of bytecode mucking is better left to later on in API changes, so for now we get a bunch of deleteGeneric.
Comment 1 Brian Hackett (:bhackett) 2011-10-06 07:28:12 PDT
Comment on attachment 564723 [details] [diff] [review]
Patch

I don't understand the opcode format comment.  There are separate bytecodes already for DELNAME, DELPROP and DELELEM, and for DELELEM there is no way for the parser to tell ahead of time whether the property being deleted is named or indexed.
Comment 2 Jeff Walden [:Waldo] (remove +bmo to email) 2011-10-19 11:39:09 PDT
What I suggest is that DELELEM be split into a variant that deletes using a value on the stack to indicate the property to delete, and a variant that deletes using a constant index included in the bytecode stream:

  delete a.b  => delprop "b"
  delete a[2] => delelem 2
  delete a[c] => delval #(slot for c)

Or something like that.

It's possible there might not be the payoff in splitting up delelem that way, since delete is kind of uncommon.  But if there were such a split, delelem could use obj->deleteElement, delprop could use obj->deleteProperty, and delval could use obj->deleteGeneric (or longer-run something to disambiguate the val into an element, property, or special, then use delete{not Generic}).
Comment 3 Jeff Walden [:Waldo] (remove +bmo to email) 2011-10-19 14:10:25 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/9291abf9fd17
Comment 4 Marco Bonardo [::mak] 2011-10-20 03:05:18 PDT
https://hg.mozilla.org/mozilla-central/rev/9291abf9fd17

Note You need to log in before you can comment on or make changes to this bug.