Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1100)

Unified Diff: src/objects.cc

Issue 1752383002: Get rid of silly "done" flag in SetPropertyIternal now that we can just return (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/lookup.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 12b206cce9fb863d23bc9e611126ea5c0a1cb70f..0f753ff2f410ea0463a7b608af4d990421ef7466 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -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;
« no previous file with comments | « src/lookup.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698