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

Unified Diff: src/objects.h

Issue 19678023: ES6: Implement WeakSet (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Reitveld is acting up Created 7 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
« no previous file with comments | « src/object-observe.js ('k') | src/objects.cc » ('j') | src/objects-printer.cc » ('J')
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 33b031bbc8b6829e3d4db624c4bbc50819261ab0..5c2dc8394bb3e658e1b33dfc9fafa2d4f24d561f 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -60,11 +60,13 @@
// - JSArray
// - JSArrayBuffer
// - JSArrayBufferView
-// - JSTypedArray
-// - JSDataView
+// - JSTypedArray
+// - JSDataView
// - JSSet
// - JSMap
-// - JSWeakMap
+// - JSWeakCollection
+// - JSWeakMap
+// - JSWeakSet
// - JSRegExp
// - JSFunction
// - JSGeneratorObject
@@ -415,6 +417,7 @@ const int kStubMinorKeyBits = kBitsPerInt - kSmiTagSize - kStubMajorKeyBits;
V(JS_DATA_VIEW_TYPE) \
V(JS_PROXY_TYPE) \
V(JS_WEAK_MAP_TYPE) \
+ V(JS_WEAK_SET_TYPE) \
V(JS_REGEXP_TYPE) \
\
V(JS_FUNCTION_TYPE) \
@@ -754,6 +757,7 @@ enum InstanceType {
JS_SET_TYPE,
JS_MAP_TYPE,
JS_WEAK_MAP_TYPE,
+ JS_WEAK_SET_TYPE,
JS_REGEXP_TYPE,
@@ -1003,7 +1007,9 @@ class MaybeObject BASE_EMBEDDED {
V(JSFunctionProxy) \
V(JSSet) \
V(JSMap) \
+ V(JSWeakCollection) \
V(JSWeakMap) \
+ V(JSWeakSet) \
V(JSRegExp) \
V(HashTable) \
V(Dictionary) \
@@ -8873,8 +8879,8 @@ class JSMap: public JSObject {
};
-// The JSWeakMap describes EcmaScript Harmony weak maps
-class JSWeakMap: public JSObject {
+// Base class for both JSWeakMap and JSWeakSet
+class JSWeakCollection: public JSObject {
public:
// [table]: the backing hash table mapping keys to values.
DECL_ACCESSORS(table, Object)
@@ -8882,6 +8888,18 @@ class JSWeakMap: public JSObject {
// [next]: linked list of encountered weak maps during GC.
DECL_ACCESSORS(next, Object)
+ static const int kTableOffset = JSObject::kHeaderSize;
+ static const int kNextOffset = kTableOffset + kPointerSize;
+ static const int kSize = kNextOffset + kPointerSize;
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakCollection);
+};
+
+
+// The JSWeakMap describes EcmaScript Harmony weak maps
+class JSWeakMap: public JSWeakCollection {
+ public:
// Casting.
static inline JSWeakMap* cast(Object* obj);
@@ -8889,15 +8907,26 @@ class JSWeakMap: public JSObject {
DECLARE_PRINTER(JSWeakMap)
DECLARE_VERIFIER(JSWeakMap)
- static const int kTableOffset = JSObject::kHeaderSize;
- static const int kNextOffset = kTableOffset + kPointerSize;
- static const int kSize = kNextOffset + kPointerSize;
-
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakMap);
};
+// The JSWeakSet describes EcmaScript Harmony weak sets
+class JSWeakSet: public JSWeakCollection {
+ public:
+ // Casting.
+ static inline JSWeakSet* cast(Object* obj);
+
+ // Dispatched behavior.
+ DECLARE_PRINTER(JSWeakSet)
+ DECLARE_VERIFIER(JSWeakSet)
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakSet);
+};
+
+
class JSArrayBuffer: public JSObject {
public:
// [backing_store]: backing memory for this array
« no previous file with comments | « src/object-observe.js ('k') | src/objects.cc » ('j') | src/objects-printer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698