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

Unified Diff: src/runtime.cc

Issue 240323003: ES6: Add support for Map/Set forEach (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Explicit instantiate the functions instead Created 6 years, 8 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/runtime.h ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 9027676c5c8faeb7b8cd9c91968699f37ee6333e..d07ac426694fe252d1713ce49fcd6709ad20585d 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -1552,6 +1552,17 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetDelete) {
}
+RUNTIME_FUNCTION(MaybeObject*, Runtime_SetClear) {
+ HandleScope scope(isolate);
+ ASSERT(args.length() == 1);
+ CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0);
+ Handle<OrderedHashSet> table(OrderedHashSet::cast(holder->table()));
+ table = OrderedHashSet::Clear(table);
+ holder->set_table(*table);
+ return isolate->heap()->undefined_value();
+}
+
+
RUNTIME_FUNCTION(MaybeObject*, Runtime_SetGetSize) {
HandleScope scope(isolate);
ASSERT(args.length() == 1);
@@ -1561,6 +1572,37 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetGetSize) {
}
+RUNTIME_FUNCTION(MaybeObject*, Runtime_SetCreateIterator) {
+ HandleScope scope(isolate);
+ ASSERT(args.length() == 2);
+ CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0);
+ CONVERT_SMI_ARG_CHECKED(kind, 1)
+ ASSERT(kind == JSSetIterator::kKindValues
+ || kind == JSSetIterator::kKindEntries);
+ Handle<OrderedHashSet> table(OrderedHashSet::cast(holder->table()));
+ Handle<JSSetIterator> iterator = JSSetIterator::Create(table, kind);
+ return *iterator;
+}
+
+
+RUNTIME_FUNCTION(MaybeObject*, Runtime_SetIteratorNext) {
+ HandleScope scope(isolate);
+ ASSERT(args.length() == 1);
+ CONVERT_ARG_HANDLE_CHECKED(JSSetIterator, holder, 0);
+ Handle<JSObject> result = JSSetIterator::Next(holder);
+ return *result;
+}
+
+
+RUNTIME_FUNCTION(MaybeObject*, Runtime_SetIteratorClose) {
+ HandleScope scope(isolate);
+ ASSERT(args.length() == 1);
+ CONVERT_ARG_HANDLE_CHECKED(JSSetIterator, holder, 0);
+ holder->Close();
+ return isolate->heap()->undefined_value();
+}
+
+
RUNTIME_FUNCTION(MaybeObject*, Runtime_MapInitialize) {
HandleScope scope(isolate);
ASSERT(args.length() == 1);
@@ -1607,6 +1649,17 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_MapDelete) {
}
+RUNTIME_FUNCTION(MaybeObject*, Runtime_MapClear) {
+ HandleScope scope(isolate);
+ ASSERT(args.length() == 1);
+ CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0);
+ Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table()));
+ table = OrderedHashMap::Clear(table);
+ holder->set_table(*table);
+ return isolate->heap()->undefined_value();
+}
+
+
RUNTIME_FUNCTION(MaybeObject*, Runtime_MapSet) {
HandleScope scope(isolate);
ASSERT(args.length() == 3);
@@ -1629,6 +1682,38 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_MapGetSize) {
}
+RUNTIME_FUNCTION(MaybeObject*, Runtime_MapCreateIterator) {
+ HandleScope scope(isolate);
+ ASSERT(args.length() == 2);
+ CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0);
+ CONVERT_SMI_ARG_CHECKED(kind, 1)
+ ASSERT(kind == JSMapIterator::kKindKeys
+ || kind == JSMapIterator::kKindValues
+ || kind == JSMapIterator::kKindEntries);
+ Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table()));
+ Handle<JSMapIterator> iterator = JSMapIterator::Create(table, kind);
+ return *iterator;
+}
+
+
+RUNTIME_FUNCTION(MaybeObject*, Runtime_MapIteratorNext) {
+ HandleScope scope(isolate);
+ ASSERT(args.length() == 1);
+ CONVERT_ARG_HANDLE_CHECKED(JSMapIterator, holder, 0);
+ Handle<JSObject> result = JSMapIterator::Next(holder);
+ return *result;
+}
+
+
+RUNTIME_FUNCTION(MaybeObject*, Runtime_MapIteratorClose) {
+ HandleScope scope(isolate);
+ ASSERT(args.length() == 1);
+ CONVERT_ARG_HANDLE_CHECKED(JSMapIterator, holder, 0);
+ holder->Close();
+ return isolate->heap()->undefined_value();
+}
+
+
static JSWeakCollection* WeakCollectionInitialize(Isolate* isolate,
Handle<JSWeakCollection> weak_collection) {
ASSERT(weak_collection->map()->inobject_properties() == 0);
« no previous file with comments | « src/runtime.h ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698