Issue 2409 in v8: Implement Object.observe

9 views
Skip to first unread message

codesite...@google.com

unread,
Nov 14, 2012, 11:27:42 AM11/14/12
to v8-...@googlegroups.com
Status: Accepted
Owner: rossb...@chromium.org
CC: raf...@chromium.org, ad...@chromium.org, a...@chromium.org
Labels: Type-FeatureRequest Priority-Medium Harmony

New issue 2409 by rossb...@chromium.org: Implement Object.observe
http://code.google.com/p/v8/issues/detail?id=2409

Implement the Object.observe proposal for ES7
(http://wiki.ecmascript.org/doku.php?id=harmony:observe).

codesite...@google.com

unread,
Nov 14, 2012, 11:44:45 AM11/14/12
to v8-...@googlegroups.com

Comment #1 on issue 2409 by rossb...@chromium.org: Implement Object.observe
http://code.google.com/p/v8/issues/detail?id=2409

Cases working:

- named properties on plain objects
- arguments object (strict and non-strict)
- proxies
- value & date objects

Cases not fully working yet, or working incorrectly:

- indexed properties (spurious oldValue in some reconfiguration cases)
- nop reconfigurations of accessors (produces change record)
- "length" property on arrays (wrong change records in some reconfiguration
cases)
- "prototype" property on function objects
- the global object
- typed arrays and array buffers ("length" and friend should not be
observable)
- __proto__

Not tested yet:
- objects with interceptors
- objects with access checks
- other DOM-style objects

Open questions:
- Should change record layout be fully determined by "type" field?


codesite...@google.com

unread,
Nov 20, 2012, 12:42:32 PM11/20/12
to v8-...@googlegroups.com

Comment #2 on issue 2409 by rossb...@chromium.org: Implement Object.observe
http://code.google.com/p/v8/issues/detail?id=2409

Also not working:

Due to use of instance type checks instead of map checks in various places
of V8 (especially optimised code), changes may not be picked up on code
paths that have previously been executed with unobserved objects. This
applies to array elements in particular.


codesite...@google.com

unread,
Nov 26, 2012, 6:37:50 PM11/26/12
to v8-...@googlegroups.com

Comment #3 on issue 2409 by ad...@chromium.org: Implement Object.observe
http://code.google.com/p/v8/issues/detail?id=2409

Regarding access checks, a proposal from a quick discussion with abarth and
rafaelw is to do an access check on observation, and disallow observation
altogether if access is not allowed. The tricky part with that there's not
a nice hook in the API for this right now: the two callbacks are
NamedSecurityCheck and IndexedSecurityCheck, neither of which apply here
(we don't have a specific property to check). As far as WebKit's use of
these access checks go we could easily get away with passing some bogus
value for the property name, but it's not clear to me what other users of
this API might expect.

codesite...@google.com

unread,
Nov 28, 2012, 8:19:56 PM11/28/12
to v8-...@googlegroups.com

Comment #4 on issue 2409 by ad...@chromium.org: Implement Object.observe
http://code.google.com/p/v8/issues/detail?id=2409

Some status on the "Not fully working" cases in #1, and some questions for
rossberg:

> - indexed properties (spurious oldValue in some reconfiguration cases)
fixed in https://codereview.chromium.org/11414177/ (awaiting review)

> - the global object
fixed in https://codereview.chromium.org/11414094/ (awaiting review)

> - "prototype" property on function objects
> - __proto__
These two still need work.

> - "length" property on arrays (wrong change records in some
> reconfiguration cases)
This bug is still present. Not sure how big a deal it is: it simply sends
more records than needed (two instead of one).

> - nop reconfigurations of accessors (produces change record)
I can't reproduce this, is it still a problem?

> - typed arrays and array buffers ("length" and friend should not be
> observable)
Is length even mutable? Do we have a test case that fails this requirement?

codesite...@google.com

unread,
Dec 5, 2012, 7:19:11 AM12/5/12
to v8-...@googlegroups.com

Comment #5 on issue 2409 by rossb...@chromium.org: Implement Object.observe
http://code.google.com/p/v8/issues/detail?id=2409

Update:

Cases working:
- named properties
- defineProperty
- __proto__
- arguments object (strict and non-strict)
- proxies
- value & date objects

Cases not fully working yet, or working incorrectly:
- indexed properties (assignment might not be recognised on previously used
code paths)
- "length" property on arrays (two change records in some cases)
- "prototype" property on function objects (under review)
- the global object (not handling hidden prototypes yet)

Not tested yet:
- objects with hidden prototypes
- objects with interceptors
- objects with access checks
- other DOM-style objects

Open questions:
- Should change record layout be fully determined by "type" field?


(@Adam: nop reconfigurations are fixed, length and friends are indeed
immutable, my mistake.)

codesite...@google.com

unread,
Dec 5, 2012, 2:49:24 PM12/5/12
to v8-...@googlegroups.com

Comment #6 on issue 2409 by ad...@chromium.org: Implement Object.observe
http://code.google.com/p/v8/issues/detail?id=2409

The global object patch should be handling hidden prototypes, is it not?

codesite...@google.com

unread,
Dec 6, 2012, 5:22:18 AM12/6/12
to v8-...@googlegroups.com

Comment #7 on issue 2409 by rossb...@chromium.org: Implement Object.observe
http://code.google.com/p/v8/issues/detail?id=2409

No, unfortunately, hidden prototypes are a mechanism entirely separate from
the global proxy thing, activated by the SetHiddenPrototype method in the
API. They were introduced for additional hacks in the WebKit bindings. In
Chrome, the observable global object actually consists of 4(!) objects at a
time: the global proxy, the "real" global, and that has a hidden prototype;
plus, the "real" global also is the hidden prototype of yet another object,
the outer window. I honestly still don't understand why it has to be that
complicated, but...

codesite...@google.com

unread,
Dec 6, 2012, 12:35:22 PM12/6/12
to v8-...@googlegroups.com

Comment #8 on issue 2409 by ad...@chromium.org: Implement Object.observe
http://code.google.com/p/v8/issues/detail?id=2409

Oh, sorry, I was indeed confused by having too much knowledge of the WebKit
side of things. This is indeed something that needs testing via the API.

codesite...@google.com

unread,
Dec 21, 2012, 6:59:36 AM12/21/12
to v8-...@googlegroups.com

Comment #9 on issue 2409 by rossb...@chromium.org: Implement Object.observe
http://code.google.com/p/v8/issues/detail?id=2409

Update:

Cases working:
- named & indexed properties
- plain assignment, compound assignment, in/decrement operators
- defineProperty
- "length" property on arrays
- "prototype" property on function objects
- arguments object (strict and non-strict)
- "__proto__" pseudo property
- proxies
- value & date objects
- ES intrinsics

Cases not fully working yet:
- the global object (not fully handling hidden prototypes yet)

Not tested yet:
- objects with interceptors
- objects with access checks
- other DOM-style objects

To be done:
- Modify spec of change records to be dependent on "type" field only


codesite...@google.com

unread,
Sep 11, 2013, 5:09:04 AM9/11/13
to v8-...@googlegroups.com
Updates:
Blockedon: v8:2877

Comment #10 on issue 2409 by dsl...@chromium.org: Implement Object.observe
http://code.google.com/p/v8/issues/detail?id=2409

(No comment was entered for this change.)

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

codesite...@google.com

unread,
Oct 18, 2013, 2:43:24 PM10/18/13
to v8-...@googlegroups.com
Updates:
Blockedon: v8:2940

Comment #11 on issue 2409 by raf...@chromium.org: Implement Object.observe

codesite...@google.com

unread,
Oct 18, 2013, 2:46:24 PM10/18/13
to v8-...@googlegroups.com
Updates:
Blockedon: v8:2941

Comment #12 on issue 2409 by raf...@chromium.org: Implement Object.observe

codesite...@google.com

unread,
Oct 18, 2013, 2:50:24 PM10/18/13
to v8-...@googlegroups.com
Updates:
Blockedon: v8:2942

Comment #13 on issue 2409 by raf...@chromium.org: Implement Object.observe

codesite...@google.com

unread,
Oct 18, 2013, 3:49:39 PM10/18/13
to v8-...@googlegroups.com
Updates:
Blockedon: v8:2944

Comment #14 on issue 2409 by raf...@chromium.org: Implement Object.observe

codesite...@google.com

unread,
Oct 18, 2013, 3:52:39 PM10/18/13
to v8-...@googlegroups.com
Updates:
Blockedon: v8:2945

Comment #15 on issue 2409 by raf...@chromium.org: Implement Object.observe

codesite...@google.com

unread,
Oct 18, 2013, 5:32:31 PM10/18/13
to v8-...@googlegroups.com
Updates:
Blockedon: v8:2946

Comment #16 on issue 2409 by raf...@chromium.org: Implement Object.observe

codesite...@google.com

unread,
Oct 22, 2013, 8:11:50 PM10/22/13
to v8-...@googlegroups.com
Updates:
Blockedon: v8:2418

Comment #17 on issue 2409 by raf...@chromium.org: Implement Object.observe

codesite...@google.com

unread,
Oct 29, 2013, 3:43:11 PM10/29/13
to v8-...@googlegroups.com
Updates:
Blockedon: v8:2975

Comment #18 on issue 2409 by raf...@chromium.org: Implement Object.observe

codesite...@google.com

unread,
Nov 8, 2013, 9:58:40 AM11/8/13
to v8-...@googlegroups.com
Updates:
Status: Fixed

Comment #19 on issue 2409 by raf...@chromium.org: Implement Object.observe
Reply all
Reply to author
Forward
0 new messages