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

Issue 12092079: Object.observe: use JSWeakMaps instead of raw ObjectHashTables in observation state (Closed)

Created:
7 years, 10 months ago by adamk
Modified:
7 years, 10 months ago
CC:
v8-dev, rafaelw
Visibility:
Public.

Description

Object.observe: use JSWeakMaps instead of raw ObjectHashTables in observation state object-observe.js uses weak maps to add "hidden" properties to objects. Previously, the hash tables it was using weren't actually weak. This patch changes the existing runtime functions to create instances of JSWeakMap instead of exposing ObjectHashTable directly. Committed: https://code.google.com/p/v8/source/detail?r=13591

Patch Set 1 #

Patch Set 2 : Linted #

Patch Set 3 : Share more WeakMap runtime code #

Patch Set 4 : Added (failing) test #

Patch Set 5 : Fix test, also test notifierTargetMap #

Unified diffs Side-by-side diffs Delta from patch set Stats (+81 lines, -45 lines) Patch
M src/object-observe.js View 1 2 1 chunk +17 lines, -12 lines 0 comments Download
M src/runtime.h View 1 2 1 chunk +2 lines, -3 lines 0 comments Download
M src/runtime.cc View 1 2 3 chunks +27 lines, -30 lines 0 comments Download
M test/cctest/test-object-observe.cc View 1 2 3 4 2 chunks +35 lines, -0 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
adamk
Note that I haven't added any tests. The existing tests didn't depend on the weakness ...
7 years, 10 months ago (2013-01-31 00:28:48 UTC) #1
Michael Starzinger
LGTM. I am fine with allocating a new map on each ObservationWeakMapCreate() call for now ...
7 years, 10 months ago (2013-01-31 11:00:47 UTC) #2
adamk
I've slightly modified the patch to share more of the WeakMap runtime code, by adding ...
7 years, 10 months ago (2013-01-31 21:53:02 UTC) #3
adamk
I've now added a test, but unfortunately it fails. Any idea what I might be ...
7 years, 10 months ago (2013-01-31 22:21:19 UTC) #4
Michael Starzinger
That is strange, the test looks OK, but the keys seem to be strongly reachable ...
7 years, 10 months ago (2013-02-04 11:29:14 UTC) #5
Michael Starzinger
I figured out what's going on with this test case. It's a tricky issue. The ...
7 years, 10 months ago (2013-02-04 12:20:03 UTC) #6
rossberg
7 years, 10 months ago (2013-02-04 13:18:20 UTC) #7
LGTM, modulo the fix to the test case that Michael described.

Powered by Google App Engine
This is Rietveld 408576698