Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(669)

Issue 11820004: Object.observe: don't unnecessarily emit oldValue for reconfigurations of data properties (Closed)

Created:
7 years, 11 months ago by adamk
Modified:
7 years, 10 months ago
Reviewers:
rossberg
CC:
v8-dev, rafaelw, arv (Not doing code reviews)
Visibility:
Public.

Description

Object.observe: don't unnecessarily emit oldValue for reconfigurations of data properties When a data property has its attributes changed but its value remains the same, don't emit an oldValue. This makes the API more consistent by only emitting oldValue when the value of a property has actually changed (or been removed, in the case of a reconfiguration as an accessor property or a deletion). Committed: https://code.google.com/p/v8/source/detail?r=13565

Patch Set 1 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+22 lines, -12 lines) Patch
M src/objects.cc View 2 chunks +17 lines, -7 lines 4 comments Download
M test/mjsunit/harmony/object-observe.js View 5 chunks +5 lines, -5 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
adamk
7 years, 11 months ago (2013-01-08 20:12:16 UTC) #1
rossberg
LGTM, with nit. https://codereview.chromium.org/11820004/diff/1/src/objects.cc File src/objects.cc (right): https://codereview.chromium.org/11820004/diff/1/src/objects.cc#newcode3189 src/objects.cc:3189: } else if (old_value->IsTheHole()) { Is ...
7 years, 11 months ago (2013-01-17 16:57:44 UTC) #2
adamk
https://codereview.chromium.org/11820004/diff/1/src/objects.cc File src/objects.cc (right): https://codereview.chromium.org/11820004/diff/1/src/objects.cc#newcode3189 src/objects.cc:3189: } else if (old_value->IsTheHole()) { On 2013/01/17 16:57:44, rossberg ...
7 years, 11 months ago (2013-01-22 22:30:10 UTC) #3
rossberg
7 years, 10 months ago (2013-01-28 13:30:43 UTC) #4
https://codereview.chromium.org/11820004/diff/1/src/objects.cc
File src/objects.cc (right):

https://codereview.chromium.org/11820004/diff/1/src/objects.cc#newcode3189
src/objects.cc:3189: } else if (old_value->IsTheHole()) {
On 2013/01/22 22:30:10, adamk wrote:
> On 2013/01/17 16:57:44, rossberg wrote:
> > Is this extra branch actually needed? It seems like the SameValue check
below
> > should apply just fine, and you can keep the condition in the 'if' below.
> 
> I think I pulled this out to avoid an unnecessary GetProperty() call for the
> oldValue-is-the-hole case, and to make it clear that the only thing triggering
> this code path is the absence of the old value. Is your objection to the
"extra"
> call to EnqueueChangeRecord?

Yeah, the fewer code paths the better, but I don't feel too strong about it in
this case. I leave it up to you.

Powered by Google App Engine
This is Rietveld 408576698