author | Boris Zbarsky <bzbarsky@mit.edu> |
Tue, 20 Nov 2012 11:36:06 -0500 | |
changeset 113791 | eaa549c9bce79317349e75a3b9e15a64e39162ef |
parent 113790 | 910b2560ac1107b8bbc5ca4a59ab859111a95271 |
child 113792 | 800bbc1295785b8f455d26b47c40e7eab6b0b34d |
push id | 23890 |
push user | ryanvm@gmail.com |
push date | Wed, 21 Nov 2012 02:43:32 +0000 |
treeherder | mozilla-central@4f19e7fd8bea [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mccr8 |
bugs | 813419 |
milestone | 20.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
dom/bindings/BindingUtils.h | file | annotate | diff | comparison | revisions | |
js/xpconnect/src/xpcpublic.h | file | annotate | diff | comparison | revisions |
--- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -473,20 +473,23 @@ public: // Create a JSObject wrapping "value", for cases when "value" is a // non-wrapper-cached object using WebIDL bindings. "value" must implement a // WrapObject() method taking a JSContext and a scope. template <class T> inline bool WrapNewBindingObject(JSContext* cx, JSObject* scope, T* value, JS::Value* vp) { - JSObject* obj = value->GetWrapper(); - if (obj && js::GetObjectCompartment(obj) == js::GetObjectCompartment(scope)) { - *vp = JS::ObjectValue(*obj); - return true; + JSObject* obj = value->GetWrapperPreserveColor(); + if (obj) { + xpc_UnmarkNonNullGrayObject(obj); + if (js::GetObjectCompartment(obj) == js::GetObjectCompartment(scope)) { + *vp = JS::ObjectValue(*obj); + return true; + } } if (!obj) { bool triedToWrap; obj = value->WrapObject(cx, scope, &triedToWrap); if (!obj) { // At this point, obj is null, so just return false. We could // try to communicate triedToWrap to the caller, but in practice
--- a/js/xpconnect/src/xpcpublic.h +++ b/js/xpconnect/src/xpcpublic.h @@ -135,26 +135,33 @@ xpc_IsGrayGCThing(void *thing) // reachable from an XPConnect root. Implemented in nsXPConnect.cpp. extern JSBool xpc_GCThingIsGrayCCThing(void *thing); // Implemented in nsXPConnect.cpp. extern void xpc_UnmarkGrayGCThingRecursive(void *thing, JSGCTraceKind kind); +// Unmark gray for known-nonnull cases +MOZ_ALWAYS_INLINE void +xpc_UnmarkNonNullGrayObject(JSObject *obj) +{ + if (xpc_IsGrayGCThing(obj)) + xpc_UnmarkGrayGCThingRecursive(obj, JSTRACE_OBJECT); + else if (JS::IsIncrementalBarrierNeededOnGCThing(obj)) + js::IncrementalReferenceBarrier(obj); +} + // Remove the gray color from the given JSObject and any other objects that can // be reached through it. -inline JSObject * +MOZ_ALWAYS_INLINE JSObject * xpc_UnmarkGrayObject(JSObject *obj) { if (obj) { - if (xpc_IsGrayGCThing(obj)) - xpc_UnmarkGrayGCThingRecursive(obj, JSTRACE_OBJECT); - else if (JS::IsIncrementalBarrierNeededOnGCThing(obj)) - js::IncrementalReferenceBarrier(obj); + xpc_UnmarkNonNullGrayObject(obj); } return obj; } inline JSScript * xpc_UnmarkGrayScript(JSScript *script) { if (script) {