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

Avoid SetPropertyInternal if the LookupIterator is NotFound

BUG=

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

Cr-Commit-Position: refs/heads/master@{#34437}
parent b7a43514
......@@ -4131,7 +4131,7 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it,
LanguageMode language_mode,
StoreFromKeyed store_mode,
bool* found) {
it->UpdateProtector();
DCHECK(it->IsFound());
ShouldThrow should_throw =
is_sloppy(language_mode) ? DONT_THROW : THROW_ON_ERROR;
......@@ -4139,7 +4139,7 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it,
// interceptor calls.
AssertNoContextChange ncc(it->isolate());
for (; it->IsFound(); it->Next()) {
do {
switch (it->state()) {
case LookupIterator::NOT_FOUND:
UNREACHABLE();
......@@ -4202,7 +4202,8 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it,
*found = false;
return Nothing<bool>();
}
}
it->Next();
} while (it->IsFound());
*found = false;
return Nothing<bool>();
......@@ -4212,10 +4213,13 @@ Maybe<bool> Object::SetPropertyInternal(LookupIterator* it,
Maybe<bool> Object::SetProperty(LookupIterator* it, Handle<Object> value,
LanguageMode language_mode,
StoreFromKeyed store_mode) {
bool found = true;
Maybe<bool> result =
SetPropertyInternal(it, value, language_mode, store_mode, &found);
if (found) return result;
it->UpdateProtector();
if (it->IsFound()) {
bool found = true;
Maybe<bool> result =
SetPropertyInternal(it, value, language_mode, store_mode, &found);
if (found) return result;
}
// If the receiver is the JSGlobalObject, the store was contextual. In case
// the property did not exist yet on the global object itself, we have to
......@@ -4237,10 +4241,13 @@ Maybe<bool> Object::SetSuperProperty(LookupIterator* it, Handle<Object> value,
StoreFromKeyed store_mode) {
Isolate* isolate = it->isolate();
bool found = true;
Maybe<bool> result =
SetPropertyInternal(it, value, language_mode, store_mode, &found);
if (found) return result;
it->UpdateProtector();
if (it->IsFound()) {
bool found = true;
Maybe<bool> result =
SetPropertyInternal(it, value, language_mode, store_mode, &found);
if (found) return result;
}
// The property either doesn't exist on the holder or exists there as a data
// property.
......@@ -4315,8 +4322,7 @@ Maybe<bool> Object::SetSuperProperty(LookupIterator* it, Handle<Object> value,
}
}
return JSObject::AddDataProperty(&own_lookup, value, NONE, should_throw,
store_mode);
return AddDataProperty(&own_lookup, value, NONE, should_throw, store_mode);
}
MaybeHandle<Object> Object::ReadAbsentProperty(LookupIterator* it) {
......
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