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

Unified Diff: src/objects.h

Issue 7553012: Prototype of mark-and-compact support for Harmony weak maps. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 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
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 58b6f281b4b986ebd7ea6f7946830b0d90eadd42..9cbb8596aee6b40fbc61522ab01b7a852fc73d4e 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -2974,6 +2974,11 @@ class ObjectHashTable: public HashTable<ObjectHashTableShape, JSObject*> {
return reinterpret_cast<ObjectHashTable*>(obj);
}
+ // Returns the value at entry.
+ Object* ValueAt(int entry) {
+ return this->get(EntryToIndex(entry) + 1);
+ }
+
// Looks up the value associated with the given key. The undefined value is
// returned in case the key is not present.
Object* Lookup(JSObject* key);
@@ -2983,8 +2988,11 @@ class ObjectHashTable: public HashTable<ObjectHashTableShape, JSObject*> {
MUST_USE_RESULT MaybeObject* Put(JSObject* key, Object* value);
private:
+ friend class MarkCompactCollector;
+
void AddEntry(int entry, JSObject* key, Object* value);
- void RemoveEntry(int entry);
+ void RemoveEntry(int entry, Heap* heap);
+ inline void RemoveEntry(int entry);
};
@@ -6628,6 +6636,12 @@ class JSWeakMap: public JSObject {
// [table]: the backing hash table mapping keys to values.
DECL_ACCESSORS(table, ObjectHashTable)
+ // [next]: linked list of encountered weak maps during GC.
+ DECL_ACCESSORS(next, Object)
+
+ // Unchecked accessors to be used during GC.
+ inline ObjectHashTable* unchecked_table();
+
// Casting.
static inline JSWeakMap* cast(Object* obj);
@@ -6642,7 +6656,8 @@ class JSWeakMap: public JSObject {
#endif
static const int kTableOffset = JSObject::kHeaderSize;
- static const int kSize = kTableOffset + kPointerSize;
+ static const int kNextOffset = kTableOffset + kPointerSize;
+ static const int kSize = kNextOffset + kPointerSize;
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakMap);

Powered by Google App Engine
This is Rietveld 408576698