aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/js.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/bindings/js.rs')
-rw-r--r--components/script/dom/bindings/js.rs15
1 files changed, 13 insertions, 2 deletions
diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs
index 10b9a481382..56193b543ad 100644
--- a/components/script/dom/bindings/js.rs
+++ b/components/script/dom/bindings/js.rs
@@ -38,6 +38,7 @@ use script_thread::STACK_ROOTS;
use std::cell::UnsafeCell;
use std::default::Default;
use std::hash::{Hash, Hasher};
+use std::intrinsics::type_name;
use std::mem;
use std::ops::Deref;
use std::ptr;
@@ -106,7 +107,16 @@ impl<T: Reflectable> Deref for JS<T> {
impl<T: Reflectable> JSTraceable for JS<T> {
fn trace(&self, trc: *mut JSTracer) {
- trace_reflector(trc, "", unsafe { (**self.ptr).reflector() });
+ #[cfg(debug_assertions)]
+ let trace_str = format!("for {} on heap", unsafe { type_name::<T>() });
+ #[cfg(debug_assertions)]
+ let trace_info = &trace_str[..];
+ #[cfg(not(debug_assertions))]
+ let trace_info = "for DOM object on heap";
+
+ trace_reflector(trc,
+ trace_info,
+ unsafe { (**self.ptr).reflector() });
}
}
@@ -520,11 +530,12 @@ impl RootCollection {
/// SM Callback that traces the rooted reflectors
pub unsafe fn trace_roots(tracer: *mut JSTracer) {
+ debug!("tracing stack roots");
STACK_ROOTS.with(|ref collection| {
let RootCollectionPtr(collection) = collection.get().unwrap();
let collection = &*(*collection).roots.get();
for root in collection {
- trace_reflector(tracer, "reflector", &**root);
+ trace_reflector(tracer, "on stack", &**root);
}
});
}