Commit 7bc5ce16 authored by jkummerow's avatar jkummerow Committed by Commit bot

OrdinaryDefineOwnProperty: always reset the LookupIterator before storing.

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

Cr-Commit-Position: refs/heads/master@{#31511}
parent 05a60095
......@@ -6089,6 +6089,11 @@ bool JSReceiver::OrdinaryDefineOwnProperty(LookupIterator* it,
isolate->has_pending_exception()) {
return false;
}
// TODO(jkummerow/verwaest): It would be nice if we didn't have to reset
// the iterator every time. Currently, the reasons why we need it are:
// - handle interceptors correctly
// - handle accessors correctly (which might change the holder's map)
it->Restart();
// 3. Let extensible be the value of the [[Extensible]] internal slot of O.
Handle<JSObject> object = Handle<JSObject>::cast(it->GetReceiver());
bool extensible = JSObject::IsExtensible(object);
......@@ -6110,13 +6115,6 @@ bool JSReceiver::OrdinaryDefineOwnProperty(LookupIterator* it,
}
return false;
}
// We have to reset the LookupIterator to handle interceptors properly.
Map* map = Handle<HeapObject>::cast(object)->map();
if ((it->IsElement() && map->has_indexed_interceptor()) ||
(!it->IsElement() && map->has_named_interceptor())) {
it->Restart();
}
// 2c. If IsGenericDescriptor(Desc) or IsDataDescriptor(Desc) is true, then:
// (This is equivalent to !IsAccessorDescriptor(desc).)
DCHECK((desc_is_generic_descriptor || desc_is_data_descriptor) ==
......
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