[gjs/mozjs78] Re-enable cache.
- From: Evan Welsh <ewlsh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/mozjs78] Re-enable cache.
- Date: Sun, 5 Jul 2020 23:59:49 +0000 (UTC)
commit fc0b65de463a51c1d7672bf445db9717cdf4ff1a
Author: Evan Welsh <noreply evanwelsh com>
Date: Sun Jul 5 18:57:23 2020 -0500
Re-enable cache.
gi/object.cpp | 18 +++++++++---------
gi/object.h | 5 ++---
2 files changed, 11 insertions(+), 12 deletions(-)
---
diff --git a/gi/object.cpp b/gi/object.cpp
index 2ee5b0b2..c1173fba 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -779,18 +779,18 @@ bool ObjectBase::id_is_never_lazy(jsid name, const GjsAtoms& atoms) {
bool ObjectPrototype::resolve_impl(JSContext* context, JS::HandleObject obj,
JS::HandleId id, const char* name,
bool* resolved) {
- // if (m_unresolvable_cache.has(id)) {
- // *resolved = false;
- // return true;
- // }
+ if (m_unresolvable_cache.has(id)) {
+ *resolved = false;
+ return true;
+ }
if (!uncached_resolve(context, obj, id, name, resolved))
return false;
- // if (!*resolved && !m_unresolvable_cache.putNew(id)) {
- // JS_ReportOutOfMemory(context);
- // return false;
- // }
+ if (!*resolved && !m_unresolvable_cache.putNew(id)) {
+ JS_ReportOutOfMemory(context);
+ return false;
+ }
return true;
}
@@ -1624,7 +1624,7 @@ void ObjectInstance::trace_impl(JSTracer* tracer) {
void ObjectPrototype::trace_impl(JSTracer* tracer) {
m_property_cache.trace(tracer);
m_field_cache.trace(tracer);
- // m_unresolvable_cache.trace(tracer);
+ m_unresolvable_cache.trace(tracer);
for (GClosure* closure : m_vfuncs)
gjs_closure_trace(closure, tracer);
}
diff --git a/gi/object.h b/gi/object.h
index ead00eb3..0f38f176 100644
--- a/gi/object.h
+++ b/gi/object.h
@@ -223,12 +223,11 @@ class ObjectPrototype
JS::GCHashMap<JS::Heap<JSString*>, GjsAutoInfo<GI_INFO_TYPE_FIELD>,
js::DefaultHasher<JSString*>, js::SystemAllocPolicy>;
using NegativeLookupCache =
- JS::GCHashSet<jsid, IdHasher, js::SystemAllocPolicy>;
+ JS::GCHashSet<JS::Heap<jsid>, IdHasher, js::SystemAllocPolicy>;
PropertyCache m_property_cache;
FieldCache m_field_cache;
- // FIXME(mozjs78): Crashes on GC
- // NegativeLookupCache m_unresolvable_cache;
+ NegativeLookupCache m_unresolvable_cache;
// a list of vfunc GClosures installed on this prototype, used when tracing
std::forward_list<GClosure*> m_vfuncs;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]