Chromium Code Reviews

Issue 555723002: Install nodeType attribute as constant in function tempalte

Created:
6 years, 3 months ago by Pan
Modified:
5 years, 11 months ago
Reviewers:
haraken, dcarney, arv (Not doing code reviews), jochen (gone - plz use gerrit)
CC:
blink-reviews, arv+blink, sof, eae+blinkwatch, blink-reviews-dom_chromium.org, dglazkov+blink, Inactive, rwlbuis
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Project:
blink
Visibility:
Public.

Description

Install nodeType attribute as constant in function tempalte BUG=None

Patch Set 1 #

Patch Set 2 : rebase #

Unified diffs Side-by-side diffs Stats (+19 lines, -6 lines)
M Source/core/dom/Attr.idl View 1 chunk +2 lines, -1 line 0 comments
M Source/core/dom/CDATASection.idl View 1 chunk +2 lines, -1 line 0 comments
M Source/core/dom/Comment.idl View 1 chunk +2 lines, -0 lines 0 comments
M Source/core/dom/Document.idl View 1 chunk +3 lines, -1 line 0 comments
M Source/core/dom/DocumentFragment.idl View 1 chunk +2 lines, -0 lines 0 comments
M Source/core/dom/DocumentType.idl View 1 chunk +2 lines, -1 line 0 comments
M Source/core/dom/Element.idl View 1 chunk +2 lines, -0 lines 0 comments
M Source/core/dom/Node.idl View 1 chunk +0 lines, -1 line 0 comments
M Source/core/dom/ProcessingInstruction.idl View 1 chunk +2 lines, -1 line 0 comments
M Source/core/dom/Text.idl View 1 chunk +2 lines, -0 lines 0 comments

Messages

Total messages: 14 (4 generated)
Pan
@haraken, This CL describes the idea to improve DOM API node.nodeType access performance. nodeType for ...
6 years, 3 months ago (2014-09-09 08:36:58 UTC) #2
haraken
Thanks for looking into the performance of DOM bindings. That being said, this approach does ...
6 years, 3 months ago (2014-09-09 09:13:26 UTC) #4
blink-reviews
Brainstorming... In the future we could add a V8 private symbol on the different prototypes ...
6 years, 3 months ago (2014-09-09 14:03:39 UTC) #5
tonyg
Just out of curiosity, do we know if nodeType is relevant on the speedometer benchmark?
6 years, 3 months ago (2014-09-09 14:35:00 UTC) #6
Pan
On 2014/09/09 14:35:00, tonyg wrote: > Just out of curiosity, do we know if nodeType ...
6 years, 3 months ago (2014-09-12 01:09:39 UTC) #7
haraken
On 2014/09/12 01:09:39, Pan wrote: > On 2014/09/09 14:35:00, tonyg wrote: > > Just out ...
6 years, 3 months ago (2014-09-12 01:22:43 UTC) #8
Pan
I didn't try it in various websites, but realized it is hot in several benchmarks. ...
6 years, 3 months ago (2014-09-12 09:08:59 UTC) #10
arv (Not doing code reviews)
On 2014/09/12 09:08:59, Pan wrote: > @arv, could you please provide more information of your ...
6 years, 3 months ago (2014-09-12 15:44:04 UTC) #11
Pan
On 2014/09/12 15:44:04, arv wrote: > On 2014/09/12 09:08:59, Pan wrote: > > @arv, could ...
6 years, 3 months ago (2014-09-24 00:19:12 UTC) #12
arv (Not doing code reviews)
6 years, 2 months ago (2014-09-29 15:38:26 UTC) #13
On 2014/09/24 00:19:12, Pan wrote:
> On 2014/09/12 15:44:04, arv wrote:
> > On 2014/09/12 09:08:59, Pan wrote:
> > > @arv, could you please provide more information of your idea? 
> > 
> > V8 has something called private symbols (these are like ES6 symbols but
never
> > exposed to any user script in any way). We could define a private symbol for
> the
> > nodeType and then use that in the getter. The following code should work
> > today[*] if we remove the instance nodeType property from the bindings.
> /////////////////////////////////////////////////////////////////////// 1st
> section start
> > var nodeTypeSymbol = NEW_PRIVATE('nodeTypeSymbol');
> > Object.defineProperty(Node.prototype, 'nodeType', {
> >   get: function() {
> >     // add instance type check?
> >     return this[nodeTypeSymbol];
> >   },
> >   enumerable: true,
> >   configurable: true
> > });
> > Element.prototype[nodeTypeSymbol] = Node.ELEMENT_NODE;
> > Attr.prototype[nodeTypeSymbol] = Node.ATTRIBUTE_NODE;
> > Text.prototype[nodeTypeSymbol] = Node.TEXT_NODE;
> > ...
> > 
>
///////////////////////////////////////////////////////////////////////////////////
> 1st section end
> > Now V8 does not have to invoke any C++ callbacks and the whole code can be
> > jitted.
> 
> > [*] We need a way to expose v8 natives to Blink.
> > 
> > We should also have a way to do true Blink in JS =P
> > 
> > To test this you could use a public symbol. It should be good enough for
doing
> > benchmarks.
> 
> @arv, great thanks for your reply, I'm not familiar with V8 :(, so more
> questions here.
> 1, By "grep" the v8 code base, I found few "NEW_PRIVATE" keywords, as my
> understanding, the place that V8 interact with node should be in binding, then
> where the 1st section code should be placed?

Our binding code does not have a place where we could run js code to set up the
environment.

> 2,
> > [*] We need a way to expose v8 natives to Blink. 
>   expose what kind of functionality to blink? through v8 API?

Same as 1. We have no way to run js code when a context is created.
 
> 3, is there similar mechanism in Blink in JS project? if true, good for me to
> learn from it.

Blink in JS is only about implementation and all the calls always goes through
the C++ bindings. It is not going to help here.

> 
> 
> thanks
> Pan

Powered by Google App Engine