mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
Backed out changeset a03e56efce4c (bug 1281156) for android failures in test_bug772796.html a=backout CLOSED TREE
This commit is contained in:
parent
8869fd86cf
commit
598c29ffbe
@ -108,7 +108,7 @@ template <typename Key,
|
||||
typename MapSweepPolicy = JS::DefaultMapSweepPolicy<Key, Value>>
|
||||
class GCRekeyableHashMap : public JS::GCHashMap<Key, Value, HashPolicy, AllocPolicy, MapSweepPolicy>
|
||||
{
|
||||
using Base = JS::GCHashMap<Key, Value, HashPolicy, AllocPolicy, MapSweepPolicy>;
|
||||
using Base = JS::GCHashMap<Key, Value, HashPolicy, AllocPolicy>;
|
||||
|
||||
public:
|
||||
explicit GCRekeyableHashMap(AllocPolicy a = AllocPolicy()) : Base(a) {}
|
||||
|
@ -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*
|
||||
|
@ -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<JSScript*>* key,
|
||||
TraceLoggerEventPayload** value)
|
||||
{
|
||||
return JS::GCPolicy<HeapPtr<JSScript*>>::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) {
|
||||
|
@ -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<JSScript*>* key, TraceLoggerEventPayload** value);
|
||||
};
|
||||
typedef HashMap<const void*,
|
||||
TraceLoggerEventPayload*,
|
||||
PointerHasher<const void*, 3>,
|
||||
SystemAllocPolicy> PointerHashMap;
|
||||
typedef GCHashMap<HeapPtr<JSScript*>,
|
||||
TraceLoggerEventPayload*,
|
||||
MovableCellHasher<HeapPtr<JSScript*>>,
|
||||
SystemAllocPolicy,
|
||||
WeakScriptMapSweepPolicy> ScriptHashMap;
|
||||
typedef JS::WeakCache<ScriptHashMap> WeakScriptHashMap;
|
||||
typedef HashMap<uint32_t,
|
||||
TraceLoggerEventPayload*,
|
||||
DefaultHasher<uint32_t>,
|
||||
@ -184,8 +173,6 @@ class TraceLoggerThread
|
||||
UniquePtr<TraceLoggerGraph> graph;
|
||||
|
||||
PointerHashMap pointerMap;
|
||||
mozilla::Maybe<WeakScriptHashMap> 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).
|
||||
|
Loading…
Reference in New Issue
Block a user