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

Issue 2335203006: Add [CachedAccessor] attribute to cache (almost) constant accessors (window.document). (Closed)

Created:
4 years, 3 months ago by Alfonso
Modified:
4 years, 1 month ago
CC:
blink-reviews, blink-reviews-bindings_chromium.org, chromium-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add [CachedAccessor] attribute to cache (almost) constant accessors. Calls to getter are translated into a cheap property load, eliminating the calling overhead. Other potential benefits could also apply, like inlining and/or constant propagation. Currently the 'document' DOM accessor is implemented as a plain data property for performance reasons, with the downside of violating the spec. This produces exactly the same (performant) code as the current hack while being spec-compliant. The following JS code is now valid: var acc = Object.getOwnPropertyDescriptor(window, "document"); var d = acc.get.call(window); To invalidate/update (e.g. window.document) just use: V8PrivateProperty::getWindowDocument().set(context, window, newDocumentWrapper); BUG=chromium:634276 Intent to Implement and Ship: https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/OhIFnre7ytQ Specialize GlobalProxy access: https://codereview.chromium.org/2369933005

Patch Set 1 #

Patch Set 2 : Rebuild IDL test results #

Patch Set 3 : Pre-review nits #

Total comments: 27

Patch Set 4 : Refactor to use V8PrivateProperty #

Patch Set 5 : Fix nits #

Total comments: 16

Patch Set 6 : Polishing + naming revisited #

Total comments: 13

Patch Set 7 : Include V8PrivateProperty.h only if needed #

Patch Set 8 : Regenerate IDL test results #

Patch Set 9 : Fix rebase dirt #

