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

Unified Diff: src/objects.cc

Issue 1756883002: Avoid SetPropertyInternal if the LookupIterator is NotFound (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 | « no previous file | 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 0f753ff2f410ea0463a7b608af4d990421ef7466..1100adb3fc98d2bee567ea5ed65e78ed7d96d219 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -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) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698