}
-// Returns false if the passed-in index is marked non-configurable,
-// which will cause the ES5 truncation operation to halt, and thus
-// no further old values need be collected.
+// Returns false if the passed-in index is marked non-configurable, which will
+// cause the truncation operation to halt, and thus no further old values need
+// be collected.
static bool GetOldValue(Isolate* isolate,
Handle<JSObject> object,
uint32_t index,
List<Handle<Object> >* old_values,
List<uint32_t>* indices) {
- Maybe<PropertyAttributes> maybe =
- JSReceiver::GetOwnElementAttributes(object, index);
- DCHECK(maybe.IsJust());
- DCHECK(maybe.FromJust() != ABSENT);
- if (maybe.FromJust() == DONT_DELETE) return false;
- Handle<Object> value;
- if (!JSObject::GetOwnElementAccessorPair(object, index).is_null()) {
- value = Handle<Object>::cast(isolate->factory()->the_hole_value());
- } else {
- value = Object::GetElement(isolate, object, index).ToHandleChecked();
- }
+ LookupIterator it(isolate, object, index, LookupIterator::HIDDEN);
+ CHECK(JSReceiver::GetPropertyAttributes(&it).IsJust());
+ DCHECK(it.IsFound());
+ if (!it.IsConfigurable()) return false;
+ Handle<Object> value =
+ it.state() == LookupIterator::ACCESSOR
+ ? Handle<Object>::cast(isolate->factory()->the_hole_value())
+ : JSReceiver::GetDataProperty(&it);
old_values->Add(value);
indices->Add(index);
return true;
}
-MaybeHandle<AccessorPair> JSObject::GetOwnElementAccessorPair(
- Handle<JSObject> object,
- uint32_t index) {
- if (object->IsJSGlobalProxy()) {
- PrototypeIterator iter(object->GetIsolate(), object);
- if (iter.IsAtEnd()) return MaybeHandle<AccessorPair>();
- DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject());
- return GetOwnElementAccessorPair(
- Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)), index);
- }
-
- // Check for lookup interceptor.
- if (object->HasIndexedInterceptor()) return MaybeHandle<AccessorPair>();
-
- return object->GetElementsAccessor()->GetAccessorPair(object, index);
-}
-
-
bool JSObject::HasFastArgumentsElements() {
Heap* heap = GetHeap();
if (!elements()->IsFixedArray()) return false;