Unified diffs Side-by-side diffs Delta from patch set Stats (+383 lines, -305 lines) Patch
M third_party/WebKit/Source/bindings/IDLExtendedAttributes.md View 1 2 3 4 5 6 7 1 chunk +31 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/IDLExtendedAttributes.txt View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.h View 1 2 3 4 5 6 7 8 3 chunks +8 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp View 1 2 3 4 5 6 7 8 4 chunks +18 lines, -12 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/V8PrivateProperty.h View 1 2 3 4 5 6 7 2 chunks +19 lines, -13 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/V8PrivateProperty.cpp View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp View 1 2 3 4 5 6 7 2 chunks +4 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/bindings/scripts/v8_attributes.py View 1 2 3 4 5 6 7 4 chunks +8 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/templates/attributes.cpp.tmpl View 1 2 3 4 5 6 7 8 3 chunks +15 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl View 1 2 3 4 5 6 7 8 1 chunk +5 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8SVGTestInterface.cpp View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestException.cpp View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestIntegerIndexed.cpp View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestIntegerIndexedGlobal.cpp View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestIntegerIndexedPrimaryGlobal.cpp View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp View 1 2 3 4 5 6 7 8 5 chunks +53 lines, -53 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface3.cpp View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceCheckSecurity.cpp View 1 2 3 4 5 6 7 8 2 chunks +9 lines, -9 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceDocument.cpp View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventInitConstructor.cpp View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceGarbageCollected.cpp View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNamedConstructor.cpp View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNode.cpp View 1 2 3 4 5 6 7 8 1 chunk +7 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceOriginTrialEnabled.cpp View 1 2 3 4 5 6 7 8 2 chunks +5 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceSecureContext.cpp View 1 2 3 4 5 6 7 8 2 chunks +6 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestNode.cpp View 1 2 3 4 5 6 7 8 1 chunk +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp View 1 2 3 4 5 6 7 8 3 chunks +160 lines, -160 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestTypedefs.cpp View 1 2 3 4 5 6 7 8 1 chunk +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface5.cpp View 1 2 3 4 5 6 7 8 2 chunks +10 lines, -10 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterfacePartial.cpp View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/frame/Window.idl View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 50 (11 generated)
Alfonso
On 2016/09/15 07:54:11, Alfonso wrote: > mailto:peterssen@google.com changed reviewers: > + mailto:jochen@chromium.org, mailto:vogelheim@chromium.org PTAL. This ...
4 years, 3 months ago (2016-09-15 07:56:52 UTC) #3
jochen (gone - plz use gerrit)
can you please file a tracking bug and reference it from the cl description (under ...
4 years, 3 months ago (2016-09-15 07:58:07 UTC) #4
Alfonso
On 2016/09/15 07:58:07, jochen wrote: > can you please file a tracking bug and reference ...
4 years, 3 months ago (2016-09-15 08:09:55 UTC) #6
Yuki
https://codereview.chromium.org/2335203006/diff/40001/third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp File third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp (right): https://codereview.chromium.org/2335203006/diff/40001/third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp#newcode416 third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp:416: v8::Local<v8::Private> priv = cachedAccessors().at("Window#document").Get(m_isolate); Can you use V8PrivateProperty? I ...
4 years, 3 months ago (2016-09-15 08:17:34 UTC) #8
jochen (gone - plz use gerrit)
https://codereview.chromium.org/2335203006/diff/40001/third_party/WebKit/Source/bindings/IDLExtendedAttributes.md File third_party/WebKit/Source/bindings/IDLExtendedAttributes.md (right): https://codereview.chromium.org/2335203006/diff/40001/third_party/WebKit/Source/bindings/IDLExtendedAttributes.md#newcode1579 third_party/WebKit/Source/bindings/IDLExtendedAttributes.md:1579: Summary: Caches invariable accessors to a private property. Private ...
4 years, 3 months ago (2016-09-15 08:20:51 UTC) #10
haraken
This looks amazing! I'm just curious but how are you planning to expose V8 APIs ...
4 years, 3 months ago (2016-09-15 09:26:10 UTC) #11
vogelheim
The naming is a bit inconsistent... surrogate + cache + StoreInField. We should agree on ...
4 years, 3 months ago (2016-09-15 15:29:47 UTC) #12
vogelheim
> That said, as yukishiino@ mentioned, if you can use V8PrivateProperty, that will > be ...
4 years, 3 months ago (2016-09-15 16:06:35 UTC) #13
vogelheim
On Thu, Sep 15, 2016 at 11:26 AM, <haraken@chromium.org> wrote: > This looks amazing! > ...
4 years, 3 months ago (2016-09-15 16:34:09 UTC) #14
vogelheim
On Thu, Sep 15, 2016 at 11:26 AM, <haraken@chromium.org> wrote: > This looks amazing! > ...
4 years, 3 months ago (2016-09-15 16:34:09 UTC) #15
haraken
On 2016/09/15 16:06:35, vogelheim wrote: > > That said, as yukishiino@ mentioned, if you can ...
4 years, 3 months ago (2016-09-16 02:22:05 UTC) #16
haraken
On 2016/09/15 16:34:09, vogelheim wrote: > On Thu, Sep 15, 2016 at 11:26 AM, <mailto:haraken@chromium.org> ...
4 years, 3 months ago (2016-09-16 02:27:23 UTC) #17
Alfonso
On 2016/09/16 02:22:05, haraken wrote: > On 2016/09/15 16:06:35, vogelheim wrote: > > > That ...
4 years, 3 months ago (2016-09-16 07:47:34 UTC) #18
haraken
On 2016/09/16 07:47:34, Alfonso wrote: > On 2016/09/16 02:22:05, haraken wrote: > > On 2016/09/15 ...
4 years, 3 months ago (2016-09-16 07:56:50 UTC) #19
Alfonso
On 2016/09/16 07:56:50, haraken wrote: > On 2016/09/16 07:47:34, Alfonso wrote: > > On 2016/09/16 ...
4 years, 3 months ago (2016-09-16 08:05:22 UTC) #20
haraken
On 2016/09/16 08:05:22, Alfonso wrote: > On 2016/09/16 07:56:50, haraken wrote: > > On 2016/09/16 ...
4 years, 3 months ago (2016-09-16 08:06:31 UTC) #21
Yuki
For WindowProxy::cachedAccessors(), IIUC, I don't see much benefit to cache them. Please correct me if ...
4 years, 3 months ago (2016-09-16 08:09:31 UTC) #23
Alfonso
On 2016/09/16 08:09:31, Yuki wrote: > For WindowProxy::cachedAccessors(), IIUC, I don't see much benefit to ...
4 years, 3 months ago (2016-09-16 08:46:20 UTC) #24
haraken
On 2016/09/16 08:46:20, Alfonso wrote: > On 2016/09/16 08:09:31, Yuki wrote: > > For WindowProxy::cachedAccessors(), ...
4 years, 3 months ago (2016-09-16 08:46:59 UTC) #25
Yuki
On 2016/09/16 08:46:59, haraken wrote: > On 2016/09/16 08:46:20, Alfonso wrote: > > On 2016/09/16 ...
4 years, 3 months ago (2016-09-16 11:53:54 UTC) #26
Alfonso
PTAL. Refactored to use V8PrivateProperty, IMHO is way cleaner now. I addressed all the comments, ...
4 years, 3 months ago (2016-09-16 14:21:48 UTC) #28
Alfonso
[StoreInField] => [Caching=Push] I've been thinking about proper naming, here's the motivation: Generally the plain ...
4 years, 3 months ago (2016-09-19 13:00:36 UTC) #29
jochen (gone - plz use gerrit)
Cached=Push sgtm Please also format your CL description according to chromium.org/developers/contributing-code#Writing_change_list_descriptions https://codereview.chromium.org/2335203006/diff/80001/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp File third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp (right): ...
4 years, 3 months ago (2016-09-19 14:54:19 UTC) #30
haraken
Implementation mostly looks good. On 2016/09/19 13:00:36, Alfonso wrote: > [StoreInField] => [Caching=Push] > I've ...
4 years, 3 months ago (2016-09-20 05:53:25 UTC) #31
Yuki
https://codereview.chromium.org/2335203006/diff/80001/third_party/WebKit/Source/bindings/core/v8/V8PrivateProperty.h File third_party/WebKit/Source/bindings/core/v8/V8PrivateProperty.h (right): https://codereview.chromium.org/2335203006/diff/80001/third_party/WebKit/Source/bindings/core/v8/V8PrivateProperty.h#newcode38 third_party/WebKit/Source/bindings/core/v8/V8PrivateProperty.h:38: X(Window, _document) nit: Why not X(Window, Document)? https://codereview.chromium.org/2335203006/diff/80001/third_party/WebKit/Source/bindings/scripts/v8_interface.py File ...
4 years, 3 months ago (2016-09-20 07:53:53 UTC) #32
Alfonso
Naming revisited + some cleanup, PTAL. https://codereview.chromium.org/2335203006/diff/80001/third_party/WebKit/Source/bindings/IDLExtendedAttributes.md File third_party/WebKit/Source/bindings/IDLExtendedAttributes.md (right): https://codereview.chromium.org/2335203006/diff/80001/third_party/WebKit/Source/bindings/IDLExtendedAttributes.md#newcode1579 third_party/WebKit/Source/bindings/IDLExtendedAttributes.md:1579: Summary: Caches invariable ...
4 years, 3 months ago (2016-09-20 13:48:24 UTC) #35
Yuki
https://codereview.chromium.org/2335203006/diff/80001/third_party/WebKit/Source/bindings/scripts/v8_interface.py File third_party/WebKit/Source/bindings/scripts/v8_interface.py (right): https://codereview.chromium.org/2335203006/diff/80001/third_party/WebKit/Source/bindings/scripts/v8_interface.py#newcode65 third_party/WebKit/Source/bindings/scripts/v8_interface.py:65: 'bindings/core/v8/V8PrivateProperty.h', On 2016/09/20 13:48:23, Alfonso wrote: > Could you ...
4 years, 3 months ago (2016-09-20 13:57:19 UTC) #36
haraken
LGTM once the Intent-to-implement is approved. Please use the name "CachedAccessor" through the CL consistently. ...
4 years, 3 months ago (2016-09-20 14:15:03 UTC) #37
jochen (gone - plz use gerrit)
Window.idl lgtm please add a link to the intent to ship thread in the CL ...
4 years, 3 months ago (2016-09-22 08:22:06 UTC) #38
blink-reviews
I've tested turning some Window 'special' attributes into plain old accessors and there's no difference ...
4 years, 2 months ago (2016-09-26 21:11:51 UTC) #40
chromium-reviews
I've tested turning some Window 'special' attributes into plain old accessors and there's no difference ...
4 years, 2 months ago (2016-09-26 21:11:54 UTC) #41
haraken
On 2016/09/26 21:11:54, chromium-reviews wrote: > I've tested turning some Window 'special' attributes into plain ...
4 years, 2 months ago (2016-09-27 04:51:12 UTC) #42
jochen (gone - plz use gerrit)
assuming that the performance numbers after your patch are about the same, I'd say ship ...
4 years, 2 months ago (2016-09-27 06:51:21 UTC) #43
haraken
On 2016/09/27 06:51:21, jochen (slow) wrote: > assuming that the performance numbers after your patch ...
4 years, 2 months ago (2016-09-27 07:25:27 UTC) #44
Alfonso
I found two cases where the cached value is being completely ignored, and the getter ...
4 years, 2 months ago (2016-09-27 13:29:45 UTC) #45
haraken
Is it likely that someone can land this CL?
4 years, 2 months ago (2016-10-04 09:38:34 UTC) #47
jochen (gone - plz use gerrit)
On 2016/10/04 at 09:38:34, haraken wrote: > Is it likely that someone can land this ...
4 years, 2 months ago (2016-10-04 09:40:44 UTC) #48
vogelheim
This work landed as crrev.com/2429343004. Closing this CL.
4 years, 1 month ago (2016-11-08 09:33:21 UTC) #49
vogelheim
4 years, 1 month ago (2016-11-08 09:33:21 UTC) #50
This work landed as crrev.com/2429343004. Closing this CL.

Powered by Google App Engine
This is Rietveld 408576698