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

Issue 234143002: Remove unnecessary %UnwrapGlobalProxy calls from object-observe.js (Closed)

Created:
6 years, 8 months ago by adamk
Modified:
6 years, 8 months ago
Reviewers:
Toon Verwaest
CC:
v8-dev, rafaelw, rossberg, arv (Not doing code reviews)
Visibility:
Public.

Description

Remove unnecessary %UnwrapGlobalProxy calls from object-observe.js The intent of these calls was to properly key the WeakMap get/set calls on the underlying global object, not the proxy, since that is the object actually being observed. But unwrapping at this layer is unnecessary since GetIdentityHash will already do the unwrapping (via its call to GetHiddenProperty). Also remove the runtime function itself, as these were the only callers, and remove the now-redundant IS_SPEC_OBJECT() checks from object-observe.js's MapWrapper type. R=verwaest@chromium.org Committed: https://code.google.com/p/v8/source/detail?r=20740

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+0 lines, -17 lines) Patch
M src/object-observe.js View 1 chunk +0 lines, -4 lines 0 comments Download
M src/runtime.h View 1 chunk +0 lines, -1 line 0 comments Download
M src/runtime.cc View 1 chunk +0 lines, -12 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
adamk
6 years, 8 months ago (2014-04-10 22:06:10 UTC) #1
Toon Verwaest
This patch LGTM (arg, we manually unwrapped the proxy!?). What you are saying regarding the ...
6 years, 8 months ago (2014-04-11 09:50:43 UTC) #2
adamk
On 2014/04/11 09:50:43, Toon Verwaest wrote: > This patch LGTM (arg, we manually unwrapped the ...
6 years, 8 months ago (2014-04-14 19:52:23 UTC) #3
adamk
Committed patchset #1 manually as r20740 (presubmit successful).
6 years, 8 months ago (2014-04-14 20:52:35 UTC) #4
Toon Verwaest
TL;DR: No, the global proxy is rebound to a new global object after navigation, and ...
6 years, 8 months ago (2014-04-15 05:57:55 UTC) #5
adamk
On 2014/04/15 05:57:55, Toon Verwaest wrote: > TL;DR: No, the global proxy is rebound to ...
6 years, 8 months ago (2014-04-15 17:31:02 UTC) #6
adamk
On 2014/04/15 17:31:02, adamk wrote: > On 2014/04/15 05:57:55, Toon Verwaest wrote: > > TL;DR: ...
6 years, 8 months ago (2014-04-15 19:05:42 UTC) #7
adamk
6 years, 8 months ago (2014-04-15 19:20:29 UTC) #8
Message was sent while issue was closed.
On 2014/04/15 19:05:42, adamk wrote:
> On 2014/04/15 17:31:02, adamk wrote:
> > On 2014/04/15 05:57:55, Toon Verwaest wrote:
> > > TL;DR: No, the global proxy is rebound to a new global object after
> > navigation,
> > > and we need to ensure that existing references outside of that context
> persist
> > > properly. Hence the identity has to stay the same.
> > > 
> > > The global proxy is the unique object representing a window. When a window
> > > navigates, the proxy stays, but the underlaying global object and context
is
> > > swapped for a new global object and new context.
> > > 
> > > To do so, the existing proxy is passed in when creating this new context.
In
> > the
> > > end the proxy is attached to the new context by CreateNewGlobals. The old
> > proxy
> > > is passed in as the (admittedly very confusingly named) "global_object"
> > > parameter (which is actually a global proxy, not a global object).
> > > 
> > > The global proxy will still be available to other contexts though. The
> frames
> > > surrounding the navigated frame could have a reference, but the old
context
> > that
> > > navigated away still has its own "this" in the global scope, which will be
> > > rebound after navigation to the new page.
> > > 
> > > Mozilla has some good extra documentation on this:
> > > https://developer.mozilla.org/en-US/docs/SpiderMonkey/Split_object
> > > 
> > > Of course, since the object persists in various contexts, the identity
hash
> > has
> > > to stay the same or stuff will break after navigation. I'll see if I can
> write
> > a
> > > test for this.
> > 
> > Arg, I get this wrong every single time I try to reason about this. I'm glad
> > someone besides Adam Barth now has this paged into their head.
> 
> After putting together the minimal test case of this just to remember how it
> worked, of course there's reattachment; I was thinking of the lack of
> reattachment in the other direction (from a global object -> detached global
> object -> reattached global object).
> 
> I'm still not convinced of what the right behavior is. In some ways, maps are
> analogous to properties as ways of keeping information about in object, and so
> losing those associations upon navigation doesn't seem that surprising, since
> expando properties are also dropped. I'll have to think more about what
problems
> this might cause.

A datapoint in favor of storing the hash on the proxy is that Firefox seems to
hold the association across navigations.

Powered by Google App Engine
This is Rietveld 408576698