OLD | NEW |
---|---|
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 Loading... | |
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_GetWeakSetEntries) { | |
arv (Not doing code reviews)
2014/07/22 15:15:10
-> GetWeakSetValues
Alexandra Mikhaylova
2014/07/22 16:01:18
Done, also renamed SetMirror.prototype.entries ->
| |
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> entries = | |
arv (Not doing code reviews)
2014/07/22 15:15:10
entries is misleading since you are not return an
Alexandra Mikhaylova
2014/07/22 16:01:18
Fixed.
| |
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 entries->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(entries); | |
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 Loading... | |
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 |
OLD | NEW |