| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 } | 136 } |
| 137 break; | 137 break; |
| 138 } | 138 } |
| 139 } | 139 } |
| 140 return it->factory()->undefined_value(); | 140 return it->factory()->undefined_value(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 | 143 |
| 144 Handle<Object> JSObject::GetDataProperty(Handle<JSObject> object, | 144 Handle<Object> JSObject::GetDataProperty(Handle<JSObject> object, |
| 145 Handle<Name> key) { | 145 Handle<Name> key) { |
| 146 LookupIterator it(object, key, LookupIterator::CHECK_DERIVED_PROPERTY); | 146 LookupIterator it(object, key, LookupIterator::PROTOTYPE_CHAIN_PROPERTY); |
| 147 return GetDataProperty(&it); | 147 return GetDataProperty(&it); |
| 148 } | 148 } |
| 149 | 149 |
| 150 | 150 |
| 151 Handle<Object> JSObject::GetDataProperty(LookupIterator* it) { | 151 Handle<Object> JSObject::GetDataProperty(LookupIterator* it) { |
| 152 for (; it->IsFound(); it->Next()) { | 152 for (; it->IsFound(); it->Next()) { |
| 153 switch (it->state()) { | 153 switch (it->state()) { |
| 154 case LookupIterator::ACCESS_CHECK: | 154 case LookupIterator::ACCESS_CHECK: |
| 155 case LookupIterator::INTERCEPTOR: | 155 case LookupIterator::INTERCEPTOR: |
| 156 case LookupIterator::NOT_FOUND: | 156 case LookupIterator::NOT_FOUND: |
| (...skipping 3623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3780 box->set_value(value->Number()); | 3780 box->set_value(value->Number()); |
| 3781 } else { | 3781 } else { |
| 3782 FastPropertyAtPut(index, value); | 3782 FastPropertyAtPut(index, value); |
| 3783 } | 3783 } |
| 3784 } | 3784 } |
| 3785 | 3785 |
| 3786 | 3786 |
| 3787 void JSObject::AddProperty(Handle<JSObject> object, Handle<Name> name, | 3787 void JSObject::AddProperty(Handle<JSObject> object, Handle<Name> name, |
| 3788 Handle<Object> value, | 3788 Handle<Object> value, |
| 3789 PropertyAttributes attributes) { | 3789 PropertyAttributes attributes) { |
| 3790 LookupIterator it(object, name, LookupIterator::CHECK_PROPERTY); | 3790 LookupIterator it(object, name, LookupIterator::OWN_PROPERTY); |
| 3791 #ifdef DEBUG | 3791 #ifdef DEBUG |
| 3792 uint32_t index; | 3792 uint32_t index; |
| 3793 DCHECK(!object->IsJSProxy()); | 3793 DCHECK(!object->IsJSProxy()); |
| 3794 DCHECK(!name->AsArrayIndex(&index)); | 3794 DCHECK(!name->AsArrayIndex(&index)); |
| 3795 Maybe<PropertyAttributes> maybe = GetPropertyAttributes(&it); | 3795 Maybe<PropertyAttributes> maybe = GetPropertyAttributes(&it); |
| 3796 DCHECK(maybe.has_value); | 3796 DCHECK(maybe.has_value); |
| 3797 DCHECK(!it.IsFound()); | 3797 DCHECK(!it.IsFound()); |
| 3798 DCHECK(object->map()->is_extensible() || | 3798 DCHECK(object->map()->is_extensible() || |
| 3799 name.is_identical_to(it.isolate()->factory()->hidden_string())); | 3799 name.is_identical_to(it.isolate()->factory()->hidden_string())); |
| 3800 #endif | 3800 #endif |
| 3801 AddDataProperty(&it, value, attributes, STRICT, | 3801 AddDataProperty(&it, value, attributes, STRICT, |
| 3802 CERTAINLY_NOT_STORE_FROM_KEYED).Check(); | 3802 CERTAINLY_NOT_STORE_FROM_KEYED).Check(); |
| 3803 } | 3803 } |
| 3804 | 3804 |
| 3805 | 3805 |
| 3806 // Reconfigures a property to a data property with attributes, even if it is not | 3806 // Reconfigures a property to a data property with attributes, even if it is not |
| 3807 // reconfigurable. | 3807 // reconfigurable. |
| 3808 MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes( | 3808 MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes( |
| 3809 Handle<JSObject> object, | 3809 Handle<JSObject> object, |
| 3810 Handle<Name> name, | 3810 Handle<Name> name, |
| 3811 Handle<Object> value, | 3811 Handle<Object> value, |
| 3812 PropertyAttributes attributes, | 3812 PropertyAttributes attributes, |
| 3813 ExecutableAccessorInfoHandling handling) { | 3813 ExecutableAccessorInfoHandling handling) { |
| 3814 DCHECK(!value->IsTheHole()); | 3814 DCHECK(!value->IsTheHole()); |
| 3815 LookupIterator it(object, name, | 3815 LookupIterator it(object, name, LookupIterator::HIDDEN_SKIP_INTERCEPTOR); |
| 3816 LookupIterator::CHECK_HIDDEN_SKIP_INTERCEPTOR); | |
| 3817 bool is_observed = object->map()->is_observed() && | 3816 bool is_observed = object->map()->is_observed() && |
| 3818 *name != it.isolate()->heap()->hidden_string(); | 3817 *name != it.isolate()->heap()->hidden_string(); |
| 3819 for (; it.IsFound(); it.Next()) { | 3818 for (; it.IsFound(); it.Next()) { |
| 3820 switch (it.state()) { | 3819 switch (it.state()) { |
| 3821 case LookupIterator::INTERCEPTOR: | 3820 case LookupIterator::INTERCEPTOR: |
| 3822 case LookupIterator::JSPROXY: | 3821 case LookupIterator::JSPROXY: |
| 3823 case LookupIterator::NOT_FOUND: | 3822 case LookupIterator::NOT_FOUND: |
| 3824 case LookupIterator::TRANSITION: | 3823 case LookupIterator::TRANSITION: |
| 3825 UNREACHABLE(); | 3824 UNREACHABLE(); |
| 3826 | 3825 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3977 } | 3976 } |
| 3978 | 3977 |
| 3979 | 3978 |
| 3980 Maybe<PropertyAttributes> JSReceiver::GetOwnPropertyAttributes( | 3979 Maybe<PropertyAttributes> JSReceiver::GetOwnPropertyAttributes( |
| 3981 Handle<JSReceiver> object, Handle<Name> name) { | 3980 Handle<JSReceiver> object, Handle<Name> name) { |
| 3982 // Check whether the name is an array index. | 3981 // Check whether the name is an array index. |
| 3983 uint32_t index = 0; | 3982 uint32_t index = 0; |
| 3984 if (object->IsJSObject() && name->AsArrayIndex(&index)) { | 3983 if (object->IsJSObject() && name->AsArrayIndex(&index)) { |
| 3985 return GetOwnElementAttribute(object, index); | 3984 return GetOwnElementAttribute(object, index); |
| 3986 } | 3985 } |
| 3987 LookupIterator it(object, name, LookupIterator::CHECK_HIDDEN); | 3986 LookupIterator it(object, name, LookupIterator::HIDDEN); |
| 3988 return GetPropertyAttributes(&it); | 3987 return GetPropertyAttributes(&it); |
| 3989 } | 3988 } |
| 3990 | 3989 |
| 3991 | 3990 |
| 3992 Maybe<PropertyAttributes> JSReceiver::GetPropertyAttributes( | 3991 Maybe<PropertyAttributes> JSReceiver::GetPropertyAttributes( |
| 3993 LookupIterator* it) { | 3992 LookupIterator* it) { |
| 3994 for (; it->IsFound(); it->Next()) { | 3993 for (; it->IsFound(); it->Next()) { |
| 3995 switch (it->state()) { | 3994 switch (it->state()) { |
| 3996 case LookupIterator::NOT_FOUND: | 3995 case LookupIterator::NOT_FOUND: |
| 3997 case LookupIterator::TRANSITION: | 3996 case LookupIterator::TRANSITION: |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4685 if (inline_value->IsUndefined() || inline_value->IsSmi()) return; | 4684 if (inline_value->IsUndefined() || inline_value->IsSmi()) return; |
| 4686 | 4685 |
| 4687 Handle<ObjectHashTable> hashtable(ObjectHashTable::cast(inline_value)); | 4686 Handle<ObjectHashTable> hashtable(ObjectHashTable::cast(inline_value)); |
| 4688 bool was_present = false; | 4687 bool was_present = false; |
| 4689 ObjectHashTable::Remove(hashtable, key, &was_present); | 4688 ObjectHashTable::Remove(hashtable, key, &was_present); |
| 4690 } | 4689 } |
| 4691 | 4690 |
| 4692 | 4691 |
| 4693 bool JSObject::HasHiddenProperties(Handle<JSObject> object) { | 4692 bool JSObject::HasHiddenProperties(Handle<JSObject> object) { |
| 4694 Handle<Name> hidden = object->GetIsolate()->factory()->hidden_string(); | 4693 Handle<Name> hidden = object->GetIsolate()->factory()->hidden_string(); |
| 4695 LookupIterator it(object, hidden, LookupIterator::CHECK_PROPERTY); | 4694 LookupIterator it(object, hidden, LookupIterator::OWN_PROPERTY); |
| 4696 Maybe<PropertyAttributes> maybe = GetPropertyAttributes(&it); | 4695 Maybe<PropertyAttributes> maybe = GetPropertyAttributes(&it); |
| 4697 // Cannot get an exception since the hidden_string isn't accessible to JS. | 4696 // Cannot get an exception since the hidden_string isn't accessible to JS. |
| 4698 DCHECK(maybe.has_value); | 4697 DCHECK(maybe.has_value); |
| 4699 return maybe.value != ABSENT; | 4698 return maybe.value != ABSENT; |
| 4700 } | 4699 } |
| 4701 | 4700 |
| 4702 | 4701 |
| 4703 Object* JSObject::GetHiddenPropertiesHashTable() { | 4702 Object* JSObject::GetHiddenPropertiesHashTable() { |
| 4704 DCHECK(!IsJSGlobalProxy()); | 4703 DCHECK(!IsJSGlobalProxy()); |
| 4705 if (HasFastProperties()) { | 4704 if (HasFastProperties()) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 4720 return this->RawFastPropertyAt(index); | 4719 return this->RawFastPropertyAt(index); |
| 4721 } else { | 4720 } else { |
| 4722 return GetHeap()->undefined_value(); | 4721 return GetHeap()->undefined_value(); |
| 4723 } | 4722 } |
| 4724 } else { | 4723 } else { |
| 4725 return GetHeap()->undefined_value(); | 4724 return GetHeap()->undefined_value(); |
| 4726 } | 4725 } |
| 4727 } else { | 4726 } else { |
| 4728 Isolate* isolate = GetIsolate(); | 4727 Isolate* isolate = GetIsolate(); |
| 4729 LookupIterator it(handle(this), isolate->factory()->hidden_string(), | 4728 LookupIterator it(handle(this), isolate->factory()->hidden_string(), |
| 4730 LookupIterator::CHECK_PROPERTY); | 4729 LookupIterator::OWN_PROPERTY); |
| 4731 if (it.IsFound() && it.HasProperty()) { | 4730 if (it.IsFound() && it.HasProperty()) { |
| 4732 DCHECK_EQ(LookupIterator::DATA, it.property_kind()); | 4731 DCHECK_EQ(LookupIterator::DATA, it.property_kind()); |
| 4733 return *it.GetDataValue(); | 4732 return *it.GetDataValue(); |
| 4734 } | 4733 } |
| 4735 return GetHeap()->undefined_value(); | 4734 return GetHeap()->undefined_value(); |
| 4736 } | 4735 } |
| 4737 } | 4736 } |
| 4738 | 4737 |
| 4739 Handle<ObjectHashTable> JSObject::GetOrCreateHiddenPropertiesHashtable( | 4738 Handle<ObjectHashTable> JSObject::GetOrCreateHiddenPropertiesHashtable( |
| 4740 Handle<JSObject> object) { | 4739 Handle<JSObject> object) { |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4916 // ECMA-262, 3rd, 8.6.2.5 | 4915 // ECMA-262, 3rd, 8.6.2.5 |
| 4917 DCHECK(name->IsName()); | 4916 DCHECK(name->IsName()); |
| 4918 | 4917 |
| 4919 uint32_t index = 0; | 4918 uint32_t index = 0; |
| 4920 if (name->AsArrayIndex(&index)) { | 4919 if (name->AsArrayIndex(&index)) { |
| 4921 return DeleteElement(object, index, delete_mode); | 4920 return DeleteElement(object, index, delete_mode); |
| 4922 } | 4921 } |
| 4923 | 4922 |
| 4924 // Skip interceptors on FORCE_DELETION. | 4923 // Skip interceptors on FORCE_DELETION. |
| 4925 LookupIterator::Configuration config = | 4924 LookupIterator::Configuration config = |
| 4926 delete_mode == FORCE_DELETION | 4925 delete_mode == FORCE_DELETION ? LookupIterator::HIDDEN_SKIP_INTERCEPTOR |
| 4927 ? LookupIterator::CHECK_HIDDEN_SKIP_INTERCEPTOR | 4926 : LookupIterator::HIDDEN; |
| 4928 : LookupIterator::CHECK_HIDDEN; | |
| 4929 | 4927 |
| 4930 LookupIterator it(object, name, config); | 4928 LookupIterator it(object, name, config); |
| 4931 | 4929 |
| 4932 bool is_observed = object->map()->is_observed() && | 4930 bool is_observed = object->map()->is_observed() && |
| 4933 *name != it.isolate()->heap()->hidden_string(); | 4931 *name != it.isolate()->heap()->hidden_string(); |
| 4934 | 4932 |
| 4935 for (; it.IsFound(); it.Next()) { | 4933 for (; it.IsFound(); it.Next()) { |
| 4936 switch (it.state()) { | 4934 switch (it.state()) { |
| 4937 case LookupIterator::JSPROXY: | 4935 case LookupIterator::JSPROXY: |
| 4938 case LookupIterator::NOT_FOUND: | 4936 case LookupIterator::NOT_FOUND: |
| (...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6147 if (!maybe.has_value) { | 6145 if (!maybe.has_value) { |
| 6148 DCHECK(false); | 6146 DCHECK(false); |
| 6149 return isolate->factory()->undefined_value(); | 6147 return isolate->factory()->undefined_value(); |
| 6150 } | 6148 } |
| 6151 preexists = maybe.value; | 6149 preexists = maybe.value; |
| 6152 if (preexists && GetOwnElementAccessorPair(object, index).is_null()) { | 6150 if (preexists && GetOwnElementAccessorPair(object, index).is_null()) { |
| 6153 old_value = | 6151 old_value = |
| 6154 Object::GetElement(isolate, object, index).ToHandleChecked(); | 6152 Object::GetElement(isolate, object, index).ToHandleChecked(); |
| 6155 } | 6153 } |
| 6156 } else { | 6154 } else { |
| 6157 LookupIterator it(object, name, | 6155 LookupIterator it(object, name, LookupIterator::HIDDEN_SKIP_INTERCEPTOR); |
| 6158 LookupIterator::CHECK_HIDDEN_SKIP_INTERCEPTOR); | |
| 6159 CHECK(GetPropertyAttributes(&it).has_value); | 6156 CHECK(GetPropertyAttributes(&it).has_value); |
| 6160 preexists = it.IsFound(); | 6157 preexists = it.IsFound(); |
| 6161 if (preexists && (it.property_kind() == LookupIterator::DATA || | 6158 if (preexists && (it.property_kind() == LookupIterator::DATA || |
| 6162 it.GetAccessors()->IsAccessorInfo())) { | 6159 it.GetAccessors()->IsAccessorInfo())) { |
| 6163 old_value = GetProperty(&it).ToHandleChecked(); | 6160 old_value = GetProperty(&it).ToHandleChecked(); |
| 6164 } | 6161 } |
| 6165 } | 6162 } |
| 6166 } | 6163 } |
| 6167 | 6164 |
| 6168 if (is_element) { | 6165 if (is_element) { |
| 6169 DefineElementAccessor(object, index, getter, setter, attributes); | 6166 DefineElementAccessor(object, index, getter, setter, attributes); |
| 6170 } else { | 6167 } else { |
| 6171 DCHECK(getter->IsSpecFunction() || getter->IsUndefined() || | 6168 DCHECK(getter->IsSpecFunction() || getter->IsUndefined() || |
| 6172 getter->IsNull()); | 6169 getter->IsNull()); |
| 6173 DCHECK(setter->IsSpecFunction() || setter->IsUndefined() || | 6170 DCHECK(setter->IsSpecFunction() || setter->IsUndefined() || |
| 6174 setter->IsNull()); | 6171 setter->IsNull()); |
| 6175 // At least one of the accessors needs to be a new value. | 6172 // At least one of the accessors needs to be a new value. |
| 6176 DCHECK(!getter->IsNull() || !setter->IsNull()); | 6173 DCHECK(!getter->IsNull() || !setter->IsNull()); |
| 6177 LookupIterator it(object, name, LookupIterator::CHECK_PROPERTY); | 6174 LookupIterator it(object, name, LookupIterator::OWN_PROPERTY); |
| 6178 if (!getter->IsNull()) { | 6175 if (!getter->IsNull()) { |
| 6179 it.TransitionToAccessorProperty(ACCESSOR_GETTER, getter, attributes); | 6176 it.TransitionToAccessorProperty(ACCESSOR_GETTER, getter, attributes); |
| 6180 } | 6177 } |
| 6181 if (!setter->IsNull()) { | 6178 if (!setter->IsNull()) { |
| 6182 it.TransitionToAccessorProperty(ACCESSOR_SETTER, setter, attributes); | 6179 it.TransitionToAccessorProperty(ACCESSOR_SETTER, setter, attributes); |
| 6183 } | 6180 } |
| 6184 } | 6181 } |
| 6185 | 6182 |
| 6186 if (is_observed) { | 6183 if (is_observed) { |
| 6187 const char* type = preexists ? "reconfigure" : "add"; | 6184 const char* type = preexists ? "reconfigure" : "add"; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6250 case DICTIONARY_ELEMENTS: | 6247 case DICTIONARY_ELEMENTS: |
| 6251 break; | 6248 break; |
| 6252 case SLOPPY_ARGUMENTS_ELEMENTS: | 6249 case SLOPPY_ARGUMENTS_ELEMENTS: |
| 6253 UNIMPLEMENTED(); | 6250 UNIMPLEMENTED(); |
| 6254 break; | 6251 break; |
| 6255 } | 6252 } |
| 6256 | 6253 |
| 6257 SetElementCallback(object, index, info, info->property_attributes()); | 6254 SetElementCallback(object, index, info, info->property_attributes()); |
| 6258 } else { | 6255 } else { |
| 6259 // Lookup the name. | 6256 // Lookup the name. |
| 6260 LookupIterator it(object, name, | 6257 LookupIterator it(object, name, LookupIterator::HIDDEN_SKIP_INTERCEPTOR); |
| 6261 LookupIterator::CHECK_HIDDEN_SKIP_INTERCEPTOR); | |
| 6262 CHECK(GetPropertyAttributes(&it).has_value); | 6258 CHECK(GetPropertyAttributes(&it).has_value); |
| 6263 // ES5 forbids turning a property into an accessor if it's not | 6259 // ES5 forbids turning a property into an accessor if it's not |
| 6264 // configurable. See 8.6.1 (Table 5). | 6260 // configurable. See 8.6.1 (Table 5). |
| 6265 if (it.IsFound() && (it.IsReadOnly() || !it.IsConfigurable())) { | 6261 if (it.IsFound() && (it.IsReadOnly() || !it.IsConfigurable())) { |
| 6266 return factory->undefined_value(); | 6262 return factory->undefined_value(); |
| 6267 } | 6263 } |
| 6268 | 6264 |
| 6269 SetPropertyCallback(object, name, info, info->property_attributes()); | 6265 SetPropertyCallback(object, name, info, info->property_attributes()); |
| 6270 } | 6266 } |
| 6271 | 6267 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6309 if (dictionary->DetailsAt(entry).type() == CALLBACKS && | 6305 if (dictionary->DetailsAt(entry).type() == CALLBACKS && |
| 6310 element->IsAccessorPair()) { | 6306 element->IsAccessorPair()) { |
| 6311 return handle(AccessorPair::cast(element)->GetComponent(component), | 6307 return handle(AccessorPair::cast(element)->GetComponent(component), |
| 6312 isolate); | 6308 isolate); |
| 6313 } | 6309 } |
| 6314 } | 6310 } |
| 6315 } | 6311 } |
| 6316 } | 6312 } |
| 6317 } else { | 6313 } else { |
| 6318 LookupIterator it(object, name, | 6314 LookupIterator it(object, name, |
| 6319 LookupIterator::CHECK_DERIVED_SKIP_INTERCEPTOR); | 6315 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
| 6320 for (; it.IsFound(); it.Next()) { | 6316 for (; it.IsFound(); it.Next()) { |
| 6321 switch (it.state()) { | 6317 switch (it.state()) { |
| 6322 case LookupIterator::INTERCEPTOR: | 6318 case LookupIterator::INTERCEPTOR: |
| 6323 case LookupIterator::NOT_FOUND: | 6319 case LookupIterator::NOT_FOUND: |
| 6324 case LookupIterator::TRANSITION: | 6320 case LookupIterator::TRANSITION: |
| 6325 UNREACHABLE(); | 6321 UNREACHABLE(); |
| 6326 | 6322 |
| 6327 case LookupIterator::ACCESS_CHECK: | 6323 case LookupIterator::ACCESS_CHECK: |
| 6328 if (it.HasAccess(v8::ACCESS_HAS)) continue; | 6324 if (it.HasAccess(v8::ACCESS_HAS)) continue; |
| 6329 isolate->ReportFailedAccessCheck(it.GetHolder<JSObject>(), | 6325 isolate->ReportFailedAccessCheck(it.GetHolder<JSObject>(), |
| (...skipping 6522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12852 return lookup.IsReadOnly(); | 12848 return lookup.IsReadOnly(); |
| 12853 } | 12849 } |
| 12854 | 12850 |
| 12855 | 12851 |
| 12856 bool JSArray::WouldChangeReadOnlyLength(Handle<JSArray> array, | 12852 bool JSArray::WouldChangeReadOnlyLength(Handle<JSArray> array, |
| 12857 uint32_t index) { | 12853 uint32_t index) { |
| 12858 uint32_t length = 0; | 12854 uint32_t length = 0; |
| 12859 CHECK(array->length()->ToArrayIndex(&length)); | 12855 CHECK(array->length()->ToArrayIndex(&length)); |
| 12860 if (length <= index) { | 12856 if (length <= index) { |
| 12861 LookupIterator it(array, array->GetIsolate()->factory()->length_string(), | 12857 LookupIterator it(array, array->GetIsolate()->factory()->length_string(), |
| 12862 LookupIterator::CHECK_PROPERTY); | 12858 LookupIterator::OWN_PROPERTY); |
| 12863 CHECK(it.IsFound()); | 12859 CHECK(it.IsFound()); |
| 12864 CHECK(it.HasProperty()); | 12860 CHECK(it.HasProperty()); |
| 12865 return it.IsReadOnly(); | 12861 return it.IsReadOnly(); |
| 12866 } | 12862 } |
| 12867 return false; | 12863 return false; |
| 12868 } | 12864 } |
| 12869 | 12865 |
| 12870 | 12866 |
| 12871 MaybeHandle<Object> JSArray::ReadOnlyLengthError(Handle<JSArray> array) { | 12867 MaybeHandle<Object> JSArray::ReadOnlyLengthError(Handle<JSArray> array) { |
| 12872 Isolate* isolate = array->GetIsolate(); | 12868 Isolate* isolate = array->GetIsolate(); |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13239 CHECK(v8::Utils::OpenHandle(*result)->IsJSArray() || | 13235 CHECK(v8::Utils::OpenHandle(*result)->IsJSArray() || |
| 13240 v8::Utils::OpenHandle(*result)->HasSloppyArgumentsElements()); | 13236 v8::Utils::OpenHandle(*result)->HasSloppyArgumentsElements()); |
| 13241 #endif | 13237 #endif |
| 13242 // Rebox before returning. | 13238 // Rebox before returning. |
| 13243 return handle(*v8::Utils::OpenHandle(*result), isolate); | 13239 return handle(*v8::Utils::OpenHandle(*result), isolate); |
| 13244 } | 13240 } |
| 13245 | 13241 |
| 13246 | 13242 |
| 13247 Maybe<bool> JSObject::HasRealNamedProperty(Handle<JSObject> object, | 13243 Maybe<bool> JSObject::HasRealNamedProperty(Handle<JSObject> object, |
| 13248 Handle<Name> key) { | 13244 Handle<Name> key) { |
| 13249 LookupIterator it(object, key, LookupIterator::CHECK_ACCESS_CHECK); | 13245 LookupIterator it(object, key, LookupIterator::OWN_SKIP_INTERCEPTOR); |
| 13250 Maybe<PropertyAttributes> maybe_result = GetPropertyAttributes(&it); | 13246 Maybe<PropertyAttributes> maybe_result = GetPropertyAttributes(&it); |
| 13251 if (!maybe_result.has_value) return Maybe<bool>(); | 13247 if (!maybe_result.has_value) return Maybe<bool>(); |
| 13252 return maybe(it.IsFound()); | 13248 return maybe(it.IsFound()); |
| 13253 } | 13249 } |
| 13254 | 13250 |
| 13255 | 13251 |
| 13256 Maybe<bool> JSObject::HasRealElementProperty(Handle<JSObject> object, | 13252 Maybe<bool> JSObject::HasRealElementProperty(Handle<JSObject> object, |
| 13257 uint32_t index) { | 13253 uint32_t index) { |
| 13258 Isolate* isolate = object->GetIsolate(); | 13254 Isolate* isolate = object->GetIsolate(); |
| 13259 HandleScope scope(isolate); | 13255 HandleScope scope(isolate); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 13277 | 13273 |
| 13278 Maybe<PropertyAttributes> result = | 13274 Maybe<PropertyAttributes> result = |
| 13279 GetElementAttributeWithoutInterceptor(object, object, index, false); | 13275 GetElementAttributeWithoutInterceptor(object, object, index, false); |
| 13280 if (!result.has_value) return Maybe<bool>(); | 13276 if (!result.has_value) return Maybe<bool>(); |
| 13281 return maybe(result.value != ABSENT); | 13277 return maybe(result.value != ABSENT); |
| 13282 } | 13278 } |
| 13283 | 13279 |
| 13284 | 13280 |
| 13285 Maybe<bool> JSObject::HasRealNamedCallbackProperty(Handle<JSObject> object, | 13281 Maybe<bool> JSObject::HasRealNamedCallbackProperty(Handle<JSObject> object, |
| 13286 Handle<Name> key) { | 13282 Handle<Name> key) { |
| 13287 LookupIterator it(object, key, LookupIterator::CHECK_ACCESS_CHECK); | 13283 LookupIterator it(object, key, LookupIterator::OWN_SKIP_INTERCEPTOR); |
| 13288 Maybe<PropertyAttributes> maybe_result = GetPropertyAttributes(&it); | 13284 Maybe<PropertyAttributes> maybe_result = GetPropertyAttributes(&it); |
| 13289 if (!maybe_result.has_value) return Maybe<bool>(); | 13285 if (!maybe_result.has_value) return Maybe<bool>(); |
| 13290 return maybe(it.IsFound() && it.property_kind() == LookupIterator::ACCESSOR); | 13286 return maybe(it.IsFound() && it.property_kind() == LookupIterator::ACCESSOR); |
| 13291 } | 13287 } |
| 13292 | 13288 |
| 13293 | 13289 |
| 13294 int JSObject::NumberOfOwnProperties(PropertyAttributes filter) { | 13290 int JSObject::NumberOfOwnProperties(PropertyAttributes filter) { |
| 13295 if (HasFastProperties()) { | 13291 if (HasFastProperties()) { |
| 13296 Map* map = this->map(); | 13292 Map* map = this->map(); |
| 13297 if (filter == NONE) return map->NumberOfOwnDescriptors(); | 13293 if (filter == NONE) return map->NumberOfOwnDescriptors(); |
| (...skipping 3136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16434 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16430 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16435 static const char* error_messages_[] = { | 16431 static const char* error_messages_[] = { |
| 16436 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16432 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16437 }; | 16433 }; |
| 16438 #undef ERROR_MESSAGES_TEXTS | 16434 #undef ERROR_MESSAGES_TEXTS |
| 16439 return error_messages_[reason]; | 16435 return error_messages_[reason]; |
| 16440 } | 16436 } |
| 16441 | 16437 |
| 16442 | 16438 |
| 16443 } } // namespace v8::internal | 16439 } } // namespace v8::internal |
| OLD | NEW |