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

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

Issue 225183009: Use OrderedHashTables as the backing store of JSSet and JSMap (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 bool Object::IsMapCache() { 913 bool Object::IsMapCache() {
914 return IsHashTable(); 914 return IsHashTable();
915 } 915 }
916 916
917 917
918 bool Object::IsObjectHashTable() { 918 bool Object::IsObjectHashTable() {
919 return IsHashTable(); 919 return IsHashTable();
920 } 920 }
921 921
922 922
923 bool Object::IsOrderedHashTable() {
924 return IsHeapObject() &&
925 HeapObject::cast(this)->map() ==
926 HeapObject::cast(this)->GetHeap()->ordered_hash_table_map();
927 }
928
929
930 bool Object::IsOrderedHashSet() {
931 return IsOrderedHashTable();
932 }
933
934
935 bool Object::IsOrderedHashMap() {
936 return IsOrderedHashTable();
937 }
938
939
923 bool Object::IsPrimitive() { 940 bool Object::IsPrimitive() {
924 return IsOddball() || IsNumber() || IsString(); 941 return IsOddball() || IsNumber() || IsString();
925 } 942 }
926 943
927 944
928 bool Object::IsJSGlobalProxy() { 945 bool Object::IsJSGlobalProxy() {
929 bool result = IsHeapObject() && 946 bool result = IsHeapObject() &&
930 (HeapObject::cast(this)->map()->instance_type() == 947 (HeapObject::cast(this)->map()->instance_type() ==
931 JS_GLOBAL_PROXY_TYPE); 948 JS_GLOBAL_PROXY_TYPE);
932 ASSERT(!result || 949 ASSERT(!result ||
(...skipping 2023 matching lines...) Expand 10 before | Expand all | Expand 10 after
2956 CAST_ACCESSOR(ExternalUint8Array) 2973 CAST_ACCESSOR(ExternalUint8Array)
2957 CAST_ACCESSOR(ExternalInt16Array) 2974 CAST_ACCESSOR(ExternalInt16Array)
2958 CAST_ACCESSOR(ExternalUint16Array) 2975 CAST_ACCESSOR(ExternalUint16Array)
2959 CAST_ACCESSOR(ExternalInt32Array) 2976 CAST_ACCESSOR(ExternalInt32Array)
2960 CAST_ACCESSOR(ExternalUint32Array) 2977 CAST_ACCESSOR(ExternalUint32Array)
2961 CAST_ACCESSOR(ExternalFloat32Array) 2978 CAST_ACCESSOR(ExternalFloat32Array)
2962 CAST_ACCESSOR(ExternalFloat64Array) 2979 CAST_ACCESSOR(ExternalFloat64Array)
2963 CAST_ACCESSOR(ExternalUint8ClampedArray) 2980 CAST_ACCESSOR(ExternalUint8ClampedArray)
2964 CAST_ACCESSOR(Struct) 2981 CAST_ACCESSOR(Struct)
2965 CAST_ACCESSOR(AccessorInfo) 2982 CAST_ACCESSOR(AccessorInfo)
2983 CAST_ACCESSOR(OrderedHashMap)
2984 CAST_ACCESSOR(OrderedHashSet)
2966 2985
2967 template <class Traits> 2986 template <class Traits>
2968 FixedTypedArray<Traits>* FixedTypedArray<Traits>::cast(Object* object) { 2987 FixedTypedArray<Traits>* FixedTypedArray<Traits>::cast(Object* object) {
2969 SLOW_ASSERT(object->IsHeapObject() && 2988 SLOW_ASSERT(object->IsHeapObject() &&
2970 HeapObject::cast(object)->map()->instance_type() == 2989 HeapObject::cast(object)->map()->instance_type() ==
2971 Traits::kInstanceType); 2990 Traits::kInstanceType);
2972 return reinterpret_cast<FixedTypedArray<Traits>*>(object); 2991 return reinterpret_cast<FixedTypedArray<Traits>*>(object);
2973 } 2992 }
2974 2993
2975 2994
(...skipping 3605 matching lines...) Expand 10 before | Expand all | Expand 10 after
6581 return Name::cast(other)->Hash(); 6600 return Name::cast(other)->Hash();
6582 } 6601 }
6583 6602
6584 6603
6585 MaybeObject* NameDictionaryShape::AsObject(Heap* heap, Name* key) { 6604 MaybeObject* NameDictionaryShape::AsObject(Heap* heap, Name* key) {
6586 ASSERT(key->IsUniqueName()); 6605 ASSERT(key->IsUniqueName());
6587 return key; 6606 return key;
6588 } 6607 }
6589 6608
6590 6609
6591 template <int entrysize> 6610 bool ObjectHashTableShape::IsMatch(Object* key, Object* other) {
6592 bool ObjectHashTableShape<entrysize>::IsMatch(Object* key, Object* other) {
6593 return key->SameValue(other); 6611 return key->SameValue(other);
6594 } 6612 }
6595 6613
6596 6614
6597 template <int entrysize> 6615 uint32_t ObjectHashTableShape::Hash(Object* key) {
6598 uint32_t ObjectHashTableShape<entrysize>::Hash(Object* key) {
6599 return Smi::cast(key->GetHash())->value(); 6616 return Smi::cast(key->GetHash())->value();
6600 } 6617 }
6601 6618
6602 6619
6603 template <int entrysize> 6620 uint32_t ObjectHashTableShape::HashForObject(Object* key, Object* other) {
6604 uint32_t ObjectHashTableShape<entrysize>::HashForObject(Object* key,
6605 Object* other) {
6606 return Smi::cast(other->GetHash())->value(); 6621 return Smi::cast(other->GetHash())->value();
6607 } 6622 }
6608 6623
6609 6624
6610 template <int entrysize> 6625 MaybeObject* ObjectHashTableShape::AsObject(Heap* heap, Object* key) {
6611 MaybeObject* ObjectHashTableShape<entrysize>::AsObject(Heap* heap,
6612 Object* key) {
6613 return key; 6626 return key;
6614 } 6627 }
6615 6628
6616 6629
6617 template <int entrysize> 6630 template <int entrysize>
6618 bool WeakHashTableShape<entrysize>::IsMatch(Object* key, Object* other) { 6631 bool WeakHashTableShape<entrysize>::IsMatch(Object* key, Object* other) {
6619 return key->SameValue(other); 6632 return key->SameValue(other);
6620 } 6633 }
6621 6634
6622 6635
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
6924 #undef READ_UINT32_FIELD 6937 #undef READ_UINT32_FIELD
6925 #undef WRITE_UINT32_FIELD 6938 #undef WRITE_UINT32_FIELD
6926 #undef READ_SHORT_FIELD 6939 #undef READ_SHORT_FIELD
6927 #undef WRITE_SHORT_FIELD 6940 #undef WRITE_SHORT_FIELD
6928 #undef READ_BYTE_FIELD 6941 #undef READ_BYTE_FIELD
6929 #undef WRITE_BYTE_FIELD 6942 #undef WRITE_BYTE_FIELD
6930 6943
6931 } } // namespace v8::internal 6944 } } // namespace v8::internal
6932 6945
6933 #endif // V8_OBJECTS_INL_H_ 6946 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/objects.h ('K') | « src/objects-debug.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698