Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(925)

Unified Diff: src/objects.h

Issue 1145183004: Debugger: use weak cells to implement ScriptCache. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/debug.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 4b7341ece9f02d2e7f1aa0886c2a67cfc47f1f1c..94c04c68eae9e739067e7c684a7ddd7b555c6a05 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -1012,6 +1012,7 @@ template <class C> inline bool Is(Object* obj);
V(WeakCell) \
V(ObjectHashTable) \
V(WeakHashTable) \
+ V(WeakValueHashTable) \
V(OrderedHashTable)
// Object is the abstract superclass for all classes in the
@@ -3958,7 +3959,7 @@ class ObjectHashTable: public HashTable<ObjectHashTable,
Handle<Object> key,
bool* was_present);
- private:
+ protected:
friend class MarkCompactCollector;
void AddEntry(int entry, Object* key, Object* value);
@@ -4185,6 +4186,8 @@ class WeakHashTable: public HashTable<WeakHashTable,
Handle<HeapObject> key,
Handle<HeapObject> value);
+ static Handle<FixedArray> GetValues(Handle<WeakHashTable> table);
+
private:
friend class MarkCompactCollector;
@@ -4197,6 +4200,26 @@ class WeakHashTable: public HashTable<WeakHashTable,
};
+class WeakValueHashTable : public ObjectHashTable {
+ public:
+ DECLARE_CAST(WeakValueHashTable)
+
+#ifdef DEBUG
+ // Looks up the value associated with the given key. The hole value is
+ // returned in case the key is not present.
+ Object* LookupWeak(Handle<Object> key);
+#endif // DEBUG
+
+ // Adds (or overwrites) the value associated with the given key. Mapping a
+ // key to the hole value causes removal of the whole entry.
+ MUST_USE_RESULT static Handle<WeakValueHashTable> PutWeak(
+ Handle<WeakValueHashTable> table, Handle<Object> key,
+ Handle<HeapObject> value);
+
+ static Handle<FixedArray> GetWeakValues(Handle<WeakValueHashTable> table);
+};
+
+
// JSFunctionResultCache caches results of some JSFunction invocation.
// It is a fixed array with fixed structure:
// [0]: factory function
@@ -4204,7 +4227,7 @@ class WeakHashTable: public HashTable<WeakHashTable,
// [2]: current cache size
// [3]: dummy field.
// The rest of array are key/value pairs.
-class JSFunctionResultCache: public FixedArray {
+class JSFunctionResultCache : public FixedArray {
public:
static const int kFactoryIndex = 0;
static const int kFingerIndex = kFactoryIndex + 1;
« no previous file with comments | « src/debug.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698