diff --git a/js/public/GCHashTable.h b/js/public/GCHashTable.h index d96a3c96f717..687128743e31 100644 --- a/js/public/GCHashTable.h +++ b/js/public/GCHashTable.h @@ -108,7 +108,7 @@ template > class GCRekeyableHashMap : public JS::GCHashMap { - using Base = JS::GCHashMap; + using Base = JS::GCHashMap; public: explicit GCRekeyableHashMap(AllocPolicy a = AllocPolicy()) : Base(a) {} diff --git a/js/src/jscntxtinlines.h b/js/src/jscntxtinlines.h index 98e3d299d753..a3eb1d61eac9 100644 --- a/js/src/jscntxtinlines.h +++ b/js/src/jscntxtinlines.h @@ -446,13 +446,6 @@ js::ExclusiveContext::setCompartment(JSCompartment* comp, compartment_ = comp; zone_ = comp ? comp->zone() : nullptr; arenas_ = zone_ ? &zone_->arenas : nullptr; - -#ifdef JS_TRACE_LOGGING - if (isJSContext()) { - TraceLoggerThread* logger = TraceLoggerForMainThread(runtime_); - logger->updateZone(zone_); - } -#endif } inline JSScript* diff --git a/js/src/vm/TraceLogging.cpp b/js/src/vm/TraceLogging.cpp index 2df167247861..1fb13c1b7a3f 100644 --- a/js/src/vm/TraceLogging.cpp +++ b/js/src/vm/TraceLogging.cpp @@ -111,16 +111,6 @@ js::DestroyTraceLoggerThreadState() } } -TraceLoggerThread::TraceLoggerThread() - : enabled_(0), - failed(false), - graph(), - currentZone_(nullptr), - nextTextId(TraceLogger_Last), - iteration_(0), - top(nullptr) -{ } - bool TraceLoggerThread::init() { @@ -140,28 +130,6 @@ TraceLoggerThread::init() return true; } -bool -TraceLoggerThread::WeakScriptMapSweepPolicy::needsSweep(HeapPtr* key, - TraceLoggerEventPayload** value) -{ - return JS::GCPolicy>::needsSweep(key); -} - -void -TraceLoggerThread::updateZone(Zone* zone) -{ - if (zone != currentZone_) { - currentZone_ = zone; - scriptMap.reset(); - - if (zone) { - scriptMap.emplace(zone, ScriptHashMap()); - if (!scriptMap->get().init()) - scriptMap.reset(); - } - } -} - void TraceLoggerThread::initGraph() { @@ -425,7 +393,7 @@ TraceLoggerThread::getOrCreateEventPayload(const char* text) TraceLoggerEventPayload* TraceLoggerThread::getOrCreateEventPayload(TraceLoggerTextId type, const char* filename, - size_t lineno, size_t colno, JSScript* script) + size_t lineno, size_t colno, const void* ptr) { MOZ_ASSERT(type == TraceLogger_Scripts || type == TraceLogger_AnnotateScripts || type == TraceLogger_InlinedScripts); @@ -439,9 +407,9 @@ TraceLoggerThread::getOrCreateEventPayload(TraceLoggerTextId type, const char* f if (!traceLoggerState->isTextIdEnabled(type)) return getOrCreateEventPayload(type); - ScriptHashMap::AddPtr p; - if (scriptMap.isSome() && script) { - p = scriptMap->get().lookupForAdd(script); + PointerHashMap::AddPtr p; + if (ptr) { + p = pointerMap.lookupForAdd(ptr); if (p) { MOZ_ASSERT(p->value()->textId() < nextTextId); // Sanity check. return p->value(); @@ -484,8 +452,8 @@ TraceLoggerThread::getOrCreateEventPayload(TraceLoggerTextId type, const char* f nextTextId++; - if (scriptMap.isSome() && script) { - if (!scriptMap->get().add(p, script, payload)) + if (ptr) { + if (!pointerMap.add(p, ptr, payload)) return nullptr; } @@ -496,7 +464,7 @@ TraceLoggerEventPayload* TraceLoggerThread::getOrCreateEventPayload(TraceLoggerTextId type, JSScript* script) { return getOrCreateEventPayload(type, script->filename(), script->lineno(), script->column(), - script); + nullptr); } TraceLoggerEventPayload* @@ -641,21 +609,6 @@ TraceLoggerThread::log(uint32_t id) e.removeFront(); } - // Remove the item in the scriptMap for which the payloads - // have no uses anymore - if (scriptMap.isSome()) { - for (ScriptHashMap::Enum e(scriptMap->get()); !e.empty(); e.popFront()) { - if (e.front().value()->uses() != 0) - continue; - - TextIdHashMap::Ptr p = textIdPayloads.lookup(e.front().value()->textId()); - MOZ_ASSERT(p); - textIdPayloads.remove(p); - - e.removeFront(); - } - } - // Free all payloads that have no uses anymore. for (TextIdHashMap::Enum e(textIdPayloads); !e.empty(); e.popFront()) { if (e.front().value()->uses() == 0) { diff --git a/js/src/vm/TraceLogging.h b/js/src/vm/TraceLogging.h index f9c21f2acb39..b16412c80d56 100644 --- a/js/src/vm/TraceLogging.h +++ b/js/src/vm/TraceLogging.h @@ -8,11 +8,9 @@ #define TraceLogging_h #include "mozilla/GuardObjects.h" -#include "mozilla/Maybe.h" #include "jsalloc.h" -#include "gc/Barrier.h" #include "js/HashTable.h" #include "js/TypeDecls.h" #include "js/Vector.h" @@ -160,19 +158,10 @@ class TraceLoggerThread { #ifdef JS_TRACE_LOGGING private: - struct WeakScriptMapSweepPolicy { - static bool needsSweep(HeapPtr* key, TraceLoggerEventPayload** value); - }; typedef HashMap, SystemAllocPolicy> PointerHashMap; - typedef GCHashMap, - TraceLoggerEventPayload*, - MovableCellHasher>, - SystemAllocPolicy, - WeakScriptMapSweepPolicy> ScriptHashMap; - typedef JS::WeakCache WeakScriptHashMap; typedef HashMap, @@ -184,8 +173,6 @@ class TraceLoggerThread UniquePtr graph; PointerHashMap pointerMap; - mozilla::Maybe scriptMap; - Zone* currentZone_; TextIdHashMap textIdPayloads; uint32_t nextTextId; @@ -204,10 +191,16 @@ class TraceLoggerThread public: AutoTraceLog* top; - TraceLoggerThread(); + TraceLoggerThread() + : enabled_(0), + failed(false), + graph(), + nextTextId(TraceLogger_Last), + iteration_(0), + top(nullptr) + { } bool init(); - void updateZone(Zone* zone); ~TraceLoggerThread(); bool init(uint32_t loggerId); @@ -281,7 +274,7 @@ class TraceLoggerThread const JS::ReadOnlyCompileOptions& script); private: TraceLoggerEventPayload* getOrCreateEventPayload(TraceLoggerTextId type, const char* filename, - size_t lineno, size_t colno, JSScript* script); + size_t lineno, size_t colno, const void* p); public: // Log an event (no start/stop, only the timestamp is recorded).