Closed
Bug 1420961
Opened 7 years ago
Closed 7 years ago
Clean up iterator code
Categories
(Core :: JavaScript Engine: JIT, enhancement)
Core
JavaScript Engine: JIT
Tracking
()
RESOLVED
FIXED
mozilla59
Tracking | Status | |
---|---|---|
firefox59 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
Details
Attachments
(4 files)
2.29 KB,
patch
|
evilpie
:
review+
|
Details | Diff | Splinter Review |
940 bytes,
patch
|
evilpie
:
review+
|
Details | Diff | Splinter Review |
32.25 KB,
patch
|
evilpie
:
review+
|
Details | Diff | Splinter Review |
1.46 KB,
patch
|
jonco
:
review+
|
Details | Diff | Splinter Review |
With for-each gone we can remove a bunch of stuff: JSOP_ITER flags operand, JSITER_ENUMERATE, and some checks in code that's pretty hot.
Assignee | ||
Comment 1•7 years ago
|
||
It doesn't use its cx argument and always returns true.
Attachment #8932137 -
Flags: review?(evilpies)
Assignee | ||
Comment 2•7 years ago
|
||
In js::GetIterator we return early if the object is a PropertyIteratorObject. I don't see how this is possible since PropertyIteratorObject shouldn't escape to JS. This patch just turns it into an assert.
Attachment #8932138 -
Flags: review?(evilpies)
Assignee | ||
Comment 3•7 years ago
|
||
Attachment #8932139 -
Flags: review?(evilpies)
Updated•7 years ago
|
Attachment #8932137 -
Flags: review?(evilpies) → review+
Updated•7 years ago
|
Attachment #8932138 -
Flags: review?(evilpies) → review+
Comment 4•7 years ago
|
||
I thought there was some other reason we didn't want to set the enumerate flags when calling from the Proxy::enumerate hook. Something to do with not putting the iterator object in the iterator list? I will look into that tomorrow.
Assignee | ||
Comment 5•7 years ago
|
||
Part 3 failed browser tests on Try. It turns out the Reify function was never called because in Wrapper::enumerate we would create an iterator with flags = 0 and then in CanReify check for flags & JSITER_ENUMERATE. I think this is a regression from bug 783829.
This patch adds a markId call to Reify and adds a shell test.
Having Reify work again makes some cross-compartment for-in micro-benchmarks > 20% faster.
Attachment #8932468 -
Flags: review?(jcoppeard)
Comment 6•7 years ago
|
||
Comment on attachment 8932468 [details] [diff] [review]
Part 4 - Add missing markId call
Review of attachment 8932468 [details] [diff] [review]:
-----------------------------------------------------------------
Ah, nice.
It's a shame it's so easy to miss marking atoms.
Attachment #8932468 -
Flags: review?(jcoppeard) → review+
Assignee | ||
Comment 7•7 years ago
|
||
(In reply to Tom Schuster [:evilpie] from comment #4)
> I thought there was some other reason we didn't want to set the enumerate
> flags when calling from the Proxy::enumerate hook. Something to do with not
> putting the iterator object in the iterator list? I will look into that
> tomorrow.
FWIW I can't think of any issues here. If we wrap an iterator it will be in the enumerator list (of the wrappee's compartment). JSOP_ITEREND may not remove it from that list but that's okay - the enumerator list is a doubly linked list and is swept on GC - it's not a stack that has to stay balanced. Also, when the Reify optimization kicks in we won't use a wrapped iterator but we just copy it and then close the original.
Comment 8•7 years ago
|
||
Comment on attachment 8932139 [details] [diff] [review]
Part 3 - Remove JSITER_ENUMERATE and flags arguments
Review of attachment 8932139 [details] [diff] [review]:
-----------------------------------------------------------------
Sounds right, thanks Jan. It's great to have that flag removed.
Attachment #8932139 -
Flags: review?(evilpies) → review+
Pushed by jandemooij@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/6133d185ba8b
part 1 - Make NativeIteratorNext infallible. r=evilpie
https://hg.mozilla.org/integration/mozilla-inbound/rev/3f9a32b603db
part 2 - Replace if-statement with an assert in js::GetIterator. r=evilpie
https://hg.mozilla.org/integration/mozilla-inbound/rev/bb14fe85b1a9
part 3 - Remove JSITER_ENUMERATE and flags arguments. r=evilpie
https://hg.mozilla.org/integration/mozilla-inbound/rev/649756a338c8
part 4 - Add missing markId call to Reify function. r=jonco
Comment 10•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/6133d185ba8b
https://hg.mozilla.org/mozilla-central/rev/3f9a32b603db
https://hg.mozilla.org/mozilla-central/rev/bb14fe85b1a9
https://hg.mozilla.org/mozilla-central/rev/649756a338c8
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox59:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in
before you can comment on or make changes to this bug.
Description
•