Commit 984f8af8 authored by hablich's avatar hablich Committed by Commit bot

Revert of Introduce LookupIterator::Restart() and use it (patchset #2 id:20001...

Revert of Introduce LookupIterator::Restart() and use it (patchset #2 id:20001 of https://codereview.chromium.org/1416053007/ )

Reason for revert:
Breaks test if rolled into Chromium: http://build.chromium.org/p/chromium.win/buildstatus?builder=Vista%20Tests%20%281%29&number=60441

Needed so the reverts applies cleanly and seems to be related to the offending CL.

Original issue's description:
> Introduce LookupIterator::Restart() and use it
>
> Committed: https://crrev.com/5676415b4add059b78f98a9a762d00c8d721dbcd
> Cr-Commit-Position: refs/heads/master@{#31483}

TBR=verwaest@chromium.org,jkummerow@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

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

Cr-Commit-Position: refs/heads/master@{#31534}
parent dc9d2c16
...@@ -80,13 +80,13 @@ void LookupIterator::Next() { ...@@ -80,13 +80,13 @@ void LookupIterator::Next() {
} }
void LookupIterator::RestartInternal(InterceptorState interceptor_state) { void LookupIterator::RestartLookupForNonMaskingInterceptors() {
interceptor_state_ = InterceptorState::kProcessNonMasking;
state_ = NOT_FOUND; state_ = NOT_FOUND;
interceptor_state_ = interceptor_state;
property_details_ = PropertyDetails::Empty(); property_details_ = PropertyDetails::Empty();
number_ = DescriptorArray::kNotFound;
holder_ = initial_holder_; holder_ = initial_holder_;
holder_map_ = handle(holder_->map(), isolate_); holder_map_ = handle(holder_->map(), isolate_);
number_ = DescriptorArray::kNotFound;
Next(); Next();
} }
......
...@@ -162,8 +162,6 @@ class LookupIterator final BASE_EMBEDDED { ...@@ -162,8 +162,6 @@ class LookupIterator final BASE_EMBEDDED {
Isolate* isolate, Handle<Object> receiver, Handle<Object> key, Isolate* isolate, Handle<Object> receiver, Handle<Object> key,
bool* success, Configuration configuration = DEFAULT); bool* success, Configuration configuration = DEFAULT);
void Restart() { RestartInternal(InterceptorState::kUninitialized); }
Isolate* isolate() const { return isolate_; } Isolate* isolate() const { return isolate_; }
State state() const { return state_; } State state() const { return state_; }
...@@ -262,10 +260,7 @@ class LookupIterator final BASE_EMBEDDED { ...@@ -262,10 +260,7 @@ class LookupIterator final BASE_EMBEDDED {
MUST_USE_RESULT inline JSReceiver* NextHolder(Map* map); MUST_USE_RESULT inline JSReceiver* NextHolder(Map* map);
inline State LookupInHolder(Map* map, JSReceiver* holder); inline State LookupInHolder(Map* map, JSReceiver* holder);
void RestartLookupForNonMaskingInterceptors() { void RestartLookupForNonMaskingInterceptors();
RestartInternal(InterceptorState::kProcessNonMasking);
}
void RestartInternal(InterceptorState interceptor_state);
State LookupNonMaskingInterceptorInHolder(Map* map, JSReceiver* holder); State LookupNonMaskingInterceptorInHolder(Map* map, JSReceiver* holder);
Handle<Object> FetchValue() const; Handle<Object> FetchValue() const;
void ReloadPropertyInformation(); void ReloadPropertyInformation();
......
...@@ -6090,8 +6090,8 @@ bool JSReceiver::OrdinaryDefineOwnProperty(LookupIterator* it, ...@@ -6090,8 +6090,8 @@ bool JSReceiver::OrdinaryDefineOwnProperty(LookupIterator* it,
return false; return false;
} }
// 3. Let extensible be the value of the [[Extensible]] internal slot of O. // 3. Let extensible be the value of the [[Extensible]] internal slot of O.
Handle<JSObject> object = Handle<JSObject>::cast(it->GetReceiver()); Handle<JSObject> o = Handle<JSObject>::cast(it->GetReceiver());
bool extensible = JSObject::IsExtensible(object); bool extensible = JSObject::IsExtensible(o);
bool desc_is_data_descriptor = PropertyDescriptor::IsDataDescriptor(desc); bool desc_is_data_descriptor = PropertyDescriptor::IsDataDescriptor(desc);
bool desc_is_accessor_descriptor = bool desc_is_accessor_descriptor =
...@@ -6110,12 +6110,12 @@ bool JSReceiver::OrdinaryDefineOwnProperty(LookupIterator* it, ...@@ -6110,12 +6110,12 @@ bool JSReceiver::OrdinaryDefineOwnProperty(LookupIterator* it,
} }
return false; return false;
} }
// We have to reset the LookupIterator to handle interceptors properly. // We have to use a fresh LookupIterator to handle interceptors properly.
Map* map = Handle<HeapObject>::cast(object)->map(); LookupIterator lookup_for_store =
if ((it->IsElement() && map->has_indexed_interceptor()) || it->IsElement() ? LookupIterator(isolate, it->GetReceiver(),
(!it->IsElement() && map->has_named_interceptor())) { it->index(), LookupIterator::HIDDEN)
it->Restart(); : LookupIterator(it->GetReceiver(), it->name(),
} LookupIterator::HIDDEN);
// 2c. If IsGenericDescriptor(Desc) or IsDataDescriptor(Desc) is true, then: // 2c. If IsGenericDescriptor(Desc) or IsDataDescriptor(Desc) is true, then:
// (This is equivalent to !IsAccessorDescriptor(desc).) // (This is equivalent to !IsAccessorDescriptor(desc).)
...@@ -6127,7 +6127,7 @@ bool JSReceiver::OrdinaryDefineOwnProperty(LookupIterator* it, ...@@ -6127,7 +6127,7 @@ bool JSReceiver::OrdinaryDefineOwnProperty(LookupIterator* it,
// [[Configurable]] attribute values are described by Desc. If the value // [[Configurable]] attribute values are described by Desc. If the value
// of an attribute field of Desc is absent, the attribute of the newly // of an attribute field of Desc is absent, the attribute of the newly
// created property is set to its default value. // created property is set to its default value.
if (!object->IsUndefined()) { if (!o->IsUndefined()) {
if (!desc->has_writable()) desc->set_writable(false); if (!desc->has_writable()) desc->set_writable(false);
if (!desc->has_enumerable()) desc->set_enumerable(false); if (!desc->has_enumerable()) desc->set_enumerable(false);
if (!desc->has_configurable()) desc->set_configurable(false); if (!desc->has_configurable()) desc->set_configurable(false);
...@@ -6137,7 +6137,8 @@ bool JSReceiver::OrdinaryDefineOwnProperty(LookupIterator* it, ...@@ -6137,7 +6137,8 @@ bool JSReceiver::OrdinaryDefineOwnProperty(LookupIterator* it,
: Handle<Object>::cast(isolate->factory()->undefined_value())); : Handle<Object>::cast(isolate->factory()->undefined_value()));
MaybeHandle<Object> result = MaybeHandle<Object> result =
JSObject::DefineOwnPropertyIgnoreAttributes( JSObject::DefineOwnPropertyIgnoreAttributes(
it, value, desc->ToAttributes(), JSObject::DONT_FORCE_FIELD); &lookup_for_store, value, desc->ToAttributes(),
JSObject::DONT_FORCE_FIELD);
if (result.is_null()) return false; if (result.is_null()) return false;
} }
} else { } else {
...@@ -6148,7 +6149,7 @@ bool JSReceiver::OrdinaryDefineOwnProperty(LookupIterator* it, ...@@ -6148,7 +6149,7 @@ bool JSReceiver::OrdinaryDefineOwnProperty(LookupIterator* it,
// [[Configurable]] attribute values are described by Desc. If the value // [[Configurable]] attribute values are described by Desc. If the value
// of an attribute field of Desc is absent, the attribute of the newly // of an attribute field of Desc is absent, the attribute of the newly
// created property is set to its default value. // created property is set to its default value.
if (!object->IsUndefined()) { if (!o->IsUndefined()) {
if (!desc->has_enumerable()) desc->set_enumerable(false); if (!desc->has_enumerable()) desc->set_enumerable(false);
if (!desc->has_configurable()) desc->set_configurable(false); if (!desc->has_configurable()) desc->set_configurable(false);
Handle<Object> getter( Handle<Object> getter(
...@@ -6159,8 +6160,8 @@ bool JSReceiver::OrdinaryDefineOwnProperty(LookupIterator* it, ...@@ -6159,8 +6160,8 @@ bool JSReceiver::OrdinaryDefineOwnProperty(LookupIterator* it,
desc->has_set() desc->has_set()
? desc->set() ? desc->set()
: Handle<Object>::cast(isolate->factory()->undefined_value())); : Handle<Object>::cast(isolate->factory()->undefined_value()));
MaybeHandle<Object> result = MaybeHandle<Object> result = JSObject::DefineAccessor(
JSObject::DefineAccessor(it, getter, setter, desc->ToAttributes()); &lookup_for_store, getter, setter, desc->ToAttributes());
if (result.is_null()) return false; if (result.is_null()) return false;
} }
} }
...@@ -6248,11 +6249,10 @@ bool JSReceiver::OrdinaryDefineOwnProperty(LookupIterator* it, ...@@ -6248,11 +6249,10 @@ bool JSReceiver::OrdinaryDefineOwnProperty(LookupIterator* it,
// [Strong mode] Disallow changing writable -> readonly for // [Strong mode] Disallow changing writable -> readonly for
// non-configurable properties. // non-configurable properties.
if (current.writable() && desc->has_writable() && !desc->writable() && if (current.writable() && desc->has_writable() && !desc->writable() &&
object->map()->is_strong()) { o->map()->is_strong()) {
if (should_throw == THROW_ON_ERROR) { if (should_throw == THROW_ON_ERROR) {
isolate->Throw(*isolate->factory()->NewTypeError( isolate->Throw(*isolate->factory()->NewTypeError(
MessageTemplate::kStrongRedefineDisallowed, object, MessageTemplate::kStrongRedefineDisallowed, o, it->GetName()));
it->GetName()));
} }
return false; return false;
} }
...@@ -6307,7 +6307,7 @@ bool JSReceiver::OrdinaryDefineOwnProperty(LookupIterator* it, ...@@ -6307,7 +6307,7 @@ bool JSReceiver::OrdinaryDefineOwnProperty(LookupIterator* it,
} }
// 10. If O is not undefined, then: // 10. If O is not undefined, then:
if (!object->IsUndefined()) { if (!o->IsUndefined()) {
// 10a. For each field of Desc that is present, set the corresponding // 10a. For each field of Desc that is present, set the corresponding
// attribute of the property named P of object O to the value of the field. // attribute of the property named P of object O to the value of the field.
PropertyAttributes attrs = NONE; PropertyAttributes attrs = NONE;
......
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