Reviewers: Igor Sheludko,
Message:
ptal
Description:
Use LookupIterator for elements in the observed part of DefineAccessor
BUG=v8:4137
LOG=n
Please review this at https://codereview.chromium.org/1177103003/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+8, -21 lines):
M src/objects.cc
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index
400be3edaebb01269d94481d7b0e7c59c2043e3e..9dfb12e928b11299e6329ea99b56eb51efd6a2ec
100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -6402,27 +6402,14 @@ MaybeHandle<Object>
JSObject::DefineAccessor(Handle<JSObject> object,
!isolate->IsInternallyUsedPropertyName(name);
bool preexists = false;
if (is_observed) {
- if (is_element) {
- Maybe<bool> maybe = HasOwnElement(object, index);
- // Workaround for a GCC 4.4.3 bug which leads to "‘preexists’ may be
used
- // uninitialized in this function".
- if (!maybe.IsJust()) {
- DCHECK(false);
- return isolate->factory()->undefined_value();
- }
- preexists = maybe.FromJust();
- if (preexists && GetOwnElementAccessorPair(object, index).is_null())
{
- old_value =
- Object::GetElement(isolate, object, index).ToHandleChecked();
- }
- } else {
- LookupIterator it(object, name,
LookupIterator::HIDDEN_SKIP_INTERCEPTOR);
- CHECK(GetPropertyAttributes(&it).IsJust());
- preexists = it.IsFound();
- if (preexists && (it.state() == LookupIterator::DATA ||
- it.GetAccessors()->IsAccessorInfo())) {
- old_value = GetProperty(&it).ToHandleChecked();
- }
+ LookupIterator::Configuration c =
LookupIterator::HIDDEN_SKIP_INTERCEPTOR;
+ LookupIterator it = is_element ? LookupIterator(isolate, object,
index, c)
+ : LookupIterator(object, name, c);
+ CHECK(GetPropertyAttributes(&it).IsJust());
+ preexists = it.IsFound();
+ if (preexists && (it.state() == LookupIterator::DATA ||
+ it.GetAccessors()->IsAccessorInfo())) {
+ old_value = GetProperty(&it).ToHandleChecked();
}
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.