| Index: src/objects.cc
|
| diff --git a/src/objects.cc b/src/objects.cc
|
| index 3895aecb50ebba76d583f52d4191aef258b0098a..1899bd88e793f0ad8cc0e706da6f6a1be08d5d1c 100644
|
| --- a/src/objects.cc
|
| +++ b/src/objects.cc
|
| @@ -481,7 +481,7 @@ Maybe<PropertyAttributes> JSObject::GetPropertyAttributesWithFailedAccessCheck(
|
| Handle<JSObject> checked = it->GetHolder<JSObject>();
|
| while (FindAllCanReadHolder(it)) {
|
| if (it->state() == LookupIterator::ACCESSOR) {
|
| - return maybe(it->property_details().attributes());
|
| + return Just(it->property_details().attributes());
|
| }
|
| DCHECK_EQ(LookupIterator::INTERCEPTOR, it->state());
|
| auto result = GetPropertyAttributesWithInterceptor(
|
| @@ -491,8 +491,8 @@ Maybe<PropertyAttributes> JSObject::GetPropertyAttributesWithFailedAccessCheck(
|
| }
|
| it->isolate()->ReportFailedAccessCheck(checked);
|
| RETURN_VALUE_IF_SCHEDULED_EXCEPTION(it->isolate(),
|
| - Maybe<PropertyAttributes>());
|
| - return maybe(ABSENT);
|
| + Nothing<PropertyAttributes>());
|
| + return Just(ABSENT);
|
| }
|
|
|
|
|
| @@ -629,8 +629,8 @@ Maybe<PropertyAttributes> JSObject::GetElementAttributesWithFailedAccessCheck(
|
| where_to_start = PrototypeIterator::START_AT_PROTOTYPE;
|
| }
|
| isolate->ReportFailedAccessCheck(object);
|
| - RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Maybe<PropertyAttributes>());
|
| - return maybe(ABSENT);
|
| + RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<PropertyAttributes>());
|
| + return Just(ABSENT);
|
| }
|
|
|
|
|
| @@ -3775,16 +3775,16 @@ Maybe<bool> JSProxy::HasPropertyWithHandler(Handle<JSProxy> proxy,
|
| Isolate* isolate = proxy->GetIsolate();
|
|
|
| // TODO(rossberg): adjust once there is a story for symbols vs proxies.
|
| - if (name->IsSymbol()) return maybe(false);
|
| + if (name->IsSymbol()) return Just(false);
|
|
|
| Handle<Object> args[] = { name };
|
| Handle<Object> result;
|
| ASSIGN_RETURN_ON_EXCEPTION_VALUE(
|
| isolate, result, CallTrap(proxy, "has", isolate->derived_has_trap(),
|
| arraysize(args), args),
|
| - Maybe<bool>());
|
| + Nothing<bool>());
|
|
|
| - return maybe(result->BooleanValue());
|
| + return Just(result->BooleanValue());
|
| }
|
|
|
|
|
| @@ -3951,17 +3951,16 @@ Maybe<PropertyAttributes> JSProxy::GetPropertyAttributesWithHandler(
|
| HandleScope scope(isolate);
|
|
|
| // TODO(rossberg): adjust once there is a story for symbols vs proxies.
|
| - if (name->IsSymbol()) return maybe(ABSENT);
|
| + if (name->IsSymbol()) return Just(ABSENT);
|
|
|
| Handle<Object> args[] = { name };
|
| Handle<Object> result;
|
| ASSIGN_RETURN_ON_EXCEPTION_VALUE(
|
| - isolate, result,
|
| - proxy->CallTrap(proxy, "getPropertyDescriptor", Handle<Object>(),
|
| - arraysize(args), args),
|
| - Maybe<PropertyAttributes>());
|
| + isolate, result, proxy->CallTrap(proxy, "getPropertyDescriptor",
|
| + Handle<Object>(), arraysize(args), args),
|
| + Nothing<PropertyAttributes>());
|
|
|
| - if (result->IsUndefined()) return maybe(ABSENT);
|
| + if (result->IsUndefined()) return Just(ABSENT);
|
|
|
| Handle<Object> argv[] = { result };
|
| Handle<Object> desc;
|
| @@ -3969,7 +3968,7 @@ Maybe<PropertyAttributes> JSProxy::GetPropertyAttributesWithHandler(
|
| isolate, desc,
|
| Execution::Call(isolate, isolate->to_complete_property_descriptor(),
|
| result, arraysize(argv), argv),
|
| - Maybe<PropertyAttributes>());
|
| + Nothing<PropertyAttributes>());
|
|
|
| // Convert result to PropertyAttributes.
|
| Handle<String> enum_n = isolate->factory()->InternalizeOneByteString(
|
| @@ -3977,26 +3976,26 @@ Maybe<PropertyAttributes> JSProxy::GetPropertyAttributesWithHandler(
|
| Handle<Object> enumerable;
|
| ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, enumerable,
|
| Object::GetProperty(desc, enum_n),
|
| - Maybe<PropertyAttributes>());
|
| + Nothing<PropertyAttributes>());
|
| Handle<String> conf_n = isolate->factory()->InternalizeOneByteString(
|
| STATIC_CHAR_VECTOR("configurable_"));
|
| Handle<Object> configurable;
|
| ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, configurable,
|
| Object::GetProperty(desc, conf_n),
|
| - Maybe<PropertyAttributes>());
|
| + Nothing<PropertyAttributes>());
|
| Handle<String> writ_n = isolate->factory()->InternalizeOneByteString(
|
| STATIC_CHAR_VECTOR("writable_"));
|
| Handle<Object> writable;
|
| ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, writable,
|
| Object::GetProperty(desc, writ_n),
|
| - Maybe<PropertyAttributes>());
|
| + Nothing<PropertyAttributes>());
|
| if (!writable->BooleanValue()) {
|
| Handle<String> set_n = isolate->factory()->InternalizeOneByteString(
|
| STATIC_CHAR_VECTOR("set_"));
|
| Handle<Object> setter;
|
| ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, setter,
|
| Object::GetProperty(desc, set_n),
|
| - Maybe<PropertyAttributes>());
|
| + Nothing<PropertyAttributes>());
|
| writable = isolate->factory()->ToBoolean(!setter->IsUndefined());
|
| }
|
|
|
| @@ -4008,14 +4007,14 @@ Maybe<PropertyAttributes> JSProxy::GetPropertyAttributesWithHandler(
|
| Handle<Object> error = isolate->factory()->NewTypeError(
|
| "proxy_prop_not_configurable", HandleVector(args, arraysize(args)));
|
| isolate->Throw(*error);
|
| - return maybe(NONE);
|
| + return Just(NONE);
|
| }
|
|
|
| int attributes = NONE;
|
| if (!enumerable->BooleanValue()) attributes |= DONT_ENUM;
|
| if (!configurable->BooleanValue()) attributes |= DONT_DELETE;
|
| if (!writable->BooleanValue()) attributes |= READ_ONLY;
|
| - return maybe(static_cast<PropertyAttributes>(attributes));
|
| + return Just(static_cast<PropertyAttributes>(attributes));
|
| }
|
|
|
|
|
| @@ -4302,7 +4301,7 @@ Maybe<PropertyAttributes> JSObject::GetPropertyAttributesWithInterceptor(
|
|
|
| Handle<InterceptorInfo> interceptor(holder->GetNamedInterceptor());
|
| if (name->IsSymbol() && !interceptor->can_intercept_symbols()) {
|
| - return maybe(ABSENT);
|
| + return Just(ABSENT);
|
| }
|
| PropertyCallbackArguments args(
|
| isolate, interceptor->data(), *receiver, *holder);
|
| @@ -4315,7 +4314,7 @@ Maybe<PropertyAttributes> JSObject::GetPropertyAttributesWithInterceptor(
|
| v8::Handle<v8::Integer> result = args.Call(query, v8::Utils::ToLocal(name));
|
| if (!result.IsEmpty()) {
|
| DCHECK(result->IsInt32());
|
| - return maybe(static_cast<PropertyAttributes>(result->Int32Value()));
|
| + return Just(static_cast<PropertyAttributes>(result->Int32Value()));
|
| }
|
| } else if (!interceptor->getter()->IsUndefined()) {
|
| v8::GenericNamedPropertyGetterCallback getter =
|
| @@ -4324,11 +4323,11 @@ Maybe<PropertyAttributes> JSObject::GetPropertyAttributesWithInterceptor(
|
| LOG(isolate,
|
| ApiNamedPropertyAccess("interceptor-named-get-has", *holder, *name));
|
| v8::Handle<v8::Value> result = args.Call(getter, v8::Utils::ToLocal(name));
|
| - if (!result.IsEmpty()) return maybe(DONT_ENUM);
|
| + if (!result.IsEmpty()) return Just(DONT_ENUM);
|
| }
|
|
|
| - RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Maybe<PropertyAttributes>());
|
| - return maybe(ABSENT);
|
| + RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<PropertyAttributes>());
|
| + return Just(ABSENT);
|
| }
|
|
|
|
|
| @@ -4367,10 +4366,10 @@ Maybe<PropertyAttributes> JSReceiver::GetPropertyAttributes(
|
| return JSObject::GetPropertyAttributesWithFailedAccessCheck(it);
|
| case LookupIterator::ACCESSOR:
|
| case LookupIterator::DATA:
|
| - return maybe(it->property_details().attributes());
|
| + return Just(it->property_details().attributes());
|
| }
|
| }
|
| - return maybe(ABSENT);
|
| + return Just(ABSENT);
|
| }
|
|
|
|
|
| @@ -4389,7 +4388,7 @@ Maybe<PropertyAttributes> JSObject::GetElementAttributeWithReceiver(
|
|
|
| if (object->IsJSGlobalProxy()) {
|
| PrototypeIterator iter(isolate, object);
|
| - if (iter.IsAtEnd()) return maybe(ABSENT);
|
| + if (iter.IsAtEnd()) return Just(ABSENT);
|
| DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject());
|
| return JSObject::GetElementAttributeWithReceiver(
|
| Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)), receiver,
|
| @@ -4419,8 +4418,8 @@ Maybe<PropertyAttributes> JSObject::GetElementAttributeWithInterceptor(
|
|
|
| Maybe<PropertyAttributes> from_interceptor =
|
| GetElementAttributeFromInterceptor(object, receiver, index);
|
| - if (!from_interceptor.has_value) return Maybe<PropertyAttributes>();
|
| - if (from_interceptor.value != ABSENT) return maybe(from_interceptor.value);
|
| + if (!from_interceptor.has_value) return Nothing<PropertyAttributes>();
|
| + if (from_interceptor.value != ABSENT) return Just(from_interceptor.value);
|
|
|
| return GetElementAttributeWithoutInterceptor(object, receiver, index,
|
| check_prototype);
|
| @@ -4442,7 +4441,7 @@ Maybe<PropertyAttributes> JSObject::GetElementAttributeFromInterceptor(
|
| ApiIndexedPropertyAccess("interceptor-indexed-has", *object, index));
|
| v8::Handle<v8::Integer> result = args.Call(query, index);
|
| if (!result.IsEmpty())
|
| - return maybe(static_cast<PropertyAttributes>(result->Int32Value()));
|
| + return Just(static_cast<PropertyAttributes>(result->Int32Value()));
|
| } else if (!interceptor->getter()->IsUndefined()) {
|
| v8::IndexedPropertyGetterCallback getter =
|
| v8::ToCData<v8::IndexedPropertyGetterCallback>(interceptor->getter());
|
| @@ -4450,10 +4449,10 @@ Maybe<PropertyAttributes> JSObject::GetElementAttributeFromInterceptor(
|
| ApiIndexedPropertyAccess(
|
| "interceptor-indexed-get-has", *object, index));
|
| v8::Handle<v8::Value> result = args.Call(getter, index);
|
| - if (!result.IsEmpty()) return maybe(NONE);
|
| + if (!result.IsEmpty()) return Just(NONE);
|
| }
|
| - RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Maybe<PropertyAttributes>());
|
| - return maybe(ABSENT);
|
| + RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<PropertyAttributes>());
|
| + return Just(ABSENT);
|
| }
|
|
|
|
|
| @@ -4462,14 +4461,14 @@ Maybe<PropertyAttributes> JSObject::GetElementAttributeWithoutInterceptor(
|
| bool check_prototype) {
|
| PropertyAttributes attr =
|
| object->GetElementsAccessor()->GetAttributes(object, index);
|
| - if (attr != ABSENT) return maybe(attr);
|
| + if (attr != ABSENT) return Just(attr);
|
|
|
| // Handle [] on String objects.
|
| if (object->IsStringObjectWithCharacterAt(index)) {
|
| - return maybe(static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE));
|
| + return Just(static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE));
|
| }
|
|
|
| - if (!check_prototype) return maybe(ABSENT);
|
| + if (!check_prototype) return Just(ABSENT);
|
|
|
| PrototypeIterator iter(object->GetIsolate(), object);
|
| if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) {
|
| @@ -4478,7 +4477,7 @@ Maybe<PropertyAttributes> JSObject::GetElementAttributeWithoutInterceptor(
|
| Handle<JSProxy>::cast(PrototypeIterator::GetCurrent(iter)), receiver,
|
| index);
|
| }
|
| - if (iter.IsAtEnd()) return maybe(ABSENT);
|
| + if (iter.IsAtEnd()) return Just(ABSENT);
|
| return GetElementAttributeWithReceiver(
|
| Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)), receiver,
|
| index, true);
|
| @@ -13916,8 +13915,8 @@ Maybe<bool> JSObject::HasRealNamedProperty(Handle<JSObject> object,
|
| Handle<Name> key) {
|
| LookupIterator it(object, key, LookupIterator::OWN_SKIP_INTERCEPTOR);
|
| Maybe<PropertyAttributes> maybe_result = GetPropertyAttributes(&it);
|
| - if (!maybe_result.has_value) return Maybe<bool>();
|
| - return maybe(it.IsFound());
|
| + if (!maybe_result.has_value) return Nothing<bool>();
|
| + return Just(it.IsFound());
|
| }
|
|
|
|
|
| @@ -13929,15 +13928,15 @@ Maybe<bool> JSObject::HasRealElementProperty(Handle<JSObject> object,
|
| if (object->IsAccessCheckNeeded()) {
|
| if (!isolate->MayAccess(object)) {
|
| isolate->ReportFailedAccessCheck(object);
|
| - RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Maybe<bool>());
|
| - return maybe(false);
|
| + RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>());
|
| + return Just(false);
|
| }
|
| }
|
|
|
| if (object->IsJSGlobalProxy()) {
|
| HandleScope scope(isolate);
|
| PrototypeIterator iter(isolate, object);
|
| - if (iter.IsAtEnd()) return maybe(false);
|
| + if (iter.IsAtEnd()) return Just(false);
|
| DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject());
|
| return HasRealElementProperty(
|
| Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)), index);
|
| @@ -13945,8 +13944,7 @@ Maybe<bool> JSObject::HasRealElementProperty(Handle<JSObject> object,
|
|
|
| Maybe<PropertyAttributes> result =
|
| GetElementAttributeWithoutInterceptor(object, object, index, false);
|
| - if (!result.has_value) return Maybe<bool>();
|
| - return maybe(result.value != ABSENT);
|
| + return result.has_value ? Just(result.value != ABSENT) : Nothing<bool>();
|
| }
|
|
|
|
|
| @@ -13954,8 +13952,8 @@ Maybe<bool> JSObject::HasRealNamedCallbackProperty(Handle<JSObject> object,
|
| Handle<Name> key) {
|
| LookupIterator it(object, key, LookupIterator::OWN_SKIP_INTERCEPTOR);
|
| Maybe<PropertyAttributes> maybe_result = GetPropertyAttributes(&it);
|
| - if (!maybe_result.has_value) return Maybe<bool>();
|
| - return maybe(it.state() == LookupIterator::ACCESSOR);
|
| + return maybe_result.has_value ? Just(it.state() == LookupIterator::ACCESSOR)
|
| + : Nothing<bool>();
|
| }
|
|
|
|
|
|
|