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 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1592 | 1592 |
1593 SIMD128_BOOLEAN_LANE_FNS(Bool32x4, int32_t, 4, INT32, kInt32Size) | 1593 SIMD128_BOOLEAN_LANE_FNS(Bool32x4, int32_t, 4, INT32, kInt32Size) |
1594 SIMD128_BOOLEAN_LANE_FNS(Bool16x8, int16_t, 8, INT16, kShortSize) | 1594 SIMD128_BOOLEAN_LANE_FNS(Bool16x8, int16_t, 8, INT16, kShortSize) |
1595 SIMD128_BOOLEAN_LANE_FNS(Bool8x16, int8_t, 16, INT8, kCharSize) | 1595 SIMD128_BOOLEAN_LANE_FNS(Bool8x16, int8_t, 16, INT8, kCharSize) |
1596 #undef SIMD128_BOOLEAN_LANE_FNS | 1596 #undef SIMD128_BOOLEAN_LANE_FNS |
1597 | 1597 |
1598 #undef SIMD128_READ_LANE | 1598 #undef SIMD128_READ_LANE |
1599 #undef SIMD128_WRITE_LANE | 1599 #undef SIMD128_WRITE_LANE |
1600 | 1600 |
1601 | 1601 |
1602 ACCESSORS(JSObject, properties, FixedArray, kPropertiesOffset) | 1602 ACCESSORS(JSReceiver, properties, FixedArray, kPropertiesOffset) |
1603 | 1603 |
1604 | 1604 |
1605 Object** FixedArray::GetFirstElementAddress() { | 1605 Object** FixedArray::GetFirstElementAddress() { |
1606 return reinterpret_cast<Object**>(FIELD_ADDR(this, OffsetOfElementAt(0))); | 1606 return reinterpret_cast<Object**>(FIELD_ADDR(this, OffsetOfElementAt(0))); |
1607 } | 1607 } |
1608 | 1608 |
1609 | 1609 |
1610 bool FixedArray::ContainsOnlySmisOrHoles() { | 1610 bool FixedArray::ContainsOnlySmisOrHoles() { |
1611 Object* the_hole = GetHeap()->the_hole_value(); | 1611 Object* the_hole = GetHeap()->the_hole_value(); |
1612 Object** current = GetFirstElementAddress(); | 1612 Object** current = GetFirstElementAddress(); |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1962 object->set_elements(*value); | 1962 object->set_elements(*value); |
1963 } | 1963 } |
1964 | 1964 |
1965 | 1965 |
1966 void JSObject::set_elements(FixedArrayBase* value, WriteBarrierMode mode) { | 1966 void JSObject::set_elements(FixedArrayBase* value, WriteBarrierMode mode) { |
1967 WRITE_FIELD(this, kElementsOffset, value); | 1967 WRITE_FIELD(this, kElementsOffset, value); |
1968 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kElementsOffset, value, mode); | 1968 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kElementsOffset, value, mode); |
1969 } | 1969 } |
1970 | 1970 |
1971 | 1971 |
1972 void JSObject::initialize_properties() { | |
1973 DCHECK(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array())); | |
1974 WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array()); | |
1975 } | |
1976 | |
1977 | |
1978 void JSObject::initialize_elements() { | 1972 void JSObject::initialize_elements() { |
1979 FixedArrayBase* elements = map()->GetInitialElements(); | 1973 FixedArrayBase* elements = map()->GetInitialElements(); |
1980 WRITE_FIELD(this, kElementsOffset, elements); | 1974 WRITE_FIELD(this, kElementsOffset, elements); |
1981 } | 1975 } |
1982 | 1976 |
1983 | 1977 |
1984 InterceptorInfo* JSObject::GetIndexedInterceptor() { | 1978 InterceptorInfo* JSObject::GetIndexedInterceptor() { |
1985 DCHECK(map()->has_indexed_interceptor()); | 1979 DCHECK(map()->has_indexed_interceptor()); |
1986 JSFunction* constructor = JSFunction::cast(map()->GetConstructor()); | 1980 JSFunction* constructor = JSFunction::cast(map()->GetConstructor()); |
1987 DCHECK(constructor->shared()->IsApiFunction()); | 1981 DCHECK(constructor->shared()->IsApiFunction()); |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2308 offset += kPointerSize; | 2302 offset += kPointerSize; |
2309 } | 2303 } |
2310 } | 2304 } |
2311 while (offset < size) { | 2305 while (offset < size) { |
2312 WRITE_FIELD(this, offset, filler_value); | 2306 WRITE_FIELD(this, offset, filler_value); |
2313 offset += kPointerSize; | 2307 offset += kPointerSize; |
2314 } | 2308 } |
2315 } | 2309 } |
2316 | 2310 |
2317 | 2311 |
2318 bool JSObject::HasFastProperties() { | |
2319 DCHECK(properties()->IsDictionary() == map()->is_dictionary_map()); | |
2320 return !properties()->IsDictionary(); | |
2321 } | |
2322 | |
2323 | |
2324 bool Map::TooManyFastProperties(StoreFromKeyed store_mode) { | 2312 bool Map::TooManyFastProperties(StoreFromKeyed store_mode) { |
2325 if (unused_property_fields() != 0) return false; | 2313 if (unused_property_fields() != 0) return false; |
2326 if (is_prototype_map()) return false; | 2314 if (is_prototype_map()) return false; |
2327 int minimum = store_mode == CERTAINLY_NOT_STORE_FROM_KEYED ? 128 : 12; | 2315 int minimum = store_mode == CERTAINLY_NOT_STORE_FROM_KEYED ? 128 : 12; |
2328 int limit = Max(minimum, GetInObjectProperties()); | 2316 int limit = Max(minimum, GetInObjectProperties()); |
2329 int external = NumberOfFields() - GetInObjectProperties(); | 2317 int external = NumberOfFields() - GetInObjectProperties(); |
2330 return external > limit; | 2318 return external > limit; |
2331 } | 2319 } |
2332 | 2320 |
2333 | 2321 |
(...skipping 4423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6757 bool JSObject::HasNamedInterceptor() { | 6745 bool JSObject::HasNamedInterceptor() { |
6758 return map()->has_named_interceptor(); | 6746 return map()->has_named_interceptor(); |
6759 } | 6747 } |
6760 | 6748 |
6761 | 6749 |
6762 bool JSObject::HasIndexedInterceptor() { | 6750 bool JSObject::HasIndexedInterceptor() { |
6763 return map()->has_indexed_interceptor(); | 6751 return map()->has_indexed_interceptor(); |
6764 } | 6752 } |
6765 | 6753 |
6766 | 6754 |
6767 NameDictionary* JSObject::property_dictionary() { | |
6768 DCHECK(!HasFastProperties()); | |
6769 DCHECK(!IsJSGlobalObject()); | |
6770 return NameDictionary::cast(properties()); | |
6771 } | |
6772 | |
6773 | |
6774 GlobalDictionary* JSObject::global_dictionary() { | 6755 GlobalDictionary* JSObject::global_dictionary() { |
6775 DCHECK(!HasFastProperties()); | 6756 DCHECK(!HasFastProperties()); |
6776 DCHECK(IsJSGlobalObject()); | 6757 DCHECK(IsJSGlobalObject()); |
6777 return GlobalDictionary::cast(properties()); | 6758 return GlobalDictionary::cast(properties()); |
6778 } | 6759 } |
6779 | 6760 |
6780 | 6761 |
6781 SeededNumberDictionary* JSObject::element_dictionary() { | 6762 SeededNumberDictionary* JSObject::element_dictionary() { |
6782 DCHECK(HasDictionaryElements()); | 6763 DCHECK(HasDictionaryElements()); |
6783 return SeededNumberDictionary::cast(elements()); | 6764 return SeededNumberDictionary::cast(elements()); |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7077 MaybeHandle<Object> Object::GetPropertyOrElement(Handle<JSReceiver> holder, | 7058 MaybeHandle<Object> Object::GetPropertyOrElement(Handle<JSReceiver> holder, |
7078 Handle<Name> name, | 7059 Handle<Name> name, |
7079 Handle<Object> receiver, | 7060 Handle<Object> receiver, |
7080 LanguageMode language_mode) { | 7061 LanguageMode language_mode) { |
7081 LookupIterator it = LookupIterator::PropertyOrElement( | 7062 LookupIterator it = LookupIterator::PropertyOrElement( |
7082 name->GetIsolate(), receiver, name, holder); | 7063 name->GetIsolate(), receiver, name, holder); |
7083 return GetProperty(&it, language_mode); | 7064 return GetProperty(&it, language_mode); |
7084 } | 7065 } |
7085 | 7066 |
7086 | 7067 |
| 7068 void JSReceiver::initialize_properties() { |
| 7069 DCHECK(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array())); |
| 7070 WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array()); |
| 7071 } |
| 7072 |
| 7073 |
| 7074 bool JSReceiver::HasFastProperties() { |
| 7075 DCHECK(properties()->IsDictionary() == map()->is_dictionary_map()); |
| 7076 return !properties()->IsDictionary(); |
| 7077 } |
| 7078 |
| 7079 |
| 7080 NameDictionary* JSReceiver::property_dictionary() { |
| 7081 DCHECK(!HasFastProperties()); |
| 7082 DCHECK(!IsJSGlobalObject()); |
| 7083 return NameDictionary::cast(properties()); |
| 7084 } |
| 7085 |
| 7086 |
7087 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object, | 7087 Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object, |
7088 Handle<Name> name) { | 7088 Handle<Name> name) { |
7089 LookupIterator it = | 7089 LookupIterator it = |
7090 LookupIterator::PropertyOrElement(object->GetIsolate(), object, name); | 7090 LookupIterator::PropertyOrElement(object->GetIsolate(), object, name); |
7091 return HasProperty(&it); | 7091 return HasProperty(&it); |
7092 } | 7092 } |
7093 | 7093 |
7094 | 7094 |
7095 Maybe<bool> JSReceiver::HasOwnProperty(Handle<JSReceiver> object, | 7095 Maybe<bool> JSReceiver::HasOwnProperty(Handle<JSReceiver> object, |
7096 Handle<Name> name) { | 7096 Handle<Name> name) { |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7796 #undef WRITE_INT64_FIELD | 7796 #undef WRITE_INT64_FIELD |
7797 #undef READ_BYTE_FIELD | 7797 #undef READ_BYTE_FIELD |
7798 #undef WRITE_BYTE_FIELD | 7798 #undef WRITE_BYTE_FIELD |
7799 #undef NOBARRIER_READ_BYTE_FIELD | 7799 #undef NOBARRIER_READ_BYTE_FIELD |
7800 #undef NOBARRIER_WRITE_BYTE_FIELD | 7800 #undef NOBARRIER_WRITE_BYTE_FIELD |
7801 | 7801 |
7802 } // namespace internal | 7802 } // namespace internal |
7803 } // namespace v8 | 7803 } // namespace v8 |
7804 | 7804 |
7805 #endif // V8_OBJECTS_INL_H_ | 7805 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |