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

Side by Side Diff: src/runtime.cc

Issue 355663002: Optimize Map/Set.prototype.forEach (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Cleanup Created 6 years, 6 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/runtime-gen/mapiteratornext.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 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after
1597 kind == JSSetIterator::kKindEntries); 1597 kind == JSSetIterator::kKindEntries);
1598 Handle<OrderedHashSet> table(OrderedHashSet::cast(set->table())); 1598 Handle<OrderedHashSet> table(OrderedHashSet::cast(set->table()));
1599 holder->set_table(*table); 1599 holder->set_table(*table);
1600 holder->set_index(Smi::FromInt(0)); 1600 holder->set_index(Smi::FromInt(0));
1601 holder->set_kind(Smi::FromInt(kind)); 1601 holder->set_kind(Smi::FromInt(kind));
1602 return isolate->heap()->undefined_value(); 1602 return isolate->heap()->undefined_value();
1603 } 1603 }
1604 1604
1605 1605
1606 RUNTIME_FUNCTION(Runtime_SetIteratorNext) { 1606 RUNTIME_FUNCTION(Runtime_SetIteratorNext) {
1607 HandleScope scope(isolate); 1607 SealHandleScope shs(isolate);
1608 ASSERT(args.length() == 1); 1608 ASSERT(args.length() == 2);
1609 CONVERT_ARG_HANDLE_CHECKED(JSSetIterator, holder, 0); 1609 CONVERT_ARG_CHECKED(JSSetIterator, holder, 0);
1610 return *JSSetIterator::Next(holder); 1610 CONVERT_ARG_CHECKED(JSArray, value_array, 1);
1611 return holder->Next(value_array);
1611 } 1612 }
1612 1613
1613 1614
1614 RUNTIME_FUNCTION(Runtime_MapInitialize) { 1615 RUNTIME_FUNCTION(Runtime_MapInitialize) {
1615 HandleScope scope(isolate); 1616 HandleScope scope(isolate);
1616 ASSERT(args.length() == 1); 1617 ASSERT(args.length() == 1);
1617 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0); 1618 CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0);
1618 Handle<OrderedHashMap> table = isolate->factory()->NewOrderedHashMap(); 1619 Handle<OrderedHashMap> table = isolate->factory()->NewOrderedHashMap();
1619 holder->set_table(*table); 1620 holder->set_table(*table);
1620 return *holder; 1621 return *holder;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1701 || kind == JSMapIterator::kKindEntries); 1702 || kind == JSMapIterator::kKindEntries);
1702 Handle<OrderedHashMap> table(OrderedHashMap::cast(map->table())); 1703 Handle<OrderedHashMap> table(OrderedHashMap::cast(map->table()));
1703 holder->set_table(*table); 1704 holder->set_table(*table);
1704 holder->set_index(Smi::FromInt(0)); 1705 holder->set_index(Smi::FromInt(0));
1705 holder->set_kind(Smi::FromInt(kind)); 1706 holder->set_kind(Smi::FromInt(kind));
1706 return isolate->heap()->undefined_value(); 1707 return isolate->heap()->undefined_value();
1707 } 1708 }
1708 1709
1709 1710
1710 RUNTIME_FUNCTION(Runtime_MapIteratorNext) { 1711 RUNTIME_FUNCTION(Runtime_MapIteratorNext) {
1711 HandleScope scope(isolate); 1712 SealHandleScope shs(isolate);
1712 ASSERT(args.length() == 1); 1713 ASSERT(args.length() == 2);
1713 CONVERT_ARG_HANDLE_CHECKED(JSMapIterator, holder, 0); 1714 CONVERT_ARG_CHECKED(JSMapIterator, holder, 0);
1714 return *JSMapIterator::Next(holder); 1715 CONVERT_ARG_CHECKED(JSArray, value_array, 1);
1716 return holder->Next(value_array);
1715 } 1717 }
1716 1718
1717 1719
1718 static Handle<JSWeakCollection> WeakCollectionInitialize( 1720 static Handle<JSWeakCollection> WeakCollectionInitialize(
1719 Isolate* isolate, 1721 Isolate* isolate,
1720 Handle<JSWeakCollection> weak_collection) { 1722 Handle<JSWeakCollection> weak_collection) {
1721 ASSERT(weak_collection->map()->inobject_properties() == 0); 1723 ASSERT(weak_collection->map()->inobject_properties() == 0);
1722 Handle<ObjectHashTable> table = ObjectHashTable::New(isolate, 0); 1724 Handle<ObjectHashTable> table = ObjectHashTable::New(isolate, 0);
1723 weak_collection->set_table(*table); 1725 weak_collection->set_table(*table);
1724 return weak_collection; 1726 return weak_collection;
(...skipping 13396 matching lines...) Expand 10 before | Expand all | Expand 10 after
15121 } 15123 }
15122 return NULL; 15124 return NULL;
15123 } 15125 }
15124 15126
15125 15127
15126 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15128 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15127 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15129 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15128 } 15130 }
15129 15131
15130 } } // namespace v8::internal 15132 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | test/mjsunit/runtime-gen/mapiteratornext.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698