Fix evaluation order problems in Object.observe hooks.

R=rossberg@chromium.org
TEST=gcmole

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14432 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e93d12a4
...@@ -3278,9 +3278,11 @@ MaybeObject* JSObject::SetPropertyForResult(LookupResult* lookup, ...@@ -3278,9 +3278,11 @@ MaybeObject* JSObject::SetPropertyForResult(LookupResult* lookup,
} else { } else {
LookupResult new_lookup(isolate); LookupResult new_lookup(isolate);
self->LocalLookup(*name, &new_lookup, true); self->LocalLookup(*name, &new_lookup, true);
if (new_lookup.IsDataProperty() && if (new_lookup.IsDataProperty()) {
!Object::GetProperty(self, name)->SameValue(*old_value)) { Handle<Object> new_value = Object::GetProperty(self, name);
EnqueueChangeRecord(self, "updated", name, old_value); if (!new_value->SameValue(*old_value)) {
EnqueueChangeRecord(self, "updated", name, old_value);
}
} }
} }
} }
...@@ -3430,8 +3432,11 @@ MaybeObject* JSObject::SetLocalPropertyIgnoreAttributes( ...@@ -3430,8 +3432,11 @@ MaybeObject* JSObject::SetLocalPropertyIgnoreAttributes(
} else { } else {
LookupResult new_lookup(isolate); LookupResult new_lookup(isolate);
self->LocalLookup(*name, &new_lookup, true); self->LocalLookup(*name, &new_lookup, true);
bool value_changed = new_lookup.IsDataProperty() && bool value_changed = false;
!old_value->SameValue(*Object::GetProperty(self, name)); if (new_lookup.IsDataProperty()) {
Handle<Object> new_value = Object::GetProperty(self, name);
value_changed = !old_value->SameValue(*new_value);
}
if (new_lookup.GetAttributes() != old_attributes) { if (new_lookup.GetAttributes() != old_attributes) {
if (!value_changed) old_value = isolate->factory()->the_hole_value(); if (!value_changed) old_value = isolate->factory()->the_hole_value();
EnqueueChangeRecord(self, "reconfigured", name, old_value); EnqueueChangeRecord(self, "reconfigured", name, old_value);
...@@ -10974,8 +10979,8 @@ MaybeObject* JSObject::SetElement(uint32_t index, ...@@ -10974,8 +10979,8 @@ MaybeObject* JSObject::SetElement(uint32_t index,
} else if (old_value->IsTheHole()) { } else if (old_value->IsTheHole()) {
EnqueueChangeRecord(self, "reconfigured", name, old_value); EnqueueChangeRecord(self, "reconfigured", name, old_value);
} else { } else {
bool value_changed = Handle<Object> new_value = Object::GetElement(self, index);
!old_value->SameValue(*Object::GetElement(self, index)); bool value_changed = !old_value->SameValue(*new_value);
if (old_attributes != new_attributes) { if (old_attributes != new_attributes) {
if (!value_changed) old_value = isolate->factory()->the_hole_value(); if (!value_changed) old_value = isolate->factory()->the_hole_value();
EnqueueChangeRecord(self, "reconfigured", name, old_value); EnqueueChangeRecord(self, "reconfigured", name, old_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