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

Unified Diff: src/objects.cc

Issue 1177103003: Use LookupIterator for elements in the observed part of DefineAccessor (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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 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());
Jakob Kummerow 2015/06/11 11:14:28 I'm not a fan of having a Release-mode CHECK here,
+ preexists = it.IsFound();
+ if (preexists && (it.state() == LookupIterator::DATA ||
+ it.GetAccessors()->IsAccessorInfo())) {
+ old_value = GetProperty(&it).ToHandleChecked();
}
}
« 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