Struct js::jsapi::TenuredHeap [] [src]

#[repr(C)]
pub struct TenuredHeap<T> { pub _base: HeapBase<T>, pub bits: usize, }

The TenuredHeap class is similar to the Heap class above in that it encapsulates the GC concerns of an on-heap reference to a JS object. However, it has two important differences:

1) Pointers which are statically known to only reference "tenured" objects can avoid the extra overhead of SpiderMonkey's write barriers.

2) Objects in the "tenured" heap have stronger alignment restrictions than those in the "nursery", so it is possible to store flags in the lower bits of pointers known to be tenured. TenuredHeap wraps a normal tagged pointer with a nice API for accessing the flag bits and adds various assertions to ensure that it is not mis-used.

GC things are said to be "tenured" when they are located in the long-lived heap: e.g. they have gained tenure as an object by surviving past at least one GC. For performance, SpiderMonkey allocates some things which are known to normally be long lived directly into the tenured generation; for example, global objects. Additionally, SpiderMonkey does not visit individual objects when deleting non-tenured objects, so object with finalizers are also always tenured; for instance, this includes most DOM objects.

The considerations to keep in mind when using a TenuredHeap vs a normal Heap are:

Fields

Trait Implementations

impl<T: Debug> Debug for TenuredHeap<T>
[src]

[src]

Formats the value using the given formatter.

impl<T: Copy> Copy for TenuredHeap<T>
[src]

impl<T: Clone> Clone for TenuredHeap<T>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more