Commit b7a43514 authored by verwaest's avatar verwaest Committed by Commit bot

Get rid of silly "done" flag in SetPropertyIternal now that we can just return

BUG=

Review URL: https://codereview.chromium.org/1752383002

Cr-Commit-Position: refs/heads/master@{#34436}
parent 2e2e8109
......@@ -472,13 +472,13 @@ bool LookupIterator::HolderIsReceiverOrHiddenPrototype() const {
// Optimization that only works if configuration_ is not mutable.
if (!check_prototype_chain()) return true;
DisallowHeapAllocation no_gc;
if (*receiver_ == *holder_) return true;
if (!receiver_->IsJSReceiver()) return false;
JSReceiver* current = JSReceiver::cast(*receiver_);
JSReceiver* object = *holder_;
if (current == object) return true;
if (!current->map()->has_hidden_prototype()) return false;
// JSProxy do not occur as hidden prototypes.
if (current->IsJSProxy()) return false;
if (object->IsJSProxy()) return false;
PrototypeIterator iter(isolate(), current,
PrototypeIterator::START_AT_PROTOTYPE,
PrototypeIterator::END_AT_NON_HIDDEN);
......
......@@ -4139,9 +4139,6 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it,
// interceptor calls.
AssertNoContextChange ncc(it->isolate());
*found = true;
bool done = false;
for (; it->IsFound(); it->Next()) {
switch (it->state()) {
case LookupIterator::NOT_FOUND:
......@@ -4167,10 +4164,12 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it,
Maybe<PropertyAttributes> maybe_attributes =
JSObject::GetPropertyAttributesWithInterceptor(it);
if (!maybe_attributes.IsJust()) return Nothing<bool>();
done = maybe_attributes.FromJust() != ABSENT;
if (done && (maybe_attributes.FromJust() & READ_ONLY) != 0) {
if (maybe_attributes.FromJust() == ABSENT) break;
if ((maybe_attributes.FromJust() & READ_ONLY) != 0) {
return WriteToReadOnlyProperty(it, value, should_throw);
}
*found = false;
return Nothing<bool>();
}
break;
......@@ -4182,13 +4181,13 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it,
if (accessors->IsAccessorInfo() &&
!it->HolderIsReceiverOrHiddenPrototype() &&
AccessorInfo::cast(*accessors)->is_special_data_property()) {
done = true;
break;
*found = false;
return Nothing<bool>();
}
return SetPropertyWithAccessor(it, value, should_throw);
}
case LookupIterator::INTEGER_INDEXED_EXOTIC:
// TODO(verwaest): We should throw an exception.
// TODO(verwaest): We should throw an exception if holder is receiver.
return Just(true);
case LookupIterator::DATA:
......@@ -4198,15 +4197,11 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it,
if (it->HolderIsReceiverOrHiddenPrototype()) {
return SetDataProperty(it, value);
}
done = true;
break;
// Fall through.
case LookupIterator::TRANSITION:
done = true;
break;
*found = false;
return Nothing<bool>();
}
if (done) break;
}
*found = false;
......@@ -4217,7 +4212,7 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it,
Maybe<bool> Object::SetProperty(LookupIterator* it, Handle<Object> value,
LanguageMode language_mode,
StoreFromKeyed store_mode) {
bool found = false;
bool found = true;
Maybe<bool> result =
SetPropertyInternal(it, value, language_mode, store_mode, &found);
if (found) return result;
......@@ -4242,7 +4237,7 @@ Maybe<bool> Object::SetSuperProperty(LookupIterator* it, Handle<Object> value,
StoreFromKeyed store_mode) {
Isolate* isolate = it->isolate();
bool found = false;
bool found = true;
Maybe<bool> result =
SetPropertyInternal(it, value, language_mode, store_mode, &found);
if (found) return result;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment