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 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 bool HeapObject::IsDependentCode() const { | 731 bool HeapObject::IsDependentCode() const { |
732 if (!IsFixedArray()) return false; | 732 if (!IsFixedArray()) return false; |
733 // There's actually no way to see the difference between a fixed array and | 733 // There's actually no way to see the difference between a fixed array and |
734 // a dependent codes array. | 734 // a dependent codes array. |
735 return true; | 735 return true; |
736 } | 736 } |
737 | 737 |
738 bool HeapObject::IsContext() const { | 738 bool HeapObject::IsContext() const { |
739 Map* map = this->map(); | 739 Map* map = this->map(); |
740 Heap* heap = GetHeap(); | 740 Heap* heap = GetHeap(); |
741 return (map == heap->function_context_map() || | 741 return ( |
742 map == heap->catch_context_map() || | 742 map == heap->function_context_map() || map == heap->catch_context_map() || |
743 map == heap->with_context_map() || | 743 map == heap->with_context_map() || map == heap->native_context_map() || |
744 map == heap->native_context_map() || | 744 map == heap->block_context_map() || map == heap->module_context_map() || |
745 map == heap->block_context_map() || | 745 map == heap->script_context_map() || |
746 map == heap->module_context_map() || | 746 map == heap->debug_evaluate_context_map()); |
747 map == heap->script_context_map()); | |
748 } | 747 } |
749 | 748 |
750 bool HeapObject::IsNativeContext() const { | 749 bool HeapObject::IsNativeContext() const { |
751 return map() == GetHeap()->native_context_map(); | 750 return map() == GetHeap()->native_context_map(); |
752 } | 751 } |
753 | 752 |
754 bool HeapObject::IsScriptContextTable() const { | 753 bool HeapObject::IsScriptContextTable() const { |
755 return map() == GetHeap()->script_context_table_map(); | 754 return map() == GetHeap()->script_context_table_map(); |
756 } | 755 } |
757 | 756 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 return IsDictionary(); | 837 return IsDictionary(); |
839 } | 838 } |
840 | 839 |
841 | 840 |
842 bool Object::IsUnseededNumberDictionary() const { | 841 bool Object::IsUnseededNumberDictionary() const { |
843 return IsDictionary(); | 842 return IsDictionary(); |
844 } | 843 } |
845 | 844 |
846 bool HeapObject::IsStringTable() const { return IsHashTable(); } | 845 bool HeapObject::IsStringTable() const { return IsHashTable(); } |
847 | 846 |
| 847 bool HeapObject::IsStringSet() const { return IsHashTable(); } |
| 848 |
848 bool HeapObject::IsNormalizedMapCache() const { | 849 bool HeapObject::IsNormalizedMapCache() const { |
849 return NormalizedMapCache::IsNormalizedMapCache(this); | 850 return NormalizedMapCache::IsNormalizedMapCache(this); |
850 } | 851 } |
851 | 852 |
852 | 853 |
853 int NormalizedMapCache::GetIndex(Handle<Map> map) { | 854 int NormalizedMapCache::GetIndex(Handle<Map> map) { |
854 return map->Hash() % NormalizedMapCache::kEntries; | 855 return map->Hash() % NormalizedMapCache::kEntries; |
855 } | 856 } |
856 | 857 |
857 bool NormalizedMapCache::IsNormalizedMapCache(const HeapObject* obj) { | 858 bool NormalizedMapCache::IsNormalizedMapCache(const HeapObject* obj) { |
(...skipping 2180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3038 // Empty entry. Uses raw unchecked accessors because it is called by the | 3039 // Empty entry. Uses raw unchecked accessors because it is called by the |
3039 // string table during bootstrapping. | 3040 // string table during bootstrapping. |
3040 if (element == isolate->heap()->root(Heap::kUndefinedValueRootIndex)) break; | 3041 if (element == isolate->heap()->root(Heap::kUndefinedValueRootIndex)) break; |
3041 if (element != isolate->heap()->root(Heap::kTheHoleValueRootIndex) && | 3042 if (element != isolate->heap()->root(Heap::kTheHoleValueRootIndex) && |
3042 Shape::IsMatch(key, element)) return entry; | 3043 Shape::IsMatch(key, element)) return entry; |
3043 entry = NextProbe(entry, count++, capacity); | 3044 entry = NextProbe(entry, count++, capacity); |
3044 } | 3045 } |
3045 return kNotFound; | 3046 return kNotFound; |
3046 } | 3047 } |
3047 | 3048 |
| 3049 bool StringSetShape::IsMatch(String* key, Object* value) { |
| 3050 return value->IsString() && key->Equals(String::cast(value)); |
| 3051 } |
| 3052 |
| 3053 uint32_t StringSetShape::Hash(String* key) { return key->Hash(); } |
| 3054 |
| 3055 uint32_t StringSetShape::HashForObject(String* key, Object* object) { |
| 3056 return object->IsString() ? String::cast(object)->Hash() : 0; |
| 3057 } |
3048 | 3058 |
3049 bool SeededNumberDictionary::requires_slow_elements() { | 3059 bool SeededNumberDictionary::requires_slow_elements() { |
3050 Object* max_index_object = get(kMaxNumberKeyIndex); | 3060 Object* max_index_object = get(kMaxNumberKeyIndex); |
3051 if (!max_index_object->IsSmi()) return false; | 3061 if (!max_index_object->IsSmi()) return false; |
3052 return 0 != | 3062 return 0 != |
3053 (Smi::cast(max_index_object)->value() & kRequiresSlowElementsMask); | 3063 (Smi::cast(max_index_object)->value() & kRequiresSlowElementsMask); |
3054 } | 3064 } |
3055 | 3065 |
3056 | 3066 |
3057 uint32_t SeededNumberDictionary::max_number_key() { | 3067 uint32_t SeededNumberDictionary::max_number_key() { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3141 CAST_ACCESSOR(ScopeInfo) | 3151 CAST_ACCESSOR(ScopeInfo) |
3142 CAST_ACCESSOR(SeededNumberDictionary) | 3152 CAST_ACCESSOR(SeededNumberDictionary) |
3143 CAST_ACCESSOR(SeqOneByteString) | 3153 CAST_ACCESSOR(SeqOneByteString) |
3144 CAST_ACCESSOR(SeqString) | 3154 CAST_ACCESSOR(SeqString) |
3145 CAST_ACCESSOR(SeqTwoByteString) | 3155 CAST_ACCESSOR(SeqTwoByteString) |
3146 CAST_ACCESSOR(SharedFunctionInfo) | 3156 CAST_ACCESSOR(SharedFunctionInfo) |
3147 CAST_ACCESSOR(Simd128Value) | 3157 CAST_ACCESSOR(Simd128Value) |
3148 CAST_ACCESSOR(SlicedString) | 3158 CAST_ACCESSOR(SlicedString) |
3149 CAST_ACCESSOR(Smi) | 3159 CAST_ACCESSOR(Smi) |
3150 CAST_ACCESSOR(String) | 3160 CAST_ACCESSOR(String) |
| 3161 CAST_ACCESSOR(StringSet) |
3151 CAST_ACCESSOR(StringTable) | 3162 CAST_ACCESSOR(StringTable) |
3152 CAST_ACCESSOR(Struct) | 3163 CAST_ACCESSOR(Struct) |
3153 CAST_ACCESSOR(Symbol) | 3164 CAST_ACCESSOR(Symbol) |
3154 CAST_ACCESSOR(Uint16x8) | 3165 CAST_ACCESSOR(Uint16x8) |
3155 CAST_ACCESSOR(Uint32x4) | 3166 CAST_ACCESSOR(Uint32x4) |
3156 CAST_ACCESSOR(Uint8x16) | 3167 CAST_ACCESSOR(Uint8x16) |
3157 CAST_ACCESSOR(UnseededNumberDictionary) | 3168 CAST_ACCESSOR(UnseededNumberDictionary) |
3158 CAST_ACCESSOR(WeakCell) | 3169 CAST_ACCESSOR(WeakCell) |
3159 CAST_ACCESSOR(WeakFixedArray) | 3170 CAST_ACCESSOR(WeakFixedArray) |
3160 CAST_ACCESSOR(WeakHashTable) | 3171 CAST_ACCESSOR(WeakHashTable) |
(...skipping 4663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7824 #undef WRITE_INT64_FIELD | 7835 #undef WRITE_INT64_FIELD |
7825 #undef READ_BYTE_FIELD | 7836 #undef READ_BYTE_FIELD |
7826 #undef WRITE_BYTE_FIELD | 7837 #undef WRITE_BYTE_FIELD |
7827 #undef NOBARRIER_READ_BYTE_FIELD | 7838 #undef NOBARRIER_READ_BYTE_FIELD |
7828 #undef NOBARRIER_WRITE_BYTE_FIELD | 7839 #undef NOBARRIER_WRITE_BYTE_FIELD |
7829 | 7840 |
7830 } // namespace internal | 7841 } // namespace internal |
7831 } // namespace v8 | 7842 } // namespace v8 |
7832 | 7843 |
7833 #endif // V8_OBJECTS_INL_H_ | 7844 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |