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

Issue 11347037: Object.observe: generate change records for named properties. (Closed)

Created:
8 years, 1 month ago by rossberg
Modified:
8 years, 1 month ago
Reviewers:
rafaelw, Toon Verwaest
CC:
v8-dev, rafaelw, adamk
Visibility:
Public.

Description

Object.observe: generate change records for named properties. In more detail: - Set observation bit for observed objects (and make NormalizedMapCache respect it). - Mutation of observed objects is always delegated from ICs to runtime. - Introduce JS runtime function for notifying generated changes. - Invoke this function in the appropriate places (including some local refactoring). - Inclusion of oldValue field is not yet implemented, nor element properties. Also, shortened flag to --harmony-observation. R=verwaest@chromium.org BUG= Committed: https://code.google.com/p/v8/source/detail?r=12867

Patch Set 1 #

Total comments: 36

Patch Set 2 : Addressing comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+345 lines, -124 lines) Patch
M src/bootstrapper.cc View 2 chunks +4 lines, -1 line 0 comments Download
M src/contexts.h View 2 chunks +4 lines, -2 lines 0 comments Download
M src/flag-definitions.h View 1 chunk +3 lines, -3 lines 0 comments Download
M src/handles.h View 1 1 chunk +7 lines, -0 lines 0 comments Download
M src/ic.cc View 2 chunks +7 lines, -1 line 0 comments Download
M src/object-observe.js View 1 4 chunks +12 lines, -2 lines 0 comments Download
M src/objects.h View 1 7 chunks +18 lines, -1 line 0 comments Download
M src/objects.cc View 1 15 chunks +215 lines, -110 lines 0 comments Download
M src/objects-inl.h View 1 chunk +10 lines, -0 lines 0 comments Download
M src/runtime.h View 1 chunk +4 lines, -0 lines 0 comments Download
M src/runtime.cc View 1 1 chunk +23 lines, -0 lines 0 comments Download
M src/v8natives.js View 1 chunk +1 line, -1 line 0 comments Download
M test/mjsunit/harmony/object-observe.js View 5 chunks +37 lines, -3 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
rossberg
8 years, 1 month ago (2012-10-30 12:40:48 UTC) #1
rafaelw
https://codereview.chromium.org/11347037/diff/1/src/object-observe.js File src/object-observe.js (right): https://codereview.chromium.org/11347037/diff/1/src/object-observe.js#newcode73 src/object-observe.js:73: } do we have JS debug-only ASSERTS? If so, ...
8 years, 1 month ago (2012-10-31 14:44:31 UTC) #2
rafaelw
https://codereview.chromium.org/11347037/diff/1/src/objects.h File src/objects.h (right): https://codereview.chromium.org/11347037/diff/1/src/objects.h#newcode2279 src/objects.h:2279: void NotifyObservers(const char* type, String* name, Object* oldValue); also, ...
8 years, 1 month ago (2012-10-31 17:27:24 UTC) #3
rafaelw
Also, FYI. It looks to me like setting elements in a loop is still being ...
8 years, 1 month ago (2012-11-02 15:57:36 UTC) #4
Toon Verwaest
First round of comments. https://chromiumcodereview.appspot.com/11347037/diff/1/src/objects.cc File src/objects.cc (right): https://chromiumcodereview.appspot.com/11347037/diff/1/src/objects.cc#newcode1680 src/objects.cc:1680: MaybeObject* ret; Can we call ...
8 years, 1 month ago (2012-11-05 13:33:22 UTC) #5
rossberg
https://codereview.chromium.org/11347037/diff/1/src/object-observe.js File src/object-observe.js (right): https://codereview.chromium.org/11347037/diff/1/src/object-observe.js#newcode73 src/object-observe.js:73: } On 2012/10/31 14:44:31, rafaelw wrote: > do we ...
8 years, 1 month ago (2012-11-05 17:11:08 UTC) #6
Toon Verwaest
lgtm
8 years, 1 month ago (2012-11-06 10:34:52 UTC) #7
rafaelw
lgtm
8 years, 1 month ago (2012-11-06 10:46:21 UTC) #8
rossberg
8 years, 1 month ago (2012-11-06 16:52:59 UTC) #9
On 2012/11/02 15:57:36, rafaelw wrote:
> Also, FYI.
> 
> It looks to me like setting elements in a loop is still being cached. The
> following test fails with this patch applied to our branch, but passes if i
turn
> off IC altogether:
> 
> // Observed not IC'd.
> reset();
> var obj = {};
> Object.observe(obj, observer.callback);
> for (var i = 0; i < 3; i++) {
>   obj[i] = i;
> }
> Object.deliverChangeRecords(observer.callback);
> observer.assertCallbackRecords([
>   { object: obj, name: "0", type: "new" },
>   { object: obj, name: "1", type: "new" },
>   { object: obj, name: "2", type: "new" },
> ]);
> 
> Note that if the assignment in the look is obj['foo' + i], then it passes --
> thus my suspicion about elements being cached somehow through a different
path.

Ack. I'll address that in a separate CL.

Powered by Google App Engine
This is Rietveld 408576698