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

Side by Side Diff: src/runtime.cc

Issue 402423003: Expose the content of Sets and WeakSets through SetMirror. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.h ('k') | test/mjsunit/harmony/mirror-collections.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <limits> 6 #include <limits>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after
1791 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); 1791 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
1792 Handle<ObjectHashTable> table( 1792 Handle<ObjectHashTable> table(
1793 ObjectHashTable::cast(weak_collection->table())); 1793 ObjectHashTable::cast(weak_collection->table()));
1794 RUNTIME_ASSERT(table->IsKey(*key)); 1794 RUNTIME_ASSERT(table->IsKey(*key));
1795 Handle<ObjectHashTable> new_table = ObjectHashTable::Put(table, key, value); 1795 Handle<ObjectHashTable> new_table = ObjectHashTable::Put(table, key, value);
1796 weak_collection->set_table(*new_table); 1796 weak_collection->set_table(*new_table);
1797 return *weak_collection; 1797 return *weak_collection;
1798 } 1798 }
1799 1799
1800 1800
1801 RUNTIME_FUNCTION(Runtime_GetWeakSetValues) {
1802 HandleScope scope(isolate);
1803 ASSERT(args.length() == 1);
1804 CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, holder, 0);
1805 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table()));
1806 Handle<FixedArray> values =
1807 isolate->factory()->NewFixedArray(table->NumberOfElements());
1808 {
1809 DisallowHeapAllocation no_gc;
1810 int number_of_non_hole_elements = 0;
1811 for (int i = 0; i < table->Capacity(); i++) {
1812 Handle<Object> key(table->KeyAt(i), isolate);
1813 if (table->IsKey(*key)) {
1814 values->set(number_of_non_hole_elements++, *key);
1815 }
1816 }
1817 ASSERT_EQ(table->NumberOfElements(), number_of_non_hole_elements);
1818 }
1819 return *isolate->factory()->NewJSArrayWithElements(values);
1820 }
1821
1822
1801 RUNTIME_FUNCTION(Runtime_ClassOf) { 1823 RUNTIME_FUNCTION(Runtime_ClassOf) {
1802 SealHandleScope shs(isolate); 1824 SealHandleScope shs(isolate);
1803 ASSERT(args.length() == 1); 1825 ASSERT(args.length() == 1);
1804 CONVERT_ARG_CHECKED(Object, obj, 0); 1826 CONVERT_ARG_CHECKED(Object, obj, 0);
1805 if (!obj->IsJSObject()) return isolate->heap()->null_value(); 1827 if (!obj->IsJSObject()) return isolate->heap()->null_value();
1806 return JSObject::cast(obj)->class_name(); 1828 return JSObject::cast(obj)->class_name();
1807 } 1829 }
1808 1830
1809 1831
1810 RUNTIME_FUNCTION(Runtime_GetPrototype) { 1832 RUNTIME_FUNCTION(Runtime_GetPrototype) {
(...skipping 13162 matching lines...) Expand 10 before | Expand all | Expand 10 after
14973 } 14995 }
14974 return NULL; 14996 return NULL;
14975 } 14997 }
14976 14998
14977 14999
14978 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15000 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
14979 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15001 return &(kIntrinsicFunctions[static_cast<int>(id)]);
14980 } 15002 }
14981 15003
14982 } } // namespace v8::internal 15004 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | test/mjsunit/harmony/mirror-collections.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698