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 { ...@@ -472,13 +472,13 @@ bool LookupIterator::HolderIsReceiverOrHiddenPrototype() const {
// Optimization that only works if configuration_ is not mutable. // Optimization that only works if configuration_ is not mutable.
if (!check_prototype_chain()) return true; if (!check_prototype_chain()) return true;
DisallowHeapAllocation no_gc; DisallowHeapAllocation no_gc;
if (*receiver_ == *holder_) return true;
if (!receiver_->IsJSReceiver()) return false; if (!receiver_->IsJSReceiver()) return false;
JSReceiver* current = JSReceiver::cast(*receiver_); JSReceiver* current = JSReceiver::cast(*receiver_);
JSReceiver* object = *holder_; JSReceiver* object = *holder_;
if (current == object) return true;
if (!current->map()->has_hidden_prototype()) return false; if (!current->map()->has_hidden_prototype()) return false;
// JSProxy do not occur as hidden prototypes. // JSProxy do not occur as hidden prototypes.
if (current->IsJSProxy()) return false; if (object->IsJSProxy()) return false;
PrototypeIterator iter(isolate(), current, PrototypeIterator iter(isolate(), current,
PrototypeIterator::START_AT_PROTOTYPE, PrototypeIterator::START_AT_PROTOTYPE,
PrototypeIterator::END_AT_NON_HIDDEN); PrototypeIterator::END_AT_NON_HIDDEN);
......
...@@ -4139,9 +4139,6 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it, ...@@ -4139,9 +4139,6 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it,
// interceptor calls. // interceptor calls.
AssertNoContextChange ncc(it->isolate()); AssertNoContextChange ncc(it->isolate());
*found = true;
bool done = false;
for (; it->IsFound(); it->Next()) { for (; it->IsFound(); it->Next()) {
switch (it->state()) { switch (it->state()) {
case LookupIterator::NOT_FOUND: case LookupIterator::NOT_FOUND:
...@@ -4167,10 +4164,12 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it, ...@@ -4167,10 +4164,12 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it,
Maybe<PropertyAttributes> maybe_attributes = Maybe<PropertyAttributes> maybe_attributes =
JSObject::GetPropertyAttributesWithInterceptor(it); JSObject::GetPropertyAttributesWithInterceptor(it);
if (!maybe_attributes.IsJust()) return Nothing<bool>(); if (!maybe_attributes.IsJust()) return Nothing<bool>();
done = maybe_attributes.FromJust() != ABSENT; if (maybe_attributes.FromJust() == ABSENT) break;
if (done && (maybe_attributes.FromJust() & READ_ONLY) != 0) { if ((maybe_attributes.FromJust() & READ_ONLY) != 0) {
return WriteToReadOnlyProperty(it, value, should_throw); return WriteToReadOnlyProperty(it, value, should_throw);
} }
*found = false;
return Nothing<bool>();
} }
break; break;
...@@ -4182,13 +4181,13 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it, ...@@ -4182,13 +4181,13 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it,
if (accessors->IsAccessorInfo() && if (accessors->IsAccessorInfo() &&
!it->HolderIsReceiverOrHiddenPrototype() && !it->HolderIsReceiverOrHiddenPrototype() &&
AccessorInfo::cast(*accessors)->is_special_data_property()) { AccessorInfo::cast(*accessors)->is_special_data_property()) {
done = true; *found = false;
break; return Nothing<bool>();
} }
return SetPropertyWithAccessor(it, value, should_throw); return SetPropertyWithAccessor(it, value, should_throw);
} }
case LookupIterator::INTEGER_INDEXED_EXOTIC: 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); return Just(true);
case LookupIterator::DATA: case LookupIterator::DATA:
...@@ -4198,15 +4197,11 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it, ...@@ -4198,15 +4197,11 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it,
if (it->HolderIsReceiverOrHiddenPrototype()) { if (it->HolderIsReceiverOrHiddenPrototype()) {
return SetDataProperty(it, value); return SetDataProperty(it, value);
} }
done = true; // Fall through.
break;
case LookupIterator::TRANSITION: case LookupIterator::TRANSITION:
done = true; *found = false;
break; return Nothing<bool>();
} }
if (done) break;
} }
*found = false; *found = false;
...@@ -4217,7 +4212,7 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it, ...@@ -4217,7 +4212,7 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it,
Maybe<bool> Object::SetProperty(LookupIterator* it, Handle<Object> value, Maybe<bool> Object::SetProperty(LookupIterator* it, Handle<Object> value,
LanguageMode language_mode, LanguageMode language_mode,
StoreFromKeyed store_mode) { StoreFromKeyed store_mode) {
bool found = false; bool found = true;
Maybe<bool> result = Maybe<bool> result =
SetPropertyInternal(it, value, language_mode, store_mode, &found); SetPropertyInternal(it, value, language_mode, store_mode, &found);
if (found) return result; if (found) return result;
...@@ -4242,7 +4237,7 @@ Maybe<bool> Object::SetSuperProperty(LookupIterator* it, Handle<Object> value, ...@@ -4242,7 +4237,7 @@ Maybe<bool> Object::SetSuperProperty(LookupIterator* it, Handle<Object> value,
StoreFromKeyed store_mode) { StoreFromKeyed store_mode) {
Isolate* isolate = it->isolate(); Isolate* isolate = it->isolate();
bool found = false; bool found = true;
Maybe<bool> result = Maybe<bool> result =
SetPropertyInternal(it, value, language_mode, store_mode, &found); SetPropertyInternal(it, value, language_mode, store_mode, &found);
if (found) return result; 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