Skip to content

Instantly share code, notes, and snippets.

@syg
Created April 24, 2014 00:23
Show Gist options
  • Save syg/11237182 to your computer and use it in GitHub Desktop.
Save syg/11237182 to your computer and use it in GitHub Desktop.
From 0070aa00753d90eacaa551dac9c66066808f7c7a Mon Sep 17 00:00:00 2001
From: Shu-yu Guo <[email protected]>
Date: Wed, 23 Apr 2014 17:26:39 -0700
Subject: [PATCH] Clear TypeCompartment tables.
---
js/src/jscompartment.cpp | 1 +
js/src/jsinfer.cpp | 11 +++++++++++
js/src/jsinfer.h | 1 +
3 files changed, 13 insertions(+)
diff --git a/js/src/jscompartment.cpp b/js/src/jscompartment.cpp
index f6af72d..9a608b2 100644
--- a/js/src/jscompartment.cpp
+++ b/js/src/jscompartment.cpp
@@ -657,6 +657,7 @@ JSCompartment::clearTables()
JS_ASSERT(!gcWeakMapList);
JS_ASSERT(enumerators->next() == enumerators);
+ types.clearTables();
if (baseShapes.initialized())
baseShapes.clear();
if (initialShapes.initialized())
diff --git a/js/src/jsinfer.cpp b/js/src/jsinfer.cpp
index 518f1ac..5e16747 100644
--- a/js/src/jsinfer.cpp
+++ b/js/src/jsinfer.cpp
@@ -4147,6 +4147,17 @@ TypeObject::sweep(FreeOp *fop, bool *oom)
}
void
+TypeCompartment::clearTables()
+{
+ if (allocationSiteTable && allocationSiteTable->initialized())
+ allocationSiteTable->clear();
+ if (arrayTypeTable && arrayTypeTable->initialized())
+ arrayTypeTable->clear();
+ if (objectTypeTable && objectTypeTable->initialized())
+ objectTypeTable->clear();
+}
+
+void
TypeCompartment::sweep(FreeOp *fop)
{
/*
diff --git a/js/src/jsinfer.h b/js/src/jsinfer.h
index 6acb33c..359de9e 100644
--- a/js/src/jsinfer.h
+++ b/js/src/jsinfer.h
@@ -1549,6 +1549,7 @@ struct TypeCompartment
/* Mark any type set containing obj as having a generic object type. */
void markSetsUnknown(JSContext *cx, TypeObject *obj);
+ void clearTables();
void sweep(FreeOp *fop);
void finalizeObjects();
--
1.9.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment