Closed
Bug 503155
Opened 16 years ago
Closed 15 years ago
TM: js_DropScope uses ATOMIC_DECREMENT even during GC (which is single threaded)
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
People
(Reporter: gal, Assigned: brendan)
Details
(Whiteboard: fixed-in-tracemonkey)
Attachments
(2 files, 2 obsolete files)
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
jorendorff
:
review+
|
Details | Diff | Splinter Review |
ATOMIC_DECREMENT turns out to be _extremely_ expensive due to the lock prefix. This is a major cost during GC. The attached patch tells js_DropScope whether the gc lock is currently being held, in which case a simple non-atomic decrement is sufficient.
Reporter | ||
Comment 1•16 years ago
|
||
Assignee: general → gal
Attachment #387508 -
Flags: review?(brendan)
Assignee | ||
Comment 2•16 years ago
|
||
Comment on attachment 387508 [details] [diff] [review]
patch
No, even simpler: assert CX_THREAD_IS_RUNNING_GC(cx) and always use the unlocked decrement.
/be
Reporter | ||
Comment 3•16 years ago
|
||
No, GetMutableScope calls DropScope from outside the GC.
Assignee | ||
Comment 4•16 years ago
|
||
(In reply to comment #3)
> No, GetMutableScope calls DropScope from outside the GC.
Oops, but that is a different call. It can never destroy a scope, in particular. Instead of adding flag param overhead, specialize just that function.
/be
Assignee | ||
Comment 5•16 years ago
|
||
Don't want to r+ myself, this is different-looking by enough code, but provably equivalent (check out the comments and assertion).
/be
Assignee: gal → brendan
Attachment #387508 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #387678 -
Flags: review?(jorendorff)
Attachment #387508 -
Flags: review?(brendan)
Assignee | ||
Comment 6•16 years ago
|
||
Want to get this in soon, scope-related patches stacking up all over.
/be
OS: Mac OS X → All
Hardware: x86 → All
Assignee | ||
Comment 7•16 years ago
|
||
Attachment #387678 -
Attachment is obsolete: true
Attachment #387683 -
Flags: review?(jorendorff)
Attachment #387678 -
Flags: review?(jorendorff)
Comment 8•16 years ago
|
||
Comment on attachment 387683 [details] [diff] [review]
fix to #ifdef JS_THREADSAFE that assertion
This test flunks the assertion in js_GetMutableScope:
// a -> b -> c
function B(){}
var c = B.prototype = {x: 1};
function A(){}
var b = A.prototype = new B;
var a = new A;
// Kill c.
b.__proto__ = null;
c = B.prototype = null;
gc();
a.y = 2;
Attachment #387683 -
Flags: review?(jorendorff)
Assignee | ||
Comment 10•16 years ago
|
||
Attachment #387692 -
Flags: review?(jorendorff)
Updated•16 years ago
|
Attachment #387692 -
Flags: review?(jorendorff) → review+
Comment 11•16 years ago
|
||
Comment on attachment 387692 [details] [diff] [review]
inline a bit more of js_DropScope into js_GetMutableScope
Looks good.
Assignee | ||
Comment 12•16 years ago
|
||
I cloned the
JS_ASSERT(scope->nrefs > 0);
from js_DropScope into the tail of js_GetMutableScope too.
http://hg.mozilla.org/tracemonkey/rev/51ed66617fb5
/be
Whiteboard: fixed-in-tracemonkey
Comment 13•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
•