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

Unified Diff: src/runtime.cc

Issue 236143002: ES6: Add support for Map.prototype.forEach and Set.prototype.forEach (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add test that calls gc() 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 4f340855e907380dc0fa7ceda43a18219fa13227..17c96214cad00aa4d722d237b5179fdb915ab37d 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -1551,6 +1551,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);
@@ -1560,6 +1571,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);
@@ -1606,6 +1648,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);
@@ -1628,6 +1681,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