From effe76ad25c23bfd8be447930bd5d5126b1c9096 Mon Sep 17 00:00:00 2001 From: neis Date: Mon, 26 Oct 2015 05:30:11 -0700 Subject: [PATCH] Assume that ReportFailedAccessCheck always schedules an exception. R=verwaest@chromium.org BUG= Review URL: https://codereview.chromium.org/1420413002 Cr-Commit-Position: refs/heads/master@{#31560} --- src/builtins.cc | 1 + src/objects.cc | 23 ++++++++++------------- src/runtime/runtime-classes.cc | 4 ++++ 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/builtins.cc b/src/builtins.cc index 1ed2fd1253..4bde68cb03 100644 --- a/src/builtins.cc +++ b/src/builtins.cc @@ -1712,6 +1712,7 @@ MUST_USE_RESULT static MaybeHandle HandleApiCallHelper( if (!isolate->MayAccess(handle(isolate->context()), js_receiver)) { isolate->ReportFailedAccessCheck(js_receiver); RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); + UNREACHABLE(); } } } diff --git a/src/objects.cc b/src/objects.cc index 467da5b71a..40e06c24ce 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -1011,7 +1011,8 @@ MaybeHandle JSObject::GetPropertyWithFailedAccessCheck( it->isolate()->ReportFailedAccessCheck(checked); RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(it->isolate(), Object); - return it->factory()->undefined_value(); + UNREACHABLE(); + return MaybeHandle(); } @@ -1030,7 +1031,8 @@ Maybe JSObject::GetPropertyAttributesWithFailedAccessCheck( it->isolate()->ReportFailedAccessCheck(checked); RETURN_VALUE_IF_SCHEDULED_EXCEPTION(it->isolate(), Nothing()); - return Just(ABSENT); + UNREACHABLE(); + return Nothing(); } @@ -1059,8 +1061,6 @@ Maybe JSObject::SetPropertyWithFailedAccessCheck( it->isolate()->ReportFailedAccessCheck(checked); RETURN_VALUE_IF_SCHEDULED_EXCEPTION(it->isolate(), Nothing()); UNREACHABLE(); - it->isolate()->Throw( - *it->isolate()->factory()->NewTypeError(MessageTemplate::kNoAccess)); return Nothing(); } @@ -4792,7 +4792,7 @@ MaybeHandle JSObject::DefineOwnPropertyIgnoreAttributes( if (!it->HasAccess()) { it->isolate()->ReportFailedAccessCheck(it->GetHolder()); RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(it->isolate(), Object); - return value; + UNREACHABLE(); } break; @@ -5821,7 +5821,7 @@ MaybeHandle JSReceiver::DeleteProperty(LookupIterator* it, if (it->HasAccess()) break; isolate->ReportFailedAccessCheck(it->GetHolder()); RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); - return it->factory()->false_value(); + UNREACHABLE(); case LookupIterator::INTERCEPTOR: { MaybeHandle maybe_result = JSObject::DeletePropertyWithInterceptor(it); @@ -6782,8 +6782,6 @@ Maybe JSObject::PreventExtensions(Handle object, isolate->ReportFailedAccessCheck(object); RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing()); UNREACHABLE(); - RETURN_FAILURE(isolate, should_throw, - NewTypeError(MessageTemplate::kNoAccess)); } if (object->IsJSGlobalProxy()) { @@ -6879,8 +6877,6 @@ Maybe JSObject::PreventExtensionsWithTransition( isolate->ReportFailedAccessCheck(object); RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing()); UNREACHABLE(); - RETURN_FAILURE(isolate, should_throw, - NewTypeError(MessageTemplate::kNoAccess)); } if (object->IsJSGlobalProxy()) { @@ -7782,6 +7778,7 @@ MaybeHandle JSReceiver::GetKeys(Handle object, if (iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)) { isolate->ReportFailedAccessCheck(current); RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, FixedArray); + UNREACHABLE(); } break; } @@ -7894,7 +7891,7 @@ MaybeHandle JSObject::DefineAccessor(LookupIterator* it, if (!it->HasAccess()) { isolate->ReportFailedAccessCheck(it->GetHolder()); RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); - return isolate->factory()->undefined_value(); + UNREACHABLE(); } it->Next(); } @@ -7959,7 +7956,7 @@ MaybeHandle JSObject::SetAccessor(Handle object, if (!it.HasAccess()) { isolate->ReportFailedAccessCheck(object); RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); - return it.factory()->undefined_value(); + UNREACHABLE(); } it.Next(); } @@ -8006,7 +8003,7 @@ MaybeHandle JSObject::GetAccessor(Handle object, if (it.HasAccess()) continue; isolate->ReportFailedAccessCheck(it.GetHolder()); RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); - return isolate->factory()->undefined_value(); + UNREACHABLE(); case LookupIterator::JSPROXY: return isolate->factory()->undefined_value(); diff --git a/src/runtime/runtime-classes.cc b/src/runtime/runtime-classes.cc index 5358308612..4c0627e168 100644 --- a/src/runtime/runtime-classes.cc +++ b/src/runtime/runtime-classes.cc @@ -272,6 +272,7 @@ static MaybeHandle LoadFromSuper(Isolate* isolate, !isolate->MayAccess(handle(isolate->context()), home_object)) { isolate->ReportFailedAccessCheck(home_object); RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); + UNREACHABLE(); } PrototypeIterator iter(isolate, home_object); @@ -297,6 +298,7 @@ static MaybeHandle LoadElementFromSuper(Isolate* isolate, !isolate->MayAccess(handle(isolate->context()), home_object)) { isolate->ReportFailedAccessCheck(home_object); RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); + UNREACHABLE(); } PrototypeIterator iter(isolate, home_object); @@ -374,6 +376,7 @@ static Object* StoreToSuper(Isolate* isolate, Handle home_object, !isolate->MayAccess(handle(isolate->context()), home_object)) { isolate->ReportFailedAccessCheck(home_object); RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); + UNREACHABLE(); } PrototypeIterator iter(isolate, home_object); @@ -399,6 +402,7 @@ static Object* StoreElementToSuper(Isolate* isolate, !isolate->MayAccess(handle(isolate->context()), home_object)) { isolate->ReportFailedAccessCheck(home_object); RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); + UNREACHABLE(); } PrototypeIterator iter(isolate, home_object);