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 // 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 Loading... |
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 DisallowHeapAllocation no_allocation; |
| 6981 array->set(0, CurrentKey()); |
| 6982 } |
| 6983 |
| 6984 |
| 6985 void JSMapIterator::PopulateValueArray(FixedArray* array) { |
| 6986 DisallowHeapAllocation no_allocation; |
| 6987 array->set(0, CurrentKey()); |
| 6988 array->set(1, CurrentValue()); |
| 6989 } |
| 6990 |
| 6991 |
| 6992 Object* JSMapIterator::CurrentValue() { |
| 6993 OrderedHashMap* table(OrderedHashMap::cast(this->table())); |
| 6994 int index = Smi::cast(this->index())->value(); |
| 6995 Object* value = table->ValueAt(index); |
| 6996 ASSERT(!value->IsTheHole()); |
| 6997 return value; |
| 6998 } |
| 6999 |
| 7000 |
6969 #undef TYPE_CHECKER | 7001 #undef TYPE_CHECKER |
6970 #undef CAST_ACCESSOR | 7002 #undef CAST_ACCESSOR |
6971 #undef INT_ACCESSORS | 7003 #undef INT_ACCESSORS |
6972 #undef ACCESSORS | 7004 #undef ACCESSORS |
6973 #undef ACCESSORS_TO_SMI | 7005 #undef ACCESSORS_TO_SMI |
6974 #undef SMI_ACCESSORS | 7006 #undef SMI_ACCESSORS |
6975 #undef SYNCHRONIZED_SMI_ACCESSORS | 7007 #undef SYNCHRONIZED_SMI_ACCESSORS |
6976 #undef NOBARRIER_SMI_ACCESSORS | 7008 #undef NOBARRIER_SMI_ACCESSORS |
6977 #undef BOOL_GETTER | 7009 #undef BOOL_GETTER |
6978 #undef BOOL_ACCESSORS | 7010 #undef BOOL_ACCESSORS |
(...skipping 16 matching lines...) Expand all Loading... |
6995 #undef READ_SHORT_FIELD | 7027 #undef READ_SHORT_FIELD |
6996 #undef WRITE_SHORT_FIELD | 7028 #undef WRITE_SHORT_FIELD |
6997 #undef READ_BYTE_FIELD | 7029 #undef READ_BYTE_FIELD |
6998 #undef WRITE_BYTE_FIELD | 7030 #undef WRITE_BYTE_FIELD |
6999 #undef NOBARRIER_READ_BYTE_FIELD | 7031 #undef NOBARRIER_READ_BYTE_FIELD |
7000 #undef NOBARRIER_WRITE_BYTE_FIELD | 7032 #undef NOBARRIER_WRITE_BYTE_FIELD |
7001 | 7033 |
7002 } } // namespace v8::internal | 7034 } } // namespace v8::internal |
7003 | 7035 |
7004 #endif // V8_OBJECTS_INL_H_ | 7036 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |