Closed
Bug 1323825
Opened 8 years ago
Closed 7 years ago
Replace Has+Get with Get where required by spec in jsarray.cpp
Categories
(Core :: JavaScript: Standard Library, defect)
Core
JavaScript: Standard Library
Tracking
()
RESOLVED
FIXED
mozilla54
People
(Reporter: anba, Assigned: anba)
References
Details
Attachments
(2 files, 1 obsolete file)
17.99 KB,
patch
|
evilpie
:
review+
|
Details | Diff | Splinter Review |
11.67 KB,
patch
|
anba
:
review+
|
Details | Diff | Splinter Review |
Test case: --- Array.prototype.join.call(new Proxy([1, 2], new Proxy({}, { get(t, pk){ print(pk); } }))); --- Expected: Doesn't call "has" trap Actual: Calls "has" trap twice
Assignee | ||
Comment 1•7 years ago
|
||
Updates the step numbers to match the current ES2017 draft, so it's easier to verify the implementation follows the spec.
Attachment #8834831 -
Flags: review?(evilpies)
Assignee | ||
Comment 2•7 years ago
|
||
Adds a new GetElement method without hole-checking and uses it in Array.prototype.{join, pop, shift}. Also inlines DoGetElement into its sole caller.
Attachment #8834834 -
Flags: review?(evilpies)
Comment 3•7 years ago
|
||
Comment on attachment 8834831 [details] [diff] [review] bug1323825-part1-update-steps.patch Review of attachment 8834831 [details] [diff] [review]: ----------------------------------------------------------------- Great, thanks for updating those.
Attachment #8834831 -
Flags: review?(evilpies) → review+
Comment 4•7 years ago
|
||
Comment on attachment 8834834 [details] [diff] [review] bug1323825-part2-remove-has.patch Review of attachment 8834834 [details] [diff] [review]: ----------------------------------------------------------------- Great tests as usual. I thought about this a bit and I couldn't come up with any other way to make this observable without using proxies. And maybe a bit faster for Arrays with holes \o/ ::: js/src/jsarray.cpp @@ +213,3 @@ > */ > +static bool > +GetElement(JSContext* cx, HandleObject obj, HandleObject receiver, uint32_t index, bool* hole, Great, we already have to many GetElement variants. I feel like we should have a followup for renaming this to HasAndGetElement. @@ +253,5 @@ > return GetElement(cx, obj, obj, index, hole, vp); > } > > +/* > + * Gets the property at the given index into the location pointed by vp. This is a weird comment, I think we can just remove it. ::: js/src/tests/ecma_6/Array/pop-no-has-trap.js @@ +1,1 @@ > +// Test that Array.prototype.join doesn't call the [[HasProperty]] internal method of objects .pop ::: js/src/tests/ecma_6/Array/shift-no-has-trap.js @@ +1,1 @@ > +// Test that Array.prototype.join doesn't call the [[HasProperty]] internal method of objects .shift
Attachment #8834834 -
Flags: review?(evilpies) → review+
Assignee | ||
Comment 5•7 years ago
|
||
Update part 2 per review comments, carrying r+ from evilpie.
Attachment #8834834 -
Attachment is obsolete: true
Attachment #8835478 -
Flags: review+
Assignee | ||
Comment 6•7 years ago
|
||
(In reply to Tom Schuster [:evilpie] from comment #4) > I thought about this a bit and I couldn't come up with any other way to make this observable without using proxies. > Yes, I don't think it's possible to observe this without proxies. > ::: js/src/jsarray.cpp > @@ +213,3 @@ > > */ > > +static bool > > +GetElement(JSContext* cx, HandleObject obj, HandleObject receiver, uint32_t index, bool* hole, > > Great, we already have to many GetElement variants. I feel like we should > have a followup for renaming this to HasAndGetElement. Filed bug 1338126.
Assignee | ||
Comment 7•7 years ago
|
||
Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=700d0dfbb55be1293c08d3f2d9a0c342d7f0525f https://treeherder.mozilla.org/#/jobs?repo=try&revision=1d20a1d6504e85a7fab5d64f92c180a252bba1ff The failures on OS X 10.7 opt, SM(p) seem to be intermittent.
Keywords: checkin-needed
Pushed by cbook@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/64fc958a94f4 Part 1: Synchronize step number comments with latest ES2017 draft. r=evilpie https://hg.mozilla.org/integration/mozilla-inbound/rev/d23e3f6246fb Part 2: Remove spec incompliant [[HasProperty]] calls in Array.prototype.{join,pop,shift}. r=evilpie
Keywords: checkin-needed
Comment 9•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/64fc958a94f4 https://hg.mozilla.org/mozilla-central/rev/d23e3f6246fb
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox54:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
You need to log in
before you can comment on or make changes to this bug.
Description
•