Closed
Bug 595963
Opened 14 years ago
Closed 14 years ago
Sand Trap game stops animating
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
blocking2.0 | --- | beta8+ |
People
(Reporter: dmandelin, Assigned: dmandelin)
References
()
Details
(Whiteboard: [chromeexperiments][fixed-in-tracemonkey])
Attachments
(2 files, 3 obsolete files)
(deleted),
application/x-javascript
|
Details | |
(deleted),
patch
|
gal
:
review+
|
Details | Diff | Splinter Review |
The game at the linked URL stops working. Specifically, it stops animating the sand after I play with it for 5 seconds or so. In the JS console, I get:
a.grains[h] is undefined
This happens at least as early as 4.0b5.
Assignee | ||
Updated•14 years ago
|
blocking2.0: --- → ?
Assignee | ||
Comment 1•14 years ago
|
||
Works in TM nightly of 7 May 2010
Fails in TM nightly of 8 May 2010
http://hg.mozilla.org/tracemonkey/pushloghtml?startdate=5%2F6%2F2010&enddate=5%2F8%2F2010
Comment 3•14 years ago
|
||
I did a non-minified version of this game with some extra debug info in case you want it for testing:
http://scotland.proximity.on.ca/dxr/tmp/sand-trap-chrome.html
Updated•14 years ago
|
Whiteboard: [chromeexperiments]
Comment 4•14 years ago
|
||
I wonder if bug 597186 comment 4 is also this bug, where we seem to lose array elements Chrome doesn't. There's a test case in that bug.
Comment 5•14 years ago
|
||
Exception: a.grains[h] is undefined
I get this even with JM and TM disabled.
And another thing:
It seems this game is calculating the JS engine's speed first, then gives the amount of sands wich the JS engine can handle.
It gives me the same amount with JM + TM and just TM and JM+TM disabled, to...
Updated•14 years ago
|
blocking2.0: ? → beta8+
This is breaking when sand falls into the bucket for the first time, on this line:
for (var h in b.grains) { b.grains[h].update(g); }
So the regression range which involves iterators seems accurate.
Comment 7•14 years ago
|
||
This might have to do with deletion during iteration?
Yup, good call. Seems to only happen with nested iterators. Here's a reduced test case.
No nested iteration needed. All you have to do is delete the current element.
Attachment #478456 -
Attachment is obsolete: true
Okay, here is the final testcase, that *actually* reproduces a valid problem. Array.splice() doesn't seem to update iterators in the way delete does.
Attachment #478473 -
Attachment is obsolete: true
Comment 11•14 years ago
|
||
Interesting. Yeah, I guess some array functions delete without going through the delete hook. Good catch.
Yeah, exactly. array_splice doesn't call DeleteArrayElement() on dense arrays. Any takers that know this code?
Comment 14•14 years ago
|
||
Pretty straight forward fix. Call
bool
js_SuppressDeletedProperty(JSContext *cx, JSObject *obj, jsid id)
on every index that was deleted (INT_TO_JSID for id). If its a large range it might be worth to do a SuppressDeletedProperties() with a range.
Comment 15•14 years ago
|
||
Do we have to do that on all splice calls? Or only the ones when we have an iterator live (and can we tell the latter?)?
Assignee | ||
Updated•14 years ago
|
Assignee: general → dmandelin
Assignee | ||
Comment 16•14 years ago
|
||
Attachment #479957 -
Flags: review?(gal)
Comment 17•14 years ago
|
||
Comment on attachment 479957 [details] [diff] [review]
Patch
js_SuppressDeletedProperty does an expensive lookup of open iterators. The loop should happen inside of it (find iterator, if its same object remove the range of ids), not outside.
Assignee | ||
Comment 18•14 years ago
|
||
Attachment #479957 -
Attachment is obsolete: true
Attachment #479984 -
Flags: review?(gal)
Attachment #479957 -
Flags: review?(gal)
Comment 19•14 years ago
|
||
Comment on attachment 479984 [details] [diff] [review]
Patch
Pretty :)
Attachment #479984 -
Flags: review?(gal) → review+
Assignee | ||
Comment 20•14 years ago
|
||
Status: NEW → ASSIGNED
Whiteboard: [chromeexperiments] → [chromeexperiments][fixed-in-tracemonkey]
Assignee | ||
Comment 21•14 years ago
|
||
Backed out due to crashtest failures:
http://hg.mozilla.org/tracemonkey/rev/d2d4a7115949
Whiteboard: [chromeexperiments][fixed-in-tracemonkey] → [chromeexperiments]
Assignee | ||
Comment 22•14 years ago
|
||
Relanded:
http://hg.mozilla.org/tracemonkey/rev/f1c60a6d07ba
Tinderbox failures the last time appear to have been bogus.
Whiteboard: [chromeexperiments] → [chromeexperiments][fixed-in-tracemonkey]
Comment 23•14 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•