Chromium Code Reviews| Index: src/runtime/runtime-collections.cc |
| diff --git a/src/runtime/runtime-collections.cc b/src/runtime/runtime-collections.cc |
| index 15c1fab76fdd3a22b59165840eb74e152152dee5..2f3de04106a94aafaa0807156767a0a95ceddc1d 100644 |
| --- a/src/runtime/runtime-collections.cc |
| +++ b/src/runtime/runtime-collections.cc |
| @@ -226,14 +226,9 @@ RUNTIME_FUNCTION(Runtime_MapIteratorDetails) { |
| return *isolate->factory()->NewJSArrayWithElements(details); |
| } |
| - |
| -RUNTIME_FUNCTION(Runtime_GetWeakMapEntries) { |
| - HandleScope scope(isolate); |
| - DCHECK_EQ(2, args.length()); |
| - CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, holder, 0); |
| - CONVERT_NUMBER_CHECKED(int, max_entries, Int32, args[1]); |
| - CHECK(max_entries >= 0); |
| - |
| +Handle<JSArray> Runtime::GetWeakMapEntries(Isolate* isolate, |
| + Handle<JSWeakCollection> holder, |
| + int max_entries) { |
| Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); |
| if (max_entries == 0 || max_entries > table->NumberOfElements()) { |
| max_entries = table->NumberOfElements(); |
| @@ -258,7 +253,16 @@ RUNTIME_FUNCTION(Runtime_GetWeakMapEntries) { |
| } |
| DCHECK_EQ(max_entries * 2, count); |
| } |
| - return *isolate->factory()->NewJSArrayWithElements(entries); |
| + return isolate->factory()->NewJSArrayWithElements(entries); |
| +} |
| + |
| +RUNTIME_FUNCTION(Runtime_GetWeakMapEntries) { |
|
Yang
2017/02/06 10:41:30
Can we move that to JSWeakMap?
jgruber
2017/02/06 12:40:39
+1
kozy
2017/02/06 18:39:26
Done.
|
| + HandleScope scope(isolate); |
| + DCHECK_EQ(2, args.length()); |
| + CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, holder, 0); |
| + CONVERT_NUMBER_CHECKED(int, max_entries, Int32, args[1]); |
| + CHECK(max_entries >= 0); |
| + return *Runtime::GetWeakMapEntries(isolate, holder, max_entries); |
| } |
| @@ -341,14 +345,9 @@ RUNTIME_FUNCTION(Runtime_WeakCollectionSet) { |
| return *weak_collection; |
| } |
| - |
| -RUNTIME_FUNCTION(Runtime_GetWeakSetValues) { |
| - HandleScope scope(isolate); |
| - DCHECK_EQ(2, args.length()); |
| - CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, holder, 0); |
| - CONVERT_NUMBER_CHECKED(int, max_values, Int32, args[1]); |
| - CHECK(max_values >= 0); |
| - |
| +Handle<JSArray> Runtime::GetWeakSetEntries(Isolate* isolate, |
|
Yang
2017/02/06 10:41:30
Can we move that to JSWeakSet?
kozy
2017/02/06 18:39:26
Done.
|
| + Handle<JSWeakCollection> holder, |
| + int max_values) { |
| Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table())); |
| if (max_values == 0 || max_values > table->NumberOfElements()) { |
| max_values = table->NumberOfElements(); |
| @@ -367,7 +366,16 @@ RUNTIME_FUNCTION(Runtime_GetWeakSetValues) { |
| } |
| DCHECK_EQ(max_values, count); |
| } |
| - return *isolate->factory()->NewJSArrayWithElements(values); |
| + return isolate->factory()->NewJSArrayWithElements(values); |
| +} |
| + |
| +RUNTIME_FUNCTION(Runtime_GetWeakSetValues) { |
| + HandleScope scope(isolate); |
| + DCHECK_EQ(2, args.length()); |
| + CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, holder, 0); |
| + CONVERT_NUMBER_CHECKED(int, max_values, Int32, args[1]); |
| + CHECK(max_values >= 0); |
| + return *Runtime::GetWeakSetEntries(isolate, holder, max_values); |
| } |
| } // namespace internal |
| } // namespace v8 |