Commit 0e285458 authored by machenbach's avatar machenbach Committed by Commit bot

Revert of [runtime] further dismantle AccessorInfoHandling, reducing it to the...

Revert of [runtime] further dismantle AccessorInfoHandling, reducing it to the single API usecase. (patchset #2 id:20001 of https://codereview.chromium.org/1643563002/ )

Reason for revert:
[Sheriff] Speculative revert for breaking webkit unit tests:
https://build.chromium.org/p/client.v8.fyi/builders/V8-Blink%20Linux%2064/builds/4251

Original issue's description:
> [runtime] further dismantle AccessorInfoHandling, reducing it to the single API usecase.
>
> BUG=
>
> Committed: https://crrev.com/85aba7df84d397c7e47537292e6895bd8b26f440
> Cr-Commit-Position: refs/heads/master@{#33613}

TBR=ishell@chromium.org,verwaest@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

Review URL: https://codereview.chromium.org/1650033003

Cr-Commit-Position: refs/heads/master@{#33615}
parent f3e41d96
...@@ -3557,8 +3557,7 @@ static i::MaybeHandle<i::Object> DefineObjectProperty( ...@@ -3557,8 +3557,7 @@ static i::MaybeHandle<i::Object> DefineObjectProperty(
isolate, js_object, key, &success, i::LookupIterator::OWN); isolate, js_object, key, &success, i::LookupIterator::OWN);
if (!success) return i::MaybeHandle<i::Object>(); if (!success) return i::MaybeHandle<i::Object>();
return i::JSObject::DefineOwnPropertyIgnoreAttributes( return i::JSObject::DefineOwnPropertyIgnoreAttributes(&it, value, attrs);
&it, value, attrs, i::JSObject::FORCE_FIELD);
} }
......
...@@ -5337,29 +5337,32 @@ Maybe<bool> JSObject::DefineOwnPropertyIgnoreAttributes( ...@@ -5337,29 +5337,32 @@ Maybe<bool> JSObject::DefineOwnPropertyIgnoreAttributes(
CERTAINLY_NOT_STORE_FROM_KEYED); CERTAINLY_NOT_STORE_FROM_KEYED);
} }
MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes( MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes(
Handle<JSObject> object, Handle<Name> name, Handle<Object> value, Handle<JSObject> object, Handle<Name> name, Handle<Object> value,
PropertyAttributes attributes) { PropertyAttributes attributes, AccessorInfoHandling handling) {
DCHECK(!value->IsTheHole()); DCHECK(!value->IsTheHole());
LookupIterator it(object, name, LookupIterator::OWN); LookupIterator it(object, name, LookupIterator::OWN);
return DefineOwnPropertyIgnoreAttributes(&it, value, attributes); return DefineOwnPropertyIgnoreAttributes(&it, value, attributes, handling);
} }
MaybeHandle<Object> JSObject::SetOwnElementIgnoreAttributes( MaybeHandle<Object> JSObject::SetOwnElementIgnoreAttributes(
Handle<JSObject> object, uint32_t index, Handle<Object> value, Handle<JSObject> object, uint32_t index, Handle<Object> value,
PropertyAttributes attributes) { PropertyAttributes attributes, AccessorInfoHandling handling) {
Isolate* isolate = object->GetIsolate(); Isolate* isolate = object->GetIsolate();
LookupIterator it(isolate, object, index, LookupIterator::OWN); LookupIterator it(isolate, object, index, LookupIterator::OWN);
return DefineOwnPropertyIgnoreAttributes(&it, value, attributes); return DefineOwnPropertyIgnoreAttributes(&it, value, attributes, handling);
} }
MaybeHandle<Object> JSObject::DefinePropertyOrElementIgnoreAttributes( MaybeHandle<Object> JSObject::DefinePropertyOrElementIgnoreAttributes(
Handle<JSObject> object, Handle<Name> name, Handle<Object> value, Handle<JSObject> object, Handle<Name> name, Handle<Object> value,
PropertyAttributes attributes) { PropertyAttributes attributes, AccessorInfoHandling handling) {
Isolate* isolate = object->GetIsolate(); Isolate* isolate = object->GetIsolate();
LookupIterator it = LookupIterator::PropertyOrElement(isolate, object, name, LookupIterator it = LookupIterator::PropertyOrElement(isolate, object, name,
LookupIterator::OWN); LookupIterator::OWN);
return DefineOwnPropertyIgnoreAttributes(&it, value, attributes); return DefineOwnPropertyIgnoreAttributes(&it, value, attributes, handling);
} }
...@@ -6591,8 +6594,8 @@ Maybe<bool> JSReceiver::ValidateAndApplyPropertyDescriptor( ...@@ -6591,8 +6594,8 @@ Maybe<bool> JSReceiver::ValidateAndApplyPropertyDescriptor(
? desc->value() ? desc->value()
: Handle<Object>::cast(isolate->factory()->undefined_value())); : Handle<Object>::cast(isolate->factory()->undefined_value()));
MaybeHandle<Object> result = MaybeHandle<Object> result =
JSObject::DefineOwnPropertyIgnoreAttributes(it, value, JSObject::DefineOwnPropertyIgnoreAttributes(
desc->ToAttributes()); it, value, desc->ToAttributes(), JSObject::DONT_FORCE_FIELD);
if (result.is_null()) return Nothing<bool>(); if (result.is_null()) return Nothing<bool>();
} }
} else { } else {
...@@ -6784,8 +6787,8 @@ Maybe<bool> JSReceiver::ValidateAndApplyPropertyDescriptor( ...@@ -6784,8 +6787,8 @@ Maybe<bool> JSReceiver::ValidateAndApplyPropertyDescriptor(
? current->value() ? current->value()
: Handle<Object>::cast( : Handle<Object>::cast(
isolate->factory()->undefined_value())); isolate->factory()->undefined_value()));
MaybeHandle<Object> result = MaybeHandle<Object> result = JSObject::DefineOwnPropertyIgnoreAttributes(
JSObject::DefineOwnPropertyIgnoreAttributes(it, value, attrs); it, value, attrs, JSObject::DONT_FORCE_FIELD);
if (result.is_null()) return Nothing<bool>(); if (result.is_null()) return Nothing<bool>();
} else { } else {
DCHECK(desc_is_accessor_descriptor || DCHECK(desc_is_accessor_descriptor ||
...@@ -6849,8 +6852,9 @@ Maybe<bool> JSObject::CreateDataProperty(LookupIterator* it, ...@@ -6849,8 +6852,9 @@ Maybe<bool> JSObject::CreateDataProperty(LookupIterator* it,
return Just(false); return Just(false);
} }
RETURN_ON_EXCEPTION_VALUE(it->isolate(), RETURN_ON_EXCEPTION_VALUE(
DefineOwnPropertyIgnoreAttributes(it, value, NONE), it->isolate(),
DefineOwnPropertyIgnoreAttributes(it, value, NONE, DONT_FORCE_FIELD),
Nothing<bool>()); Nothing<bool>());
return Just(true); return Just(true);
......
...@@ -2067,35 +2067,36 @@ class JSObject: public JSReceiver { ...@@ -2067,35 +2067,36 @@ class JSObject: public JSReceiver {
MUST_USE_RESULT static Maybe<bool> SetPropertyWithInterceptor( MUST_USE_RESULT static Maybe<bool> SetPropertyWithInterceptor(
LookupIterator* it, ShouldThrow should_throw, Handle<Object> value); LookupIterator* it, ShouldThrow should_throw, Handle<Object> value);
// The API currently still wants DefineOwnPropertyIgnoreAttributes to convert // SetLocalPropertyIgnoreAttributes converts callbacks to fields. We need to
// AccessorInfo objects to data fields. We allow FORCE_FIELD as an exception // grant an exemption to AccessorInfo callbacks in some cases.
// to the default behavior that calls the setter. enum AccessorInfoHandling { DEFAULT_HANDLING, DONT_FORCE_FIELD };
enum AccessorInfoHandling { FORCE_FIELD, DONT_FORCE_FIELD };
MUST_USE_RESULT static MaybeHandle<Object> DefineOwnPropertyIgnoreAttributes( MUST_USE_RESULT static MaybeHandle<Object> DefineOwnPropertyIgnoreAttributes(
LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, LookupIterator* it, Handle<Object> value, PropertyAttributes attributes,
AccessorInfoHandling handling = DONT_FORCE_FIELD); AccessorInfoHandling handling = DEFAULT_HANDLING);
MUST_USE_RESULT static Maybe<bool> DefineOwnPropertyIgnoreAttributes( MUST_USE_RESULT static Maybe<bool> DefineOwnPropertyIgnoreAttributes(
LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, LookupIterator* it, Handle<Object> value, PropertyAttributes attributes,
ShouldThrow should_throw, ShouldThrow should_throw,
AccessorInfoHandling handling = DONT_FORCE_FIELD); AccessorInfoHandling handling = DEFAULT_HANDLING);
MUST_USE_RESULT static MaybeHandle<Object> SetOwnPropertyIgnoreAttributes( MUST_USE_RESULT static MaybeHandle<Object> SetOwnPropertyIgnoreAttributes(
Handle<JSObject> object, Handle<Name> name, Handle<Object> value, Handle<JSObject> object, Handle<Name> name, Handle<Object> value,
PropertyAttributes attributes); PropertyAttributes attributes,
AccessorInfoHandling handling = DEFAULT_HANDLING);
MUST_USE_RESULT static MaybeHandle<Object> SetOwnElementIgnoreAttributes( MUST_USE_RESULT static MaybeHandle<Object> SetOwnElementIgnoreAttributes(
Handle<JSObject> object, uint32_t index, Handle<Object> value, Handle<JSObject> object, uint32_t index, Handle<Object> value,
PropertyAttributes attributes); PropertyAttributes attributes,
AccessorInfoHandling handling = DEFAULT_HANDLING);
// Equivalent to one of the above depending on whether |name| can be converted // Equivalent to one of the above depending on whether |name| can be converted
// to an array index. // to an array index.
MUST_USE_RESULT static MaybeHandle<Object> MUST_USE_RESULT static MaybeHandle<Object>
DefinePropertyOrElementIgnoreAttributes(Handle<JSObject> object, DefinePropertyOrElementIgnoreAttributes(
Handle<Name> name, Handle<JSObject> object, Handle<Name> name, Handle<Object> value,
Handle<Object> value, PropertyAttributes attributes = NONE,
PropertyAttributes attributes = NONE); AccessorInfoHandling handling = DEFAULT_HANDLING);
// Adds or reconfigures a property to attributes NONE. It will fail when it // Adds or reconfigures a property to attributes NONE. It will fail when it
// cannot. // cannot.
......
...@@ -78,8 +78,8 @@ static Object* DeclareGlobals(Isolate* isolate, Handle<JSGlobalObject> global, ...@@ -78,8 +78,8 @@ static Object* DeclareGlobals(Isolate* isolate, Handle<JSGlobalObject> global,
} }
// Define or redefine own property. // Define or redefine own property.
RETURN_FAILURE_ON_EXCEPTION( RETURN_FAILURE_ON_EXCEPTION(isolate, JSObject::SetOwnPropertyIgnoreAttributes(
isolate, JSObject::DefineOwnPropertyIgnoreAttributes(&it, value, attr)); global, name, value, attr));
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
} }
...@@ -196,8 +196,8 @@ RUNTIME_FUNCTION(Runtime_InitializeConstGlobal) { ...@@ -196,8 +196,8 @@ RUNTIME_FUNCTION(Runtime_InitializeConstGlobal) {
} }
} }
RETURN_FAILURE_ON_EXCEPTION( RETURN_FAILURE_ON_EXCEPTION(isolate, JSObject::SetOwnPropertyIgnoreAttributes(
isolate, JSObject::DefineOwnPropertyIgnoreAttributes(&it, value, attr)); global, name, value, attr));
return *value; return *value;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment