Closed
Bug 614915
Opened 15 years ago
Closed 15 years ago
[undefined].sort() returns sort function
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
blocking2.0 | --- | final+ |
People
(Reporter: jandem, Assigned: dmandelin)
References
Details
(Whiteboard: fixed-in-tracemonkey)
Attachments
(1 file)
1.19 KB,
patch
|
cdleary
:
review+
|
Details | Diff | Splinter Review |
Consider this:
---
js> [undefined].sort()
function sort() {[native code]}
---
IIRC, this happens when a function does not set its return value.
Reporter | ||
Updated•15 years ago
|
blocking2.0: --- → ?
Reporter | ||
Comment 1•15 years ago
|
||
Seems to be caused by this:
---
if (newlen == 0)
return true; /* The array has only holes and undefs. */
---
This happens for all arrays with only holes and undefined.
Updated•15 years ago
|
blocking2.0: ? → final+
Assignee | ||
Updated•15 years ago
|
Assignee: general → dmandelin
Assignee | ||
Comment 2•15 years ago
|
||
Attachment #493855 -
Flags: review?(cdleary)
Comment 3•15 years ago
|
||
Comment on attachment 493855 [details] [diff] [review]
Patch
(In reply to comment #0)
> IIRC, this happens when a function does not set its return value.
Yes, because the callee is placed in vp[0] on invocation, which is also where the return value is placed. (Somewhat surprisingly, if you do JS_SET_RVAL in a fast native you can no longer rely on the return value of JS_CALLEE, so you can't think of JS_[SET_]RVAL as a general storage mechanism.)
Attachment #493855 -
Flags: review?(cdleary) → review+
Assignee | ||
Comment 4•15 years ago
|
||
Status: NEW → ASSIGNED
Whiteboard: fixed-in-tracemonkey
Comment 5•15 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•