Reviewers: Toon Verwaest,

Description:
Fix lookup iterator checks in GetRealNamedProperty* methods

BUG=v8:4143
[email protected]
LOG=n

Please review this at https://codereview.chromium.org/1161553004/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+5, -6 lines):
  M src/api.cc


Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 808def3b0fad215568c02b494e8faac6b5249c5b..959e8a003bfc6034aaeee42e9af02803ead366b8 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -4033,10 +4033,10 @@ MaybeLocal<Value> v8::Object::GetRealNamedPropertyInPrototypeChain(
   auto proto = i::PrototypeIterator::GetCurrent(iter);
i::LookupIterator it(self, key_obj, i::Handle<i::JSReceiver>::cast(proto), i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
-  if (!it.IsFound()) return MaybeLocal<Value>();
   Local<Value> result;
has_pending_exception = !ToLocal<Value>(i::Object::GetProperty(&it), &result);
   RETURN_ON_FAILED_EXECUTION(Value);
+  if (!it.IsFound()) return MaybeLocal<Value>();
   RETURN_ESCAPED(result);
 }

@@ -4062,9 +4062,9 @@ v8::Object::GetRealNamedPropertyAttributesInPrototypeChain(
   auto proto = i::PrototypeIterator::GetCurrent(iter);
i::LookupIterator it(self, key_obj, i::Handle<i::JSReceiver>::cast(proto), i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
-  if (!it.IsFound()) return Nothing<PropertyAttribute>();
   auto result = i::JSReceiver::GetPropertyAttributes(&it);
   RETURN_ON_FAILED_EXECUTION_PRIMITIVE(PropertyAttribute);
+  if (!it.IsFound()) return Nothing<PropertyAttribute>();
   if (result.FromJust() == ABSENT) {
     return Just(static_cast<PropertyAttribute>(NONE));
   }
@@ -4082,16 +4082,15 @@ v8::Object::GetRealNamedPropertyAttributesInPrototypeChain(Handle<String> key) {

 MaybeLocal<Value> v8::Object::GetRealNamedProperty(Local<Context> context,
                                                    Local<Name> key) {
-  PREPARE_FOR_EXECUTION(
- context, "v8::Object::GetRealNamedPropertyInPrototypeChain()", Value); + PREPARE_FOR_EXECUTION(context, "v8::Object::GetRealNamedProperty()", Value);
   auto self = Utils::OpenHandle(this);
   auto key_obj = Utils::OpenHandle(*key);
   i::LookupIterator it(self, key_obj,
i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
-  if (!it.IsFound()) return MaybeLocal<Value>();
   Local<Value> result;
has_pending_exception = !ToLocal<Value>(i::Object::GetProperty(&it), &result);
   RETURN_ON_FAILED_EXECUTION(Value);
+  if (!it.IsFound()) return MaybeLocal<Value>();
   RETURN_ESCAPED(result);
 }

@@ -4111,9 +4110,9 @@ Maybe<PropertyAttribute> v8::Object::GetRealNamedPropertyAttributes(
   auto key_obj = Utils::OpenHandle(*key);
   i::LookupIterator it(self, key_obj,
i::LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
-  if (!it.IsFound()) return Nothing<PropertyAttribute>();
   auto result = i::JSReceiver::GetPropertyAttributes(&it);
   RETURN_ON_FAILED_EXECUTION_PRIMITIVE(PropertyAttribute);
+  if (!it.IsFound()) return Nothing<PropertyAttribute>();
   if (result.FromJust() == ABSENT) {
     return Just(static_cast<PropertyAttribute>(NONE));
   }


--
--
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.

Reply via email to