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

Unified Diff: src/objects-inl.h

Issue 329253004: Optimize Map/Set.prototype.forEach (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add the runtime-gen files 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.cc ('k') | src/runtime.h » ('j') | src/runtime.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 2bca797d18a8bc5d33c839e842a0474a33530dbc..76fa3c0867da659e7b62b45f2ece9495e3bacf6c 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -6957,6 +6957,26 @@ void FlexibleBodyDescriptor<start_offset>::IterateBody(HeapObject* obj,
}
+template<class Derived, class TableType>
+Handle<Object> OrderedHashTableIterator<Derived, TableType>::CurrentKey(
+ Handle<Derived> iterator) {
+ TableType* table(TableType::cast(iterator->table()));
adamk 2014/06/16 20:37:46 The use of a raw pointer in a handlified function
arv (Not doing code reviews) 2014/06/16 21:57:21 Done.
+ int index = Smi::cast(iterator->index())->value();
+ Handle<Object> key(table->KeyAt(index), iterator->GetIsolate());
+ ASSERT(!key->IsTheHole());
+ return key;
+}
+
+
+Handle<Object> JSMapIterator::CurrentValue(Handle<JSMapIterator> iterator) {
adamk 2014/06/16 20:37:46 Same as above, but less scary. Seems like this cou
arv (Not doing code reviews) 2014/06/16 21:57:20 Done.
+ OrderedHashMap* table(OrderedHashMap::cast(iterator->table()));
+ int index = Smi::cast(iterator->index())->value();
+ Handle<Object> value(table->ValueAt(index), iterator->GetIsolate());
+ ASSERT(!value->IsTheHole());
+ return value;
+}
+
+
#undef TYPE_CHECKER
#undef CAST_ACCESSOR
#undef INT_ACCESSORS
« no previous file with comments | « src/objects.cc ('k') | src/runtime.h » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698