| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/objects.h" | 5 #include "src/objects.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <iomanip> | 8 #include <iomanip> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 | 10 |
| (...skipping 5209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5220 object->JSObjectVerify(); | 5220 object->JSObjectVerify(); |
| 5221 } | 5221 } |
| 5222 #endif | 5222 #endif |
| 5223 return true; | 5223 return true; |
| 5224 } | 5224 } |
| 5225 | 5225 |
| 5226 | 5226 |
| 5227 void JSObject::AddProperty(Handle<JSObject> object, Handle<Name> name, | 5227 void JSObject::AddProperty(Handle<JSObject> object, Handle<Name> name, |
| 5228 Handle<Object> value, | 5228 Handle<Object> value, |
| 5229 PropertyAttributes attributes) { | 5229 PropertyAttributes attributes) { |
| 5230 LookupIterator it(object, name, LookupIterator::OWN_SKIP_INTERCEPTOR); | 5230 LookupIterator it(object, name, object, LookupIterator::OWN_SKIP_INTERCEPTOR); |
| 5231 CHECK_NE(LookupIterator::ACCESS_CHECK, it.state()); | 5231 CHECK_NE(LookupIterator::ACCESS_CHECK, it.state()); |
| 5232 #ifdef DEBUG | 5232 #ifdef DEBUG |
| 5233 uint32_t index; | 5233 uint32_t index; |
| 5234 DCHECK(!object->IsJSProxy()); | 5234 DCHECK(!object->IsJSProxy()); |
| 5235 DCHECK(!name->AsArrayIndex(&index)); | 5235 DCHECK(!name->AsArrayIndex(&index)); |
| 5236 Maybe<PropertyAttributes> maybe = GetPropertyAttributes(&it); | 5236 Maybe<PropertyAttributes> maybe = GetPropertyAttributes(&it); |
| 5237 DCHECK(maybe.IsJust()); | 5237 DCHECK(maybe.IsJust()); |
| 5238 DCHECK(!it.IsFound()); | 5238 DCHECK(!it.IsFound()); |
| 5239 DCHECK(object->map()->is_extensible() || name->IsPrivate()); | 5239 DCHECK(object->map()->is_extensible() || name->IsPrivate()); |
| 5240 #endif | 5240 #endif |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5331 Nothing<bool>()); | 5331 Nothing<bool>()); |
| 5332 } | 5332 } |
| 5333 | 5333 |
| 5334 return Just(true); | 5334 return Just(true); |
| 5335 } | 5335 } |
| 5336 case LookupIterator::INTEGER_INDEXED_EXOTIC: | 5336 case LookupIterator::INTEGER_INDEXED_EXOTIC: |
| 5337 return RedefineIncompatibleProperty(it->isolate(), it->GetName(), value, | 5337 return RedefineIncompatibleProperty(it->isolate(), it->GetName(), value, |
| 5338 should_throw); | 5338 should_throw); |
| 5339 | 5339 |
| 5340 case LookupIterator::DATA: { | 5340 case LookupIterator::DATA: { |
| 5341 Handle<Object> old_value = it->factory()->the_hole_value(); | |
| 5342 // Regular property update if the attributes match. | 5341 // Regular property update if the attributes match. |
| 5343 if (it->property_attributes() == attributes) { | 5342 if (it->property_attributes() == attributes) { |
| 5344 return SetDataProperty(it, value); | 5343 return SetDataProperty(it, value); |
| 5345 } | 5344 } |
| 5346 | 5345 |
| 5347 // Special case: properties of typed arrays cannot be reconfigured to | 5346 // Special case: properties of typed arrays cannot be reconfigured to |
| 5348 // non-writable nor to non-enumerable. | 5347 // non-writable nor to non-enumerable. |
| 5349 if (it->IsElement() && object->HasFixedTypedArrayElements()) { | 5348 if (it->IsElement() && object->HasFixedTypedArrayElements()) { |
| 5350 return RedefineIncompatibleProperty(it->isolate(), it->GetName(), | 5349 return RedefineIncompatibleProperty(it->isolate(), it->GetName(), |
| 5351 value, should_throw); | 5350 value, should_throw); |
| 5352 } | 5351 } |
| 5353 | 5352 |
| 5354 // Reconfigure the data property if the attributes mismatch. | 5353 // Reconfigure the data property if the attributes mismatch. |
| 5354 Handle<Object> old_value = it->factory()->the_hole_value(); |
| 5355 if (is_observed) old_value = it->GetDataValue(); | 5355 if (is_observed) old_value = it->GetDataValue(); |
| 5356 | 5356 |
| 5357 it->ReconfigureDataProperty(value, attributes); | 5357 it->ReconfigureDataProperty(value, attributes); |
| 5358 | 5358 |
| 5359 if (is_observed) { | 5359 if (is_observed) { |
| 5360 if (old_value->SameValue(*value)) { | 5360 if (old_value->SameValue(*value)) { |
| 5361 old_value = it->factory()->the_hole_value(); | 5361 old_value = it->factory()->the_hole_value(); |
| 5362 } | 5362 } |
| 5363 RETURN_ON_EXCEPTION_VALUE( | 5363 RETURN_ON_EXCEPTION_VALUE( |
| 5364 it->isolate(), EnqueueChangeRecord(object, "reconfigure", | 5364 it->isolate(), EnqueueChangeRecord(object, "reconfigure", |
| 5365 it->GetName(), old_value), | 5365 it->GetName(), old_value), |
| 5366 Nothing<bool>()); | 5366 Nothing<bool>()); |
| 5367 } | 5367 } |
| 5368 return Just(true); | 5368 return Just(true); |
| 5369 } | 5369 } |
| 5370 } | 5370 } |
| 5371 } | 5371 } |
| 5372 | 5372 |
| 5373 return AddDataProperty(it, value, attributes, should_throw, | 5373 return AddDataProperty(it, value, attributes, should_throw, |
| 5374 CERTAINLY_NOT_STORE_FROM_KEYED); | 5374 CERTAINLY_NOT_STORE_FROM_KEYED); |
| 5375 } | 5375 } |
| 5376 | 5376 |
| 5377 MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes( | 5377 MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes( |
| 5378 Handle<JSObject> object, Handle<Name> name, Handle<Object> value, | 5378 Handle<JSObject> object, Handle<Name> name, Handle<Object> value, |
| 5379 PropertyAttributes attributes) { | 5379 PropertyAttributes attributes) { |
| 5380 DCHECK(!value->IsTheHole()); | 5380 DCHECK(!value->IsTheHole()); |
| 5381 LookupIterator it(object, name, LookupIterator::OWN); | 5381 LookupIterator it(object, name, object, LookupIterator::OWN); |
| 5382 return DefineOwnPropertyIgnoreAttributes(&it, value, attributes); | 5382 return DefineOwnPropertyIgnoreAttributes(&it, value, attributes); |
| 5383 } | 5383 } |
| 5384 | 5384 |
| 5385 MaybeHandle<Object> JSObject::SetOwnElementIgnoreAttributes( | 5385 MaybeHandle<Object> JSObject::SetOwnElementIgnoreAttributes( |
| 5386 Handle<JSObject> object, uint32_t index, Handle<Object> value, | 5386 Handle<JSObject> object, uint32_t index, Handle<Object> value, |
| 5387 PropertyAttributes attributes) { | 5387 PropertyAttributes attributes) { |
| 5388 Isolate* isolate = object->GetIsolate(); | 5388 Isolate* isolate = object->GetIsolate(); |
| 5389 LookupIterator it(isolate, object, index, LookupIterator::OWN); | 5389 LookupIterator it(isolate, object, index, object, LookupIterator::OWN); |
| 5390 return DefineOwnPropertyIgnoreAttributes(&it, value, attributes); | 5390 return DefineOwnPropertyIgnoreAttributes(&it, value, attributes); |
| 5391 } | 5391 } |
| 5392 | 5392 |
| 5393 MaybeHandle<Object> JSObject::DefinePropertyOrElementIgnoreAttributes( | 5393 MaybeHandle<Object> JSObject::DefinePropertyOrElementIgnoreAttributes( |
| 5394 Handle<JSObject> object, Handle<Name> name, Handle<Object> value, | 5394 Handle<JSObject> object, Handle<Name> name, Handle<Object> value, |
| 5395 PropertyAttributes attributes) { | 5395 PropertyAttributes attributes) { |
| 5396 Isolate* isolate = object->GetIsolate(); | 5396 Isolate* isolate = object->GetIsolate(); |
| 5397 LookupIterator it = LookupIterator::PropertyOrElement(isolate, object, name, | 5397 LookupIterator it = LookupIterator::PropertyOrElement( |
| 5398 LookupIterator::OWN); | 5398 isolate, object, name, object, LookupIterator::OWN); |
| 5399 return DefineOwnPropertyIgnoreAttributes(&it, value, attributes); | 5399 return DefineOwnPropertyIgnoreAttributes(&it, value, attributes); |
| 5400 } | 5400 } |
| 5401 | 5401 |
| 5402 | 5402 |
| 5403 Maybe<PropertyAttributes> JSObject::GetPropertyAttributesWithInterceptor( | 5403 Maybe<PropertyAttributes> JSObject::GetPropertyAttributesWithInterceptor( |
| 5404 LookupIterator* it) { | 5404 LookupIterator* it) { |
| 5405 Isolate* isolate = it->isolate(); | 5405 Isolate* isolate = it->isolate(); |
| 5406 // Make sure that the top context does not change when doing | 5406 // Make sure that the top context does not change when doing |
| 5407 // callbacks or interceptor calls. | 5407 // callbacks or interceptor calls. |
| 5408 AssertNoContextChange ncc(isolate); | 5408 AssertNoContextChange ncc(isolate); |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5870 } | 5870 } |
| 5871 | 5871 |
| 5872 // static | 5872 // static |
| 5873 Handle<Smi> JSObject::GetOrCreateIdentityHash(Handle<JSObject> object) { | 5873 Handle<Smi> JSObject::GetOrCreateIdentityHash(Handle<JSObject> object) { |
| 5874 if (object->IsJSGlobalProxy()) { | 5874 if (object->IsJSGlobalProxy()) { |
| 5875 return GetOrCreateIdentityHashHelper(Handle<JSGlobalProxy>::cast(object)); | 5875 return GetOrCreateIdentityHashHelper(Handle<JSGlobalProxy>::cast(object)); |
| 5876 } | 5876 } |
| 5877 Isolate* isolate = object->GetIsolate(); | 5877 Isolate* isolate = object->GetIsolate(); |
| 5878 | 5878 |
| 5879 Handle<Name> hash_code_symbol = isolate->factory()->hash_code_symbol(); | 5879 Handle<Name> hash_code_symbol = isolate->factory()->hash_code_symbol(); |
| 5880 LookupIterator it(object, hash_code_symbol, LookupIterator::OWN); | 5880 LookupIterator it(object, hash_code_symbol, object, LookupIterator::OWN); |
| 5881 if (it.IsFound()) { | 5881 if (it.IsFound()) { |
| 5882 DCHECK_EQ(LookupIterator::DATA, it.state()); | 5882 DCHECK_EQ(LookupIterator::DATA, it.state()); |
| 5883 Handle<Object> maybe_hash = it.GetDataValue(); | 5883 Handle<Object> maybe_hash = it.GetDataValue(); |
| 5884 if (maybe_hash->IsSmi()) return Handle<Smi>::cast(maybe_hash); | 5884 if (maybe_hash->IsSmi()) return Handle<Smi>::cast(maybe_hash); |
| 5885 } | 5885 } |
| 5886 | 5886 |
| 5887 Handle<Smi> hash(GenerateIdentityHash(isolate), isolate); | 5887 Handle<Smi> hash(GenerateIdentityHash(isolate), isolate); |
| 5888 CHECK(AddDataProperty(&it, hash, NONE, THROW_ON_ERROR, | 5888 CHECK(AddDataProperty(&it, hash, NONE, THROW_ON_ERROR, |
| 5889 CERTAINLY_NOT_STORE_FROM_KEYED) | 5889 CERTAINLY_NOT_STORE_FROM_KEYED) |
| 5890 .IsJust()); | 5890 .IsJust()); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5979 | 5979 |
| 5980 Handle<ObjectHashTable> hashtable(ObjectHashTable::cast(inline_value)); | 5980 Handle<ObjectHashTable> hashtable(ObjectHashTable::cast(inline_value)); |
| 5981 bool was_present = false; | 5981 bool was_present = false; |
| 5982 ObjectHashTable::Remove(hashtable, key, &was_present); | 5982 ObjectHashTable::Remove(hashtable, key, &was_present); |
| 5983 } | 5983 } |
| 5984 | 5984 |
| 5985 | 5985 |
| 5986 bool JSObject::HasHiddenProperties(Handle<JSObject> object) { | 5986 bool JSObject::HasHiddenProperties(Handle<JSObject> object) { |
| 5987 Isolate* isolate = object->GetIsolate(); | 5987 Isolate* isolate = object->GetIsolate(); |
| 5988 Handle<Symbol> hidden = isolate->factory()->hidden_properties_symbol(); | 5988 Handle<Symbol> hidden = isolate->factory()->hidden_properties_symbol(); |
| 5989 LookupIterator it(object, hidden); | 5989 LookupIterator it(object, hidden, object); |
| 5990 Maybe<PropertyAttributes> maybe = GetPropertyAttributes(&it); | 5990 Maybe<PropertyAttributes> maybe = GetPropertyAttributes(&it); |
| 5991 // Cannot get an exception since the hidden_properties_symbol isn't exposed to | 5991 // Cannot get an exception since the hidden_properties_symbol isn't exposed to |
| 5992 // JS. | 5992 // JS. |
| 5993 DCHECK(maybe.IsJust()); | 5993 DCHECK(maybe.IsJust()); |
| 5994 return maybe.FromJust() != ABSENT; | 5994 return maybe.FromJust() != ABSENT; |
| 5995 } | 5995 } |
| 5996 | 5996 |
| 5997 | 5997 |
| 5998 Object* JSObject::GetHiddenPropertiesHashTable() { | 5998 Object* JSObject::GetHiddenPropertiesHashTable() { |
| 5999 DCHECK(!IsJSGlobalProxy()); | 5999 DCHECK(!IsJSGlobalProxy()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 6014 FieldIndex index = FieldIndex::ForDescriptor(this->map(), | 6014 FieldIndex index = FieldIndex::ForDescriptor(this->map(), |
| 6015 sorted_index); | 6015 sorted_index); |
| 6016 return this->RawFastPropertyAt(index); | 6016 return this->RawFastPropertyAt(index); |
| 6017 } else { | 6017 } else { |
| 6018 return GetHeap()->undefined_value(); | 6018 return GetHeap()->undefined_value(); |
| 6019 } | 6019 } |
| 6020 } else { | 6020 } else { |
| 6021 return GetHeap()->undefined_value(); | 6021 return GetHeap()->undefined_value(); |
| 6022 } | 6022 } |
| 6023 } else { | 6023 } else { |
| 6024 Handle<Symbol> hidden = GetIsolate()->factory()->hidden_properties_symbol(); | 6024 Isolate* isolate = GetIsolate(); |
| 6025 LookupIterator it(handle(this), hidden); | 6025 Handle<Symbol> hidden = isolate->factory()->hidden_properties_symbol(); |
| 6026 Handle<JSObject> receiver(this, isolate); |
| 6027 LookupIterator it(receiver, hidden, receiver); |
| 6026 // Access check is always skipped for the hidden string anyways. | 6028 // Access check is always skipped for the hidden string anyways. |
| 6027 return *GetDataProperty(&it); | 6029 return *GetDataProperty(&it); |
| 6028 } | 6030 } |
| 6029 } | 6031 } |
| 6030 | 6032 |
| 6031 Handle<ObjectHashTable> JSObject::GetOrCreateHiddenPropertiesHashtable( | 6033 Handle<ObjectHashTable> JSObject::GetOrCreateHiddenPropertiesHashtable( |
| 6032 Handle<JSObject> object) { | 6034 Handle<JSObject> object) { |
| 6033 Isolate* isolate = object->GetIsolate(); | 6035 Isolate* isolate = object->GetIsolate(); |
| 6034 | 6036 |
| 6035 static const int kInitialCapacity = 4; | 6037 static const int kInitialCapacity = 4; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6214 } | 6216 } |
| 6215 } | 6217 } |
| 6216 } | 6218 } |
| 6217 | 6219 |
| 6218 return Just(true); | 6220 return Just(true); |
| 6219 } | 6221 } |
| 6220 | 6222 |
| 6221 | 6223 |
| 6222 Maybe<bool> JSReceiver::DeleteElement(Handle<JSReceiver> object, uint32_t index, | 6224 Maybe<bool> JSReceiver::DeleteElement(Handle<JSReceiver> object, uint32_t index, |
| 6223 LanguageMode language_mode) { | 6225 LanguageMode language_mode) { |
| 6224 LookupIterator it(object->GetIsolate(), object, index, | 6226 LookupIterator it(object->GetIsolate(), object, index, object, |
| 6225 LookupIterator::HIDDEN); | 6227 LookupIterator::HIDDEN); |
| 6226 return DeleteProperty(&it, language_mode); | 6228 return DeleteProperty(&it, language_mode); |
| 6227 } | 6229 } |
| 6228 | 6230 |
| 6229 | 6231 |
| 6230 Maybe<bool> JSReceiver::DeleteProperty(Handle<JSReceiver> object, | 6232 Maybe<bool> JSReceiver::DeleteProperty(Handle<JSReceiver> object, |
| 6231 Handle<Name> name, | 6233 Handle<Name> name, |
| 6232 LanguageMode language_mode) { | 6234 LanguageMode language_mode) { |
| 6233 LookupIterator it(object, name, LookupIterator::HIDDEN); | 6235 LookupIterator it(object, name, object, LookupIterator::HIDDEN); |
| 6234 return DeleteProperty(&it, language_mode); | 6236 return DeleteProperty(&it, language_mode); |
| 6235 } | 6237 } |
| 6236 | 6238 |
| 6237 | 6239 |
| 6238 Maybe<bool> JSReceiver::DeletePropertyOrElement(Handle<JSReceiver> object, | 6240 Maybe<bool> JSReceiver::DeletePropertyOrElement(Handle<JSReceiver> object, |
| 6239 Handle<Name> name, | 6241 Handle<Name> name, |
| 6240 LanguageMode language_mode) { | 6242 LanguageMode language_mode) { |
| 6241 LookupIterator it = LookupIterator::PropertyOrElement( | 6243 LookupIterator it = LookupIterator::PropertyOrElement( |
| 6242 name->GetIsolate(), object, name, LookupIterator::HIDDEN); | 6244 name->GetIsolate(), object, name, object, LookupIterator::HIDDEN); |
| 6243 return DeleteProperty(&it, language_mode); | 6245 return DeleteProperty(&it, language_mode); |
| 6244 } | 6246 } |
| 6245 | 6247 |
| 6246 | 6248 |
| 6247 // ES6 7.1.14 | 6249 // ES6 7.1.14 |
| 6248 MaybeHandle<Object> ToPropertyKey(Isolate* isolate, Handle<Object> value) { | 6250 MaybeHandle<Object> ToPropertyKey(Isolate* isolate, Handle<Object> value) { |
| 6249 // 1. Let key be ToPrimitive(argument, hint String). | 6251 // 1. Let key be ToPrimitive(argument, hint String). |
| 6250 MaybeHandle<Object> maybe_key = | 6252 MaybeHandle<Object> maybe_key = |
| 6251 Object::ToPrimitive(value, ToPrimitiveHint::kString); | 6253 Object::ToPrimitive(value, ToPrimitiveHint::kString); |
| 6252 // 2. ReturnIfAbrupt(key). | 6254 // 2. ReturnIfAbrupt(key). |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7099 desc->ToAttributes() != DONT_ENUM) { | 7101 desc->ToAttributes() != DONT_ENUM) { |
| 7100 RETURN_FAILURE(isolate, should_throw, | 7102 RETURN_FAILURE(isolate, should_throw, |
| 7101 NewTypeError(MessageTemplate::kProxyPrivate)); | 7103 NewTypeError(MessageTemplate::kProxyPrivate)); |
| 7102 } | 7104 } |
| 7103 DCHECK(proxy->map()->is_dictionary_map()); | 7105 DCHECK(proxy->map()->is_dictionary_map()); |
| 7104 Handle<Object> value = | 7106 Handle<Object> value = |
| 7105 desc->has_value() | 7107 desc->has_value() |
| 7106 ? desc->value() | 7108 ? desc->value() |
| 7107 : Handle<Object>::cast(isolate->factory()->undefined_value()); | 7109 : Handle<Object>::cast(isolate->factory()->undefined_value()); |
| 7108 | 7110 |
| 7109 LookupIterator it(proxy, private_name); | 7111 LookupIterator it(proxy, private_name, proxy); |
| 7110 | 7112 |
| 7111 if (it.IsFound()) { | 7113 if (it.IsFound()) { |
| 7112 DCHECK_EQ(LookupIterator::DATA, it.state()); | 7114 DCHECK_EQ(LookupIterator::DATA, it.state()); |
| 7113 DCHECK_EQ(DONT_ENUM, it.property_attributes()); | 7115 DCHECK_EQ(DONT_ENUM, it.property_attributes()); |
| 7114 it.WriteDataValue(value); | 7116 it.WriteDataValue(value); |
| 7115 return Just(true); | 7117 return Just(true); |
| 7116 } | 7118 } |
| 7117 | 7119 |
| 7118 Handle<NameDictionary> dict(proxy->property_dictionary()); | 7120 Handle<NameDictionary> dict(proxy->property_dictionary()); |
| 7119 PropertyDetails details(DONT_ENUM, DATA, 0, PropertyCellType::kNoCell); | 7121 PropertyDetails details(DONT_ENUM, DATA, 0, PropertyCellType::kNoCell); |
| (...skipping 7927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15047 | 15049 |
| 15048 | 15050 |
| 15049 // Returns false if the passed-in index is marked non-configurable, which will | 15051 // Returns false if the passed-in index is marked non-configurable, which will |
| 15050 // cause the truncation operation to halt, and thus no further old values need | 15052 // cause the truncation operation to halt, and thus no further old values need |
| 15051 // be collected. | 15053 // be collected. |
| 15052 static bool GetOldValue(Isolate* isolate, | 15054 static bool GetOldValue(Isolate* isolate, |
| 15053 Handle<JSObject> object, | 15055 Handle<JSObject> object, |
| 15054 uint32_t index, | 15056 uint32_t index, |
| 15055 List<Handle<Object> >* old_values, | 15057 List<Handle<Object> >* old_values, |
| 15056 List<uint32_t>* indices) { | 15058 List<uint32_t>* indices) { |
| 15057 LookupIterator it(isolate, object, index, LookupIterator::HIDDEN); | 15059 LookupIterator it(isolate, object, index, object, LookupIterator::HIDDEN); |
| 15058 CHECK(JSReceiver::GetPropertyAttributes(&it).IsJust()); | 15060 CHECK(JSReceiver::GetPropertyAttributes(&it).IsJust()); |
| 15059 DCHECK(it.IsFound()); | 15061 DCHECK(it.IsFound()); |
| 15060 if (!it.IsConfigurable()) return false; | 15062 if (!it.IsConfigurable()) return false; |
| 15061 Handle<Object> value = | 15063 Handle<Object> value = |
| 15062 it.state() == LookupIterator::ACCESSOR | 15064 it.state() == LookupIterator::ACCESSOR |
| 15063 ? Handle<Object>::cast(isolate->factory()->the_hole_value()) | 15065 ? Handle<Object>::cast(isolate->factory()->the_hole_value()) |
| 15064 : JSReceiver::GetDataProperty(&it); | 15066 : JSReceiver::GetDataProperty(&it); |
| 15065 old_values->Add(value); | 15067 old_values->Add(value); |
| 15066 indices->Add(index); | 15068 indices->Add(index); |
| 15067 return true; | 15069 return true; |
| (...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16114 | 16116 |
| 16115 bool JSArray::HasReadOnlyLength(Handle<JSArray> array) { | 16117 bool JSArray::HasReadOnlyLength(Handle<JSArray> array) { |
| 16116 Isolate* isolate = array->GetIsolate(); | 16118 Isolate* isolate = array->GetIsolate(); |
| 16117 // Optimistic fast path: "length" is usually the first fast property. | 16119 // Optimistic fast path: "length" is usually the first fast property. |
| 16118 DescriptorArray* descriptors = array->map()->instance_descriptors(); | 16120 DescriptorArray* descriptors = array->map()->instance_descriptors(); |
| 16119 if (descriptors->length() >= 1 && | 16121 if (descriptors->length() >= 1 && |
| 16120 descriptors->GetKey(0) == isolate->heap()->length_string()) { | 16122 descriptors->GetKey(0) == isolate->heap()->length_string()) { |
| 16121 return descriptors->GetDetails(0).IsReadOnly(); | 16123 return descriptors->GetDetails(0).IsReadOnly(); |
| 16122 } | 16124 } |
| 16123 | 16125 |
| 16124 LookupIterator it(array, isolate->factory()->length_string(), | 16126 LookupIterator it(array, isolate->factory()->length_string(), array, |
| 16125 LookupIterator::OWN_SKIP_INTERCEPTOR); | 16127 LookupIterator::OWN_SKIP_INTERCEPTOR); |
| 16126 CHECK_EQ(LookupIterator::ACCESSOR, it.state()); | 16128 CHECK_EQ(LookupIterator::ACCESSOR, it.state()); |
| 16127 return it.IsReadOnly(); | 16129 return it.IsReadOnly(); |
| 16128 } | 16130 } |
| 16129 | 16131 |
| 16130 | 16132 |
| 16131 bool JSArray::WouldChangeReadOnlyLength(Handle<JSArray> array, | 16133 bool JSArray::WouldChangeReadOnlyLength(Handle<JSArray> array, |
| 16132 uint32_t index) { | 16134 uint32_t index) { |
| 16133 uint32_t length = 0; | 16135 uint32_t length = 0; |
| 16134 CHECK(array->length()->ToArrayLength(&length)); | 16136 CHECK(array->length()->ToArrayLength(&length)); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16292 Handle<Name> name) { | 16294 Handle<Name> name) { |
| 16293 LookupIterator it = LookupIterator::PropertyOrElement( | 16295 LookupIterator it = LookupIterator::PropertyOrElement( |
| 16294 name->GetIsolate(), object, name, LookupIterator::OWN_SKIP_INTERCEPTOR); | 16296 name->GetIsolate(), object, name, LookupIterator::OWN_SKIP_INTERCEPTOR); |
| 16295 return HasProperty(&it); | 16297 return HasProperty(&it); |
| 16296 } | 16298 } |
| 16297 | 16299 |
| 16298 | 16300 |
| 16299 Maybe<bool> JSObject::HasRealElementProperty(Handle<JSObject> object, | 16301 Maybe<bool> JSObject::HasRealElementProperty(Handle<JSObject> object, |
| 16300 uint32_t index) { | 16302 uint32_t index) { |
| 16301 Isolate* isolate = object->GetIsolate(); | 16303 Isolate* isolate = object->GetIsolate(); |
| 16302 LookupIterator it(isolate, object, index, | 16304 LookupIterator it(isolate, object, index, object, |
| 16303 LookupIterator::OWN_SKIP_INTERCEPTOR); | 16305 LookupIterator::OWN_SKIP_INTERCEPTOR); |
| 16304 return HasProperty(&it); | 16306 return HasProperty(&it); |
| 16305 } | 16307 } |
| 16306 | 16308 |
| 16307 | 16309 |
| 16308 Maybe<bool> JSObject::HasRealNamedCallbackProperty(Handle<JSObject> object, | 16310 Maybe<bool> JSObject::HasRealNamedCallbackProperty(Handle<JSObject> object, |
| 16309 Handle<Name> name) { | 16311 Handle<Name> name) { |
| 16310 LookupIterator it = LookupIterator::PropertyOrElement( | 16312 LookupIterator it = LookupIterator::PropertyOrElement( |
| 16311 name->GetIsolate(), object, name, LookupIterator::OWN_SKIP_INTERCEPTOR); | 16313 name->GetIsolate(), object, name, LookupIterator::OWN_SKIP_INTERCEPTOR); |
| 16312 Maybe<PropertyAttributes> maybe_result = GetPropertyAttributes(&it); | 16314 Maybe<PropertyAttributes> maybe_result = GetPropertyAttributes(&it); |
| (...skipping 3443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19756 if (cell->value() != *new_value) { | 19758 if (cell->value() != *new_value) { |
| 19757 cell->set_value(*new_value); | 19759 cell->set_value(*new_value); |
| 19758 Isolate* isolate = cell->GetIsolate(); | 19760 Isolate* isolate = cell->GetIsolate(); |
| 19759 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19761 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 19760 isolate, DependentCode::kPropertyCellChangedGroup); | 19762 isolate, DependentCode::kPropertyCellChangedGroup); |
| 19761 } | 19763 } |
| 19762 } | 19764 } |
| 19763 | 19765 |
| 19764 } // namespace internal | 19766 } // namespace internal |
| 19765 } // namespace v8 | 19767 } // namespace v8 |
| OLD | NEW |