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

Side by Side Diff: src/objects-inl.h

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/objects.cc ('k') | src/runtime.h » ('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 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 6948 matching lines...) Expand 10 before | Expand all | Expand 10 after
6959 6959
6960 template<int start_offset> 6960 template<int start_offset>
6961 void FlexibleBodyDescriptor<start_offset>::IterateBody(HeapObject* obj, 6961 void FlexibleBodyDescriptor<start_offset>::IterateBody(HeapObject* obj,
6962 int object_size, 6962 int object_size,
6963 ObjectVisitor* v) { 6963 ObjectVisitor* v) {
6964 v->VisitPointers(HeapObject::RawField(obj, start_offset), 6964 v->VisitPointers(HeapObject::RawField(obj, start_offset),
6965 HeapObject::RawField(obj, object_size)); 6965 HeapObject::RawField(obj, object_size));
6966 } 6966 }
6967 6967
6968 6968
6969 template<class Derived, class TableType>
6970 Object* OrderedHashTableIterator<Derived, TableType>::CurrentKey() {
6971 TableType* table(TableType::cast(this->table()));
6972 int index = Smi::cast(this->index())->value();
6973 Object* key = table->KeyAt(index);
6974 ASSERT(!key->IsTheHole());
6975 return key;
6976 }
6977
6978
6979 void JSSetIterator::PopulateValueArray(FixedArray* array) {
6980 array->set(0, CurrentKey());
6981 }
6982
6983
6984 void JSMapIterator::PopulateValueArray(FixedArray* array) {
6985 array->set(0, CurrentKey());
6986 array->set(1, CurrentValue());
6987 }
6988
6989
6990 Object* JSMapIterator::CurrentValue() {
6991 OrderedHashMap* table(OrderedHashMap::cast(this->table()));
6992 int index = Smi::cast(this->index())->value();
6993 Object* value = table->ValueAt(index);
6994 ASSERT(!value->IsTheHole());
6995 return value;
6996 }
6997
6998
6969 #undef TYPE_CHECKER 6999 #undef TYPE_CHECKER
6970 #undef CAST_ACCESSOR 7000 #undef CAST_ACCESSOR
6971 #undef INT_ACCESSORS 7001 #undef INT_ACCESSORS
6972 #undef ACCESSORS 7002 #undef ACCESSORS
6973 #undef ACCESSORS_TO_SMI 7003 #undef ACCESSORS_TO_SMI
6974 #undef SMI_ACCESSORS 7004 #undef SMI_ACCESSORS
6975 #undef SYNCHRONIZED_SMI_ACCESSORS 7005 #undef SYNCHRONIZED_SMI_ACCESSORS
6976 #undef NOBARRIER_SMI_ACCESSORS 7006 #undef NOBARRIER_SMI_ACCESSORS
6977 #undef BOOL_GETTER 7007 #undef BOOL_GETTER
6978 #undef BOOL_ACCESSORS 7008 #undef BOOL_ACCESSORS
(...skipping 16 matching lines...) Expand all
6995 #undef READ_SHORT_FIELD 7025 #undef READ_SHORT_FIELD
6996 #undef WRITE_SHORT_FIELD 7026 #undef WRITE_SHORT_FIELD
6997 #undef READ_BYTE_FIELD 7027 #undef READ_BYTE_FIELD
6998 #undef WRITE_BYTE_FIELD 7028 #undef WRITE_BYTE_FIELD
6999 #undef NOBARRIER_READ_BYTE_FIELD 7029 #undef NOBARRIER_READ_BYTE_FIELD
7000 #undef NOBARRIER_WRITE_BYTE_FIELD 7030 #undef NOBARRIER_WRITE_BYTE_FIELD
7001 7031
7002 } } // namespace v8::internal 7032 } } // namespace v8::internal
7003 7033
7004 #endif // V8_OBJECTS_INL_H_ 7034 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698