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

Unified Diff: include/v8.h

Issue 1157453002: Add basic API support for Map & Set (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 | « no previous file | src/api.h » ('j') | src/bootstrapper.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index f52f8b8cfc6b8725748de27ae5896924d222aa07..4e024bd58938b6801830ce11107070ccdea6bd35 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1808,37 +1808,31 @@ class V8_EXPORT Value : public Data {
/**
* Returns true if this value is a Map.
- * This is an experimental feature.
*/
bool IsMap() const;
/**
* Returns true if this value is a Set.
- * This is an experimental feature.
*/
bool IsSet() const;
/**
* Returns true if this value is a Map Iterator.
- * This is an experimental feature.
*/
bool IsMapIterator() const;
/**
* Returns true if this value is a Set Iterator.
- * This is an experimental feature.
*/
bool IsSetIterator() const;
/**
* Returns true if this value is a WeakMap.
- * This is an experimental feature.
*/
bool IsWeakMap() const;
/**
* Returns true if this value is a WeakSet.
- * This is an experimental feature.
*/
bool IsWeakSet() const;
@@ -2968,6 +2962,46 @@ class V8_EXPORT Array : public Object {
};
+/**
+ * An instance of the built-in Map constructor (ECMA-262, 6th Edition, 23.1.1).
+ */
+class V8_EXPORT Map : public Object {
+ public:
+ size_t Size() const;
+
+ /**
+ * Creates a new Map.
+ */
+ static Local<Map> New(Isolate* isolate);
+
+ V8_INLINE static Map* Cast(Value* obj);
+
+ private:
+ Map();
+ static void CheckCast(Value* obj);
+};
+
+
+/**
+ * An instance of the built-in Set constructor (ECMA-262, 6th Edition, 23.2.1).
+ */
+class V8_EXPORT Set : public Object {
+ public:
+ size_t Size() const;
+
+ /**
+ * Creates a new Set.
+ */
+ static Local<Set> New(Isolate* isolate);
+
+ V8_INLINE static Set* Cast(Value* obj);
+
+ private:
+ Set();
+ static void CheckCast(Value* obj);
+};
+
+
template<typename T>
class ReturnValue {
public:
@@ -7697,6 +7731,22 @@ Array* Array::Cast(v8::Value* value) {
}
+Map* Map::Cast(v8::Value* value) {
+#ifdef V8_ENABLE_CHECKS
+ CheckCast(value);
+#endif
+ return static_cast<Map*>(value);
+}
+
+
+Set* Set::Cast(v8::Value* value) {
+#ifdef V8_ENABLE_CHECKS
+ CheckCast(value);
+#endif
+ return static_cast<Set*>(value);
+}
+
+
Promise* Promise::Cast(v8::Value* value) {
#ifdef V8_ENABLE_CHECKS
CheckCast(value);
« no previous file with comments | « no previous file | src/api.h » ('j') | src/bootstrapper.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698