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

Side by Side Diff: src/runtime.cc

Issue 399963002: Revert "Expose the content of Maps and WeakMaps through MapMirror." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 1688 matching lines...) Expand 10 before | Expand all | Expand 10 after
1699 || kind == JSMapIterator::kKindValues 1699 || kind == JSMapIterator::kKindValues
1700 || kind == JSMapIterator::kKindEntries); 1700 || kind == JSMapIterator::kKindEntries);
1701 Handle<OrderedHashMap> table(OrderedHashMap::cast(map->table())); 1701 Handle<OrderedHashMap> table(OrderedHashMap::cast(map->table()));
1702 holder->set_table(*table); 1702 holder->set_table(*table);
1703 holder->set_index(Smi::FromInt(0)); 1703 holder->set_index(Smi::FromInt(0));
1704 holder->set_kind(Smi::FromInt(kind)); 1704 holder->set_kind(Smi::FromInt(kind));
1705 return isolate->heap()->undefined_value(); 1705 return isolate->heap()->undefined_value();
1706 } 1706 }
1707 1707
1708 1708
1709 RUNTIME_FUNCTION(Runtime_GetWeakMapEntries) {
1710 HandleScope scope(isolate);
1711 ASSERT(args.length() == 1);
1712 CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, holder, 0);
1713 Handle<ObjectHashTable> table(ObjectHashTable::cast(holder->table()));
1714 Handle<FixedArray> entries =
1715 isolate->factory()->NewFixedArray(table->NumberOfElements() * 2);
1716 {
1717 DisallowHeapAllocation no_gc;
1718 int number_of_non_hole_elements = 0;
1719 for (int i = 0; i < table->Capacity(); i++) {
1720 Handle<Object> key(table->KeyAt(i), isolate);
1721 if (table->IsKey(*key)) {
1722 entries->set(number_of_non_hole_elements++, *key);
1723 entries->set(number_of_non_hole_elements++, table->Lookup(key));
1724 }
1725 }
1726 ASSERT_EQ(table->NumberOfElements() * 2, number_of_non_hole_elements);
1727 }
1728 return *isolate->factory()->NewJSArrayWithElements(entries);
1729 }
1730
1731
1732 RUNTIME_FUNCTION(Runtime_MapIteratorNext) { 1709 RUNTIME_FUNCTION(Runtime_MapIteratorNext) {
1733 SealHandleScope shs(isolate); 1710 SealHandleScope shs(isolate);
1734 ASSERT(args.length() == 2); 1711 ASSERT(args.length() == 2);
1735 CONVERT_ARG_CHECKED(JSMapIterator, holder, 0); 1712 CONVERT_ARG_CHECKED(JSMapIterator, holder, 0);
1736 CONVERT_ARG_CHECKED(JSArray, value_array, 1); 1713 CONVERT_ARG_CHECKED(JSArray, value_array, 1);
1737 return holder->Next(value_array); 1714 return holder->Next(value_array);
1738 } 1715 }
1739 1716
1740 1717
1741 static Handle<JSWeakCollection> WeakCollectionInitialize( 1718 static Handle<JSWeakCollection> WeakCollectionInitialize(
(...skipping 13242 matching lines...) Expand 10 before | Expand all | Expand 10 after
14984 } 14961 }
14985 return NULL; 14962 return NULL;
14986 } 14963 }
14987 14964
14988 14965
14989 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 14966 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
14990 return &(kIntrinsicFunctions[static_cast<int>(id)]); 14967 return &(kIntrinsicFunctions[static_cast<int>(id)]);
14991 } 14968 }
14992 14969
14993 } } // namespace v8::internal 14970 } } // 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