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

Unified Diff: src/objects.cc

Issue 1190023002: Use output parameter to distinguish error from absent result (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 | « src/objects.h ('k') | 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 bbf582a7b5d6dbbd90b9b9bbf0cce169a7c49e78..74586db26361938f22f53a560ba5a0759e5d4d1c 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -137,10 +137,12 @@ MaybeHandle<Object> Object::GetProperty(LookupIterator* it) {
return JSProxy::GetPropertyWithHandler(
it->GetHolder<JSProxy>(), it->GetReceiver(), it->GetName());
case LookupIterator::INTERCEPTOR: {
- MaybeHandle<Object> maybe_result =
- JSObject::GetPropertyWithInterceptor(it);
- if (!maybe_result.is_null()) return maybe_result;
- if (it->isolate()->has_pending_exception()) return maybe_result;
+ bool done;
+ Handle<Object> result;
+ ASSIGN_RETURN_ON_EXCEPTION(
+ it->isolate(), result,
+ JSObject::GetPropertyWithInterceptor(it, &done), Object);
+ if (done) return result;
break;
}
case LookupIterator::ACCESS_CHECK:
@@ -493,9 +495,11 @@ MaybeHandle<Object> JSObject::GetPropertyWithFailedAccessCheck(
return GetPropertyWithAccessor(it);
}
DCHECK_EQ(LookupIterator::INTERCEPTOR, it->state());
- auto result = GetPropertyWithInterceptor(it);
- if (it->isolate()->has_scheduled_exception()) break;
- if (!result.is_null()) return result;
+ bool done;
+ Handle<Object> result;
+ ASSIGN_RETURN_ON_EXCEPTION(it->isolate(), result,
+ GetPropertyWithInterceptor(it, &done), Object);
+ if (done) return result;
}
it->isolate()->ReportFailedAccessCheck(checked);
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(it->isolate(), Object);
@@ -13314,7 +13318,9 @@ InterceptorInfo* JSObject::GetIndexedInterceptor() {
}
-MaybeHandle<Object> JSObject::GetPropertyWithInterceptor(LookupIterator* it) {
+MaybeHandle<Object> JSObject::GetPropertyWithInterceptor(LookupIterator* it,
+ bool* done) {
+ *done = false;
Isolate* isolate = it->isolate();
// Make sure that the top context does not change when doing callbacks or
// interceptor calls.
@@ -13322,7 +13328,9 @@ MaybeHandle<Object> JSObject::GetPropertyWithInterceptor(LookupIterator* it) {
DCHECK_EQ(LookupIterator::INTERCEPTOR, it->state());
Handle<InterceptorInfo> interceptor = it->GetInterceptor();
- if (interceptor->getter()->IsUndefined()) return MaybeHandle<Object>();
+ if (interceptor->getter()->IsUndefined()) {
+ return isolate->factory()->undefined_value();
+ }
Handle<JSObject> holder = it->GetHolder<JSObject>();
v8::Handle<v8::Value> result;
@@ -13340,7 +13348,7 @@ MaybeHandle<Object> JSObject::GetPropertyWithInterceptor(LookupIterator* it) {
Handle<Name> name = it->name();
if (name->IsSymbol() && !interceptor->can_intercept_symbols()) {
- return MaybeHandle<Object>();
+ return isolate->factory()->undefined_value();
}
v8::GenericNamedPropertyGetterCallback getter =
@@ -13352,9 +13360,10 @@ MaybeHandle<Object> JSObject::GetPropertyWithInterceptor(LookupIterator* it) {
}
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
- if (result.IsEmpty()) return MaybeHandle<Object>();
+ if (result.IsEmpty()) return isolate->factory()->undefined_value();
Handle<Object> result_internal = v8::Utils::OpenHandle(*result);
result_internal->VerifyApiCallResultType();
+ *done = true;
// Rebox handle before return
return handle(*result_internal, isolate);
}
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698