Example #1
0
JSCompartment::~JSCompartment()
{
    reportTelemetry();

    // Write the code coverage information in a file.
    JSRuntime* rt = runtimeFromActiveCooperatingThread();
    if (rt->lcovOutput().isEnabled())
        rt->lcovOutput().writeLCovResult(lcovOutput);

    js_delete(jitCompartment_);
    js_delete(scriptCountsMap);
    js_delete(scriptNameMap);
    js_delete(debugScriptMap);
    js_delete(debugEnvs);
    js_delete(objectMetadataTable);
    js_delete(lazyArrayBuffers);
    js_delete(nonSyntacticLexicalEnvironments_);
    js_free(enumerators);

#ifdef DEBUG
    // Avoid assertion destroying the unboxed layouts list if the embedding
    // leaked GC things.
    if (!rt->gc.shutdownCollectedEverything())
        unboxedLayouts.clear();
#endif

    runtime_->numCompartments--;
}