Closed Bug 775166 Opened 13 years ago Closed 13 years ago

Remove some ugly optimization in jsarray

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla17

People

(Reporter: evilpies, Assigned: evilpies)

Details

(Whiteboard: [js:t])

Attachments

(1 file)

Attached patch v1Splinter Review
This seems very premature to optimize, because this is unlikely to really matter. Checking if something is a hole based on whether this index was atomized before seems really ugly.
Attachment #643435 - Flags: review?(bhackett1024)
Comment on attachment 643435 [details] [diff] [review] v1 Review of attachment 643435 [details] [diff] [review]: ----------------------------------------------------------------- Wow, gross.
Attachment #643435 - Flags: review?(bhackett1024) → review+
Whiteboard: [js:t]
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
Comment on attachment 643435 [details] [diff] [review] v1 Review of attachment 643435 [details] [diff] [review]: ----------------------------------------------------------------- I was always pretty meh about this ugly, nice to see someone caring more than me enough to remove it. :-) A few little comments in passing, while I'm skimming the bugmail backlog. ::: js/src/jsarray.cpp @@ +260,5 @@ > return true; > } > > +bool > +DoubleIndexToId(JSContext *cx, double index, jsid *id) Shouldn't this be static bool? @@ +261,5 @@ > } > > +bool > +DoubleIndexToId(JSContext *cx, double index, jsid *id) > +{ I think this method can assert that index is finite and a non-negative integer, right? @@ +262,5 @@ > > +bool > +DoubleIndexToId(JSContext *cx, double index, jsid *id) > +{ > + if (index == uint32_t(index)) Tom, if |index|, truncated, isn't a uint32_t, this invokes undefined behavior. I *think*, if I remember correctly, that this method's only called with integral values, so couldn't you change this test to |index <= JSID_INT_MAX| to avoid this problem?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: